This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Heuristic resolution for dependent type and template names
ClosedPublic

Authored by nridge on Sep 29 2020, 12:20 AM.

Diff Detail

Event Timeline

nridge created this revision.Sep 29 2020, 12:20 AM
nridge requested review of this revision.Sep 29 2020, 12:20 AM
hokein added inline comments.Sep 29 2020, 2:07 AM
clang-tools-extra/clangd/FindTarget.cpp
128

why not using isa<TypeDecl>(D)?

clang-tools-extra/clangd/unittests/FindTargetTests.cpp
743

can you try to add a nested struct C in B, and verify typename A<T>::B::[[C]]) still works?

nridge added inline comments.Sep 29 2020, 8:23 PM
clang-tools-extra/clangd/FindTarget.cpp
128

Heh. When I wrote this, I searched for TypeDecl via workspaceSymbols, did not see it in the first few results, and concluded that there is no such type.

Now I see it is there, just further down (and below partial matches like CFConstantStringTypeDecl). Maybe I should file a workspaceSymbols bug about this :)

clang-tools-extra/clangd/unittests/FindTargetTests.cpp
743

Thank you for the example; this does not currently work.

Also, typename A<T>::[[B]]::C does not work either, because only the leaf type gets a DependentNameType.

I will try to get these to work.

hokein added inline comments.Sep 29 2020, 11:59 PM
clang-tools-extra/clangd/FindTarget.cpp
128

yeah, I reproduced that, I think it is probably a ranking bug -- but if you type clang::TypeDecl, you will get it from the first result.

nridge planned changes to this revision.Sep 30 2020, 12:43 AM
nridge updated this revision to Diff 296019.Oct 3 2020, 9:46 PM

Address review comments

nridge marked 3 inline comments as done.Oct 3 2020, 9:48 PM
hokein added inline comments.Oct 5 2020, 1:22 AM
clang-tools-extra/clangd/FindTarget.cpp
549

we need to be robust in resolveNestedNameSpecifierToType -- we may get a null qualifier for DependentTemplateSpecializationType, see https://reviews.llvm.org/D76320.

nridge updated this revision to Diff 297445.Oct 10 2020, 11:41 PM
nridge marked an inline comment as done.

Address review comment

hokein accepted this revision.Oct 12 2020, 6:35 AM

thanks.

This revision is now accepted and ready to land.Oct 12 2020, 6:35 AM