diff options
author | Fangrui Song <maskray@google.com> | 2018-11-30 23:41:18 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2018-11-30 23:41:18 +0000 |
commit | aa528ab4a083268edddd038d0f251afe792cfa36 (patch) | |
tree | 49f4310ac390f0607b60758590ab778ae7b0525a /include/clang/AST/Expr.h | |
parent | 61aeae1a6579c0f661a628784d8ab6d3b7a42ef4 (diff) |
Revert "Revert r347417 "Re-Reinstate 347294 with a fix for the failures.""
It seems the two failing tests can be simply fixed after r348037
Fix 3 cases in Analysis/builtin-functions.cpp
Delete the bad CodeGen/builtin-constant-p.c for now
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348053 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/Expr.h')
-rw-r--r-- | include/clang/AST/Expr.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index 6165ff4bb6..7df7b56ca1 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -583,7 +583,8 @@ 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) const; + bool EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx, + bool InConstantContext = false) const; /// EvaluateAsBooleanCondition - Return true if this is a constant /// which we can fold and convert to a boolean condition using @@ -600,7 +601,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(llvm::APSInt &Result, const ASTContext &Ctx, + bool EvaluateAsInt(EvalResult &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects = SE_NoSideEffects) const; /// EvaluateAsFloat - Return true if this is a constant which we can fold and @@ -901,10 +902,15 @@ 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) {} @@ -3087,8 +3093,8 @@ inline Expr *Expr::IgnoreImpCasts() { while (true) if (ImplicitCastExpr *ice = dyn_cast<ImplicitCastExpr>(e)) e = ice->getSubExpr(); - else if (ConstantExpr *ce = dyn_cast<ConstantExpr>(e)) - e = ce->getSubExpr(); + else if (FullExpr *fe = dyn_cast<FullExpr>(e)) + e = fe->getSubExpr(); else break; return e; |