1// Test for ignorelist functionality of initialization-order checker.
2
3// RUN: %clangxx_asan -O0 %s %p/Helpers/initialization-ignorelist-extra.cpp\
4// RUN: %p/Helpers/initialization-ignorelist-extra2.cpp \
5// RUN: -fsanitize-ignorelist=%p/Helpers/initialization-ignorelist.txt -o %t
6// RUN: %env_asan_opts=check_initialization_order=true %run %t 2>&1
7// RUN: %clangxx_asan -O1 %s %p/Helpers/initialization-ignorelist-extra.cpp\
8// RUN: %p/Helpers/initialization-ignorelist-extra2.cpp \
9// RUN: -fsanitize-ignorelist=%p/Helpers/initialization-ignorelist.txt -o %t
10// RUN: %env_asan_opts=check_initialization_order=true %run %t 2>&1
11// RUN: %clangxx_asan -O2 %s %p/Helpers/initialization-ignorelist-extra.cpp\
12// RUN: %p/Helpers/initialization-ignorelist-extra2.cpp \
13// RUN: -fsanitize-ignorelist=%p/Helpers/initialization-ignorelist.txt -o %t
14// RUN: %env_asan_opts=check_initialization_order=true %run %t 2>&1
15
16// Function is defined in another TU.
17int readBadGlobal();
18int x = readBadGlobal(); // init-order bug.
19
20// Function is defined in another TU.
21int accessBadObject();
22int y = accessBadObject(); // init-order bug.
23
24int readBadSrcGlobal();
25int z = readBadSrcGlobal(); // init-order bug.
26
27int main(int argc, char **argv) {
28 return argc + x + y + z - 1;
29}
30

source code of compiler-rt/test/asan/TestCases/initialization-ignorelist.cpp