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 10struct 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.globals = !{![[GLOB_1:[0-9]+]], ![[GLOB_2:[0-9]+]], ![[GLOB_3:[0-9]]]} 31// CHECK: ![[GLOB_1]] = metadata !{%struct.PODStruct* {{.*}}, i1 false, i1 false} 32// CHECK: ![[GLOB_2]] = metadata !{%struct.PODWithDtor* {{.*}}, i1 false, i1 false} 33// CHECK: ![[GLOB_3]] = metadata !{%struct.PODWithCtorAndDtor* {{.*}}, i1 true, i1 false} 34 35// BLACKLIST: !llvm.asan.globals = !{![[GLOB_1:[0-9]+]], ![[GLOB_2:[0-9]+]], ![[GLOB_3:[0-9]]]} 36// BLACKLIST: ![[GLOB_1]] = metadata !{%struct.PODStruct* {{.*}}, i1 false, i1 false} 37// BLACKLIST: ![[GLOB_2]] = metadata !{%struct.PODWithDtor* {{.*}}, i1 false, i1 false} 38// BLACKLIST: ![[GLOB_3]] = metadata !{%struct.PODWithCtorAndDtor* {{.*}}, i1 false, i1 false} 39