r303882 - Revert MSVC CXXOperatorNames patch due to issues with Chromium

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu May 25 09:24:49 PDT 2017


Author: erichkeane
Date: Thu May 25 11:24:49 2017
New Revision: 303882

URL: http://llvm.org/viewvc/llvm-project?rev=303882&view=rev
Log:
Revert MSVC CXXOperatorNames patch due to issues with Chromium

Modified:
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp
    cfe/trunk/test/Parser/MicrosoftExtensions.cpp
    cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=303882&r1=303881&r2=303882&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu May 25 11:24:49 2017
@@ -1882,7 +1882,7 @@ static void ParseLangArgs(LangOptions &O
   Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
                                   Opts.GNUKeywords);
 
-  if (Args.hasArg(OPT_fno_operator_names) || Args.hasArg(OPT_fms_compatibility))
+  if (Args.hasArg(OPT_fno_operator_names))
     Opts.CXXOperatorNames = 0;
 
   if (Args.hasArg(OPT_fcuda_is_device))

Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.cpp?rev=303882&r1=303881&r2=303882&view=diff
==============================================================================
--- cfe/trunk/test/Parser/MicrosoftExtensions.cpp (original)
+++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp Thu May 25 11:24:49 2017
@@ -261,8 +261,9 @@ int __identifier(else} = __identifier(fo
 #define identifier_weird(x) __identifier(x
 int k = identifier_weird(if)); // expected-error {{use of undeclared identifier 'if'}}
 
-// 'and' is not an operator name with Microsoft compatibility.
-extern int __identifier(and) r; // expected-error {{expected ';' after top level declarator}}
+// This is a bit weird, but the alternative tokens aren't keywords, and this
+// behavior matches MSVC. FIXME: Consider supporting this anyway.
+extern int __identifier(and) r; // expected-error {{cannot convert '&&' token to an identifier}}
 
 void f() {
   __identifier(() // expected-error {{cannot convert '(' token to an identifier}}
@@ -354,6 +355,7 @@ void TestProperty() {
   ++sp.V11;
 }
 
+//expected-warning at +1 {{C++ operator 'and' (aka '&&') used as a macro name}}
 #define and foo
 
 struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {};

Modified: cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp?rev=303882&r1=303881&r2=303882&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp (original)
+++ cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp Thu May 25 11:24:49 2017
@@ -1,6 +1,5 @@
 // RUN: %clang_cc1 %s -E -verify -DOPERATOR_NAMES
 // RUN: %clang_cc1 %s -E -verify -fno-operator-names
-// RUN: %clang_cc1 %s    -verify -DTESTWIN -fms-compatibility
 
 #ifndef OPERATOR_NAMES
 //expected-error at +3 {{token is not a valid binary operator in a preprocessor subexpression}}
@@ -30,14 +29,3 @@
 #ifdef and
 #warning and is defined
 #endif
-
-#ifdef TESTWIN
-// For cl compatibility, fno-operator-names is enabled by default.
-int and;
-int bitand;
-int bitor;
-int compl;
-int not;
-int or;
-int xor;
-#endif




More information about the cfe-commits mailing list