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