2013-01-18 19:30:38 +08:00
|
|
|
// Verify ubsan doesn't emit checks for blacklisted functions and files
|
|
|
|
// RUN: echo "fun:hash" > %t-func.blacklist
|
2016-10-21 07:11:45 +08:00
|
|
|
// RUN: echo "src:%s" | sed -e 's/\\/\\\\/g' > %t-file.blacklist
|
2013-01-18 19:30:38 +08:00
|
|
|
// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -emit-llvm %s -o - | FileCheck %s --check-prefix=DEFAULT
|
|
|
|
// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -fsanitize-blacklist=%t-func.blacklist -emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC
|
|
|
|
// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -fsanitize-blacklist=%t-file.blacklist -emit-llvm %s -o - | FileCheck %s --check-prefix=FILE
|
|
|
|
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
// DEFAULT: @hash
|
|
|
|
// FUNC: @hash
|
|
|
|
// FILE: @hash
|
|
|
|
unsigned hash() {
|
2015-06-30 01:29:50 +08:00
|
|
|
// DEFAULT: call {{.*}}void @__ubsan
|
|
|
|
// FUNC-NOT: call {{.*}}void @__ubsan
|
|
|
|
// FILE-NOT: call {{.*}}void @__ubsan
|
2013-01-18 19:30:38 +08:00
|
|
|
return i * 37;
|
|
|
|
}
|
|
|
|
|
|
|
|
// DEFAULT: @add
|
|
|
|
// FUNC: @add
|
|
|
|
// FILE: @add
|
|
|
|
unsigned add() {
|
2015-06-30 01:29:50 +08:00
|
|
|
// DEFAULT: call {{.*}}void @__ubsan
|
|
|
|
// FUNC: call {{.*}}void @__ubsan
|
|
|
|
// FILE-NOT: call {{.*}}void @__ubsan
|
2013-01-18 19:30:38 +08:00
|
|
|
return i + 1;
|
|
|
|
}
|