2014-06-14 01:53:44 +08:00
|
|
|
// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - %s | FileCheck %s
|
2013-04-05 15:47:28 +08:00
|
|
|
|
2014-05-29 09:43:53 +08:00
|
|
|
// Test blacklist functionality.
|
2016-10-21 07:11:45 +08:00
|
|
|
// RUN: echo "src:%s=init" | sed -e 's/\\/\\\\/g' > %t-file.blacklist
|
2014-11-20 09:27:19 +08:00
|
|
|
// RUN: echo "type:PODWithCtorAndDtor=init" > %t-type.blacklist
|
2014-10-18 06:37:33 +08:00
|
|
|
// RUN: echo "type:NS::PODWithCtor=init" >> %t-type.blacklist
|
2014-06-14 01:53:44 +08:00
|
|
|
// RUN: %clang_cc1 -fsanitize=address -fsanitize-blacklist=%t-file.blacklist -emit-llvm -o - %s | FileCheck %s --check-prefix=BLACKLIST
|
|
|
|
// RUN: %clang_cc1 -fsanitize=address -fsanitize-blacklist=%t-type.blacklist -emit-llvm -o - %s | FileCheck %s --check-prefix=BLACKLIST
|
2014-05-29 09:43:53 +08:00
|
|
|
|
2013-04-05 15:47:28 +08:00
|
|
|
struct PODStruct {
|
|
|
|
int x;
|
|
|
|
};
|
|
|
|
PODStruct s1;
|
|
|
|
|
|
|
|
struct PODWithDtor {
|
|
|
|
~PODWithDtor() { }
|
|
|
|
int x;
|
|
|
|
};
|
|
|
|
PODWithDtor s2;
|
|
|
|
|
|
|
|
struct PODWithCtorAndDtor {
|
|
|
|
PODWithCtorAndDtor() { }
|
|
|
|
~PODWithCtorAndDtor() { }
|
|
|
|
int x;
|
|
|
|
};
|
|
|
|
PODWithCtorAndDtor s3;
|
|
|
|
|
2014-10-18 06:37:33 +08:00
|
|
|
namespace NS {
|
|
|
|
class PODWithCtor {
|
|
|
|
public:
|
|
|
|
PODWithCtor() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
const volatile PODWithCtor array[5][5];
|
|
|
|
}
|
|
|
|
|
2013-04-05 15:47:28 +08:00
|
|
|
// Check that ASan init-order checking ignores structs with trivial default
|
|
|
|
// constructor.
|
2014-10-18 06:37:33 +08:00
|
|
|
// CHECK: !llvm.asan.globals = !{![[GLOB_1:[0-9]+]], ![[GLOB_2:[0-9]+]], ![[GLOB_3:[0-9]]], ![[GLOB_4:[0-9]]]}
|
2014-12-16 03:10:08 +08:00
|
|
|
// CHECK: ![[GLOB_1]] = !{%struct.PODStruct* {{.*}}, i1 false, i1 false}
|
|
|
|
// CHECK: ![[GLOB_2]] = !{%struct.PODWithDtor* {{.*}}, i1 false, i1 false}
|
|
|
|
// CHECK: ![[GLOB_3]] = !{%struct.PODWithCtorAndDtor* {{.*}}, i1 true, i1 false}
|
|
|
|
// CHECK: ![[GLOB_4]] = !{{{.*}}class.NS::PODWithCtor{{.*}}, i1 true, i1 false}
|
2014-05-29 09:43:53 +08:00
|
|
|
|
2014-10-18 06:37:33 +08:00
|
|
|
// BLACKLIST: !llvm.asan.globals = !{![[GLOB_1:[0-9]+]], ![[GLOB_2:[0-9]+]], ![[GLOB_3:[0-9]]], ![[GLOB_4:[0-9]]]}
|
2014-12-16 03:10:08 +08:00
|
|
|
// BLACKLIST: ![[GLOB_1]] = !{%struct.PODStruct* {{.*}}, i1 false, i1 false}
|
|
|
|
// BLACKLIST: ![[GLOB_2]] = !{%struct.PODWithDtor* {{.*}}, i1 false, i1 false}
|
|
|
|
// BLACKLIST: ![[GLOB_3]] = !{%struct.PODWithCtorAndDtor* {{.*}}, i1 false, i1 false}
|
|
|
|
// BLACKLIST: ![[GLOB_4]] = !{{{.*}}class.NS::PODWithCtor{{.*}}, i1 false, i1 false}
|