add a helper method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44976 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Lex/Lexer.cpp b/Lex/Lexer.cpp
index f712bec..646d575 100644
--- a/Lex/Lexer.cpp
+++ b/Lex/Lexer.cpp
@@ -51,6 +51,13 @@
   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
 //===----------------------------------------------------------------------===//
diff --git a/include/clang/Lex/Token.h b/include/clang/Lex/Token.h
index 6206507..9f839fd 100644
--- a/include/clang/Lex/Token.h
+++ b/include/clang/Lex/Token.h
@@ -80,7 +80,11 @@
   void setIdentifierInfo(IdentifierInfo *II) {
     IdentInfo = II;
   }
-
+  
+  /// isNamedIdentifier - Return true if this token is a ppidentifier with the
+  /// specified name.  For example, tok.isNamedIdentifier("this").
+  bool isNamedIdentifier(const char *Name) const;
+  
   /// setFlag - Set the specified flag.
   void setFlag(TokenFlags Flag) {
     Flags |= Flag;