[PATCH] D74830: [clang][Index] Fix the incomplete instantiations in libindex.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 20 02:34:02 PST 2020
hokein added inline comments.
================
Comment at: clang/test/Index/Core/index-instantiated-source.cpp:103
+// explicit instantiations.
+template class Foo<float>;
+Foo<float> t3;
----------------
kadircet wrote:
> yes this is an explicit instantiation and will have TSKKind set properly.
>
> but i was talking about an explicit specialization in the example above, i.e:
>
> ```
> template <> class Foo<float>;
> ```
>
> which will still have `TSK_Undeclared` (I believe, haven't checked).
>
>
> and let me make myself clear, I am not opposed to the idea of making this also a ref to the primary template instead of the specialization, I just want to make sure we spell it out in the comments and tests explicitly.
Added an explicit specialization declaration (but not definition) case.
In this case, the TSK_Kind is ` TSK_ExplicitSpecialization`, so the result is `SpecializationDecl`.
================
Comment at: clang/test/Index/Core/index-instantiated-source.cpp:104
+template class Foo<float>;
+Foo<float> t3;
+// CHECK: [[@LINE-1]]:1 | class(Gen)/C++ | Foo | c:@N at index_specialization@ST>1#T at Foo | <no-cgname> | Ref,RelCont | rel: 1
----------------
kadircet wrote:
> this is not valid, as you can't define a variable of incomplete type, this needs to be in a function declaration (as I provided in the example) or you can also try making this a pointer as you did below.
>
> i.e.:
>
> ```
> void foo(Foo<float>);
> ```
This is valid code, as this is an explicit instantiation (I thought you meat explicit instantiation).
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