From: Ted Kremenek Date: Mon, 30 Mar 2009 22:29:21 +0000 (+0000) Subject: Add partial CFG support for Objective-C exception-handling blocks. We basically X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e31c0d206b872b056dc42c3af21b11d5de4edfd9;p=clang Add partial CFG support for Objective-C exception-handling blocks. We basically assume that @catch blocks are never executed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68072 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/CFG.cpp b/lib/AST/CFG.cpp index 804c2d2bd5..fc893d5b64 100644 --- a/lib/AST/CFG.cpp +++ b/lib/AST/CFG.cpp @@ -129,10 +129,13 @@ public: return Block; } - CFGBlock* VisitObjCAtTryStmt(ObjCAtTryStmt* S) { return NYS(); } - CFGBlock* VisitObjCAtCatchStmt(ObjCAtCatchStmt* S) { return NYS(); } - CFGBlock* VisitObjCAtFinallyStmt(ObjCAtFinallyStmt* S) { return NYS(); } - + CFGBlock* VisitObjCAtTryStmt(ObjCAtTryStmt* S); + CFGBlock* VisitObjCAtCatchStmt(ObjCAtCatchStmt* S) { + // FIXME: For now we pretend that @catch and the code it contains + // does not exit. + return Block; + } + // FIXME: This is not completely supported. We basically @throw like // a 'return'. CFGBlock* VisitObjCAtThrowStmt(ObjCAtThrowStmt* S); @@ -888,7 +891,17 @@ CFGBlock* CFGBuilder::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) { Block = createBlock(); return addStmt(S->getCollection()); } - + +CFGBlock* CFGBuilder::VisitObjCAtTryStmt(ObjCAtTryStmt* S) { + // Process the statements of the @finally block. + if (ObjCAtFinallyStmt *FS = S->getFinallyStmt()) + Visit(FS->getFinallyBody()); + + // FIXME: Handle the @catch statements. + + // Process the try body + return Visit(S->getTryBody()); +} CFGBlock* CFGBuilder::VisitWhileStmt(WhileStmt* W) { // "while" is a control-flow statement. Thus we stop processing the