diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2011-06-27 21:53:17 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2011-06-27 21:53:17 +0000 |
| commit | cadd8eefdf4bb1b844ff497985a892019ee89f3e (patch) | |
| tree | 0d6ce27f275566a20c0e0127915fe91aee08173a | |
| parent | d1a075d21ad6fd9035a92d381a3c74a71dfa0016 (diff) | |
| download | bcm5719-llvm-cadd8eefdf4bb1b844ff497985a892019ee89f3e.tar.gz bcm5719-llvm-cadd8eefdf4bb1b844ff497985a892019ee89f3e.zip | |
Cache the result of AttributeList::getKind(); it's relatively expensive to compute, and we query it frequently enough that it showed up in a profile.
llvm-svn: 133948
| -rw-r--r-- | clang/include/clang/Sema/AttributeList.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/include/clang/Sema/AttributeList.h b/clang/include/clang/Sema/AttributeList.h index 597bda68947..a2c8f6f168e 100644 --- a/clang/include/clang/Sema/AttributeList.h +++ b/clang/include/clang/Sema/AttributeList.h @@ -77,6 +77,8 @@ private: /// availability attribute. unsigned IsAvailability : 1; + unsigned AttrKind : 8; + /// \brief The location of the 'unavailable' keyword in an /// availability attribute. SourceLocation UnavailableLoc; @@ -123,6 +125,7 @@ private: DeclspecAttribute(declspec), CXX0XAttribute(cxx0x), Invalid(false), IsAvailability(false), NextInPosition(0), NextInPool(0) { if (numArgs) memcpy(getArgsBuffer(), args, numArgs * sizeof(Expr*)); + AttrKind = getKind(getName()); } AttributeList(IdentifierInfo *attrName, SourceLocation attrLoc, @@ -141,6 +144,7 @@ private: new (&getAvailabilitySlot(IntroducedSlot)) AvailabilityChange(introduced); new (&getAvailabilitySlot(DeprecatedSlot)) AvailabilityChange(deprecated); new (&getAvailabilitySlot(ObsoletedSlot)) AvailabilityChange(obsoleted); + AttrKind = getKind(getName()); } friend class AttributePool; @@ -259,7 +263,7 @@ public: bool isInvalid() const { return Invalid; } void setInvalid(bool b = true) const { Invalid = b; } - Kind getKind() const { return getKind(getName()); } + Kind getKind() const { return Kind(AttrKind); } static Kind getKind(const IdentifierInfo *Name); AttributeList *getNext() const { return NextInPosition; } |

