1 
2 #include "targeted-top.h"
3 #include "targeted-preamble.h"
4 
5 extern int LocalVar;
6 int LocalVar;
7 
8 // RUN: c-index-test -write-pch %t.h.pch %S/targeted-top.h -Xclang -detailed-preprocessing-record
9 // RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -file-refs-at=%s:5:17 %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
13 
14 // RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \
15 // RUN:   c-index-test -file-refs-at=%s:5:17 %s -include %t.h \
16 // RUN:    -Xclang -error-on-deserialized-decl=PreambleVar  \
17 // RUN:    -Xclang -error-on-deserialized-decl=NestedVar1  \
18 // RUN:    -Xclang -error-on-deserialized-decl=TopVar  \
19 // RUN:  | FileCheck %s -check-prefix=LOCAL
20 
21 // LOCAL: VarDecl=LocalVar:5:12
22 // LOCAL: VarDecl=LocalVar:5:12 =[5:12 - 5:20]
23 // LOCAL: VarDecl=LocalVar:6:5 =[6:5 - 6:13]
24 
25 // RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -file-refs-at=%S/targeted-top.h:14:7 %s -include %t.h \
26 // RUN:    -Xclang -error-on-deserialized-decl=NestedVar1  \
27 // RUN:  | FileCheck %s -check-prefix=TOP
28 
29 // RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \
30 // RUN:   c-index-test -file-refs-at=%S/targeted-top.h:14:7 %s -include %t.h \
31 // RUN:    -Xclang -error-on-deserialized-decl=PreambleVar  \
32 // RUN:    -Xclang -error-on-deserialized-decl=NestedVar1  \
33 // RUN:  | FileCheck %s -check-prefix=TOP
34 
35 // TOP: FieldDecl=x:14:7 (Definition)
36 // TOP: FieldDecl=x:14:7 (Definition) =[14:7 - 14:8]
37 // TOP: MemberRefExpr=x:14:7 SingleRefName=[20:13 - 20:14] RefName=[20:13 - 20:14] =[20:13 - 20:14]
38 
39 // RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -file-refs-at=%S/targeted-nested1.h:2:16 %s -include %t.h \
40 // RUN:    -Xclang -error-on-deserialized-decl=TopVar  \
41 // RUN:  | FileCheck %s -check-prefix=NESTED
42 
43 // RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \
44 // RUN:   c-index-test -file-refs-at=%S/targeted-nested1.h:2:16 %s -include %t.h \
45 // RUN:    -Xclang -error-on-deserialized-decl=PreambleVar  \
46 // RUN:    -Xclang -error-on-deserialized-decl=TopVar  \
47 // RUN:  | FileCheck %s -check-prefix=NESTED
48 
49 // NESTED: VarDecl=NestedVar1:2:12
50 // NESTED: VarDecl=NestedVar1:2:12 =[2:12 - 2:22]
51 
52 // RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \
53 // RUN:   c-index-test -file-refs-at=%S/targeted-preamble.h:2:15 %s -include %t.h \
54 // RUN:    -Xclang -error-on-deserialized-decl=NestedVar1  \
55 // RUN:    -Xclang -error-on-deserialized-decl=TopVar  \
56 // RUN:  | FileCheck %s -check-prefix=PREAMBLE
57 
58 // PREAMBLE: VarDecl=PreambleVar:2:12
59 // PREAMBLE: VarDecl=PreambleVar:2:12 =[2:12 - 2:23]
60