summaryrefslogtreecommitdiffstats
path: root/clang/AST/Expr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-10-25 00:29:32 +0000
committerChris Lattner <sabre@nondot.org>2007-10-25 00:29:32 +0000
commit35e564ed09d57b6ceae9022afaa77635b16da53e (patch)
tree22c679cf6a7213099d651a7a03318e54b70836dc /clang/AST/Expr.cpp
parent00974dce680fd63ddb25fab1fee2812a7a935b5a (diff)
downloadbcm5719-llvm-35e564ed09d57b6ceae9022afaa77635b16da53e.tar.gz
bcm5719-llvm-35e564ed09d57b6ceae9022afaa77635b16da53e.zip
Add a new ChooseExpr::isConditionTrue method to unify
some code. llvm-svn: 43322
Diffstat (limited to 'clang/AST/Expr.cpp')
-rw-r--r--clang/AST/Expr.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/AST/Expr.cpp b/clang/AST/Expr.cpp
index d6960d35e27..0c631df5c04 100644
--- a/clang/AST/Expr.cpp
+++ b/clang/AST/Expr.cpp
@@ -894,6 +894,14 @@ ObjCMessageExpr::ObjCMessageExpr(IdentifierInfo *clsName, Selector selInfo,
RBracloc = RBrac;
}
+
+bool ChooseExpr::isConditionTrue(ASTContext &C) const {
+ llvm::APSInt CondVal(32);
+ bool IsConst = getCond()->isIntegerConstantExpr(CondVal, C);
+ assert(IsConst && "Condition of choose expr must be i-c-e"); IsConst=IsConst;
+ return CondVal != 0;
+}
+
//===----------------------------------------------------------------------===//
// Child Iterators for iterating over subexpressions/substatements
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud