2021-11-17 20:40:55 +08:00
|
|
|
// Verify ubsan doesn't emit checks for ignorelisted functions and files
|
|
|
|
// RUN: echo "fun:hash" > %t-func.ignorelist
|
|
|
|
// RUN: echo "src:%s" | sed -e 's/\\/\\\\/g' > %t-file.ignorelist
|
2013-01-18 19:30:38 +08:00
|
|
|
// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -emit-llvm %s -o - | FileCheck %s --check-prefix=DEFAULT
|
2021-11-17 20:40:55 +08:00
|
|
|
// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -fsanitize-ignorelist=%t-func.ignorelist -emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC
|
|
|
|
// RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -fsanitize-ignorelist=%t-file.ignorelist -emit-llvm %s -o - | FileCheck %s --check-prefix=FILE
|
2013-01-18 19:30:38 +08:00
|
|
|
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
// DEFAULT: @hash
|
|
|
|
// FUNC: @hash
|
|
|
|
// FILE: @hash
|
2022-02-17 05:09:36 +08:00
|
|
|
unsigned hash(void) {
|
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
|
2022-02-17 05:09:36 +08:00
|
|
|
unsigned add(void) {
|
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;
|
|
|
|
}
|