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 | 407659ab0a1048027b3419b163c245036469ec35 (patch) | |
tree | 52e6ecfa03743811c8c88293f77a520618561b15 /clang/lib/CodeGen/CGExprScalar.cpp | |
parent | cada498038e320b175130210c7bf2386e3e50a91 (diff) | |
download | bcm5719-llvm-407659ab0a1048027b3419b163c245036469ec35.tar.gz bcm5719-llvm-407659ab0a1048027b3419b163c245036469ec35.zip |
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
llvm-svn: 348053
Diffstat (limited to 'clang/lib/CodeGen/CGExprScalar.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index e7c63ac11e9..4980f53cc4d 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/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(); |