| 1 |
// Frontend rejects invalid option |
| 2 |
// RUN: not %clang_cc1 -fsanitize=address \ |
| 3 |
// RUN: -fsanitize-address-destructor=bad_arg -emit-llvm -o - \ |
| 4 |
// RUN: -triple x86_64-apple-macosx10.15 %s 2>&1 | \ |
| 5 |
// RUN: FileCheck %s --check-prefixes=CHECK-BAD-ARG |
| 6 |
// CHECK-BAD-ARG: invalid value 'bad_arg' in '-fsanitize-address-destructor=bad_arg' |
| 7 |
|
| 8 |
// Default is global dtor |
| 9 |
// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-apple-macosx10.15 %s \ |
| 10 |
// RUN: | FileCheck %s --check-prefixes=CHECK-GLOBAL-DTOR |
| 11 |
|
| 12 |
// Explicitly ask for global dtor |
| 13 |
// RUN: %clang_cc1 -fsanitize=address \ |
| 14 |
// RUN: -fsanitize-address-destructor=global -emit-llvm -o - \ |
| 15 |
// RUN: -triple x86_64-apple-macosx10.15 %s | \ |
| 16 |
// RUN: FileCheck %s --check-prefixes=CHECK-GLOBAL-DTOR |
| 17 |
|
| 18 |
// CHECK-GLOBAL-DTOR: llvm.global_dtor{{.+}}asan.module_dtor |
| 19 |
// CHECK-GLOBAL-DTOR: define internal void @asan.module_dtor |
| 20 |
|
| 21 |
// Explicitly ask for no dtors |
| 22 |
// RUN: %clang_cc1 -fsanitize=address \ |
| 23 |
// RUN: -fsanitize-address-destructor=none -emit-llvm -o - \ |
| 24 |
// RUN: -triple x86_64-apple-macosx10.15 %s | \ |
| 25 |
// RUN: FileCheck %s --check-prefixes=CHECK-NONE-DTOR |
| 26 |
|
| 27 |
int global; |
| 28 |
|
| 29 |
int main() { |
| 30 |
return global; |
| 31 |
} |
| 32 |
|
| 33 |
// CHECK-NONE-DTOR-NOT: llvm.global_dtor{{.+}}asan.module_dtor |
| 34 |
// CHECK-NONE-DTOR-NOT: define internal void @asan.module_dtor |