My Project
|
#include <Attributes.h>
Public Types | |
enum | RemoveResult { RemoveResult::Removed, RemoveResult::NotFound } |
Public Member Functions | |
NamedAttributeList (DictionaryAttr attrs=nullptr) | |
NamedAttributeList (ArrayRef< NamedAttribute > attributes) | |
bool | operator!= (const NamedAttributeList &other) const |
bool | operator== (const NamedAttributeList &other) const |
DictionaryAttr | getDictionary () const |
ArrayRef< NamedAttribute > | getAttrs () const |
Return all of the attributes on this operation. More... | |
void | setAttrs (ArrayRef< NamedAttribute > attributes) |
Replace the held attributes with ones provided in 'newAttrs'. More... | |
Attribute | get (StringRef name) const |
Return the specified attribute if present, null otherwise. More... | |
Attribute | get (Identifier name) const |
Return the specified attribute if present, null otherwise. More... | |
void | set (Identifier name, Attribute value) |
RemoveResult | remove (Identifier name) |
A NamedAttributeList is used to manage a list of named attributes. This provides simple interfaces for adding/removing/finding attributes from within a DictionaryAttr.
We assume there will be relatively few attributes on a given operation (maybe a dozen or so, but not hundreds or thousands) so we use linear searches for everything.
|
strong |
|
inline |
NamedAttributeList::NamedAttributeList | ( | ArrayRef< NamedAttribute > | attributes | ) |
Attribute NamedAttributeList::get | ( | StringRef | name | ) | const |
Return the specified attribute if present, null otherwise.
Attribute NamedAttributeList::get | ( | Identifier | name | ) | const |
Return the specified attribute if present, null otherwise.
ArrayRef< NamedAttribute > NamedAttributeList::getAttrs | ( | ) | const |
Return all of the attributes on this operation.
|
inline |
Return the underlying dictionary attribute. This may be null, if this list has no attributes.
|
inline |
|
inline |
auto NamedAttributeList::remove | ( | Identifier | name | ) |
Remove the attribute with the specified name if it exists. The return value indicates whether the attribute was present or not.
void NamedAttributeList::set | ( | Identifier | name, |
Attribute | value | ||
) |
If the an attribute exists with the specified name, change it to the new value. Otherwise, add a new attribute with the specified name/value.
void NamedAttributeList::setAttrs | ( | ArrayRef< NamedAttribute > | attributes | ) |
Replace the held attributes with ones provided in 'newAttrs'.