blob: dc8e8e2f9faeb52681a641aceb671a7f4983da44 [file] [log] [blame]
Alexey Samsonove595e1a2014-06-13 17:53:44 +00001// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - %s | FileCheck %s
Alexey Samsonovcb9efbe2013-04-05 07:47:28 +00002
Alexey Samsonovc054d982014-05-29 01:43:53 +00003// 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 Samsonove595e1a2014-06-13 17:53:44 +00006// 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 Samsonovc054d982014-05-29 01:43:53 +00008// REQUIRES: shell
9
Alexey Samsonovcb9efbe2013-04-05 07:47:28 +000010struct PODStruct {
11 int x;
12};
13PODStruct s1;
14
15struct PODWithDtor {
16 ~PODWithDtor() { }
17 int x;
18};
19PODWithDtor s2;
20
21struct PODWithCtorAndDtor {
22 PODWithCtorAndDtor() { }
23 ~PODWithCtorAndDtor() { }
24 int x;
25};
26PODWithCtorAndDtor 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 Samsonovc054d982014-05-29 01:43:53 +000032
33// BLACKLIST-NOT: llvm.asan.dynamically_initialized_globals