From 6b22dda5a3909f46862ec001110b5d4671bbf142 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Wed, 26 Apr 2017 21:55:17 +0000 Subject: [ubsan] nullability-assign: Check assignments into C++ structs Fix the nullability-assign check so that it can handle assignments into C++ structs. Previously, such assignments were not instrumented. Testing: check-clang, check-ubsan, enabling the existing test in ObjC++ mode, and building some Apple frameworks with -fsanitize=nullability. llvm-svn: 301482 --- clang/lib/CodeGen/CGExpr.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'clang/lib/CodeGen') diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index d0aacf65428..863b4380da4 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -4065,6 +4065,8 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const BinaryOperator *E) { RValue RV = EmitAnyExpr(E->getRHS()); LValue LV = EmitCheckedLValue(E->getLHS(), TCK_Store); + if (RV.isScalar()) + EmitNullabilityCheck(LV, RV.getScalarVal(), E->getExprLoc()); EmitStoreThroughLValue(RV, LV); return LV; } -- cgit v1.2.3