From f463519f0c1a0c20f6a0d1c61814f0b1b4183a10 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 8 Mar 2019 22:44:50 +0000 Subject: Vendor import of clang release_80 branch r355677: https://llvm.org/svn/llvm-project/cfe/branches/release_80@355677 --- lib/AST/ExprConstant.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib/AST/ExprConstant.cpp') diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index da093ff22c12..1f82b4add0c4 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -9821,13 +9821,12 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) { return true; } - uint64_t V; - if (LV.isNullPointer()) - V = Info.Ctx.getTargetNullPointerValue(SrcType); - else - V = LV.getLValueOffset().getQuantity(); + APSInt AsInt; + APValue V; + LV.moveInto(V); + if (!V.toIntegralConstant(AsInt, SrcType, Info.Ctx)) + llvm_unreachable("Can't cast this!"); - APSInt AsInt = Info.Ctx.MakeIntValue(V, SrcType); return Success(HandleIntToIntCast(Info, E, DestType, SrcType, AsInt), E); } -- cgit v1.2.3