1 namespace NS {
2 class C {
3 public:
C()4 C() { }
5 void m();
6 };
7 }
8
m()9 void NS::C::m() {
10 C c;
11 c.m();
12 }
13
f()14 void f() {
15 NS::C c1();
16 NS::C c2 = NS::C();
17 }
18
19 void over(int);
20 void over(float);
21
test_over()22 void test_over() {
23 over(0);
24 over(0.0f);
25 }
26
27 template <typename T>
tf(T t)28 T tf(T t) {
29 return t;
30 }
31
32 namespace Test2 {
33
34 struct S {
35 S(int x, int y);
36 S();
37 };
38
39 typedef S Cake;
40
f()41 void f() {
42 Cake p;
43 p = Test2::S(0,2);
44 p = Test2::Cake(0,2);
45 }
46
47 }
48
49 // RUN: c-index-test \
50
51 // RUN: -file-refs-at=%s:9:7 \
52 // CHECK: NamespaceRef=NS:1:11
53 // CHECK-NEXT: Namespace=NS:1:11 (Definition) =[1:11 - 1:13]
54 // CHECK-NEXT: NamespaceRef=NS:1:11 =[9:6 - 9:8]
55 // CHECK-NEXT: NamespaceRef=NS:1:11 =[15:3 - 15:5]
56 // CHECK-NEXT: NamespaceRef=NS:1:11 =[16:3 - 16:5]
57 // CHECK-NEXT: NamespaceRef=NS:1:11 =[16:14 - 16:16]
58
59 // RUN: -file-refs-at=%s:2:9 \
60 // CHECK-NEXT: ClassDecl=C:2:9 (Definition)
61 // CHECK-NEXT: ClassDecl=C:2:9 (Definition) =[2:9 - 2:10]
62 // CHECK-NEXT: CXXConstructor=C:4:5 (Definition) (default constructor) =[4:5 - 4:6]
63 // CHECK-NEXT: TypeRef=class NS::C:2:9 =[9:10 - 9:11]
64 // CHECK-NEXT: TypeRef=class NS::C:2:9 =[10:3 - 10:4]
65 // CHECK-NEXT: TypeRef=class NS::C:2:9 =[15:7 - 15:8]
66 // CHECK-NEXT: TypeRef=class NS::C:2:9 =[16:7 - 16:8]
67 // CHECK-NEXT: TypeRef=class NS::C:2:9 =[16:18 - 16:19]
68
69 // RUN: -file-refs-at=%s:16:18 \
70 // CHECK-NEXT: CallExpr=C:4:5
71 // CHECK-NEXT: ClassDecl=C:2:9 (Definition) =[2:9 - 2:10]
72 // CHECK-NEXT: CXXConstructor=C:4:5 (Definition) (default constructor) =[4:5 - 4:6]
73 // CHECK-NEXT: TypeRef=class NS::C:2:9 =[9:10 - 9:11]
74 // CHECK-NEXT: TypeRef=class NS::C:2:9 =[10:3 - 10:4]
75 // CHECK-NEXT: TypeRef=class NS::C:2:9 =[15:7 - 15:8]
76 // CHECK-NEXT: TypeRef=class NS::C:2:9 =[16:7 - 16:8]
77 // CHECK-NEXT: TypeRef=class NS::C:2:9 =[16:18 - 16:19]
78
79 // RUN: -file-refs-at=%s:20:8 \
80 // CHECK-NEXT: FunctionDecl=over:20:6
81 // CHECK-NEXT: FunctionDecl=over:20:6 =[20:6 - 20:10]
82 // CHECK-NEXT: DeclRefExpr=over:20:6 =[24:3 - 24:7]
83
84 // RUN: -file-refs-at=%s:28:1 \
85 // CHECK-NEXT: TypeRef=T:27:20
86 // FIXME: Missing TemplateTypeParameter=T:27:20 (Definition)
87 // CHECK-NEXT: TypeRef=T:27:20 =[28:1 - 28:2]
88 // CHECK-NEXT: TypeRef=T:27:20 =[28:6 - 28:7]
89
90 // RUN: -file-refs-at=%s:43:14 \
91 // CHECK-NEXT: CallExpr=S:35:3
92 // CHECK-NEXT: StructDecl=S:34:8 (Definition) =[34:8 - 34:9]
93 // CHECK-NEXT: CXXConstructor=S:35:3 =[35:3 - 35:4]
94 // CHECK-NEXT: CXXConstructor=S:36:3 (default constructor) =[36:3 - 36:4]
95 // CHECK-NEXT: TypeRef=struct Test2::S:34:8 =[39:9 - 39:10]
96 // CHECK-NEXT: TypeRef=struct Test2::S:34:8 =[43:14 - 43:15]
97
98 // RUN: -file-refs-at=%s:44:16 \
99 // CHECK-NEXT: CallExpr=S:35:3
100 // CHECK-NEXT: TypedefDecl=Cake:39:11 (Definition) =[39:11 - 39:15]
101 // CHECK-NEXT: TypeRef=Cake:39:11 =[42:3 - 42:7]
102 // CHECK-NEXT: TypeRef=Cake:39:11 =[44:14 - 44:18]
103
104 // RUN: %s | FileCheck %s
105