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