[cfe-commits] r67433 - /cfe/trunk/include/clang/AST/DeclarationName.h
Chris Lattner
sabre at nondot.org
Fri Mar 20 23:49:20 PDT 2009
Author: lattner
Date: Sat Mar 21 01:49:19 2009
New Revision: 67433
URL: http://llvm.org/viewvc/llvm-project?rev=67433&view=rev
Log:
continue dancing around the obvious algorithm issues in PR3810:
This speeds up getAsIdentifierInfo from being a call to a function
with a big switch to a single testl instruction. This speeds up
the example in PR3810 by 6.2%
Modified:
cfe/trunk/include/clang/AST/DeclarationName.h
Modified: cfe/trunk/include/clang/AST/DeclarationName.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclarationName.h?rev=67433&r1=67432&r2=67433&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclarationName.h (original)
+++ cfe/trunk/include/clang/AST/DeclarationName.h Sat Mar 21 01:49:19 2009
@@ -163,8 +163,18 @@
(reinterpret_cast<IdentifierInfo *>(Ptr & ~PtrMask));
}
+ /// Predicate functions for querying what type of name this is.
+ bool isIdentifier() const { return getStoredNameKind() == StoredIdentifier; }
+ bool isObjCZeroArgSelector() const {
+ return getStoredNameKind() == StoredObjCZeroArgSelector;
+ }
+ bool isObjCOneArgSelector() const {
+ return getStoredNameKind() == StoredObjCOneArgSelector;
+ }
+
/// getNameKind - Determine what kind of name this is.
NameKind getNameKind() const;
+
/// getName - Retrieve the human-readable string for this name.
std::string getAsString() const;
@@ -173,7 +183,7 @@
/// this declaration name, or NULL if this declaration name isn't a
/// simple identifier.
IdentifierInfo *getAsIdentifierInfo() const {
- if (getNameKind() == Identifier)
+ if (isIdentifier())
return reinterpret_cast<IdentifierInfo *>(Ptr);
return 0;
}
More information about the cfe-commits
mailing list