Author: erichkeane
Date: Fri Jun  9 17:50:02 2017
New Revision: 305128

URL: http://llvm.org/viewvc/llvm-project?rev=305128&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Lex/Preprocessor.cpp

Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=305128&r1=305127&r2=305128&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Fri Jun  9 17:50:02 2017
@@ -713,7 +713,9 @@ bool Preprocessor::HandleIdentifier(Toke
   // 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.


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to