Skip to content

AstAttribute

Base class for all IR node attribute values.

Synopsis

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

class AstAttribute;

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 [constructor]

Default constructor

~AstAttribute [destructor] [virtual]

Destructor

additionalEdgeInfo [virtual]

additionalNodeInfo [virtual]

additionalNodeOptions [virtual]

DOT support.

attribute_class_name [virtual]

Attribute class name.

commentOutNodeInGraph [virtual]

Eliminate IR nodes in DOT graphs.

constructor [virtual]

Virtual default constructor.

copy [virtual]

Virtual copy constructor.

getOwnershipPolicy [virtual]

Who owns this attribute.

packed_data [virtual]

packed_size [virtual]

Packing support.

toString [virtual]

Convert an attribute to a string.

unpacked_data [virtual]

Derived Classes

Name

Description

AstAttributeDOT

**

AstRegExAttribute

Attribute containing a regex expression as a string.

AstTextAttribute

AstUnparseAttribute

AstValueAttribute

IR node attribute that stores a copyable value.

CFGEdgeAttribute

CFGNodeAttribute

This class stores index of each node as an attribuite of SgGraphNode.

FrontierDetectionForTokenStreamMappingAttribute

MetricAttribute

Attribute corresponding to a metric.

MissingTemplateHeaderFixupAttribute

PreviousAndNextAttribute

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.

numCallersAttribute

* numCallersAnnotator * Annotates every function's SgFunctionDefinition * node with a numCallersAttribute that contains the * number of functions that call the given function. ****

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 abstract 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 stack, 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.

Created with MrDocs