Init-order and use-after-return modes can currently be enabled by runtime flags. use-after-scope mode is not really working at the moment. The only problem I see is that users won't be able to disable extra instrumentation for init-order and use-after-scope by a top-level Clang flag. But this instrumentation was implicitly enabled for quite a while and we didn't hear from users hurt by it. llvm-svn: 210924
34 lines
1.0 KiB
C++
34 lines
1.0 KiB
C++
// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - %s | FileCheck %s
|
|
|
|
// Test blacklist functionality.
|
|
// RUN: echo "global-init-src:%s" > %t-file.blacklist
|
|
// RUN: echo "global-init-type:struct.PODWithCtorAndDtor" > %t-type.blacklist
|
|
// 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
|
|
// REQUIRES: shell
|
|
|
|
struct PODStruct {
|
|
int x;
|
|
};
|
|
PODStruct s1;
|
|
|
|
struct PODWithDtor {
|
|
~PODWithDtor() { }
|
|
int x;
|
|
};
|
|
PODWithDtor s2;
|
|
|
|
struct PODWithCtorAndDtor {
|
|
PODWithCtorAndDtor() { }
|
|
~PODWithCtorAndDtor() { }
|
|
int x;
|
|
};
|
|
PODWithCtorAndDtor s3;
|
|
|
|
// Check that ASan init-order checking ignores structs with trivial default
|
|
// constructor.
|
|
// CHECK: !llvm.asan.dynamically_initialized_globals = !{[[GLOB:![0-9]+]]}
|
|
// CHECK: [[GLOB]] = metadata !{%struct.PODWithCtorAndDtor
|
|
|
|
// BLACKLIST-NOT: llvm.asan.dynamically_initialized_globals
|