diff options
| author | Bill Wendling <isanbard@gmail.com> | 2018-11-21 20:44:18 +0000 |
|---|---|---|
| committer | Bill Wendling <isanbard@gmail.com> | 2018-11-21 20:44:18 +0000 |
| commit | 4e64d31bc5f3acbb9dd104dd4ae7ef492d4fe031 (patch) | |
| tree | dd55b3cf11351ddce77e676435622743879ad499 /lib/CodeGen/CGExprScalar.cpp | |
| parent | cb1a557450468b15cb27dffafcaeba1a0a715e0d (diff) | |
| download | clang-4e64d31bc5f3acbb9dd104dd4ae7ef492d4fe031.tar.gz | |
Re-Reinstate 347294 with a fix for the failures.
Don't try to emit a scalar expression for a non-scalar argument to
__builtin_constant_p().
Third time's a charm!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347417 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
| -rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index e7c63ac11e..4980f53cc4 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -1717,8 +1717,9 @@ Value *ScalarExprEmitter::VisitMemberExpr(MemberExpr *E) { CGF.EmitIgnoredExpr(E->getBase()); return CGF.emitScalarConstant(Constant, E); } else { - llvm::APSInt Value; - if (E->EvaluateAsInt(Value, CGF.getContext(), Expr::SE_AllowSideEffects)) { + Expr::EvalResult Result; + if (E->EvaluateAsInt(Result, CGF.getContext(), Expr::SE_AllowSideEffects)) { + llvm::APSInt Value = Result.Val.getInt(); CGF.EmitIgnoredExpr(E->getBase()); return Builder.getInt(Value); } @@ -2597,9 +2598,11 @@ Value *ScalarExprEmitter::VisitUnaryLNot(const UnaryOperator *E) { Value *ScalarExprEmitter::VisitOffsetOfExpr(OffsetOfExpr *E) { // Try folding the offsetof to a constant. - llvm::APSInt Value; - if (E->EvaluateAsInt(Value, CGF.getContext())) + Expr::EvalResult EVResult; + if (E->EvaluateAsInt(EVResult, CGF.getContext())) { + llvm::APSInt Value = EVResult.Val.getInt(); return Builder.getInt(Value); + } // Loop over the components of the offsetof to compute the value. unsigned n = E->getNumComponents(); |
