1 
2 #include "targeted-top.h"
3 #include "targeted-preamble.h"
4 
5 int LocalVar1;
6 int LocalVar2;
7 
8 // RUN: c-index-test -write-pch %t.h.pch %S/targeted-top.h
9 // RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%s:5:10 %s -include %t.h \
10 // RUN:    -Xclang -error-on-deserialized-decl=NestedVar1  \
11 // RUN:    -Xclang -error-on-deserialized-decl=TopVar  \
12 // RUN:  | FileCheck %s -check-prefix=LOCAL-CURSOR1
13 
14 // RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%S/targeted-top.h:11:15 %s -include %t.h \
15 // RUN:    -Xclang -error-on-deserialized-decl=NestedVar1  \
16 // RUN:    -Xclang -error-on-deserialized-decl=vector_get_x  \
17 // RUN:  | FileCheck %s -check-prefix=TOP-CURSOR1
18 
19 // RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%S/targeted-nested1.h:2:16 %s -include %t.h \
20 // RUN:    -Xclang -error-on-deserialized-decl=TopVar  \
21 // RUN:  | FileCheck %s -check-prefix=NESTED-CURSOR1
22 
23 // RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%S/targeted-fields.h:2:7 %s -include %t.h \
24 // RUN:    -Xclang -error-on-deserialized-decl=NestedVar1  \
25 // RUN:    -Xclang -error-on-deserialized-decl=TopVar  \
26 // RUN:  | FileCheck %s -check-prefix=FIELD-CURSOR1
27 
28 // RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%S/targeted-fields.h:1:1 %s -include %t.h \
29 // RUN:    -Xclang -error-on-deserialized-decl=NestedVar1  \
30 // RUN:    -Xclang -error-on-deserialized-decl=TopVar  \
31 // RUN:  | FileCheck %s -check-prefix=FIELD-CURSOR2
32 
33 // RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \
34 // RUN:   c-index-test -cursor-at=%s:5:10 %s -include %t.h \
35 // RUN:    -Xclang -error-on-deserialized-decl=PreambleVar  \
36 // RUN:    -Xclang -error-on-deserialized-decl=NestedVar1  \
37 // RUN:    -Xclang -error-on-deserialized-decl=TopVar  \
38 // RUN:  | FileCheck %s -check-prefix=LOCAL-CURSOR1
39 
40 // RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \
41 // RUN:   c-index-test -cursor-at=%S/targeted-top.h:11:15 %s -include %t.h \
42 // RUN:    -Xclang -error-on-deserialized-decl=PreambleVar  \
43 // RUN:    -Xclang -error-on-deserialized-decl=NestedVar1  \
44 // RUN:    -Xclang -error-on-deserialized-decl=vector_get_x  \
45 // RUN:  | FileCheck %s -check-prefix=TOP-CURSOR1
46 
47 // RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \
48 // RUN:   c-index-test -cursor-at=%S/targeted-nested1.h:2:16 %s -include %t.h \
49 // RUN:    -Xclang -error-on-deserialized-decl=PreambleVar  \
50 // RUN:    -Xclang -error-on-deserialized-decl=TopVar  \
51 // RUN:  | FileCheck %s -check-prefix=NESTED-CURSOR1
52 
53 // RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \
54 // RUN:   c-index-test -cursor-at=%S/targeted-preamble.h:2:15 %s -include %t.h \
55 // RUN:    -Xclang -error-on-deserialized-decl=NestedVar1  \
56 // RUN:    -Xclang -error-on-deserialized-decl=TopVar  \
57 // RUN:  | FileCheck %s -check-prefix=PREAMBLE-CURSOR1
58 
59 // LOCAL-CURSOR1: VarDecl=LocalVar1:5:5
60 // TOP-CURSOR1: VarDecl=TopVar:11:12
61 // NESTED-CURSOR1: VarDecl=NestedVar1:2:12
62 // PREAMBLE-CURSOR1: VarDecl=PreambleVar:2:12
63 
64 // FIELD-CURSOR1: FieldDecl=z:2:7 (Definition)
65 // FIELD-CURSOR2: StructDecl=:13:9 (Definition)
66