aboutsummaryrefslogtreecommitdiff
path: root/Driver/RewriteMacros.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-05-31 22:01:01 +0000
committerChris Lattner <sabre@nondot.org>2008-05-31 22:01:01 +0000
commit8ea78e6e5717d8e6ea9cd31a5d5982494dab6bff (patch)
tree1f433c631b039c8795e59a8ce7f4fef88db21c05 /Driver/RewriteMacros.cpp
parent77eedd6fcea7b090cb0368d26ec65305a84dbc6c (diff)
Two identifiers are not the same unless they have the same identifier info.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51827 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/RewriteMacros.cpp')
-rw-r--r--Driver/RewriteMacros.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Driver/RewriteMacros.cpp b/Driver/RewriteMacros.cpp
index b61a13c9bb..136492517d 100644
--- a/Driver/RewriteMacros.cpp
+++ b/Driver/RewriteMacros.cpp
@@ -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;