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