hokein added inline comments.

================
Comment at: clang/lib/Index/IndexingContext.cpp:175
+  if (TKind == TSK_Undeclared)
+    return dyn_cast<ClassTemplateSpecializationDecl>(D);
+
----------------
kadircet wrote:
> kadircet wrote:
> > i believe this might as well be an explicit instantiation, e.g.
> > 
> > ```
> > template <typename T> struct Foo{};
> > template <> struct Foo<int>;
> > 
> > void foo(Foo<int>);
> > ```
> > 
> > could you check what this yield for `TKind` (and add tests)?
> > 
> > even if this one is also `TSK_Undeclared` I suppose it is still OK to make 
> > use of
> > `TemplatedDecl` for indexing purposes, but will likely need some changes in 
> > the
> > function name(`ImplicitOrUninstantiated`?)/documentation.
> nit: please use `isa` instead to emphasize on the fact that we are returning 
> a bool.
> also please move it into switch statement.
I think explicit instantiation is fine, as it will create a **complete** 
specialization, TSK will be `TSK_ExplicitInstantiationDeclaration` or 
`TSK_ExplicitInstantiationDefinition`.

we will get the primary template, no behavior change before/after this patch. 
Added a test.


================
Comment at: clang/test/Index/Core/index-source.cpp:324
 // CHECK:   RelSpecialization | functionSp | c:@FT@>2#T#NIfunctionSp#v#
-// CHECK: [[@LINE-3]]:17 | class(Gen,TS)/C++ | SpecializationDecl | 
c:@S@SpecializationDecl>#$@S@Cls | <no-cgname> | Ref,RelCont | rel: 1
 // CHECK: [[@LINE-4]]:36 | class/C++ | Cls | c:@S@Cls | <no-cgname> | 
Ref,RelCont | rel: 1
----------------
kadircet wrote:
> this looks like a regression, previously when indexing this symbol it was 
> known that first template argument was a `SpecializationDecl<Cls>` now it is 
> class template instead.
> 
> (same for the 2 below)
yeah, that was my thought previously, but it turns out not -- it is a bug I 
think, there is no explicit specialization for `SpecializationDecl<Cls>`, so we 
should give the primary template. 

Take a look on Line 60 of this file, `TemplCls<int> gtv(0);` it gives the 
primary class template as well. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74830/new/

https://reviews.llvm.org/D74830



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to