Skip to content

AstAttribute

Base class for all IR node attribute values.

Synopsis

Declared in <src/midend/astProcessing/AstAttributeMechanism.h>

class [[visibility("default")]] AstAttribute;

Description

This is the base class for all attribute values stored in the Sage IR node using the AstAttributeMechanism. IR node attributes are polymorphic based on this class, and are always allocated on the heap. Once the attribute value is handed to an attribute container method the container owns the value and is responsible for deleting it. In the case of methods that only optionally insert a value, the value is deleted immediately if it's not inserted. But see getOwnershipPolicy for additional information.

The underlying mechanism is designed to store values of any type, including POD, 3rd party types, and pointers. On the other hand, the AstAttributeMechanism interface described here stores only pointers to values allocated on the heap, owns those values, and supports operations that are useful specifically in IR nodes.

Subclasses should each implement a virtual copy constructor, which should allocate a new copy of the value. The implementation in this base class returns a null pointer, which means that the attribute is not copied into a new AST node when its AST node is copied. If a subclass fails to implement the virtual copy constructor and a superclass has an implementation that return non-null, then copying the AST node will copy only the superclass part of the attribute and the new attribute will have the dynamic type of the superclass--probably not what you want!

For a more detailed description of using attributes in ROSE (and your own classes) see attributes.

Types

Name Description
AttributeEdgeInfo Support for attributes to specify edges in the dot graphs.
AttributeNodeInfo Support for adding nodes to DOT graphs.

Enums

Name Description
OwnershipPolicy Who owns this attribute.

Member Functions

Name Description
AstAttribute
AstAttribute(); [constructor]
Default constructor
~AstAttribute
virtual ~AstAttribute(); [destructor] [virtual]
Destructor
additionalEdgeInfo
virtual std::vector<AttributeEdgeInfo> additionalEdgeInfo(); [virtual]
additionalNodeInfo
virtual std::vector<AttributeNodeInfo> additionalNodeInfo(); [virtual]
additionalNodeOptions
virtual std::string additionalNodeOptions(); [virtual]
DOT support.
attribute_class_name
virtual std::string attribute_class_name() const; [virtual]
Attribute class name.
commentOutNodeInGraph
virtual bool commentOutNodeInGraph(); [virtual]
Eliminate IR nodes in DOT graphs.
copy
virtual AstAttribute* copy() const;
Virtual copy constructor.
getOwnershipPolicy
virtual OwnershipPolicy getOwnershipPolicy() const; [virtual]
Who owns this attribute.
toString
virtual std::string toString(); [virtual]
Convert an attribute to a string.

Derived Classes

Name Description
AstAttributeDOT
AstValueAttribute IR node attribute that stores a copyable value.
MetricAttribute Attribute corresponding to a metric.
UniqueNameAttribute A persistent attribute to represent a unique name for an expression
VarUniqueName Class holding a unique name for a variable. Is attached to varRefs as a persistent attribute. This is used to assign absolute names to VarRefExp nodes during VariableRenaming.

Created with MrDocs