diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-05-31 22:01:01 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-05-31 22:01:01 +0000 |
| commit | d3f3231a072c67989d6bd1aeeafa12636098ebd1 (patch) | |
| tree | 362419da4a3ddb6667c7f93f372c22c9089e2bfd /clang | |
| parent | 252e5f1b2975aceb35c739d4511df7003055f2bd (diff) | |
| download | bcm5719-llvm-d3f3231a072c67989d6bd1aeeafa12636098ebd1.tar.gz bcm5719-llvm-d3f3231a072c67989d6bd1aeeafa12636098ebd1.zip | |
Two identifiers are not the same unless they have the same identifier info.
llvm-svn: 51827
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/Driver/RewriteMacros.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/Driver/RewriteMacros.cpp b/clang/Driver/RewriteMacros.cpp index b61a13c9bb5..136492517d6 100644 --- a/clang/Driver/RewriteMacros.cpp +++ b/clang/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; |

