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