diff options
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGExprConstant.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 8 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 2 |
5 files changed, 9 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index ec0ca424220..bdf49a1e790 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -176,7 +176,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, unsigned BuiltinID, const CallExpr *E) { // See if we can constant fold this builtin. If so, don't emit it at all. Expr::EvalResult Result; - if (E->Evaluate(Result, CGM.getContext()) && + if (E->EvaluateAsRValue(Result, CGM.getContext()) && !Result.hasSideEffects()) { if (Result.Val.isInt()) return RValue::get(llvm::ConstantInt::get(getLLVMContext(), diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index b7107d5883a..920eb5578e4 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1112,7 +1112,8 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) { if (const VarDecl *V = dyn_cast<VarDecl>(*I)) { if (const Expr *Init = V->getInit()) { Expr::EvalResult Result; - if (Init->Evaluate(Result, CGM.getContext()) && Result.Val.isInt()) { + if (Init->EvaluateAsRValue(Result, CGM.getContext()) && + Result.Val.isInt()) { llvm::ConstantInt *CI = llvm::ConstantInt::get(CGM.getLLVMContext(), Result.Val.getInt()); diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index 31e0f2c3b0e..0622c101651 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -957,7 +957,7 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E, if (DestType->isReferenceType()) Success = E->EvaluateAsLValue(Result, Context); else - Success = E->Evaluate(Result, Context); + Success = E->EvaluateAsRValue(Result, Context); if (Success && !Result.HasSideEffects) { switch (Result.Val.getKind()) { diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 25b4a0a0e77..50c5057f3eb 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -208,7 +208,7 @@ public: // l-values. Value *VisitDeclRefExpr(DeclRefExpr *E) { Expr::EvalResult Result; - if (!E->Evaluate(Result, CGF.getContext())) + if (!E->EvaluateAsRValue(Result, CGF.getContext())) return EmitLoadOfLValue(E); assert(!Result.HasSideEffects && "Constant declref with side-effect?!"); @@ -801,7 +801,7 @@ Value *ScalarExprEmitter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { } Value *ScalarExprEmitter::VisitMemberExpr(MemberExpr *E) { Expr::EvalResult Result; - if (E->Evaluate(Result, CGF.getContext()) && Result.Val.isInt()) { + if (E->EvaluateAsRValue(Result, CGF.getContext()) && Result.Val.isInt()) { if (E->isArrow()) CGF.EmitScalarExpr(E->getBase()); else @@ -1474,7 +1474,7 @@ Value *ScalarExprEmitter::VisitUnaryLNot(const UnaryOperator *E) { Value *ScalarExprEmitter::VisitOffsetOfExpr(OffsetOfExpr *E) { // Try folding the offsetof to a constant. Expr::EvalResult EvalResult; - if (E->Evaluate(EvalResult, CGF.getContext())) + if (E->EvaluateAsRValue(EvalResult, CGF.getContext())) return Builder.getInt(EvalResult.Val.getInt()); // Loop over the components of the offsetof to compute the value. @@ -1597,7 +1597,7 @@ ScalarExprEmitter::VisitUnaryExprOrTypeTraitExpr( // If this isn't sizeof(vla), the result must be constant; use the constant // folding logic so we don't have to duplicate it here. Expr::EvalResult Result; - E->Evaluate(Result, CGF.getContext()); + E->EvaluateAsRValue(Result, CGF.getContext()); return Builder.getInt(Result.Val.getInt()); } diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 3da4bd1f987..03469361462 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -513,7 +513,7 @@ ConstantFoldsToSimpleInteger(const Expr *Cond, llvm::APInt &ResultInt) { // FIXME: Rename and handle conversion of other evaluatable things // to bool. Expr::EvalResult Result; - if (!Cond->Evaluate(Result, getContext()) || !Result.Val.isInt() || + if (!Cond->EvaluateAsRValue(Result, getContext()) || !Result.Val.isInt() || Result.HasSideEffects) return false; // Not foldable, not integer or not fully evaluatable. |