blob: 6c67f027e9226e201bf4326f2e9d0865665ae2e6 [file] [log] [blame]
Will Dietz4f45bc02013-01-18 11:30:38 +00001// Verify ubsan doesn't emit checks for blacklisted functions and files
2// RUN: echo "fun:hash" > %t-func.blacklist
3// RUN: echo "src:%s" > %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
NAKAMURA Takumiea8bca72013-01-18 14:11:04 +00008// FIXME: %t-file.blacklist contains DOSish paths.
9// REQUIRES: shell
10
Will Dietz4f45bc02013-01-18 11:30:38 +000011unsigned i;
12
13// DEFAULT: @hash
14// FUNC: @hash
15// FILE: @hash
16unsigned hash() {
17// DEFAULT: call void @__ubsan
18// FUNC-NOT: call void @__ubsan
19// FILE-NOT: call void @__ubsan
20 return i * 37;
21}
22
23// DEFAULT: @add
24// FUNC: @add
25// FILE: @add
26unsigned add() {
27// DEFAULT: call void @__ubsan
28// FUNC: call void @__ubsan
29// FILE-NOT: call void @__ubsan
30 return i + 1;
31}