From 390e48b15ad93f85bfd1e33b9992c198fa0db475 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Wed, 12 Nov 2008 21:11:49 +0000 Subject: [PATCH] ObjCForCollectionStmts are block-level expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59160 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/CFG.h | 4 ++-- 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(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(getTerminator())); } -Expr* CFGBlock::getTerminatorCondition() { +Stmt* CFGBlock::getTerminatorCondition() { if (!Terminator) return NULL; @@ -1653,7 +1653,10 @@ Expr* CFGBlock::getTerminatorCondition() { case Stmt::BinaryOperatorClass: // '&&' and '||' E = cast(Terminator)->getLHS(); - break; + break; + + case Stmt::ObjCForCollectionStmtClass: + return Terminator; } return E ? E->IgnoreParens() : NULL; -- 2.40.0