r315699 - Hide "#pragma optimize("", off)" from clang when it pretends to be MSVC 2017

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 13 09:18:32 PDT 2017


Author: rnk
Date: Fri Oct 13 09:18:32 2017
New Revision: 315699

URL: http://llvm.org/viewvc/llvm-project?rev=315699&view=rev
Log:
Hide "#pragma optimize("", off)" from clang when it pretends to be MSVC 2017

These pragmas work around a bug in VC 1911 that isn't present in clang,
and clang warns about them.

Modified:
    cfe/trunk/lib/AST/StmtProfile.cpp

Modified: cfe/trunk/lib/AST/StmtProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=315699&r1=315698&r2=315699&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Fri Oct 13 09:18:32 2017
@@ -1418,7 +1418,7 @@ static Stmt::StmtClass DecodeOperatorCal
   llvm_unreachable("Invalid overloaded operator expression");
 }
 
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && !defined(__clang__)
 #if _MSC_VER == 1911
 // Work around https://developercommunity.visualstudio.com/content/problem/84002/clang-cl-when-built-with-vc-2017-crashes-cause-vc.html
 // MSVC 2017 update 3 miscompiles this function, and a clang built with it
@@ -1459,7 +1459,7 @@ void StmtProfiler::VisitCXXOperatorCallE
   ID.AddInteger(S->getOperator());
 }
 
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && !defined(__clang__)
 #if _MSC_VER == 1911
 #pragma optimize("", on)
 #endif




More information about the cfe-commits mailing list