[cfe-commits] r51190 - in /cfe/trunk: include/clang/AST/CFG.h lib/AST/CFG.cpp
Ted Kremenek
kremenek at apple.com
Fri May 16 09:06:00 PDT 2008
Author: kremenek
Date: Fri May 16 11:06:00 2008
New Revision: 51190
URL: http://llvm.org/viewvc/llvm-project?rev=51190&view=rev
Log:
Added CFGBlock::hasBinaryBranchTerminator().
Modified:
cfe/trunk/include/clang/AST/CFG.h
cfe/trunk/lib/AST/CFG.cpp
Modified: cfe/trunk/include/clang/AST/CFG.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CFG.h?rev=51190&r1=51189&r2=51190&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/CFG.h (original)
+++ cfe/trunk/include/clang/AST/CFG.h Fri May 16 11:06:00 2008
@@ -158,6 +158,8 @@
return const_cast<CFGBlock*>(this)->getTerminatorCondition();
}
+ bool hasBinaryBranchTerminator() const;
+
Stmt* getLabel() { return Label; }
const Stmt* getLabel() const { return Label; }
Modified: cfe/trunk/lib/AST/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CFG.cpp?rev=51190&r1=51189&r2=51190&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CFG.cpp (original)
+++ cfe/trunk/lib/AST/CFG.cpp Fri May 16 11:06:00 2008
@@ -1587,6 +1587,30 @@
return E ? E->IgnoreParens() : NULL;
}
+bool CFGBlock::hasBinaryBranchTerminator() const {
+
+ if (!Terminator)
+ return false;
+
+ Expr* E = NULL;
+
+ switch (Terminator->getStmtClass()) {
+ default:
+ return false;
+
+ case Stmt::ForStmtClass:
+ case Stmt::WhileStmtClass:
+ case Stmt::DoStmtClass:
+ case Stmt::IfStmtClass:
+ case Stmt::ChooseExprClass:
+ case Stmt::ConditionalOperatorClass:
+ case Stmt::BinaryOperatorClass:
+ return true;
+ }
+
+ return E ? E->IgnoreParens() : NULL;
+}
+
//===----------------------------------------------------------------------===//
// CFG Graphviz Visualization
More information about the cfe-commits
mailing list