[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / clang / test / CodeGen / ubsan-ignorelist-vfs.c
blobb7ed577fdad36c91a6b7e8d74d45f72a7f19c303
1 // Verify ubsan doesn't emit checks for ignorelisted functions and files
2 // RUN: echo "fun:hash" > %t-func.ignorelist
3 // RUN: echo "src:%s" | sed -e 's/\\/\\\\/g' > %t-file.ignorelist
5 // RUN: rm -f %t-vfsoverlay.yaml
6 // RUN: rm -f %t-nonexistent.ignorelist
7 // RUN: sed -e "s|@DIR@|%/T|g" %S/Inputs/sanitizer-ignorelist-vfsoverlay.yaml | sed -e "s|@REAL_FILE@|%/t-func.ignorelist|g" | sed -e "s|@NONEXISTENT_FILE@|%/t-nonexistent.ignorelist|g" > %t-vfsoverlay.yaml
8 // RUN: %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-ignorelist=%/T/only-virtual-file.ignorelist -emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC
10 // RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-ignorelist=%/T/invalid-virtual-file.ignorelist -emit-llvm %s -o - 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=INVALID-MAPPED-FILE
11 // INVALID-MAPPED-FILE: invalid-virtual-file.ignorelist': [[MSG]]
13 // RUN: not %clang_cc1 -fsanitize=unsigned-integer-overflow -ivfsoverlay %t-vfsoverlay.yaml -fsanitize-ignorelist=%t-nonexistent.ignorelist -emit-llvm %s -o - 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=INVALID
14 // INVALID: nonexistent.ignorelist': [[MSG]]
16 unsigned i;
18 // DEFAULT: @hash
19 // FUNC: @hash
20 // FILE: @hash
21 unsigned hash(void) {
22 // DEFAULT: call {{.*}}void @__ubsan
23 // FUNC-NOT: call {{.*}}void @__ubsan
24 // FILE-NOT: call {{.*}}void @__ubsan
25 return i * 37;
28 // DEFAULT: @add
29 // FUNC: @add
30 // FILE: @add
31 unsigned add(void) {
32 // DEFAULT: call {{.*}}void @__ubsan
33 // FUNC: call {{.*}}void @__ubsan
34 // FILE-NOT: call {{.*}}void @__ubsan
35 return i + 1;