xref: /llvm-project/clang/test/Frontend/print-header-includes.c (revision 67a11290df64fec44e671a1bdc3a225ed8a02962)
1 // RUN: %clang_cc1 -I%S -include Inputs/test3.h -isystem %S/Inputs/SystemHeaderPrefix \
2 // RUN:     -E -H -o /dev/null %s 2> %t.stderr
3 // RUN: FileCheck < %t.stderr %s
4 
5 // CHECK-NOT: test3.h
6 // CHECK-NOT: . {{.*noline.h}}
7 // CHECK: . {{.*test.h}}
8 // CHECK: .. {{.*test2.h}}
9 // CHECK-NOT: .. {{.*test2.h}}
10 
11 // RUN: %clang_cc1 -I%S -isystem %S/Inputs/SystemHeaderPrefix \
12 // RUN:     -E -H -fshow-skipped-includes -o /dev/null %s 2> %t.stderr
13 // RUN: FileCheck --check-prefix=SKIPPED < %t.stderr %s
14 
15 // SKIPPED-NOT: . {{.*noline.h}}
16 // SKIPPED: . {{.*test.h}}
17 // SKIPPED: .. {{.*test2.h}}
18 // SKIPPED: .. {{.*test2.h}}
19 
20 // RUN: %clang_cc1 -isystem %S -isystem %S/Inputs/SystemHeaderPrefix \
21 // RUN:     -E -H -fshow-skipped-includes -sys-header-deps -o /dev/null %s 2> %t.stderr
22 // RUN: FileCheck --check-prefix=SKIPPED-SYS < %t.stderr %s
23 
24 // SKIPPED-SYS: . {{.*noline.h}}
25 // SKIPPED-SYS: . {{.*test.h}}
26 // SKIPPED-SYS: .. {{.*test2.h}}
27 // SKIPPED-SYS: .. {{.*test2.h}}
28 
29 // RUN: %clang_cc1 -I%S -isystem %S/Inputs/SystemHeaderPrefix -include Inputs/test.h \
30 // RUN:     -E -H -fshow-skipped-includes -o /dev/null %s 2> %t.stderr
31 // RUN: FileCheck --check-prefix=SKIPPED-PREDEFINES < %t.stderr %s
32 
33 // The skipped include of test2.h from the -include test.h shouldn't be printed.
34 // SKIPPED-PREDEFINES-NOT: {{.*test2.h}}
35 // SKIPPED-PREDEFINES:     . {{.*test.h}}
36 
37 // RUN: %clang_cc1 -isystem %S -isystem %S/Inputs/SystemHeaderPrefix \
38 // RUN:     -E -H -fshow-skipped-includes -o /dev/null %s 2> %t.stderr
39 // RUN: FileCheck --check-prefix=SKIPPED-NO-SYS --allow-empty < %t.stderr %s
40 
41 // SKIPPED-NO-SYS-NOT: .
42 
43 // RUN: %clang_cc1 -I%S -include Inputs/test3.h -isystem %S/Inputs/SystemHeaderPrefix \
44 // RUN:     -E -H -sys-header-deps -o /dev/null %s 2> %t.stderr
45 // RUN: FileCheck --check-prefix SYSHEADERS < %t.stderr %s
46 
47 // SYSHEADERS-NOT: test3.h
48 // SYSHEADERS: . {{.*noline.h}}
49 // SYSHEADERS: . {{.*test.h}}
50 // SYSHEADERS: .. {{.*test2.h}}
51 
52 // RUN: %clang_cc1 -I%S -include Inputs/test3.h -isystem %S/Inputs/SystemHeaderPrefix \
53 // RUN:     --show-includes -o /dev/null %s | \
54 // RUN:     FileCheck --strict-whitespace --check-prefix=MS-STDOUT %s
55 // MS-STDOUT-NOT: <command line>
56 // MS-STDOUT-NOT: Note: including file: {{[^ ]*noline.h}}
57 // MS-STDOUT: Note: including file: {{[^ ]*test3.h}}
58 // MS-STDOUT: Note: including file: {{[^ ]*test.h}}
59 // MS-STDOUT: Note: including file:  {{[^ ]*test2.h}}
60 // MS-STDOUT-NOT: Note
61 
62 // RUN: %clang_cc1 -I%S -include Inputs/test3.h -isystem %S/Inputs/SystemHeaderPrefix \
63 // RUN:     -E --show-includes -o /dev/null %s 2> %t.stderr
64 // RUN: FileCheck --strict-whitespace --check-prefix=MS-STDERR < %t.stderr %s
65 // MS-STDERR-NOT: <command line>
66 // MS-STDERR-NOT: Note: including file: {{[^ ]*noline.h}}
67 // MS-STDERR: Note: including file: {{[^ ]*test3.h}}
68 // MS-STDERR: Note: including file: {{[^ ]*test.h}}
69 // MS-STDERR: Note: including file:  {{[^ ]*test2.h}}
70 // MS-STDERR-NOT: Note
71 
72 // RUN: echo "fun:foo" > %t.ignorelist
73 // RUN: %clang_cc1 -I%S -isystem %S/Inputs/SystemHeaderPrefix \
74 // RUN:     -fsanitize=address -fdepfile-entry=%t.ignorelist \
75 // RUN:     --show-includes -o /dev/null %s | \
76 // RUN:     FileCheck --strict-whitespace --check-prefix=MS-IGNORELIST %s
77 // MS-IGNORELIST: Note: including file: {{[^ ]*\.ignorelist}}
78 // MS-IGNORELIST-NOT: Note: including file: {{[^ ]*noline.h}}
79 // MS-IGNORELIST: Note: including file: {{[^ ]*test.h}}
80 // MS-IGNORELIST: Note: including file:  {{[^ ]*test2.h}}
81 // MS-IGNORELIST-NOT: Note
82 
83 #include <noline.h>
84 #include <Inputs/test.h>
85