[PATCH] D74830: [clang][Index] Fix the incomplete instantiations in libindex.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 20 00:12:49 PST 2020


kadircet added inline comments.


================
Comment at: clang/lib/Index/IndexingContext.cpp:175
+  if (TKind == TSK_Undeclared)
+    return dyn_cast<ClassTemplateSpecializationDecl>(D);
+
----------------
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.


================
Comment at: clang/lib/Index/IndexingContext.cpp:175
+  if (TKind == TSK_Undeclared)
+    return dyn_cast<ClassTemplateSpecializationDecl>(D);
+
----------------
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.


================
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 at SpecializationDecl>#$@S at Cls | <no-cgname> | Ref,RelCont | rel: 1
 // CHECK: [[@LINE-4]]:36 | class/C++ | Cls | c:@S at Cls | <no-cgname> | Ref,RelCont | rel: 1
----------------
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)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74830





More information about the cfe-commits mailing list