diff options
Diffstat (limited to 'include/clang/AST/Attr.h')
-rw-r--r-- | include/clang/AST/Attr.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/include/clang/AST/Attr.h b/include/clang/AST/Attr.h index aad2fb8577..fbb097011f 100644 --- a/include/clang/AST/Attr.h +++ b/include/clang/AST/Attr.h @@ -44,10 +44,14 @@ private: unsigned AttrKind : 16; protected: + /// An index into the spelling list of an + /// attribute defined in Attr.td file. + unsigned SpellingListIndex : 4; + bool Inherited : 1; virtual ~Attr(); - + void* operator new(size_t bytes) throw() { llvm_unreachable("Attrs cannot be allocated with regular 'new'."); } @@ -67,14 +71,17 @@ public: } protected: - Attr(attr::Kind AK, SourceRange R) - : Range(R), AttrKind(AK), Inherited(false) {} + Attr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex = 0) + : Range(R), AttrKind(AK), SpellingListIndex(SpellingListIndex), + Inherited(false) {} public: attr::Kind getKind() const { return static_cast<attr::Kind>(AttrKind); } + + unsigned getSpellingListIndex() const { return SpellingListIndex; } SourceLocation getLocation() const { return Range.getBegin(); } SourceRange getRange() const { return Range; } @@ -95,8 +102,8 @@ public: class InheritableAttr : public Attr { virtual void anchor(); protected: - InheritableAttr(attr::Kind AK, SourceRange R) - : Attr(AK, R) {} + InheritableAttr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex = 0) + : Attr(AK, R, SpellingListIndex) {} public: void setInherited(bool I) { Inherited = I; } @@ -110,8 +117,9 @@ public: class InheritableParamAttr : public InheritableAttr { virtual void anchor(); protected: - InheritableParamAttr(attr::Kind AK, SourceRange R) - : InheritableAttr(AK, R) {} + InheritableParamAttr(attr::Kind AK, SourceRange R, + unsigned SpellingListIndex = 0) + : InheritableAttr(AK, R, SpellingListIndex) {} public: // Implement isa/cast/dyncast/etc. |