summaryrefslogtreecommitdiffstats
path: root/include/clang/AST/Expr.h
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2018-11-30 21:26:09 +0000
committerFangrui Song <maskray@google.com>2018-11-30 21:26:09 +0000
commite350174b21a6044aaa0b4cd47d9b491191466abe (patch)
tree79b0e7d5b3301763c795366220b5ee62ccf1a649 /include/clang/AST/Expr.h
parent62d639eafabc912b452450185f9e0ec117bdbd7a (diff)
Revert r347417 "Re-Reinstate 347294 with a fix for the failures."
Kept the "indirect_builtin_constant_p" test case in test/SemaCXX/constant-expression-cxx1y.cpp while we are investigating why the following snippet fails: extern char extern_var; struct { int a; } a = {__builtin_constant_p(extern_var)}; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348039 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/Expr.h')
-rw-r--r--include/clang/AST/Expr.h16
1 files changed, 5 insertions, 11 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index 7df7b56ca1..6165ff4bb6 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -583,8 +583,7 @@ public:
/// this function returns true, it returns the folded constant in Result. If
/// the expression is a glvalue, an lvalue-to-rvalue conversion will be
/// applied.
- bool EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx,
- bool InConstantContext = false) const;
+ bool EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx) const;
/// EvaluateAsBooleanCondition - Return true if this is a constant
/// which we can fold and convert to a boolean condition using
@@ -601,7 +600,7 @@ public:
/// EvaluateAsInt - Return true if this is a constant which we can fold and
/// convert to an integer, using any crazy technique that we want to.
- bool EvaluateAsInt(EvalResult &Result, const ASTContext &Ctx,
+ bool EvaluateAsInt(llvm::APSInt &Result, const ASTContext &Ctx,
SideEffectsKind AllowSideEffects = SE_NoSideEffects) const;
/// EvaluateAsFloat - Return true if this is a constant which we can fold and
@@ -902,15 +901,10 @@ public:
/// ConstantExpr - An expression that occurs in a constant context.
class ConstantExpr : public FullExpr {
+public:
ConstantExpr(Expr *subexpr)
: FullExpr(ConstantExprClass, subexpr) {}
-public:
- static ConstantExpr *Create(const ASTContext &Context, Expr *E) {
- assert(!isa<ConstantExpr>(E));
- return new (Context) ConstantExpr(E);
- }
-
/// Build an empty constant expression wrapper.
explicit ConstantExpr(EmptyShell Empty)
: FullExpr(ConstantExprClass, Empty) {}
@@ -3093,8 +3087,8 @@ inline Expr *Expr::IgnoreImpCasts() {
while (true)
if (ImplicitCastExpr *ice = dyn_cast<ImplicitCastExpr>(e))
e = ice->getSubExpr();
- else if (FullExpr *fe = dyn_cast<FullExpr>(e))
- e = fe->getSubExpr();
+ else if (ConstantExpr *ce = dyn_cast<ConstantExpr>(e))
+ e = ce->getSubExpr();
else
break;
return e;