xref: /llvm-project/clang/test/Index/index-template-specialization.cpp (revision f750f7f3fbb868635c0bb7d250b459acb290b985)
13e0051bbSEric Liu template <typename T>
23e0051bbSEric Liu class Foo {
33e0051bbSEric Liu public:
f(T t)43e0051bbSEric Liu   void f(T t) {}
53e0051bbSEric Liu };
63e0051bbSEric Liu 
g()73e0051bbSEric Liu void g() {
83e0051bbSEric Liu   Foo<int> foo;
93e0051bbSEric Liu   foo.f(0);
103e0051bbSEric Liu }
113e0051bbSEric Liu 
12*f750f7f3SFangrui Song template <typename T>
13*f750f7f3SFangrui Song struct B {};
14*f750f7f3SFangrui Song 
15*f750f7f3SFangrui Song template <typename T>
16*f750f7f3SFangrui Song struct D : B<T> {};
17*f750f7f3SFangrui Song 
183e0051bbSEric Liu // FIXME: if c-index-test uses OrigD for symbol info, refererences below should
193e0051bbSEric Liu // refer to template specialization decls.
203e0051bbSEric Liu // RUN: env CINDEXTEST_INDEXIMPLICITTEMPLATEINSTANTIATIONS=1 c-index-test -index-file %s | FileCheck %s
213e0051bbSEric Liu // CHECK: [indexDeclaration]: kind: c++-class-template | name: Foo
223e0051bbSEric Liu // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: f
233e0051bbSEric Liu // CHECK-NEXT: [indexDeclaration]: kind: function | name: g
243e0051bbSEric Liu // CHECK-NEXT: [indexEntityReference]: kind: c++-class-template | name: Foo | USR: c:@ST>1#T@Foo
253e0051bbSEric Liu // CHECK-NEXT: [indexEntityReference]: kind: c++-instance-method | name: f | USR: c:@ST>1#T@Foo@F@f#t0.0#
26*f750f7f3SFangrui Song 
27*f750f7f3SFangrui Song // CHECK: [indexDeclaration]: kind: c++-class-template | name: D
28*f750f7f3SFangrui Song // CHECK-NEXT: <base>: kind: c++-class-template | name: B
29*f750f7f3SFangrui Song // CHECK-NEXT: [indexEntityReference]: kind: c++-class-template | name: B
30