diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2017-05-01 02:03:23 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2017-05-01 02:03:23 +0000 |
commit | 02552ffef539b814470475718d7b0f78c02e7083 (patch) | |
tree | eb987f60977e004ff411d92994284517c5dbaa46 /lib/AST/ExprConstant.cpp | |
parent | 088659bc7724ffb7ced7c3aa3478b65384e3b1e4 (diff) |
Handle expressions with non-literal types like ignored expressions if we are supposed to continue evaluating them.
Also fix a crash casting a derived nullptr to a virtual base.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301785 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r-- | lib/AST/ExprConstant.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 75bb0cac51..c99ccb6f1f 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -2169,6 +2169,9 @@ static bool HandleLValueBase(EvalInfo &Info, const Expr *E, LValue &Obj, if (!Base->isVirtual()) return HandleLValueDirectBase(Info, E, Obj, DerivedDecl, BaseDecl); + if (!Obj.checkNullPointer(Info, E, CSK_Base)) + return false; + SubobjectDesignator &D = Obj.Designator; if (D.Invalid) return false; @@ -9913,8 +9916,11 @@ static bool EvaluateAsRValue(EvalInfo &Info, const Expr *E, APValue &Result) { if (E->getType().isNull()) return false; - if (!CheckLiteralType(Info, E)) + if (!CheckLiteralType(Info, E)) { + if (Info.noteFailure()) + EvaluateIgnoredValue(Info, E); return false; + } if (!::Evaluate(Result, Info, E)) return false; |