summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCXX.cpp
diff options
context:
space:
mode:
authorNaomi Musgrave <nmusgrave@google.com>2015-09-03 23:02:30 +0000
committerNaomi Musgrave <nmusgrave@google.com>2015-09-03 23:02:30 +0000
commit866af2d6d14292c255c50588e235c65a3b2406a3 (patch)
tree09a704799c45d0248f463cfdd13e51ff49cb6cdc /clang/lib/CodeGen/CGCXX.cpp
parentc285307e1457c4db2346443a4336e672d7487111 (diff)
downloadbcm5719-llvm-866af2d6d14292c255c50588e235c65a3b2406a3.tar.gz
bcm5719-llvm-866af2d6d14292c255c50588e235c65a3b2406a3.zip
Refactored dtor sanitizing into EHScopeStack
Summary: Dtor sanitization handled amidst other dtor cleanups, between cleaning bases and fields. Sanitizer call pushed onto stack of cleanup operations. Reviewers: eugenis, kcc Differential Revision: http://reviews.llvm.org/D12022 Refactoring dtor sanitizing emission order. - Support multiple inheritance by poisoning after member destructors are invoked, and before base class destructors are invoked. - Poison for virtual destructor and virtual bases. - Repress dtor aliasing when sanitizing in dtor. - CFE test for dtor aliasing, and repression of aliasing in dtor code generation. - Poison members on field-by-field basis, with collective poisoning of trivial members when possible. - Check msan flags and existence of fields, before dtor sanitizing, and when determining if aliasing is allowed. - Testing sanitizing bit fields. llvm-svn: 246815
Diffstat (limited to 'clang/lib/CodeGen/CGCXX.cpp')
-rw-r--r--clang/lib/CodeGen/CGCXX.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp
index 7fd307b4161..cb8700ec563 100644
--- a/clang/lib/CodeGen/CGCXX.cpp
+++ b/clang/lib/CodeGen/CGCXX.cpp
@@ -39,6 +39,12 @@ bool CodeGenModule::TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D) {
if (getCodeGenOpts().OptimizationLevel == 0)
return true;
+ // If sanitizing memory to check for use-after-dtor, do not emit as
+ // an alias, unless this class owns no members.
+ if (getCodeGenOpts().SanitizeMemoryUseAfterDtor &&
+ !D->getParent()->field_empty())
+ return true;
+
// If the destructor doesn't have a trivial body, we have to emit it
// separately.
if (!D->hasTrivialBody())
OpenPOWER on IntegriCloud