[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / sanitize-init-order.cpp
blob698f5bd1b7cca0f9cea29c399843aa5e600fe6df
1 // RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - %s | FileCheck %s
3 // Test ignorelist functionality.
4 // RUN: echo "src:%s=init" | sed -e 's/\\/\\\\/g' > %t-file.ignorelist
5 // RUN: echo "type:PODWithCtorAndDtor=init" > %t-type.ignorelist
6 // RUN: echo "type:NS::PODWithCtor=init" >> %t-type.ignorelist
7 // RUN: %clang_cc1 -fsanitize=address -fsanitize-ignorelist=%t-file.ignorelist -emit-llvm -o - %s | FileCheck %s --check-prefix=IGNORELIST
8 // RUN: %clang_cc1 -fsanitize=address -fsanitize-ignorelist=%t-type.ignorelist -emit-llvm -o - %s | FileCheck %s --check-prefix=IGNORELIST
10 struct PODStruct {
11 int x;
13 PODStruct s1;
15 struct PODWithDtor {
16 ~PODWithDtor() { }
17 int x;
19 PODWithDtor s2;
21 struct PODWithCtorAndDtor {
22 PODWithCtorAndDtor() { }
23 ~PODWithCtorAndDtor() { }
24 int x;
26 PODWithCtorAndDtor s3;
28 namespace NS {
29 class PODWithCtor {
30 public:
31 PODWithCtor() {}
34 const volatile PODWithCtor array[5][5];
37 // Check that ASan init-order checking ignores structs with trivial default
38 // constructor.
40 // CHECK: @{{.*}}s1{{.*}} ={{.*}} global
41 // CHECK-NOT: sanitize_address_dyninit
42 // CHECK: @{{.*}}s2{{.*}} ={{.*}} global
43 // CHECK-NOT: sanitize_address_dyninit
44 // CHECK: @{{.*}}s3{{.*}} ={{.*}} global {{.*}}, sanitize_address_dyninit
45 // CHECK: @{{.*}}array{{.*}} ={{.*}} global {{.*}}, sanitize_address_dyninit
47 // IGNORELIST: @{{.*}}s1{{.*}} ={{.*}} global
48 // IGNORELIST-NOT: sanitize_address_dyninit
49 // IGNORELIST: @{{.*}}s2{{.*}} ={{.*}} global
50 // IGNORELIST-NOT: sanitize_address_dyninit
51 // IGNORELIST: @{{.*}}s3{{.*}} ={{.*}} global
52 // IGNORELIST-NOT: sanitize_address_dyninit
53 // IGNORELIST: @{{.*}}array{{.*}} ={{.*}} global
54 // IGNORELIST-NOT: sanitize_address_dyninit