diff options
-rw-r--r-- | include/clang/AST/CFG.h | 4 | ||||
-rw-r--r-- | lib/AST/CFG.cpp | 13 |
2 files changed, 10 insertions, 7 deletions
diff --git a/include/clang/AST/CFG.h b/include/clang/AST/CFG.h index 2f3183c533..0b179f9edf 100644 --- a/include/clang/AST/CFG.h +++ b/include/clang/AST/CFG.h @@ -153,9 +153,9 @@ public: Stmt* getTerminator() { return Terminator; } const Stmt* getTerminator() const { return Terminator; } - Expr* getTerminatorCondition(); + Stmt* getTerminatorCondition(); - const Expr* getTerminatorCondition() const { + const Stmt* getTerminatorCondition() const { return const_cast<CFGBlock*>(this)->getTerminatorCondition(); } diff --git a/lib/AST/CFG.cpp b/lib/AST/CFG.cpp index 95e188269e..4b7085a03d 100644 --- a/lib/AST/CFG.cpp +++ b/lib/AST/CFG.cpp @@ -1259,11 +1259,11 @@ static BlkExprMapTy* PopulateBlkExprMap(CFG& cfg) { // Look at terminators. The condition is a block-level expression. - Expr* Exp = I->getTerminatorCondition(); + Stmt* S = I->getTerminatorCondition(); - if (Exp && M->find(Exp) == M->end()) { + if (S && M->find(S) == M->end()) { unsigned x = M->size(); - (*M)[Exp] = x; + (*M)[S] = x; } } @@ -1608,7 +1608,7 @@ void CFGBlock::printTerminator(llvm::raw_ostream& OS) const { TPrinter.Visit(const_cast<Stmt*>(getTerminator())); } -Expr* CFGBlock::getTerminatorCondition() { +Stmt* CFGBlock::getTerminatorCondition() { if (!Terminator) return NULL; @@ -1653,7 +1653,10 @@ Expr* CFGBlock::getTerminatorCondition() { case Stmt::BinaryOperatorClass: // '&&' and '||' E = cast<BinaryOperator>(Terminator)->getLHS(); - break; + break; + + case Stmt::ObjCForCollectionStmtClass: + return Terminator; } return E ? E->IgnoreParens() : NULL; |