summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2018-02-24 03:54:22 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2018-02-24 03:54:22 +0000
commit1c6ed3add617a06da11c8a69b643a7b2e41604b9 (patch)
tree95a853a4d4597755aa3aadc1100503f18484d7cc
parent161c805da4d2a5f37a8ae982284b4a0743c035c6 (diff)
downloadbcm5719-llvm-1c6ed3add617a06da11c8a69b643a7b2e41604b9.tar.gz
bcm5719-llvm-1c6ed3add617a06da11c8a69b643a7b2e41604b9.zip
[CFG] Keep speculatively working around an MSVC compiler crash.
Replace if() with a switch(). Because random changes in the code seem to suppress the crash. Story so far: r325966 - Crash introduced. r325969 - Speculative fix had no effect. r325978 - Tried to bisect the offending function, crash suddenly disappeared. r326016 - After another random change in the code, bug appeared again. llvm-svn: 326021
-rw-r--r--clang/lib/Analysis/CFG.cpp40
1 files changed, 31 insertions, 9 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp
index 7ad6fbbf90b..1cf70631172 100644
--- a/clang/lib/Analysis/CFG.cpp
+++ b/clang/lib/Analysis/CFG.cpp
@@ -1171,25 +1171,47 @@ void CFGBuilder::findConstructionContexts(
const ConstructionContext *ContextSoFar, Stmt *Child) {
if (!BuildOpts.AddRichCXXConstructors)
return;
+
if (!Child)
return;
- if (auto *CE = dyn_cast<CXXConstructExpr>(Child)) {
- consumeConstructionContext(ContextSoFar, CE);
- } else if (auto *Cleanups = dyn_cast<ExprWithCleanups>(Child)) {
+
+ switch(Child->getStmtClass()) {
+ case Stmt::CXXConstructExprClass:
+ case Stmt::CXXTemporaryObjectExprClass: {
+ consumeConstructionContext(ContextSoFar, cast<CXXConstructExpr>(Child));
+ break;
+ }
+ case Stmt::ExprWithCleanupsClass: {
+ auto *Cleanups = cast<ExprWithCleanups>(Child);
findConstructionContexts(ContextSoFar, Cleanups->getSubExpr());
- } else if (auto *Cast = dyn_cast<CXXFunctionalCastExpr>(Child)) {
+ break;
+ }
+ case Stmt::CXXFunctionalCastExprClass: {
+ auto *Cast = cast<CXXFunctionalCastExpr>(Child);
+ findConstructionContexts(ContextSoFar, Cast->getSubExpr());
+ break;
+ }
+ case Stmt::ImplicitCastExprClass: {
+ auto *Cast = cast<ImplicitCastExpr>(Child);
findConstructionContexts(ContextSoFar, Cast->getSubExpr());
- } else if (auto *ImplicitCast = dyn_cast<ImplicitCastExpr>(Child)) {
- if (ImplicitCast->getCastKind() == CK_NoOp)
- findConstructionContexts(ContextSoFar, ImplicitCast->getSubExpr());
- } else if (auto *BTE = dyn_cast<CXXBindTemporaryExpr>(Child)) {
+ break;
+ }
+ case Stmt::CXXBindTemporaryExprClass: {
+ auto *BTE = cast<CXXBindTemporaryExpr>(Child);
findConstructionContexts(
ConstructionContext::create(cfg->getBumpVectorContext(), BTE,
ContextSoFar),
BTE->getSubExpr());
- } else if (auto *CO = dyn_cast<ConditionalOperator>(Child)) {
+ break;
+ }
+ case Stmt::ConditionalOperatorClass: {
+ auto *CO = cast<ConditionalOperator>(Child);
findConstructionContexts(ContextSoFar, CO->getLHS());
findConstructionContexts(ContextSoFar, CO->getRHS());
+ break;
+ }
+ default:
+ break;
}
}
OpenPOWER on IntegriCloud