aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/AST/Expr.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index 692a0ea85f..5569bb6c73 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -95,6 +95,16 @@ public:
bool isNullPointerConstant(ASTContext &Ctx) const;
+ /// getIntegerConstantExprValue() - Return the value of an integer
+ /// constant expression. The expression must be a valid integer
+ /// constant expression as determined by isIntegerConstantExpr.
+ llvm::APSInt getIntegerConstantExprValue(ASTContext &Ctx) const {
+ llvm::APSInt X(32);
+ bool success = isIntegerConstantExpr(X, Ctx);
+ assert(success && "Illegal argument to getIntegerConstantExpr");
+ return X;
+ }
+
/// isIntegerConstantExpr - Return true if this expression is a valid integer
/// constant expression, and, if so, return its value in Result. If not a
/// valid i-c-e, return false and fill in Loc (if specified) with the location