brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 698f5bd Raw
55 lines · cpp
1// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - %s | FileCheck %s2 3// Test ignorelist functionality.4// RUN: echo "src:%s=init" | sed -e 's/\\/\\\\/g' > %t-file.ignorelist5// RUN: echo "type:PODWithCtorAndDtor=init" > %t-type.ignorelist6// RUN: echo "type:NS::PODWithCtor=init" >> %t-type.ignorelist7// RUN: %clang_cc1 -fsanitize=address -fsanitize-ignorelist=%t-file.ignorelist -emit-llvm -o - %s | FileCheck %s --check-prefix=IGNORELIST8// RUN: %clang_cc1 -fsanitize=address -fsanitize-ignorelist=%t-type.ignorelist -emit-llvm -o - %s | FileCheck %s --check-prefix=IGNORELIST9 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 28namespace NS {29class PODWithCtor {30public:31  PODWithCtor() {}32};33 34const volatile PODWithCtor array[5][5];35}36 37// Check that ASan init-order checking ignores structs with trivial default38// constructor.39 40// CHECK: @{{.*}}s1{{.*}} ={{.*}} global41// CHECK-NOT: sanitize_address_dyninit42// CHECK: @{{.*}}s2{{.*}} ={{.*}} global43// CHECK-NOT: sanitize_address_dyninit44// CHECK: @{{.*}}s3{{.*}} ={{.*}} global {{.*}}, sanitize_address_dyninit45// CHECK: @{{.*}}array{{.*}} ={{.*}} global {{.*}}, sanitize_address_dyninit46 47// IGNORELIST: @{{.*}}s1{{.*}} ={{.*}} global48// IGNORELIST-NOT: sanitize_address_dyninit49// IGNORELIST: @{{.*}}s2{{.*}} ={{.*}} global50// IGNORELIST-NOT: sanitize_address_dyninit51// IGNORELIST: @{{.*}}s3{{.*}} ={{.*}} global52// IGNORELIST-NOT: sanitize_address_dyninit53// IGNORELIST: @{{.*}}array{{.*}} ={{.*}} global54// IGNORELIST-NOT: sanitize_address_dyninit55