[cfe-commits] r68072 - /cfe/trunk/lib/AST/CFG.cpp

Ted Kremenek kremenek at apple.com
Mon Mar 30 15:29:21 PDT 2009


Author: kremenek
Date: Mon Mar 30 17:29:21 2009
New Revision: 68072

URL: http://llvm.org/viewvc/llvm-project?rev=68072&view=rev
Log:
Add partial CFG support for Objective-C exception-handling blocks. We basically
assume that @catch blocks are never executed.

Modified:
    cfe/trunk/lib/AST/CFG.cpp

Modified: cfe/trunk/lib/AST/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CFG.cpp?rev=68072&r1=68071&r2=68072&view=diff

==============================================================================
--- cfe/trunk/lib/AST/CFG.cpp (original)
+++ cfe/trunk/lib/AST/CFG.cpp Mon Mar 30 17:29:21 2009
@@ -129,10 +129,13 @@
     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 @@
   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





More information about the cfe-commits mailing list