| 1 | // Verify ubsan doesn't emit checks for blacklisted functions and files |
| 2 | // RUN: echo "fun:hash" > %t-func.blacklist |
| 3 | // RUN: echo "src:%s" | sed -e 's/\\/\\\\/g' > %t-file.blacklist |
| 4 | // RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -emit-llvm %s -o - | FileCheck %s --check-prefix=DEFAULT |
| 5 | // RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -fsanitize-blacklist=%t-func.blacklist -emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC |
| 6 | // RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -fsanitize-blacklist=%t-file.blacklist -emit-llvm %s -o - | FileCheck %s --check-prefix=FILE |
| 7 | |
| 8 | unsigned i; |
| 9 | |
| 10 | // DEFAULT: @hash |
| 11 | // FUNC: @hash |
| 12 | // FILE: @hash |
| 13 | unsigned hash() { |
| 14 | // DEFAULT: call {{.*}}void @__ubsan |
| 15 | // FUNC-NOT: call {{.*}}void @__ubsan |
| 16 | // FILE-NOT: call {{.*}}void @__ubsan |
| 17 | return i * 37; |
| 18 | } |
| 19 | |
| 20 | // DEFAULT: @add |
| 21 | // FUNC: @add |
| 22 | // FILE: @add |
| 23 | unsigned add() { |
| 24 | // DEFAULT: call {{.*}}void @__ubsan |
| 25 | // FUNC: call {{.*}}void @__ubsan |
| 26 | // FILE-NOT: call {{.*}}void @__ubsan |
| 27 | return i + 1; |
| 28 | } |
| 29 | |