diff options
| author | Vedant Kumar <vsk@apple.com> | 2017-04-26 21:55:17 +0000 |
|---|---|---|
| committer | Vedant Kumar <vsk@apple.com> | 2017-04-26 21:55:17 +0000 |
| commit | 6b22dda5a3909f46862ec001110b5d4671bbf142 (patch) | |
| tree | cb6d69b78291b28f697fe78155d7d57112803ee7 /clang/lib/CodeGen | |
| parent | e6d2bebb25f2c1a1ffb1884b11df37ff50a33c49 (diff) | |
| download | bcm5719-llvm-6b22dda5a3909f46862ec001110b5d4671bbf142.tar.gz bcm5719-llvm-6b22dda5a3909f46862ec001110b5d4671bbf142.zip | |
[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
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
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; } |

