2015-07-31 01:59:46 +08:00
|
|
|
// Test -fsanitize-memory-use-after-dtor
|
2016-12-23 08:23:01 +08:00
|
|
|
// RUN: %clang_cc1 -fsanitize=memory -fsanitize-memory-use-after-dtor -disable-llvm-passes -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -O1 -fsanitize=memory -fsanitize-memory-use-after-dtor -disable-llvm-passes -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s
|
2015-07-31 01:59:46 +08:00
|
|
|
|
|
|
|
struct Simple {
|
|
|
|
int x_;
|
|
|
|
Simple() {
|
|
|
|
x_ = 5;
|
|
|
|
}
|
|
|
|
~Simple() {
|
|
|
|
x_ += 1;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Simple s;
|
|
|
|
// Simple internal member is poisoned by compiler-generated dtor
|
2015-07-31 01:59:55 +08:00
|
|
|
// CHECK: define {{.*}}SimpleD2Ev{{.*}} [[ATTRIBUTE:#[0-9]+]]
|
2015-07-31 01:59:48 +08:00
|
|
|
// CHECK: {{^ *}}call void @__sanitizer_dtor_callback
|
2015-07-31 01:59:55 +08:00
|
|
|
// CHECK-NOT: call void @__sanitizer_dtor_callback
|
2015-07-31 01:59:46 +08:00
|
|
|
// CHECK: ret void
|
2015-07-31 01:59:52 +08:00
|
|
|
|
|
|
|
// Destructor does not emit any tail calls
|
2015-07-31 01:59:54 +08:00
|
|
|
// CHECK: attributes [[ATTRIBUTE]] = {{.*}}"disable-tail-calls"="true"
|