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 
someTemplFn()82 template <class T> typename T::A someTemplFn() {}
someTemplFn()83 template <class T> typename T::B someTemplFn() {}
someTemplFn()84 template <class T> int someTemplFn() {}
85 
funWithChar(char c)86 void funWithChar(char c) {}
funWithChar(unsigned char c)87 void funWithChar(unsigned char c) {}
funWithChar(signed char c)88 void funWithChar(signed char c) {}
89 
90 struct { int x; } embedS1;
91 struct { int x; } embedS2;
92 
93 template <typename T>
94 class TC1 {
95   void meth(TC1);
96 };
97 
98 typedef __attribute__((__ext_vector_type__(3))) float float3;
99 
100 typedef float __m128 __attribute__((__vector_size__(16)));
101 
102 float3 vectorOverload(float3 f);
103 
104 __m128 vectorOverload(__m128 f);
105 
106 // RUN: c-index-test -test-load-source-usrs all -fno-delayed-template-parsing %s | FileCheck %s
107 // CHECK: usrs.cpp c:@N@foo Extent=[1:1 - 4:2]
108 // CHECK: usrs.cpp c:@N@foo@x Extent=[2:3 - 2:8]
109 // CHECK: usrs.cpp c:@N@foo@F@bar#I# Extent=[3:3 - 3:18]
110 // CHECK: usrs.cpp c:usrs.cpp@36@N@foo@F@bar#I#@z Extent=[3:12 - 3:17]
111 // CHECK: usrs.cpp c:@N@bar Extent=[5:1 - 8:2]
112 // CHECK: usrs.cpp c:usrs.cpp@N@bar@T@QType Extent=[6:3 - 6:20]
113 // CHECK: usrs.cpp c:@N@bar@F@bar#I# Extent=[7:3 - 7:20]
114 // CHECK: usrs.cpp c:usrs.cpp@94@N@bar@F@bar#I#@z Extent=[7:12 - 7:19]
115 // CHECK: usrs.cpp c:@S@ClsA Extent=[10:1 - 14:2]
116 // CHECK: usrs.cpp c: Extent=[11:1 - 11:8]
117 // CHECK: usrs.cpp c:@S@ClsA@FI@a Extent=[12:3 - 12:8]
118 // CHECK: usrs.cpp c:@S@ClsA@FI@b Extent=[12:3 - 12:11]
119 // CHECK: usrs.cpp c:@S@ClsA@F@ClsA#I#I# Extent=[13:3 - 13:37]
120 // CHECK: usrs.cpp c:usrs.cpp@147@S@ClsA@F@ClsA#I#I#@A Extent=[13:8 - 13:13]
121 // CHECK: usrs.cpp c:usrs.cpp@154@S@ClsA@F@ClsA#I#I#@B Extent=[13:15 - 13:20]
122 // CHECK: usrs.cpp c:@N@foo Extent=[16:1 - 22:2]
123 // CHECK: usrs.cpp c:@N@foo@S@ClsB Extent=[17:3 - 21:4]
124 // CHECK: usrs.cpp c: Extent=[18:3 - 18:10]
125 // CHECK: usrs.cpp c:@N@foo@S@ClsB@F@ClsB# Extent=[19:5 - 19:27]
126 // CHECK: usrs.cpp c:@N@foo@S@ClsB@F@result#1 Extent=[20:5 - 20:23]
127 // CHECK: usrs.cpp c:@N@foo@S@ClsB@F@result#1 Extent=[24:1 - 26:2]
128 // CHECK: usrs.cpp c:usrs.cpp@aN@S@ClsC Extent=[29:3 - 29:35]
129 // CHECK: usrs.cpp c:usrs.cpp@aN@w Extent=[30:3 - 30:8]
130 // CHECK: usrs.cpp c:@z Extent=[33:1 - 33:6]
131 // CHECK: usrs.cpp c:@N@foo Extent=[35:1 - 40:2]
132 // CHECK: usrs.cpp c:@N@foo@N@taz Extent=[35:17 - 39:2]
133 // CHECK: usrs.cpp c:@N@foo@N@taz@x Extent=[36:3 - 36:8]
134 // CHECK: usrs.cpp c:usrs.cpp@N@foo@N@taz@F@add#I#I# Extent=[37:3 - 37:56]
135 // CHECK: usrs.cpp c:usrs.cpp@479@N@foo@N@taz@F@add#I#I#@a Extent=[37:25 - 37:30]
136 // CHECK: usrs.cpp c:usrs.cpp@486@N@foo@N@taz@F@add#I#I#@b Extent=[37:32 - 37:37]
137 // CHECK: usrs.cpp c:@N@foo@N@taz@F@sub#I#I# Extent=[38:3 - 38:25]
138 // CHECK: usrs.cpp c:usrs.cpp@522@N@foo@N@taz@F@sub#I#I#@a Extent=[38:12 - 38:17]
139 // CHECK: usrs.cpp c:usrs.cpp@529@N@foo@N@taz@F@sub#I#I#@b Extent=[38:19 - 38:24]
140 // CHECK: usrs.cpp c:@N@foo Extent=[42:1 - 52:3]
141 // CHECK: usrs.cpp c:@N@foo@N@taz Extent=[42:17 - 52:2]
142 // CHECK: usrs.cpp c:@N@foo@N@taz@S@ClsD Extent=[43:3 - 51:4]
143 // CHECK: usrs.cpp c: Extent=[44:3 - 44:10]
144 // CHECK: usrs.cpp c:@N@foo@N@taz@S@ClsD@F@operator=#I# Extent=[45:5 - 45:52]
145 // CHECK: usrs.cpp c:usrs.cpp@638@N@foo@N@taz@S@ClsD@F@operator=#I#@x Extent=[45:21 - 45:26]
146 // CHECK: usrs.cpp c:@N@foo@N@taz@S@ClsD@F@operator=#d# Extent=[46:5 - 46:61]
147 // CHECK: usrs.cpp c:usrs.cpp@690@N@foo@N@taz@S@ClsD@F@operator=#d#@x Extent=[46:21 - 46:29]
148 // CHECK: usrs.cpp c:@N@foo@N@taz@S@ClsD@F@operator=#&1$@N@foo@N@taz@S@ClsD# Extent=[47:5 - 47:62]
149 // CHECK: usrs.cpp c:usrs.cpp@751@N@foo@N@taz@S@ClsD@F@operator=#&1$@N@foo@N@taz@S@ClsD#@x Extent=[47:21 - 47:34]
150 // CHECK: usrs.cpp c:@N@foo@N@taz@S@ClsD@F@qux#S Extent=[48:5 - 48:21]
151 // CHECK: usrs.cpp c:@N@foo@N@taz@S@ClsD@F@uz#I.#S Extent=[49:5 - 49:30]
152 // CHECK: usrs.cpp c:usrs.cpp@833@N@foo@N@taz@S@ClsD@F@uz#I.#S@z Extent=[49:19 - 49:24]
153 // CHECK: usrs.cpp c:@N@foo@N@taz@S@ClsD@F@operator==#&1$@N@foo@N@taz@S@ClsD#1 Extent=[50:5 - 50:62]
154 // CHECK: usrs.cpp c:usrs.cpp@866@N@foo@N@taz@S@ClsD@F@operator==#&1$@N@foo@N@taz@S@ClsD#1@x Extent=[50:21 - 50:34]
155 // CHECK: usrs.cpp c:@F@rez Extent=[55:3 - 55:25]
156 // CHECK: usrs.cpp c:usrs.cpp@941@F@rez@a Extent=[55:12 - 55:17]
157 // CHECK: usrs.cpp c:usrs.cpp@948@F@rez@b Extent=[55:19 - 55:24]
158 // CHECK: usrs.cpp c:@NA@foo_alias
159 // CHECK-NOT: foo
160 // CHECK: usrs.cpp c:@NA@foo_alias2
161 // CHECK: usrs.cpp c:@UD@ClsB Extent=[64:1 - 64:16]
162 // CHECK: usrs.cpp c:@NA@foo_alias3
163 // CHECK: usrs.cpp c:@aN Extent=[68:1 - 73:2]
164 // CHECK: usrs.cpp c:usrs.cpp@aN@S@RDar9371763_Foo Extent=[69:1 - 72:2]
165 // CHECK: usrs.cpp c: Extent=[70:1 - 70:8]
166 // CHECK: usrs.cpp c:usrs.cpp@aN@S@RDar9371763_Foo@F@bar# Extent=[71:3 - 71:13]
167 // CHECK: usrs.cpp c:usrs.cpp@aN@S@RDar9371763_Foo@F@bar# Extent=[75:1 - 75:31]
168 // CHECK: usrs.cpp c:@F@rdar9371763# Extent=[77:1 - 80:2]
169 // CHECK: usrs.cpp c:usrs.cpp@1204@F@rdar9371763#@foo Extent=[78:3 - 78:22]
170 
171 // CHECK: usrs.cpp c:@FT@>1#TsomeTemplFn#^type-parameter-0-0:::A# Extent=[82:1 - 82:50]
172 // CHECK: usrs.cpp c:@FT@>1#TsomeTemplFn#^type-parameter-0-0:::B# Extent=[83:1 - 83:50]
173 // CHECK: usrs.cpp c:@FT@>1#TsomeTemplFn#I# Extent=[84:1 - 84:40]
174 
175 // CHECK: usrs.cpp c:@F@funWithChar#C# Extent=[86:1 - 86:28]
176 // CHECK: usrs.cpp c:@F@funWithChar#c# Extent=[87:1 - 87:37]
177 // CHECK: usrs.cpp c:@F@funWithChar#r# Extent=[88:1 - 88:35]
178 
179 // CHECK: usrs.cpp c:usrs.cpp@S@usrs.cpp@1483@FI@x Extent=[90:10 - 90:15]
180 // CHECK: usrs.cpp c:usrs.cpp@S@usrs.cpp@1510@FI@x Extent=[91:10 - 91:15]
181 
182 // CHECK: usrs.cpp c:@ST>1#T@TC1@F@meth#>@ST>1#T@TC11t0.0# Extent=[95:3 - 95:17]
183 
184 // CHECK: usrs.cpp c:@F@vectorOverload#]3f# Extent=[102:1 - 102:32]
185 // CHECK: usrs.cpp c:@F@vectorOverload#[4f# Extent=[104:1 - 104:32]
186