diff options
author | Erich Keane <erich.keane@intel.com> | 2017-06-09 16:29:35 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2017-06-09 16:29:35 +0000 |
commit | 3148514e3baca9b32f9da60915df952cc8b227b9 (patch) | |
tree | d059827c61b344c5b4d349d9d98509268834b08c /lib/Lex/Preprocessor.cpp | |
parent | 52709f3610567494b4a764660f01d29053fc37d8 (diff) |
support operator keywords used in Windows SDK
to support operator keywords used in Windows SDK, alter token type when
seen in system headers
Hello, I submitted D33505 to address this problem, but the
proposal was rejected as too big a hammer.
This change will allow clang to parse the WindowsSDK header <query.h>
which uses the operator name "or" as a field name. Treat cpp operator
keywords as ordinary identifiers inside the Microsoft headers, but
treat them as usual in the user's program.
Original Submitter: Melanie Blower (mibintc)
Differential Revision: https://reviews.llvm.org/D33782
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305087 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
-rw-r--r-- | lib/Lex/Preprocessor.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 3596337c24..77b46ae5cc 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -580,7 +580,11 @@ IdentifierInfo *Preprocessor::LookUpIdentifierInfo(Token &Identifier) const { // Update the token info (identifier info and appropriate token kind). Identifier.setIdentifierInfo(II); - Identifier.setKind(II->getTokenID()); + if (getLangOpts().MSVCCompat && II->isCPlusPlusOperatorKeyword() && + getSourceManager().isInSystemHeader(Identifier.getLocation())) + Identifier.setKind(clang::tok::identifier); + else + Identifier.setKind(II->getTokenID()); return II; } |