inspector: Implement a custom StageVariable copy constructor
The fields `has_location_decoration` and `location_decoration` are references to `has_location_attribute` and `location_attribute`, respectively, which act as an alias for a field-rename. The default copy-constructor was copying across the reference (pointer) to the source StageVariable, instead of making a reference to the target's fields. This is causing Bad Things™ to happen in downstream projects. Credit to dneto@ for identifying the issue, and for making this fix (which I've stolen for this CL). Change-Id: Id0570e4e389f28980fa5aea29ad63b5100373dc5 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79200 Reviewed-by: David Neto <dneto@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
d9b32c3178
commit
fa0d64b76d
|
@ -18,7 +18,17 @@ namespace tint {
|
|||
namespace inspector {
|
||||
|
||||
StageVariable::StageVariable() = default;
|
||||
StageVariable::StageVariable(const StageVariable&) = default;
|
||||
StageVariable::StageVariable(const StageVariable& other)
|
||||
: name(other.name),
|
||||
has_location_attribute(other.has_location_attribute),
|
||||
location_attribute(other.location_attribute),
|
||||
has_location_decoration(has_location_attribute),
|
||||
location_decoration(location_attribute),
|
||||
component_type(other.component_type),
|
||||
composition_type(other.composition_type),
|
||||
interpolation_type(other.interpolation_type),
|
||||
interpolation_sampling(other.interpolation_sampling) {}
|
||||
|
||||
StageVariable::~StageVariable() = default;
|
||||
|
||||
EntryPoint::EntryPoint() = default;
|
||||
|
|
|
@ -59,7 +59,8 @@ struct StageVariable {
|
|||
/// Constructor
|
||||
StageVariable();
|
||||
/// Copy constructor
|
||||
StageVariable(const StageVariable&);
|
||||
/// @param other the StageVariable to copy
|
||||
StageVariable(const StageVariable& other);
|
||||
/// Destructor
|
||||
~StageVariable();
|
||||
|
||||
|
|
Loading…
Reference in New Issue