AstAttribute::copy
Virtual copy constructor.
Synopsis
Declared in <src/midend/astProcessing/AstAttributeMechanism.h>
virtual
AstAttribute*
copy() const;
Description
Copy‐constructs a new object on the heap and returns its pointer. All subclasses must implement this in order to instantiate the correct dynamic type, although many don't. If this copy method returns a null pointer (like the base implementation) then the attribute is not copied as part of copying its container. E.g., an attribute stored in an AST will not be copied when the AST is copied if that attribute is directly derived from AstAttribute and fails to implement copy. If a subclass fails to implement copy and inherits from a class that does implement a copy that returns non‐null, then the copied attribute will have an incorrect dynamic type.
It would be nice if we could make this pure virtual, but unfortunately ROSETTA‐generated code fails to compile because it generates an instantiation of this interface (whether or not that code is ever executed is unkown). [Robb Matzke 2015‐11‐10]
Return Value
Base class for all IR node attribute values.
Created with MrDocs