summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-12-09 20:20:09 +0000
committerTed Kremenek <kremenek@apple.com>2008-12-09 20:20:09 +0000
commit93041ba48357dc78eba02a18dd981c249f0d8ec4 (patch)
tree0c69ae92bf02bb806e82e8d06029862bd5997cbf /clang/lib/AST
parent1857ff4e2c42f1974cfe89088e674f4a6849c2e3 (diff)
downloadbcm5719-llvm-93041ba48357dc78eba02a18dd981c249f0d8ec4.tar.gz
bcm5719-llvm-93041ba48357dc78eba02a18dd981c249f0d8ec4.zip
Add preliminary CFG support for @throw. We basically treat it like a return statement.
llvm-svn: 60790
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/CFG.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/clang/lib/AST/CFG.cpp b/clang/lib/AST/CFG.cpp
index 69e82f2b832..b84ead763f7 100644
--- a/clang/lib/AST/CFG.cpp
+++ b/clang/lib/AST/CFG.cpp
@@ -132,7 +132,10 @@ public:
CFGBlock* VisitObjCAtTryStmt(ObjCAtTryStmt* S) { return NYS(); }
CFGBlock* VisitObjCAtCatchStmt(ObjCAtCatchStmt* S) { return NYS(); }
CFGBlock* VisitObjCAtFinallyStmt(ObjCAtFinallyStmt* S) { return NYS(); }
- CFGBlock* VisitObjCAtThrowStmt(ObjCAtThrowStmt* S) { return NYS(); }
+
+ // FIXME: This is not completely supported. We basically @throw like
+ // a 'return'.
+ CFGBlock* VisitObjCAtThrowStmt(ObjCAtThrowStmt* S);
CFGBlock* VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt* S){
return NYS();
@@ -972,6 +975,25 @@ CFGBlock* CFGBuilder::VisitWhileStmt(WhileStmt* W) {
Succ = EntryConditionBlock;
return EntryConditionBlock;
}
+
+CFGBlock* CFGBuilder::VisitObjCAtThrowStmt(ObjCAtThrowStmt* S) {
+ // FIXME: This isn't complete. We basically treat @throw like a return
+ // statement.
+
+ // If we were in the middle of a block we stop processing that block
+ // and reverse its statements.
+ if (Block) FinishBlock(Block);
+
+ // Create the new block.
+ Block = createBlock(false);
+
+ // The Exit block is the only successor.
+ Block->addSuccessor(&cfg->getExit());
+
+ // Add the statement to the block. This may create new blocks
+ // if S contains control-flow (short-circuit operations).
+ return addStmt(S);
+}
CFGBlock* CFGBuilder::VisitDoStmt(DoStmt* D) {
// "do...while" is a control-flow statement. Thus we stop processing the
OpenPOWER on IntegriCloud