[PATCH] D11109: basic code generation for use-after-dtor
Evgeniy Stepanov
eugenis at google.com
Mon Jul 13 13:37:29 PDT 2015
eugenis added a comment.
The test should be in CodeGenCXX, and probably called "sanitize-dtor-callback.cpp".
================
Comment at: test/CodeGen/sanitize-dtor-usage.cpp:7
@@ +6,3 @@
+ int x_;
+ A() {
+ x_ = 5;
----------------
You probably don't need a lot of this code, like main() function, or A() constructor.
================
Comment at: test/CodeGen/sanitize-dtor-usage.cpp:11
@@ +10,3 @@
+ ~A() {
+ // __msan_poison(this, sizeof(*this));
+ }
----------------
remove the comments.
================
Comment at: test/CodeGen/sanitize-dtor-usage.cpp:20
@@ +19,3 @@
+
+// Check that MSan destructor sanitization poisons simple internal attribute
+// DTOR: call void @__sanitizer_dtor_callback
----------------
Add a CHECK-LABEL: test for the function name to make sure the call is in the destructor.
You'll probably need -triple=x86_64-pc-linux in the run line so that destructor name mangling is consistent.
================
Comment at: test/CodeGen/sanitize-dtor-usage.cpp:22
@@ +21,2 @@
+// DTOR: call void @__sanitizer_dtor_callback
+// CHECK: ret void
----------------
This does not do anything because of --check-prefix=DTOR (CHECK is the default prefix that is disabled if you set some other prefix). Add --check-prefix=CHECK.
Test that the function call is not added when building without -fsanitize-memory-use-after-dtor.
http://reviews.llvm.org/D11109
More information about the cfe-commits
mailing list