[PATCH] D12712: Implementation and testing for poisoning vtable ptr in dtor.
Evgeniy Stepanov via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 10 16:22:14 PDT 2015
eugenis added a comment.
So, this can not be moved to the complete destructor because that would fail to poisons vptrs of the base classes. On the other hand, the current implementation is a bit wasteful, as it can poison the same pointer multiple times when it is shared by the derived class and the first base.
Maybe skip poisoning if the first base (or whatever is at offset 0 in the record layout) is a dynamic class with non-trivial destructor?
================
Comment at: lib/CodeGen/CGClass.cpp:1652
@@ +1651,3 @@
+
+ static void Poison(CodeGenFunction &CGF, llvm::Value *OffsetPtr,
+ CharUnits::QuantityType PoisonSize);
----------------
If it's a global function, it should have a more descriptive name, like EmitSanitizerDtorCallback.
OffsetPtr => just Ptr
And move the body of the function to this line to avoid unnecessary redeclaration.
================
Comment at: test/CodeGenCXX/sanitize-dtor-derived-class.cpp:67
@@ -63,3 +66,3 @@
// CHECK: call void {{.*}}BaseD2Ev
-// CHECK-NOT: call void @__sanitizer_dtor_callback
+// CHECK: call void @__sanitizer_dtor_callback
// CHECK: ret void
----------------
Check that this poisons exactly 8 bytes.
http://reviews.llvm.org/D12712
More information about the cfe-commits
mailing list