Evgeniy Stepanov | 7cacbe4 | 2015-07-14 00:34:50 +0000 | [diff] [blame^] | 1 | // Test -fsanitize-memory-use-after-dtor |
| 2 | // RUN: %clang_cc1 -fsanitize=memory -fsanitize-memory-use-after-dtor -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s |
| 3 | // RUN: %clang_cc1 -fsanitize=memory -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s -check-prefix=NO_DTOR_CHECK |
| 4 | |
| 5 | struct Simple { |
| 6 | ~Simple() {} |
| 7 | }; |
| 8 | Simple s; |
| 9 | // Simple internal member is poisoned by compiler-generated dtor |
| 10 | // CHECK-LABEL: @_ZN6SimpleD2Ev |
| 11 | // CHECK: call void @__sanitizer_dtor_callback |
| 12 | // CHECK: ret void |
| 13 | |
| 14 | // Compiling without the flag does not generate member-poisoning dtor |
| 15 | // NO_DTOR_CHECK-LABEL: @_ZN6SimpleD2Ev |
| 16 | // NO_DTOR_CHECK-NOT: call void @sanitizer_dtor_callback |
| 17 | // NO_DTOR_CHECK: ret void |