aboutsummaryrefslogtreecommitdiff
path: root/Lex/Lexer.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-12-13 01:59:49 +0000
committerChris Lattner <sabre@nondot.org>2007-12-13 01:59:49 +0000
commit53702cd401b8fdca985aede7732c2f6a82ad9b1c (patch)
treec89be440668049f9b445b42153962780e5218d1a /Lex/Lexer.cpp
parent5dc043dc0b6ee665f5f1f9113b6dd4e819083352 (diff)
add a helper method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44976 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Lex/Lexer.cpp')
-rw-r--r--Lex/Lexer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lex/Lexer.cpp b/Lex/Lexer.cpp
index f712bec719..646d575bae 100644
--- a/Lex/Lexer.cpp
+++ b/Lex/Lexer.cpp
@@ -51,6 +51,13 @@ tok::ObjCKeywordKind Token::getObjCKeywordID() const {
return specId ? specId->getObjCKeywordID() : tok::objc_not_keyword;
}
+/// isNamedIdentifier - Return true if this token is a ppidentifier with the
+/// specified name. For example, tok.isNamedIdentifier("this").
+bool Token::isNamedIdentifier(const char *Name) const {
+ return IdentInfo && !strcmp(IdentInfo->getName(), Name);
+}
+
+
//===----------------------------------------------------------------------===//
// Lexer Class Implementation
//===----------------------------------------------------------------------===//