1*67e74705SXin Li // RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - %s | FileCheck %s 2*67e74705SXin Li 3*67e74705SXin Li // Test blacklist functionality. 4*67e74705SXin Li // RUN: echo "src:%s=init" > %t-file.blacklist 5*67e74705SXin Li // RUN: echo "type:PODWithCtorAndDtor=init" > %t-type.blacklist 6*67e74705SXin Li // RUN: echo "type:NS::PODWithCtor=init" >> %t-type.blacklist 7*67e74705SXin Li // RUN: %clang_cc1 -fsanitize=address -fsanitize-blacklist=%t-file.blacklist -emit-llvm -o - %s | FileCheck %s --check-prefix=BLACKLIST 8*67e74705SXin Li // RUN: %clang_cc1 -fsanitize=address -fsanitize-blacklist=%t-type.blacklist -emit-llvm -o - %s | FileCheck %s --check-prefix=BLACKLIST 9*67e74705SXin Li // REQUIRES: shell 10*67e74705SXin Li 11*67e74705SXin Li struct PODStruct { 12*67e74705SXin Li int x; 13*67e74705SXin Li }; 14*67e74705SXin Li PODStruct s1; 15*67e74705SXin Li 16*67e74705SXin Li struct PODWithDtor { ~PODWithDtorPODWithDtor17*67e74705SXin Li ~PODWithDtor() { } 18*67e74705SXin Li int x; 19*67e74705SXin Li }; 20*67e74705SXin Li PODWithDtor s2; 21*67e74705SXin Li 22*67e74705SXin Li struct PODWithCtorAndDtor { PODWithCtorAndDtorPODWithCtorAndDtor23*67e74705SXin Li PODWithCtorAndDtor() { } ~PODWithCtorAndDtorPODWithCtorAndDtor24*67e74705SXin Li ~PODWithCtorAndDtor() { } 25*67e74705SXin Li int x; 26*67e74705SXin Li }; 27*67e74705SXin Li PODWithCtorAndDtor s3; 28*67e74705SXin Li 29*67e74705SXin Li namespace NS { 30*67e74705SXin Li class PODWithCtor { 31*67e74705SXin Li public: PODWithCtor()32*67e74705SXin Li PODWithCtor() {} 33*67e74705SXin Li }; 34*67e74705SXin Li 35*67e74705SXin Li const volatile PODWithCtor array[5][5]; 36*67e74705SXin Li } 37*67e74705SXin Li 38*67e74705SXin Li // Check that ASan init-order checking ignores structs with trivial default 39*67e74705SXin Li // constructor. 40*67e74705SXin Li // CHECK: !llvm.asan.globals = !{![[GLOB_1:[0-9]+]], ![[GLOB_2:[0-9]+]], ![[GLOB_3:[0-9]]], ![[GLOB_4:[0-9]]]} 41*67e74705SXin Li // CHECK: ![[GLOB_1]] = !{%struct.PODStruct* {{.*}}, i1 false, i1 false} 42*67e74705SXin Li // CHECK: ![[GLOB_2]] = !{%struct.PODWithDtor* {{.*}}, i1 false, i1 false} 43*67e74705SXin Li // CHECK: ![[GLOB_3]] = !{%struct.PODWithCtorAndDtor* {{.*}}, i1 true, i1 false} 44*67e74705SXin Li // CHECK: ![[GLOB_4]] = !{{{.*}}class.NS::PODWithCtor{{.*}}, i1 true, i1 false} 45*67e74705SXin Li 46*67e74705SXin Li // BLACKLIST: !llvm.asan.globals = !{![[GLOB_1:[0-9]+]], ![[GLOB_2:[0-9]+]], ![[GLOB_3:[0-9]]], ![[GLOB_4:[0-9]]]} 47*67e74705SXin Li // BLACKLIST: ![[GLOB_1]] = !{%struct.PODStruct* {{.*}}, i1 false, i1 false} 48*67e74705SXin Li // BLACKLIST: ![[GLOB_2]] = !{%struct.PODWithDtor* {{.*}}, i1 false, i1 false} 49*67e74705SXin Li // BLACKLIST: ![[GLOB_3]] = !{%struct.PODWithCtorAndDtor* {{.*}}, i1 false, i1 false} 50*67e74705SXin Li // BLACKLIST: ![[GLOB_4]] = !{{{.*}}class.NS::PODWithCtor{{.*}}, i1 false, i1 false} 51