]> granicus.if.org Git - clang/commitdiff
Two identifiers are not the same unless they have the same identifier info.
authorChris Lattner <sabre@nondot.org>
Sat, 31 May 2008 22:01:01 +0000 (22:01 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 31 May 2008 22:01:01 +0000 (22:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51827 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/RewriteMacros.cpp

index b61a13c9bb5224ca63e4113ee73c966802be31c6..136492517d645c067fb92105a8980b50711e7886 100644 (file)
@@ -24,9 +24,15 @@ using namespace clang;
 /// isSameToken - Return true if the two specified tokens start have the same
 /// content.
 static bool isSameToken(Token &RawTok, Token &PPTok) {
-  if (PPTok.getKind() == RawTok.getKind())
+  // If two tokens have the same kind and the same identifier info, they are
+  // obviously the same.
+  if (PPTok.getKind() == RawTok.getKind() &&
+      PPTok.getIdentifierInfo() == RawTok.getIdentifierInfo())
     return true;
   
+  // Otherwise, if they are different but have the same identifier info, they
+  // are also considered to be the same.  This allows keywords and raw lexed
+  // identifiers with the same name to be treated the same.
   if (PPTok.getIdentifierInfo() &&
       PPTok.getIdentifierInfo() == RawTok.getIdentifierInfo())
     return true;