summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 00d5b5fe688..1ebfd798c55 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -948,6 +948,15 @@ void CodeGenFunction::StartFunction(GlobalDecl GD,
// fast register allocator would be happier...
CXXThisValue = CXXABIThisValue;
}
+
+ // Null-check the 'this' pointer once per function, if it's available.
+ if (CXXThisValue) {
+ SanitizerSet SkippedChecks;
+ SkippedChecks.set(SanitizerKind::Alignment, true);
+ SkippedChecks.set(SanitizerKind::ObjectSize, true);
+ EmitTypeCheck(TCK_Load, Loc, CXXThisValue, MD->getThisType(getContext()),
+ /*Alignment=*/CharUnits::Zero(), SkippedChecks);
+ }
}
// If any of the arguments have a variably modified type, make sure to
OpenPOWER on IntegriCloud