Alexey Samsonov | e595e1a | 2014-06-13 17:53:44 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - %s | FileCheck %s |
Alexey Samsonov | cb9efbe | 2013-04-05 07:47:28 +0000 | [diff] [blame] | 2 | |
Alexey Samsonov | c054d98 | 2014-05-29 01:43:53 +0000 | [diff] [blame] | 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 |
Alexey Samsonov | e595e1a | 2014-06-13 17:53:44 +0000 | [diff] [blame^] | 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 |
Alexey Samsonov | c054d98 | 2014-05-29 01:43:53 +0000 | [diff] [blame] | 8 | // REQUIRES: shell |
| 9 | |
Alexey Samsonov | cb9efbe | 2013-04-05 07:47:28 +0000 | [diff] [blame] | 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 |
Alexey Samsonov | c054d98 | 2014-05-29 01:43:53 +0000 | [diff] [blame] | 32 | |
| 33 | // BLACKLIST-NOT: llvm.asan.dynamically_initialized_globals |