Skip to content

AstAttributeMechanism::set

Insert an attribute.

Synopsis

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

void
set(
    std::string const& name,
    AstAttribute* value);

Description

Inserts the specified heap-allocated value for the given attribute name, replacing any previous value stored for that same name.

If the new value uses the AstAttribute::CONTAINER_OWNERSHIP policy then ownership is immediately transferred/moved to this container, which becomes responsible for deleting the attribute. Otherwise, the attribute's designer is responsible for preventing leaks.

If the old value (if present) uses the AstAttribute::CONTAINER_OWNERSHIP policy then it is deleted. Otherwise the attribute's designer is responsible for implementing an ownership policy that safely prevents leaks, and the attribute must not be deleted until after this method returns.

Parameters

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

Created with MrDocs