summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2017-06-09 16:29:35 +0000
committerErich Keane <erich.keane@intel.com>2017-06-09 16:29:35 +0000
commit33c3d8a916cfe6cdef165a198735a49560c03652 (patch)
tree5ced8c2c0d28488aad2150321f09e32d8297cc3b /clang/lib/Lex/Preprocessor.cpp
parent31ce4ec2fd1114f816110d47ca0fb9fad395adfb (diff)
downloadbcm5719-llvm-33c3d8a916cfe6cdef165a198735a49560c03652.tar.gz
bcm5719-llvm-33c3d8a916cfe6cdef165a198735a49560c03652.zip
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 llvm-svn: 305087
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r--clang/lib/Lex/Preprocessor.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 3596337c245..77b46ae5ccc 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud