BUG 1)
CFG failed to build for empty functions, or functions containing only
NullStmts or empty compound statements.
We now handle such cases, although now we cannot test for CFG
construction failure by asserting that the last block constructed is
not NULL (since it now may be).
BUG 2)
CFG construction segfaulted on some cases when walking the AST and not
taking into account that some children of a statement may be NULL.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42370
91177308-0d34-0410-b5e6-
96231b3b80d8
B->addSuccessor(LI->second);
}
-
- // Create an empty entry block that has no predecessors.
+
Succ = B;
- cfg->setEntry(createBlock());
-
- // NULL out cfg so that repeated calls to the builder will fail and that
- // the ownership of the constructed CFG is passed to the caller.
- CFG* t = cfg;
- cfg = NULL;
- return t;
- }
- else {
- assert (false && "CFG construction failed.");
- return NULL;
}
+
+ // Create an empty entry block that has no predecessors.
+ cfg->setEntry(createBlock());
+
+ // NULL out cfg so that repeated calls to the builder will fail and that
+ // the ownership of the constructed CFG is passed to the caller.
+ CFG* t = cfg;
+ cfg = NULL;
+ return t;
}
/// createBlock - Used to lazily create blocks that are connected
CFGBlock* B = Block;
for (Stmt::child_iterator I = S->child_begin(), E = S->child_end() ;
I != E; ++I)
- B = WalkAST(*I);
+ if (*I) B = WalkAST(*I);
return B;
}