1 // RUN: rm -rf %t && mkdir %t && cp %s %t/main.cc && mkdir %t/a && mkdir %t/QtCore && mkdir %t/Headers %t/Some.framework %t/Some.framework/Headers
2 // RUN: touch %t/foo.h && touch %t/foo.cc && touch %t/a/foosys %t/a/foosys.h && touch %t/QtCore/foosys %t/QtCore/foo.h
3 // RUN: touch %t/Headers/foosys %t/Headers/foo.h %t/Some.framework/Headers/foosys %t/Some.framework/Headers/foo.h
4 
5 // Quoted string shows header-ish files from CWD, and all from system.
6 #include "foo.h"
7 // RUN: %clang -fsyntax-only -isystem %t/a -Xclang -code-completion-at=%t/main.cc:6:13 %t/main.cc | FileCheck -check-prefix=CHECK-1 %s
8 // CHECK-1-NOT: foo.cc"
9 // CHECK-1: foo.h"
10 // CHECK-1: foosys"
11 
12 // Quoted string with dir shows header-ish files in that subdir.
13 #include "a/foosys"
14 // RUN: %clang -fsyntax-only -isystem %t/a -Xclang -code-completion-at=%t/main.cc:13:13 %t/main.cc | FileCheck -check-prefix=CHECK-2 %s
15 // CHECK-2-NOT: foo.h"
16 // CHECK-2: foosys.h"
17 // CHECK-2-NOT: foosys"
18 
19 // Angled shows headers from system dirs.
20 #include <foosys>
21 // RUN: %clang -fsyntax-only -isystem %t/a -Xclang -code-completion-at=%t/main.cc:20:13 %t/main.cc | FileCheck -check-prefix=CHECK-3 %s
22 // CHECK-3-NOT: foo.cc>
23 // CHECK-3-NOT: foo.h>
24 // CHECK-3: foosys>
25 
26 // With -I rather than -isystem, the header extension is required.
27 #include <foosys>
28 // RUN: %clang -fsyntax-only -I %t/a -Xclang -code-completion-at=%t/main.cc:27:13 %t/main.cc | FileCheck -check-prefix=CHECK-4 %s
29 // CHECK-4-NOT: foo.cc>
30 // CHECK-4-NOT: foo.h>
31 // CHECK-4-NOT: foosys>
32 
33 // Backslash handling.
34 #include "a\foosys"
35 // RUN: %clang -fsyntax-only -isystem %t/a -Xclang -code-completion-at=%t/main.cc:34:13 %t/main.cc -fms-compatibility | FileCheck -check-prefix=CHECK-5 %s
36 // CHECK-5: foosys.h"
37 
38 // Qt headers don't necessarily have extensions.
39 #include <foosys>
40 // RUN: %clang -fsyntax-only -I %t/QtCore -Xclang -code-completion-at=%t/main.cc:39:13 %t/main.cc -fms-compatibility | FileCheck -check-prefix=CHECK-6 %s
41 // CHECK-6-NOT: foo.cc>
42 // CHECK-6: foo.h>
43 // CHECK-6: foosys>
44 
45 // If the include path directly points into a framework's Headers/ directory, we allow extension-less headers.
46 #include <foosys>
47 // RUN: %clang -fsyntax-only -I %t/Some.framework/Headers -Xclang -code-completion-at=%t/main.cc:46:13 %t/main.cc -fms-compatibility | FileCheck -check-prefix=CHECK-7 %s
48 // CHECK-7-NOT: foo.cc>
49 // CHECK-7: foo.h>
50 // CHECK-7: foosys>
51 
52 // Simply naming a directory "Headers" is not enough to allow extension-less headers.
53 #include <foosys>
54 // RUN: %clang -fsyntax-only -I %t/Headers -Xclang -code-completion-at=%t/main.cc:53:13 %t/main.cc -fms-compatibility | FileCheck -check-prefix=CHECK-8 %s
55 // CHECK-8-NOT: foo.cc>
56 // CHECK-8: foo.h>
57 // CHECK-8-NOT: foosys>
58