[PATCH] D11189: adding tests for various dtor decl types

Evgeniy Stepanov eugenis at google.com
Tue Jul 14 13:05:35 PDT 2015


eugenis added inline comments.

================
Comment at: test/CodeGenCXX/sanitize-dtor-callback.cpp:6
@@ -4,1 +5,3 @@
+// RUN: %clang_cc1 -std=c++11 -fsanitize=memory -fsanitize-memory-use-after-dtor -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s -check-prefix=STD11
+// RUN: %clang_cc1 -std=c++11 -fsanitize=memory -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s -check-prefix=NO-DTOR-STD11-CHECK
 
----------------
Why all this c++11 complexity? It does not seem to affect the test at all.

It's OK to only test c++11.


================
Comment at: test/CodeGenCXX/sanitize-dtor-callback.cpp:47
@@ +46,3 @@
+// the memory inline. However, it must still poison this memory.
+// STD11-CHECK-LABEL: alloca %struct.Defaulted_Trivial
+// STD11: call void @__sanitizer_dtor_callback
----------------
Please make this a regular check, and a CHECK-LABEL for the function name. Does not have to be "main".

Also, STD11-LABEL - without "CHECK".
Please verify that such tests actually fail when the implementation is broken.

This case is not handled in the implementation, there is no sanitizer call in the .ll output.
The test matches a sanitizer call from a different function (because in -std=c++11 mode you build 4 destructors but only do 2 checks).

This uncovers another problem - destructors are not emitted in the c++ declaration order. I'm not sure what the order is, you'll need either to reorder the checks or split into multiple files.



http://reviews.llvm.org/D11189







More information about the cfe-commits mailing list