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

69 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek 7926f7c45c Removed special-casing in CFG construction for ParenExprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41540 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-28 16:18:58 +00:00
Ted Kremenek 0b1d9b7557 Added support for short-circuit '&&' and '||' operators in source-level CFGs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41520 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-27 21:54:41 +00:00
Ted Kremenek 9da2fb773c Implemented support for ternary "?" operators in source-level CFGs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41514 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-27 21:27:44 +00:00
Ted Kremenek 49af7cb8a3 Changes to CFGBuilder:
+ Added the creation of an empty Entry block at the end of CFG
  construction if the Entry block in the CFG contains multiple
  predecessors (which can happen with labels and do loops).

+ Fixed bug in the creation of an empty Exit block with functions where not
  all paths end in a return statement (but some do).  Basic blocks with
  return statements were jumping to a (sometimes) non-empty block.

+ FinishBlock no longer checks for labels at the beginning of a basic
  block before reversing the statements in the block.  This is because
  the recursion invariants of the builder methods have been cleaned up,
  and blocks are only passed to FinishBlock at most once.

+ Modified handling of "if", "for", "while", "do", and "switch" to allow
  condition expressions that can span multiple basic blocks.  This allows
  such conditions to contain short-circuit expressions (which span multiple
  blocks in the CFG).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41508 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-27 19:46:09 +00:00
Ted Kremenek d4fdee3547 No functionality change. Moved visitor methods for CFGBuilder out-of-line
from the class declaration.  This enables a nice view of what visitor methods
have been implemented.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41337 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-23 21:42:29 +00:00
Ted Kremenek befef2f697 moved CFGBuilder into an anonymous namespace
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41334 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-23 21:26:19 +00:00
Ted Kremenek b5c13b0f4e Added support for switch, default, and case statements in source-level CFGs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41332 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-23 18:43:24 +00:00
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