Home | History | Annotate | Download | only in lit_tests
      1 // Test for blacklist functionality of initialization-order checker.
      2 
      3 // RUN: %clangxx_asan -m64 -O0 %s %p/Helpers/initialization-blacklist-extra.cc\
      4 // RUN:   -fsanitize-blacklist=%p/Helpers/initialization-blacklist.txt \
      5 // RUN:   -fsanitize=init-order -o %t
      6 // RUN: ASAN_OPTIONS=check_initialization_order=true %t 2>&1
      7 // RUN: %clangxx_asan -m64 -O1 %s %p/Helpers/initialization-blacklist-extra.cc\
      8 // RUN:   -fsanitize-blacklist=%p/Helpers/initialization-blacklist.txt \
      9 // RUN:   -fsanitize=init-order -o %t
     10 // RUN: ASAN_OPTIONS=check_initialization_order=true %t 2>&1
     11 // RUN: %clangxx_asan -m64 -O2 %s %p/Helpers/initialization-blacklist-extra.cc\
     12 // RUN:   -fsanitize-blacklist=%p/Helpers/initialization-blacklist.txt \
     13 // RUN:   -fsanitize=init-order -o %t
     14 // RUN: ASAN_OPTIONS=check_initialization_order=true %t 2>&1
     15 // RUN: %clangxx_asan -m32 -O0 %s %p/Helpers/initialization-blacklist-extra.cc\
     16 // RUN:   -fsanitize-blacklist=%p/Helpers/initialization-blacklist.txt \
     17 // RUN:   -fsanitize=init-order -o %t
     18 // RUN: ASAN_OPTIONS=check_initialization_order=true %t 2>&1
     19 // RUN: %clangxx_asan -m32 -O1 %s %p/Helpers/initialization-blacklist-extra.cc\
     20 // RUN:   -fsanitize-blacklist=%p/Helpers/initialization-blacklist.txt \
     21 // RUN:   -fsanitize=init-order -o %t
     22 // RUN: ASAN_OPTIONS=check_initialization_order=true %t 2>&1
     23 // RUN: %clangxx_asan -m32 -O2 %s %p/Helpers/initialization-blacklist-extra.cc\
     24 // RUN:   -fsanitize-blacklist=%p/Helpers/initialization-blacklist.txt \
     25 // RUN:   -fsanitize=init-order -o %t
     26 // RUN: ASAN_OPTIONS=check_initialization_order=true %t 2>&1
     27 
     28 // Function is defined in another TU.
     29 int readBadGlobal();
     30 int x = readBadGlobal();  // init-order bug.
     31 
     32 // Function is defined in another TU.
     33 int accessBadObject();
     34 int y = accessBadObject();  // init-order bug.
     35 
     36 int main(int argc, char **argv) {
     37   return argc + x + y - 1;
     38 }
     39