1 namespace foo {
2 int x;
3 void bar(int z);
4 }
5 namespace bar {
6 typedef int QType;
7 void bar(QType z);
8 }
9
10 class ClsA {
11 public:
12 int a, b;
ClsA(int A,int B)13 ClsA(int A, int B) : a(A), b(B) {}
14 };
15
16 namespace foo {
17 class ClsB : public ClsA {
18 public:
ClsB()19 ClsB() : ClsA(1, 2) {}
20 int result() const;
21 };
22 }
23
result() const24 int foo::ClsB::result() const {
25 return a + b;
26 }
27
28 namespace {
29 class ClsC : public foo::ClsB {};
30 int w;
31 }
32
33 int z;
34
35 namespace foo { namespace taz {
36 int x;
add(int a,int b)37 static inline int add(int a, int b) { return a + b; }
38 void sub(int a, int b);
39 }
40 }
41
42 namespace foo { namespace taz {
43 class ClsD : public foo::ClsB {
44 public:
operator =(int x)45 ClsD& operator=(int x) { a = x; return *this; }
operator =(double x)46 ClsD& operator=(double x) { a = (int) x; return *this; }
operator =(const ClsD & x)47 ClsD& operator=(const ClsD &x) { a = x.a; return *this; }
48 static int qux();
49 static int uz(int z, ...);
operator ==(const ClsD & x) const50 bool operator==(const ClsD &x) const { return a == x.a; }
51 };
52 }}
53
54 extern "C" {
55 void rez(int a, int b);
56 }
57
58 namespace foo_alias = foo;
59
60 using namespace foo;
61
62 namespace foo_alias2 = foo;
63
64 using foo::ClsB;
65
66 namespace foo_alias3 = foo;
67
68 namespace {
69 class RDar9371763_Foo {
70 public:
71 void bar();
72 };
73 }
74
bar()75 void RDar9371763_Foo::bar() {}
76
rdar9371763()77 void rdar9371763() {
78 RDar9371763_Foo foo;
79 foo.bar();
80 }
81
82 // RUN: c-index-test -test-load-source-usrs all %s | FileCheck %s
83 // CHECK: usrs.cpp c:@N@foo Extent=[1:1 - 4:2]
84 // CHECK: usrs.cpp c:@N@foo@x Extent=[2:3 - 2:8]
85 // CHECK: usrs.cpp c:@N@foo@F@bar#I# Extent=[3:3 - 3:18]
86 // CHECK: usrs.cpp c:usrs.cpp@36@N@foo@F@bar#I#@z Extent=[3:12 - 3:17]
87 // CHECK: usrs.cpp c:@N@bar Extent=[5:1 - 8:2]
88 // CHECK: usrs.cpp c:usrs.cpp@64@N@bar@T@QType Extent=[6:3 - 6:20]
89 // CHECK: usrs.cpp c:@N@bar@F@bar#I# Extent=[7:3 - 7:20]
90 // CHECK: usrs.cpp c:usrs.cpp@94@N@bar@F@bar#I#@z Extent=[7:12 - 7:19]
91 // CHECK: usrs.cpp c:@C@ClsA Extent=[10:1 - 14:2]
92 // CHECK: usrs.cpp c: Extent=[11:1 - 11:8]
93 // CHECK: usrs.cpp c:@C@ClsA@FI@a Extent=[12:3 - 12:8]
94 // CHECK: usrs.cpp c:@C@ClsA@FI@b Extent=[12:3 - 12:11]
95 // CHECK: usrs.cpp c:@C@ClsA@F@ClsA#I#I# Extent=[13:3 - 13:37]
96 // CHECK: usrs.cpp c:usrs.cpp@147@C@ClsA@F@ClsA#I#I#@A Extent=[13:8 - 13:13]
97 // CHECK: usrs.cpp c:usrs.cpp@154@C@ClsA@F@ClsA#I#I#@B Extent=[13:15 - 13:20]
98 // CHECK: usrs.cpp c:@N@foo Extent=[16:1 - 22:2]
99 // CHECK: usrs.cpp c:@N@foo@C@ClsB Extent=[17:3 - 21:4]
100 // CHECK: usrs.cpp c: Extent=[18:3 - 18:10]
101 // CHECK: usrs.cpp c:@N@foo@C@ClsB@F@ClsB# Extent=[19:5 - 19:27]
102 // CHECK: usrs.cpp c:@N@foo@C@ClsB@F@result#1 Extent=[20:5 - 20:23]
103 // CHECK: usrs.cpp c:@N@foo@C@ClsB@F@result#1 Extent=[24:1 - 26:2]
104 // CHECK: usrs.cpp c:@aN@C@ClsC Extent=[29:3 - 29:35]
105 // CHECK: usrs.cpp c:@aN@w Extent=[30:3 - 30:8]
106 // CHECK: usrs.cpp c:@z Extent=[33:1 - 33:6]
107 // CHECK: usrs.cpp c:@N@foo Extent=[35:1 - 40:2]
108 // CHECK: usrs.cpp c:@N@foo@N@taz Extent=[35:17 - 39:2]
109 // CHECK: usrs.cpp c:@N@foo@N@taz@x Extent=[36:3 - 36:8]
110 // CHECK: usrs.cpp c:usrs.cpp@457@N@foo@N@taz@F@add#I#I# Extent=[37:3 - 37:56]
111 // CHECK: usrs.cpp c:usrs.cpp@479@N@foo@N@taz@F@add#I#I#@a Extent=[37:25 - 37:30]
112 // CHECK: usrs.cpp c:usrs.cpp@486@N@foo@N@taz@F@add#I#I#@b Extent=[37:32 - 37:37]
113 // CHECK: usrs.cpp c:@N@foo@N@taz@F@sub#I#I# Extent=[38:3 - 38:25]
114 // CHECK: usrs.cpp c:usrs.cpp@522@N@foo@N@taz@F@sub#I#I#@a Extent=[38:12 - 38:17]
115 // CHECK: usrs.cpp c:usrs.cpp@529@N@foo@N@taz@F@sub#I#I#@b Extent=[38:19 - 38:24]
116 // CHECK: usrs.cpp c:@N@foo Extent=[42:1 - 52:3]
117 // CHECK: usrs.cpp c:@N@foo@N@taz Extent=[42:17 - 52:2]
118 // CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD Extent=[43:3 - 51:4]
119 // CHECK: usrs.cpp c: Extent=[44:3 - 44:10]
120 // CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#I# Extent=[45:5 - 45:52]
121 // CHECK: usrs.cpp c:usrs.cpp@638@N@foo@N@taz@C@ClsD@F@operator=#I#@x Extent=[45:21 - 45:26]
122 // CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#d# Extent=[46:5 - 46:61]
123 // CHECK: usrs.cpp c:usrs.cpp@690@N@foo@N@taz@C@ClsD@F@operator=#d#@x Extent=[46:21 - 46:29]
124 // CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#&1$@N@foo@N@taz@C@ClsD# Extent=[47:5 - 47:62]
125 // CHECK: usrs.cpp c:usrs.cpp@751@N@foo@N@taz@C@ClsD@F@operator=#&1$@N@foo@N@taz@C@ClsD#@x Extent=[47:21 - 47:34]
126 // CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@qux#S Extent=[48:5 - 48:21]
127 // CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@uz#I.#S Extent=[49:5 - 49:30]
128 // CHECK: usrs.cpp c:usrs.cpp@833@N@foo@N@taz@C@ClsD@F@uz#I.#S@z Extent=[49:19 - 49:24]
129 // CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator==#&1$@N@foo@N@taz@C@ClsD#1 Extent=[50:5 - 50:62]
130 // CHECK: usrs.cpp c:usrs.cpp@866@N@foo@N@taz@C@ClsD@F@operator==#&1$@N@foo@N@taz@C@ClsD#1@x Extent=[50:21 - 50:34]
131 // CHECK: usrs.cpp c:@F@rez Extent=[55:3 - 55:25]
132 // CHECK: usrs.cpp c:usrs.cpp@941@F@rez@a Extent=[55:12 - 55:17]
133 // CHECK: usrs.cpp c:usrs.cpp@948@F@rez@b Extent=[55:19 - 55:24]
134 // CHECK: usrs.cpp c:@NA@foo_alias
135 // CHECK-NOT: foo
136 // CHECK: usrs.cpp c:@NA@foo_alias2
137 // CHECK-NOT: ClsB
138 // CHECK: usrs.cpp c:@NA@foo_alias3
139 // CHECK: usrs.cpp c:@aN Extent=[68:1 - 73:2]
140 // CHECK: usrs.cpp c:@aN@C@RDar9371763_Foo Extent=[69:1 - 72:2]
141 // CHECK: usrs.cpp c: Extent=[70:1 - 70:8]
142 // CHECK: usrs.cpp c:usrs.cpp@1131@aN@C@RDar9371763_Foo@F@bar# Extent=[71:3 - 71:13]
143 // CHECK: usrs.cpp c:usrs.cpp@1131@aN@C@RDar9371763_Foo@F@bar# Extent=[75:1 - 75:31]
144 // CHECK: usrs.cpp c:@F@rdar9371763# Extent=[77:1 - 80:2]
145 // CHECK: usrs.cpp c:usrs.cpp@1204@F@rdar9371763#@foo Extent=[78:3 - 78:22]
146
147