Skip to content

AstValueAttribute

IR node attribute that stores a copyable value.

Synopsis

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

template<class T>
class [[visibility("default")]] AstValueAttribute
    : public AstAttribute

Description

Since IR node attributes must all inherit from AstAttribute we need to write wrappers around POD types and 3rd party types when we want to store them as IR attributes. We've ended up with a proliferation of such attributes that all do almost the same thing but have different names to access their data members. Hopefully by providing one class template we can avoid further proliferation.

Base Classes

Name Description
AstAttribute Base class for all IR node attribute values.

Type Aliases

Name Description
Value Type of value this wrapper holds.

Member Functions

Name Description
AstValueAttribute
AstValueAttribute(); [constructor]
Constructors
attribute_class_name
virtual std::string attribute_class_name() const override; [virtual]
copy
virtual AstAttribute* copy() const override; [virtual]
get
T const& get() const;
Return the stored value by reference.
getOwnershipPolicy
virtual AstAttribute::OwnershipPolicy getOwnershipPolicy() const override; [virtual]
set
void set(T const& value);
Assign a new value.

Private Data Members

Name
value_

Derived Classes

Name Description
AstIntAttribute
AstSgNodeAttribute Attribute storing an SgNode.

Created with MrDocs