[CFG] Try to narrow down MSVC compiler crash via binary search.

Split the presumably offending function in two to see which part of it causes
the crash to occur.

The crash was introduced in r325966.
r325969 did not help.

llvm-svn: 325978
This commit is contained in:
Artem Dergachev 2018-02-23 23:38:41 +00:00
parent 60c206e0bd
commit c1b07bdde9
1 changed files with 17 additions and 11 deletions

View File

@ -650,6 +650,10 @@ private:
return Block;
}
// Remember to apply \p CC when constructing the CFG element for \p CE.
void consumeConstructionContext(const ConstructionContext *CC,
CXXConstructExpr *CE);
// Scan the child statement \p Child to find the constructor that might
// have been directly triggered by the current node, \p Trigger. If such
// constructor has been found, set current construction context to point
@ -1149,6 +1153,18 @@ static const VariableArrayType *FindVA(const Type *t) {
return nullptr;
}
void CFGBuilder::consumeConstructionContext(const ConstructionContext *CC, CXXConstructExpr *CE) {
if (const ConstructionContext *PreviousContext =
ConstructionContextMap.lookup(CE)) {
// We might have visited this child when we were finding construction
// contexts within its parents.
assert(PreviousContext->isStrictlyMoreSpecificThan(CC) &&
"Already within a different construction context!");
} else {
ConstructionContextMap[CE] = CC;
}
}
void CFGBuilder::findConstructionContexts(
const ConstructionContext *ContextSoFar, Stmt *Child) {
if (!BuildOpts.AddRichCXXConstructors)
@ -1156,17 +1172,7 @@ void CFGBuilder::findConstructionContexts(
if (!Child)
return;
if (auto *CE = dyn_cast<CXXConstructExpr>(Child)) {
if (const ConstructionContext *PreviousContext =
ConstructionContextMap.lookup(CE)) {
// We might have visited this child when we were finding construction
// contexts within its parents.
assert(PreviousContext->isStrictlyMoreSpecificThan(ContextSoFar) &&
"Already within a different construction context!");
} else {
auto Pair =
ConstructionContextMap.insert(std::make_pair(CE, ContextSoFar));
assert(Pair.second && "Already within a construction context!");
}
consumeConstructionContext(ContextSoFar, CE);
} else if (auto *Cleanups = dyn_cast<ExprWithCleanups>(Child)) {
findConstructionContexts(ContextSoFar, Cleanups->getSubExpr());
} else if (auto *BTE = dyn_cast<CXXBindTemporaryExpr>(Child)) {