1 // Basic test
2 // RUN: rm -rf %t.dir
3 // RUN: mkdir -p %t.dir/a/b
4 // RUN: echo > %t.dir/a/b/x.h
5 // RUN: cd %t.dir
6 // RUN: %clang -MD -MF - %s -fsyntax-only -I a/b | FileCheck -check-prefix=CHECK-ONE %s
7 // CHECK-ONE: {{ }}a{{[/\\]}}b{{[/\\]}}x.h
8 
9 // PR8974 (-include flag)
10 // RUN: %clang -MD -MF - %s -fsyntax-only -include a/b/x.h -DINCLUDE_FLAG_TEST | FileCheck -check-prefix=CHECK-TWO %s
11 // CHECK-TWO: {{ }}a{{[/\\]}}b{{[/\\]}}x.h
12 
13 // rdar://problem/9734352 (paths involving ".")
14 // RUN: %clang -MD -MF - %s -fsyntax-only -I ./a/b | FileCheck -check-prefix=CHECK-THREE %s
15 // CHECK-THREE: {{ }}a{{[/\\]}}b{{[/\\]}}x.h
16 // RUN: %clang -MD -MF - %s -fsyntax-only -I .//./a/b/ | FileCheck -check-prefix=CHECK-FOUR %s
17 // CHECK-FOUR: {{ }}a{{[/\\]}}b{{[/\\]}}x.h
18 // RUN: %clang -MD -MF - %s -fsyntax-only -I a/b/. | FileCheck -check-prefix=CHECK-FIVE %s
19 // CHECK-FIVE: {{ }}a{{[/\\]}}b{{[/\\]}}.{{[/\\]}}x.h
20 // RUN: cd a/b
21 // RUN: %clang -MD -MF - %s -fsyntax-only -I ./ | FileCheck -check-prefix=CHECK-SIX %s
22 // CHECK-SIX: {{ }}x.h
23 // RUN: echo "fun:foo" > %t.blacklist
24 // RUN: %clang -MD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_sanitizer_blacklist -fsanitize=undefined -flto -fvisibility=hidden -fsanitize-blacklist=%t.blacklist -I ./ | FileCheck -check-prefix=CHECK-SEVEN %s
25 // CHECK-SEVEN: .blacklist
26 // CHECK-SEVEN: {{ }}x.h
27 #ifndef INCLUDE_FLAG_TEST
28 #include <x.h>
29 #endif
30 
31 // RUN: echo "fun:foo" > %t.blacklist1
32 // RUN: echo "fun:foo" > %t.blacklist2
33 // RUN: %clang -MD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_sanitizer_blacklist -fsanitize=undefined -flto -fvisibility=hidden -fsanitize-blacklist=%t.blacklist1 -fsanitize-blacklist=%t.blacklist2 -I ./ | FileCheck -check-prefix=TWO-BLACK-LISTS %s
34 // TWO-BLACK-LISTS: dependency-gen.o:
35 // TWO-BLACK-LISTS-DAG: blacklist1
36 // TWO-BLACK-LISTS-DAG: blacklist2
37 // TWO-BLACK-LISTS-DAG: x.h
38 // TWO-BLACK-LISTS-DAG: dependency-gen.c
39 
40 // RUN: %clang -MD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_sanitizer_blacklist -fsanitize=undefined -flto -fvisibility=hidden -I ./ | FileCheck -check-prefix=USER-AND-SYS-DEPS %s
41 // USER-AND-SYS-DEPS: dependency-gen.o:
42 // USER-AND-SYS-DEPS-DAG: ubsan_blacklist.txt
43 
44 // RUN: %clang -MMD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_sanitizer_blacklist -fsanitize=undefined -flto -fvisibility=hidden -I ./ | FileCheck -check-prefix=ONLY-USER-DEPS %s
45 // ONLY-USER-DEPS: dependency-gen.o:
46 // NOT-ONLY-USER-DEPS: ubsan_blacklist.txt
47