diff options
author | Steve Naroff <snaroff@apple.com> | 2007-08-23 18:16:40 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2007-08-23 18:16:40 +0000 |
commit | 861cf3effdc0fbc97d401539bc3050da76b2476f (patch) | |
tree | 1f69e0758f4b1568891ec69bbd8c268f9516ce0d /Lex/IdentifierTable.cpp | |
parent | edcc752060be38bfa7e7b32691c0cc4d843622a8 (diff) |
Add helper functions Token::isObjCAtKeyword() and Token::getObjCKeywordID().
Convert all clients to the new cleaner, more robust API.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41330 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Lex/IdentifierTable.cpp')
-rw-r--r-- | Lex/IdentifierTable.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lex/IdentifierTable.cpp b/Lex/IdentifierTable.cpp index c12fdef203..d3faeb58db 100644 --- a/Lex/IdentifierTable.cpp +++ b/Lex/IdentifierTable.cpp @@ -18,6 +18,22 @@ using namespace clang; //===----------------------------------------------------------------------===// +// Token Implementation +//===----------------------------------------------------------------------===// + +/// isObjCAtKeyword - Return true if we have an ObjC keyword identifier. +bool Token::isObjCAtKeyword(tok::ObjCKeywordKind objcKey) const { + return getKind() == tok::identifier && + getIdentifierInfo()->getObjCKeywordID() == objcKey; +} + +/// getObjCKeywordID - Return the ObjC keyword kind. +tok::ObjCKeywordKind Token::getObjCKeywordID() const { + IdentifierInfo *specId = getIdentifierInfo(); + return specId ? specId->getObjCKeywordID() : tok::objc_not_keyword; +} + +//===----------------------------------------------------------------------===// // IdentifierInfo Implementation //===----------------------------------------------------------------------===// |