block (because we are creating a CFG from an incomplete AST) we now
(gracefully) have a block ending with such statements not have any successors
instead of firing an assertion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41327 91177308-0d34-0410-b5e6-96231b3b80d8
Added explicit "Exit" CFGBlock pointer to the source-level CFG.
Changed the construction of blocks with "return" statements to have the
return statement appear both as a statement in the list of statements for
a CFGBlock as well as appear as a control-flow terminator. Also removed
the implicit linearization of "return" so that the return value and the
return statement did not appear as separate statements in the block.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41323 91177308-0d34-0410-b5e6-96231b3b80d8
where break targets weren't being set and restored properly. Also
cleaned up CFGBuilder code for "for" and "while" to use less reliance
on globals and to have clearer semantics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41302 91177308-0d34-0410-b5e6-96231b3b80d8
Cleaned up some code for "for" and "while" loops by making their
implementations more symmetrical (and added a few comments).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41298 91177308-0d34-0410-b5e6-96231b3b80d8
Adjusted printing of source-level CFGs to account that the entry block
may not be the first block in the list of blocks a CFG object maintains.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41294 91177308-0d34-0410-b5e6-96231b3b80d8
In CFG dumper, refactored the code to print block terminators into a
StmtVisitor.
Added the method "FinishBlock" to CFGBuilder to do the reversal of statements
in a block instead of calling "reverseStmts" for a block directly. This
was necessary to fix a bug in how blocks with labels were being processed
(some cases would cause the statements to be reversed twice). FinishBlock
detects blocks that start with labels and doesn't do a second reversal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41281 91177308-0d34-0410-b5e6-96231b3b80d8
Modified CFG so that getEntry(), getExit(), front() and back() return
CFGBlock& instead of CFGBlock*.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41258 91177308-0d34-0410-b5e6-96231b3b80d8
Added builder code to translate ASTs to CFGs. This currently supports
if, return, and non-control flow statements.
Added pretty-printer to debug CFGs.
Added a "-dump-cfg" option to the clang driver to dump CFGs for code
sent through the frontend.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41252 91177308-0d34-0410-b5e6-96231b3b80d8