1 // Test -fsanitize-memory-use-after-dtor
2 // RUN: %clang_cc1 -fsanitize=memory -fsanitize-memory-use-after-dtor -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s --implicit-check-not="call void @__sanitizer_"
4 // The no_sanitize_memory attribute, when applied to a destructor,
5 // represses emission of sanitizing callback
7 template <class T
> class Vector
{
17 __attribute__((no_sanitize_memory
)) ~No_San() = default;
21 No_San
*ns
= new No_San();
26 // Repressing the sanitization attribute results in no msan
27 // instrumentation of the destructor
28 // CHECK: define {{.*}}No_SanD1Ev{{.*}} [[ATTRIBUTE:#[0-9]+]]
31 // CHECK: define {{.*}}No_SanD2Ev{{.*}} [[ATTRIBUTE:#[0-9]+]]
32 // CHECK: call void {{.*}}VectorIiED2Ev
35 // CHECK: define {{.*}}VectorIiED2Ev
36 // CHECK: call void @__sanitizer_dtor_callback
39 // When attribute is repressed, the destructor does not emit any tail calls
40 // CHECK-NOT: attributes [[ATTRIBUTE]] = {{.*}} sanitize_memory