blob: b6a6d3dadab6501c6f7df092fb9f0136c38dde37 [file] [log] [blame]
Ted Kremenekcbd66f02010-05-06 23:38:28 +00001namespace 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
Ted Kremenekd5d90fe2010-05-07 01:04:23 +000042namespace 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; }
Ted Kremenek2ea5baf2010-05-07 20:39:40 +000047 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; }
Ted Kremenekd5d90fe2010-05-07 01:04:23 +000051 };
52}}
53
Ted Kremenek8e672192010-05-07 01:04:32 +000054extern "C" {
55 void rez(int a, int b);
56}
57
Ted Kremenekcbd66f02010-05-06 23:38:28 +000058// RUN: c-index-test -test-load-source-usrs all %s | FileCheck %s
59// CHECK: usrs.cpp c:@N@foo Extent=[1:11 - 4:2]
60// CHECK: usrs.cpp c:@N@foo@x Extent=[2:3 - 2:8]
Ted Kremenek2ea5baf2010-05-07 20:39:40 +000061// CHECK: usrs.cpp c:@N@foo@F@bar#I# Extent=[3:8 - 3:18]
62// CHECK: usrs.cpp c:usrs.cpp@3:12@N@foo@F@bar#I#@z Extent=[3:12 - 3:17]
Ted Kremenekcbd66f02010-05-06 23:38:28 +000063// CHECK: usrs.cpp c:@N@bar Extent=[5:11 - 8:2]
64// CHECK: usrs.cpp c:usrs.cpp@6:15@N@bar@T@QType Extent=[6:15 - 6:20]
Ted Kremenek2ea5baf2010-05-07 20:39:40 +000065// CHECK: usrs.cpp c:@N@bar@F@bar#I# Extent=[7:8 - 7:20]
66// CHECK: usrs.cpp c:usrs.cpp@7:12@N@bar@F@bar#I#@z Extent=[7:12 - 7:19]
Ted Kremenekcbd66f02010-05-06 23:38:28 +000067// CHECK: usrs.cpp c:@C@ClsA Extent=[10:1 - 14:2]
68// CHECK: usrs.cpp c:@C@ClsA@FI@a Extent=[12:7 - 12:8]
69// CHECK: usrs.cpp c:@C@ClsA@FI@b Extent=[12:10 - 12:11]
Ted Kremenek2ea5baf2010-05-07 20:39:40 +000070// CHECK: usrs.cpp c:@C@ClsA@F@ClsA#I#I# Extent=[13:3 - 13:37]
71// CHECK: usrs.cpp c:usrs.cpp@13:8@C@ClsA@F@ClsA#I#I#@A Extent=[13:8 - 13:13]
72// CHECK: usrs.cpp c:usrs.cpp@13:15@C@ClsA@F@ClsA#I#I#@B Extent=[13:15 - 13:20]
Ted Kremenekcbd66f02010-05-06 23:38:28 +000073// CHECK: usrs.cpp c:@N@foo Extent=[16:11 - 22:2]
74// CHECK: usrs.cpp c:@N@foo@C@ClsB Extent=[17:3 - 21:4]
Ted Kremenek2ea5baf2010-05-07 20:39:40 +000075// CHECK: usrs.cpp c:@N@foo@C@ClsB@F@ClsB# Extent=[19:5 - 19:27]
76// CHECK: usrs.cpp c:@N@foo@C@ClsB@F@result#1 Extent=[20:9 - 20:17]
77// CHECK: usrs.cpp c:@N@foo@C@ClsB@F@result#1 Extent=[24:16 - 26:2]
Ted Kremenekcbd66f02010-05-06 23:38:28 +000078// CHECK: usrs.cpp c:@aN@C@ClsC Extent=[29:3 - 29:35]
79// CHECK: usrs.cpp c:@aN@w Extent=[30:3 - 30:8]
80// CHECK: usrs.cpp c:@z Extent=[33:1 - 33:6]
81// CHECK: usrs.cpp c:@N@foo Extent=[35:11 - 40:2]
82// CHECK: usrs.cpp c:@N@foo@N@taz Extent=[35:27 - 39:2]
83// CHECK: usrs.cpp c:@N@foo@N@taz@x Extent=[36:3 - 36:8]
Ted Kremenek2ea5baf2010-05-07 20:39:40 +000084// CHECK: usrs.cpp c:usrs.cpp@37:21@N@foo@N@taz@F@add#I#I# Extent=[37:21 - 37:56]
85// CHECK: usrs.cpp c:usrs.cpp@37:25@N@foo@N@taz@F@add#I#I#@a Extent=[37:25 - 37:30]
86// CHECK: usrs.cpp c:usrs.cpp@37:32@N@foo@N@taz@F@add#I#I#@b Extent=[37:32 - 37:37]
87// CHECK: usrs.cpp c:@N@foo@N@taz@F@sub#I#I# Extent=[38:8 - 38:25]
88// CHECK: usrs.cpp c:usrs.cpp@38:12@N@foo@N@taz@F@sub#I#I#@a Extent=[38:12 - 38:17]
89// CHECK: usrs.cpp c:usrs.cpp@38:19@N@foo@N@taz@F@sub#I#I#@b Extent=[38:19 - 38:24]
90// CHECK: usrs.cpp c:@N@foo Extent=[42:11 - 52:3]
91// CHECK: usrs.cpp c:@N@foo@N@taz Extent=[42:27 - 52:2]
92// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD Extent=[43:3 - 51:4]
93// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#I# Extent=[45:11 - 45:52]
94// CHECK: usrs.cpp c:usrs.cpp@45:21@N@foo@N@taz@C@ClsD@F@operator=#I#@x Extent=[45:21 - 45:26]
95// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#d# Extent=[46:11 - 46:61]
96// CHECK: usrs.cpp c:usrs.cpp@46:21@N@foo@N@taz@C@ClsD@F@operator=#d#@x Extent=[46:21 - 46:29]
97// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#&1$@N@foo@N@taz@C@ClsD# Extent=[47:11 - 47:62]
98// CHECK: usrs.cpp c:usrs.cpp@47:27@N@foo@N@taz@C@ClsD@F@operator=#&1$@N@foo@N@taz@C@ClsD#@x Extent=[47:27 - 47:34]
99// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@qux#S Extent=[48:16 - 48:21]
100// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@uz#I.#S Extent=[49:16 - 49:30]
101// CHECK: usrs.cpp c:usrs.cpp@49:19@N@foo@N@taz@C@ClsD@F@uz#I.#S@z Extent=[49:19 - 49:24]
102// 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]
103// CHECK: usrs.cpp c:usrs.cpp@50:27@N@foo@N@taz@C@ClsD@F@operator==#&1$@N@foo@N@taz@C@ClsD#1@x Extent=[50:27 - 50:34]
104// CHECK: usrs.cpp c:@F@rez Extent=[55:8 - 55:25]
105// CHECK: usrs.cpp c:usrs.cpp@55:12@F@rez@a Extent=[55:12 - 55:17]
106// CHECK: usrs.cpp c:usrs.cpp@55:19@F@rez@b Extent=[55:19 - 55:24]
Ted Kremenekd5d90fe2010-05-07 01:04:23 +0000107