summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2017-06-09 22:50:02 +0000
committerErich Keane <erich.keane@intel.com>2017-06-09 22:50:02 +0000
commit3cf69bce69da1e21c23fda1b772a3c5e0643309f (patch)
tree296374b887f289897c73ee0203cba5dbf0c3aead /clang/lib/Lex/Preprocessor.cpp
parent21fde385faaf70787af5902f4537a4e1a6ac6fb1 (diff)
downloadbcm5719-llvm-3cf69bce69da1e21c23fda1b772a3c5e0643309f.tar.gz
bcm5719-llvm-3cf69bce69da1e21c23fda1b772a3c5e0643309f.zip
Support operator keywords used in Windows SDK(fix ubsan)
UBSan found an issue with a nullptr being assigned to a reference. This was because a following function went back and checked the identifier in the CPPOperatorName case. This patch corrects that location with the original logic as well. llvm-svn: 305128
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r--clang/lib/Lex/Preprocessor.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 77b46ae5ccc..f9a399cd7fd 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -713,7 +713,9 @@ bool Preprocessor::HandleIdentifier(Token &Identifier) {
// C++ 2.11p2: If this is an alternative representation of a C++ operator,
// then we act as if it is the actual operator and not the textual
// representation of it.
- if (II.isCPlusPlusOperatorKeyword())
+ if (II.isCPlusPlusOperatorKeyword() &&
+ !(getLangOpts().MSVCCompat &&
+ getSourceManager().isInSystemHeader(Identifier.getLocation())))
Identifier.setIdentifierInfo(nullptr);
// If this is an extension token, diagnose its use.
OpenPOWER on IntegriCloud