1[
2{
3  "directory": ".",
4  "command": "/usr/bin/clang++ -fsyntax-only t1.cpp",
5  "file": "t1.cpp"
6},
7{
8  "directory": ".",
9  "command": "/usr/bin/clang++ -fsyntax-only t2.cpp -DBLAH",
10  "file": "t2.cpp"
11},
12{
13  "directory": ".",
14  "command": "/usr/bin/clang++ -fsyntax-only t3.cpp -DBLAH",
15  "file": "t2.cpp"
16}
17]
18
19// XFAIL: mingw32,win32,windows-gnu
20// RUN: c-index-test -index-compile-db %s | FileCheck %s
21
22// CHECK:      [enteredMainFile]: t1.cpp
23// CHECK:      [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
24// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
25// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:9:27
26// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
27// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 1 | isDef: 1 | isContainer: 1
28// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS |
29// CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C |
30// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:15:5
31// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
32// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:19:5
33// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val1'
34// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val2'
35// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val3'
36
37// CHECK-NEXT: [enteredMainFile]: t2.cpp
38// CHECK:      [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
39// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
40// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
41// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isContainer: skipped
42// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS |
43// CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C |
44// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
45// CHECK-NEXT: [ppIncludedFile]: ./pragma_once.h
46// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo2 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
47// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:25:5
48// CHECK:      [indexDeclaration]: kind: c++-instance-method | name: tsmeth | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
49// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./pragma_once.h:8:7
50// CHECK:      [indexDeclaration]: kind: function | name: imp_foo | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1
51// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./imported.h:4:5
52// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val4'
53// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_tsval'
54// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_impval'
55
56// CHECK-NEXT: [enteredMainFile]: t3.cpp
57// CHECK:      [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
58// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
59// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0
60// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 1 | isDef: 1 | isContainer: skipped
61// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS |
62// CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C |
63// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
64// CHECK-NEXT: [ppIncludedFile]: ./pragma_once.h
65// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo2 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
66// CHECK-NEXT: [indexDeclaration]: kind: variable | {{.*}} | loc: ./pragma_once.h:3:12
67// CHECK:      [indexDeclaration]: kind: c++-instance-method | name: tsmeth | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
68// CHECK-NOT:  [indexEntityReference]: kind: variable | name: some_val |
69// CHECK:      [indexDeclaration]: kind: function | name: imp_foo | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped
70// CHECK-NOT:  [indexEntityReference]: kind: variable | name: some_val |
71// CHECK-NOT:  [diagnostic]: {{.*}} undeclared identifier
72