summaryrefslogtreecommitdiffstats
path: root/include/clang/Sema/AttributeList.h
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-06-27 21:53:17 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-06-27 21:53:17 +0000
commit0c1c98c2375fe68fee0a6075905772e5290d4a28 (patch)
tree0cbae6e30a9c4b540e409ad8e7b5f0721c5e6257 /include/clang/Sema/AttributeList.h
parente6d134b244cd666c47a3d2dd78f82ff0824188bd (diff)
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133948 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Sema/AttributeList.h')
-rw-r--r--include/clang/Sema/AttributeList.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/clang/Sema/AttributeList.h b/include/clang/Sema/AttributeList.h
index 597bda6894..a2c8f6f168 100644
--- a/include/clang/Sema/AttributeList.h
+++ b/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; }