summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/StmtProfile.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2017-07-24 16:54:11 +0000
committerNico Weber <nicolasweber@gmx.de>2017-07-24 16:54:11 +0000
commitf56f446f504c73c1a5567635260daae6be05ac82 (patch)
tree9a61676cfac9dee37af453d6fabd7a8c0f68405f /clang/lib/AST/StmtProfile.cpp
parent2434d45b85af800f79d72791488329c62c1b6c37 (diff)
Work around an MSVC2017 update 3 codegen bug.
C2017 update 3 produces a clang that crashes when compiling clang. Disabling optimizations for StmtProfiler::VisitCXXOperatorCallExpr() makes the crash go away. Patch from Bruce Dawson <brucedawson@chromium.org>! https://reviews.llvm.org/D35757 llvm-svn: 308897
Diffstat (limited to 'clang/lib/AST/StmtProfile.cpp')
-rw-r--r--clang/lib/AST/StmtProfile.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp
index a86fded2a2c4..72efca00403b 100644
--- a/clang/lib/AST/StmtProfile.cpp
+++ b/clang/lib/AST/StmtProfile.cpp
@@ -1412,6 +1412,15 @@ static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
llvm_unreachable("Invalid overloaded operator expression");
}
+#if defined(_MSC_VER)
+#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
+// will crash in stage 2 of a bootstrap build.
+#pragma optimize("", off)
+#endif
+#endif
+
void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) {
if (S->isTypeDependent()) {
// Type-dependent operator calls are profiled like their underlying
@@ -1444,6 +1453,12 @@ void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) {
ID.AddInteger(S->getOperator());
}
+#if defined(_MSC_VER)
+#if _MSC_VER == 1911
+#pragma optimize("", on)
+#endif
+#endif
+
void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) {
VisitCallExpr(S);
}