CFGBlock* VisitDefaultStmt(DefaultStmt* D);
CFGBlock* VisitIndirectGotoStmt(IndirectGotoStmt* I);
+ // FIXME: Add support for ObjC-specific control-flow structures.
+
+ CFGBlock* VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
+ badCFG = true;
+ return Block;
+ }
+
+ CFGBlock* VisitObjCAtTryStmt(ObjCAtTryStmt* S) {
+ badCFG = true;
+ return Block;
+ }
+
private:
CFGBlock* createBlock(bool add_successor = true);
CFGBlock* addStmt(Stmt* S);
CFGBlock* WalkAST_VisitStmtExpr(StmtExpr* S);
void FinishBlock(CFGBlock* B);
+ bool badCFG;
};
/// BuildCFG - Constructs a CFG from an AST (a Stmt*). The AST can
assert (cfg);
if (!Statement) return NULL;
+ badCFG = false;
+
// Create an empty block that will serve as the exit block for the CFG.
// Since this is the first block added to the CFG, it will be implicitly
// registered as the exit block.
// Create an empty entry block that has no predecessors.
cfg->setEntry(createBlock());
+ if (badCFG) {
+ delete cfg;
+ cfg = NULL;
+ return NULL;
+ }
+
// NULL out cfg so that repeated calls to the builder will fail and that
// the ownership of the constructed CFG is passed to the caller.
CFG* t = cfg;
}
CFG *C = CFG::buildCFG(FD->getBody());
- VisitCFG(*C, *FD);
- delete C;
+
+ if (C) {
+ VisitCFG(*C, *FD);
+ delete C;
+ }
+ else
+ llvm::cerr << "warning: CFG could not be constructed.\n";
}
//===----------------------------------------------------------------------===//