35 lines · cpp
1// Frontend rejects invalid option2// 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-ARG6// CHECK-BAD-ARG: invalid value 'bad_arg' in '-fsanitize-address-destructor=bad_arg'7 8// Default is global dtor9// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-apple-macosx10.15 %s \10// RUN: | FileCheck %s --check-prefixes=CHECK-GLOBAL-DTOR11 12// Explicitly ask for global dtor13// 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-DTOR17 18// CHECK-GLOBAL-DTOR: llvm.global_dtor{{.+}}asan.module_dtor19// CHECK-GLOBAL-DTOR: define internal void @asan.module_dtor20 21// Explicitly ask for no dtors22// 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-DTOR26 27int global;28 29int main() {30 return global;31}32 33// CHECK-NONE-DTOR-NOT: llvm.global_dtor{{.+}}asan.module_dtor34// CHECK-NONE-DTOR-NOT: define internal void @asan.module_dtor35