summaryrefslogtreecommitdiff
path: root/clang/test/Index/file-refs.cpp
blob: a96d27c63071896e099210b6e20d21a8ac65deb7 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
namespace NS {
  class C {
  public:
    C() { }
    void m();
  };
}

void NS::C::m() {
  C c;
  c.m();
}

void f() {
  NS::C c1();
  NS::C c2 = NS::C();
}

void over(int);
void over(float);

void test_over() {
  over(0);
  over(0.0f);
}

template <typename T>
T tf(T t) {
  return t;
}

namespace Test2 {

struct S {
  S(int x, int y);
  S();
};

typedef S Cake;

void f() {
  Cake p;
  p = Test2::S(0,2);
  p = Test2::Cake(0,2);
}

}

// RUN: c-index-test \

// RUN:  -file-refs-at=%s:9:7 \
// CHECK:      NamespaceRef=NS:1:11
// CHECK-NEXT: Namespace=NS:1:11 (Definition) =[1:11 - 1:13]
// CHECK-NEXT: NamespaceRef=NS:1:11 =[9:6 - 9:8]
// CHECK-NEXT: NamespaceRef=NS:1:11 =[15:3 - 15:5]
// CHECK-NEXT: NamespaceRef=NS:1:11 =[16:3 - 16:5]
// CHECK-NEXT: NamespaceRef=NS:1:11 =[16:14 - 16:16]

// RUN:  -file-refs-at=%s:2:9 \
// CHECK-NEXT: ClassDecl=C:2:9 (Definition)
// CHECK-NEXT: ClassDecl=C:2:9 (Definition) =[2:9 - 2:10]
// CHECK-NEXT: CXXConstructor=C:4:5 (Definition) =[4:5 - 4:6]
// CHECK-NEXT: TypeRef=class NS::C:2:9 =[9:10 - 9:11]
// CHECK-NEXT: TypeRef=class NS::C:2:9 =[10:3 - 10:4]
// CHECK-NEXT: TypeRef=class NS::C:2:9 =[15:7 - 15:8]
// CHECK-NEXT: TypeRef=class NS::C:2:9 =[16:7 - 16:8]
// CHECK-NEXT: TypeRef=class NS::C:2:9 =[16:18 - 16:19]

// RUN:  -file-refs-at=%s:16:18 \
// CHECK-NEXT: CallExpr=C:4:5
// CHECK-NEXT: ClassDecl=C:2:9 (Definition) =[2:9 - 2:10]
// CHECK-NEXT: CXXConstructor=C:4:5 (Definition) =[4:5 - 4:6]
// CHECK-NEXT: TypeRef=class NS::C:2:9 =[9:10 - 9:11]
// CHECK-NEXT: TypeRef=class NS::C:2:9 =[10:3 - 10:4]
// CHECK-NEXT: TypeRef=class NS::C:2:9 =[15:7 - 15:8]
// CHECK-NEXT: TypeRef=class NS::C:2:9 =[16:7 - 16:8]
// CHECK-NEXT: TypeRef=class NS::C:2:9 =[16:18 - 16:19]

// RUN:  -file-refs-at=%s:20:8 \
// CHECK-NEXT: FunctionDecl=over:20:6
// CHECK-NEXT: FunctionDecl=over:20:6 =[20:6 - 20:10]
// CHECK-NEXT: DeclRefExpr=over:20:6 =[24:3 - 24:7]

// RUN:  -file-refs-at=%s:28:1 \
// CHECK-NEXT: TypeRef=T:27:20
// FIXME: Missing TemplateTypeParameter=T:27:20 (Definition)
// CHECK-NEXT: TypeRef=T:27:20 =[28:1 - 28:2]
// CHECK-NEXT: TypeRef=T:27:20 =[28:6 - 28:7]

// RUN:  -file-refs-at=%s:43:14 \
// CHECK-NEXT: CallExpr=S:35:3
// CHECK-NEXT: StructDecl=S:34:8 (Definition) =[34:8 - 34:9]
// CHECK-NEXT: CXXConstructor=S:35:3 =[35:3 - 35:4]
// CHECK-NEXT: CXXConstructor=S:36:3 =[36:3 - 36:4]
// CHECK-NEXT: TypeRef=struct Test2::S:34:8 =[39:9 - 39:10]
// CHECK-NEXT: TypeRef=struct Test2::S:34:8 =[43:14 - 43:15]

// RUN:  -file-refs-at=%s:44:16 \
// CHECK-NEXT: CallExpr=S:35:3
// CHECK-NEXT: TypedefDecl=Cake:39:11 (Definition) =[39:11 - 39:15]
// CHECK-NEXT: TypeRef=Cake:39:11 =[42:3 - 42:7]
// CHECK-NEXT: TypeRef=Cake:39:11 =[44:14 - 44:18]

// RUN:   %s | FileCheck %s