1 // RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - %s | FileCheck %s
2 
3 // Test blacklist functionality.
4 // RUN: echo "global-init-src:%s" > %t-file.blacklist
5 // RUN: echo "global-init-type:struct.PODWithCtorAndDtor" > %t-type.blacklist
6 // RUN: %clang_cc1 -fsanitize=address -fsanitize-blacklist=%t-file.blacklist -emit-llvm -o - %s | FileCheck %s --check-prefix=BLACKLIST
7 // RUN: %clang_cc1 -fsanitize=address -fsanitize-blacklist=%t-type.blacklist -emit-llvm -o - %s | FileCheck %s --check-prefix=BLACKLIST
8 // REQUIRES: shell
9 
10 struct PODStruct {
11   int x;
12 };
13 PODStruct s1;
14 
15 struct PODWithDtor {
16   ~PODWithDtor() { }
17   int x;
18 };
19 PODWithDtor s2;
20 
21 struct PODWithCtorAndDtor {
22   PODWithCtorAndDtor() { }
23   ~PODWithCtorAndDtor() { }
24   int x;
25 };
26 PODWithCtorAndDtor s3;
27 
28 // Check that ASan init-order checking ignores structs with trivial default
29 // constructor.
30 // CHECK: !llvm.asan.dynamically_initialized_globals = !{[[GLOB:![0-9]+]]}
31 // CHECK: [[GLOB]] = metadata !{%struct.PODWithCtorAndDtor
32 
33 // BLACKLIST-NOT: llvm.asan.dynamically_initialized_globals
34