summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2017-05-01 02:03:23 +0000
committerNick Lewycky <nicholas@mxc.ca>2017-05-01 02:03:23 +0000
commit499968f8a57cfe8bd44ac7370949809d77172391 (patch)
tree30315885802e1d5e3503cea22fb86ffb3fbc3a20 /clang/lib
parentfea2d0b8bf28a12ad54b8061fa72f996abcbe12a (diff)
downloadbcm5719-llvm-499968f8a57cfe8bd44ac7370949809d77172391.tar.gz
bcm5719-llvm-499968f8a57cfe8bd44ac7370949809d77172391.zip
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. llvm-svn: 301785
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ExprConstant.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 75bb0cac51b..c99ccb6f1fe 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud