diff options
-rw-r--r-- | clang/include/clang/AST/DeclarationName.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/include/clang/AST/DeclarationName.h b/clang/include/clang/AST/DeclarationName.h index d1cd4ebc958..42c1640b564 100644 --- a/clang/include/clang/AST/DeclarationName.h +++ b/clang/include/clang/AST/DeclarationName.h @@ -163,8 +163,18 @@ public: (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 @@ public: /// 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; } |