[cfe-commits] r51827 - /cfe/trunk/Driver/RewriteMacros.cpp
Chris Lattner
sabre at nondot.org
Sat May 31 15:01:01 PDT 2008
Author: lattner
Date: Sat May 31 17:01:01 2008
New Revision: 51827
URL: http://llvm.org/viewvc/llvm-project?rev=51827&view=rev
Log:
Two identifiers are not the same unless they have the same identifier info.
Modified:
cfe/trunk/Driver/RewriteMacros.cpp
Modified: cfe/trunk/Driver/RewriteMacros.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteMacros.cpp?rev=51827&r1=51826&r2=51827&view=diff
==============================================================================
--- cfe/trunk/Driver/RewriteMacros.cpp (original)
+++ cfe/trunk/Driver/RewriteMacros.cpp Sat May 31 17:01:01 2008
@@ -24,9 +24,15 @@
/// 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;
More information about the cfe-commits
mailing list