Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / asan-destructor-kind.cpp
blob50188067c68b32b21bf700df2217ab40f7afcff6
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'
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
12 // Explictly 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
18 // CHECK-GLOBAL-DTOR: llvm.global_dtor{{.+}}asan.module_dtor
19 // CHECK-GLOBAL-DTOR: define internal void @asan.module_dtor
21 // Explictly 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
27 int global;
29 int main() {
30 return global;
33 // CHECK-NONE-DTOR-NOT: llvm.global_dtor{{.+}}asan.module_dtor
34 // CHECK-NONE-DTOR-NOT: define internal void @asan.module_dtor