diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-03-08 22:44:50 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-03-08 22:44:50 +0000 |
commit | f463519f0c1a0c20f6a0d1c61814f0b1b4183a10 (patch) | |
tree | c7ce8c258e1f5b4fb4c087cf8bc9ada05a6041b5 /lib/AST/ExprConstant.cpp | |
parent | 1dda0966cc880e12302298fb005bacb5fb294b93 (diff) |
Notes
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r-- | lib/AST/ExprConstant.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
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); } |