Граф коммитов

12 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek 989d52d469 For gotos, breaks, and continues where we cannot find a target successor
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
2007-08-23 17:29:58 +00:00
Ted Kremenek f752fcfae8 Added support for do..while loops in CFG construction.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41325 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-23 17:15:32 +00:00
Ted Kremenek 026473c217 Renamed "CFG::BuildCFG" to "CFG::buildCFG" to have more consistent capitalization.
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
2007-08-23 16:51:22 +00:00
Ted Kremenek 31dcd3c8c4 Fixed bugs in source-level CFG construction for "for" and "while" loops
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
2007-08-22 22:35:28 +00:00
Ted Kremenek 8a294713e0 Added support for "break" statements in source-level ASTs.
Some comment cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41299 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-22 21:51:58 +00:00
Ted Kremenek bf15b278a4 Added support for "continue" statements in source-level CFGs
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
2007-08-22 21:36:54 +00:00
Ted Kremenek 2bac4ea765 Added preliminary support for while loops within source-level CFGs.
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
2007-08-22 21:05:42 +00:00
Ted Kremenek e8ee26b49d Added CFG support for: for loops
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
2007-08-22 18:22:34 +00:00
Ted Kremenek 4a2b8a10c4 Changed data structure recording the CFG blocks that need to be backpatched
to labeled blocks from a list to a vector.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41274 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-22 15:40:58 +00:00
Ted Kremenek 0cebe3e29b Added CFG support for gotos and labels.
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
2007-08-21 23:26:17 +00:00
Ted Kremenek c310e933a9 Converted CFGBuilder to use StmtVisitor instead of doing a switch
dispatch to walk the AST.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41254 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 22:06:14 +00:00
Ted Kremenek fddd51853f Added CFG infrastructure (CFG.cpp and CFG.h) for clang ASTs.
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
2007-08-21 21:42:03 +00:00