summaryrefslogtreecommitdiffstats
path: root/lib/Lex
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
commit6feeb00acd06ed4183dc89e1264124d5daff6f94 (patch)
treecaf7c1fdf08272c8a5668bfffd070ee4070ed547 /lib/Lex
parentbc18067b2dbf059e09e10e8b2417361857c52ba2 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305128 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex')
-rw-r--r--lib/Lex/Preprocessor.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index 77b46ae5cc..f9a399cd7f 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/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.