Clang Project

clang_source_code/test/CodeCompletion/included-files.cpp
1// RUN: rm -rf %t && mkdir %t && cp %s %t/main.cc && mkdir %t/a
2// RUN: touch %t/foo.h && touch %t/foo.cc && touch %t/a/foosys %t/a/foosys.h
3
4// Quoted string shows header-ish files from CWD, and all from system.
5#include "foo.h"
6// RUN: %clang -fsyntax-only -isystem %t/a -Xclang -code-completion-at=%t/main.cc:5:13 %t/main.cc | FileCheck -check-prefix=CHECK-1 %s
7// CHECK-1-NOT: foo.cc"
8// CHECK-1: foo.h"
9// CHECK-1: foosys"
10
11// Quoted string with dir shows header-ish files in that subdir.
12#include "a/foosys"
13// RUN: %clang -fsyntax-only -isystem %t/a -Xclang -code-completion-at=%t/main.cc:12:13 %t/main.cc | FileCheck -check-prefix=CHECK-2 %s
14// CHECK-2-NOT: foo.h"
15// CHECK-2: foosys.h"
16// CHECK-2-NOT: foosys"
17
18// Angled shows headers from system dirs.
19#include <foosys>
20// RUN: %clang -fsyntax-only -isystem %t/a -Xclang -code-completion-at=%t/main.cc:19:13 %t/main.cc | FileCheck -check-prefix=CHECK-3 %s
21// CHECK-3-NOT: foo.cc>
22// CHECK-3-NOT: foo.h>
23// CHECK-3: foosys>
24
25// With -I rather than -isystem, the header extension is required.
26#include <foosys>
27// RUN: %clang -fsyntax-only -I %t/a -Xclang -code-completion-at=%t/main.cc:26:13 %t/main.cc | FileCheck -check-prefix=CHECK-4 %s
28// CHECK-4-NOT: foo.cc>
29// CHECK-4-NOT: foo.h>
30// CHECK-4-NOT: foosys>
31
32// Backslash handling.
33#include "a\foosys"
34// RUN: %clang -fsyntax-only -isystem %t/a -Xclang -code-completion-at=%t/main.cc:33:13 %t/main.cc -fms-compatibility | FileCheck -check-prefix=CHECK-5 %s
35// CHECK-5: foosys.h"
36