Co-authored-by: lightmelodies <lightmelodies@outlook.com>
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
"base" refs are only useful on class forward decls
but for some reasons this still shows up on dtor implementations
clang-tools-extra/clangd/CodeLens.cpp | ||
---|---|---|
87 | they still show up on dtor implementations iirc |
I just searched again and found https://reviews.llvm.org/D91930.
But seems like it never got updated with the latest code featured here. Though looks like the test got dropped.
remove bases codelens for classes
fix lit test
exclude self from ref count
https://github.com/clangd/clangd/issues/442#issuecomment-1125056812
clang-tools-extra/clangd/CodeLens.cpp | ||
---|---|---|
94 | As noted in the previous PR it may be of low value, I guess only if override is missing or if it actually hides several functions. |
clang-tools-extra/clangd/tool/ClangdMain.cpp | ||
---|---|---|
338 | I guess we should rather make it opt-in and gather some feedback. |
One remaining issue is multiple lenses for template code like
template <int V> int i = 0; template int i<0>; template int i<1>; template int i<2>; template <int V> struct Foo { int foo(); // I see 3 codelenses here }; template struct Foo<0>; template struct Foo<1>; int main() { // return Foo<0>().foo() + Foo<1>().foo(); // return i<0> + i<1> + i<2>; }
Well, multiple lenses occured due to https://github.com/lightmelodies/llvm-project/blob/codelens/clang-tools-extra/clangd/FindSymbols.cpp#L500
And can be fixed by https://github.com/lightmelodies/llvm-project/blob/codelens/clang-tools-extra/clangd/CodeLens.cpp#L69
Thanks, it seems to fix the base case, but I still see multiple lenses when I add
template <int V> int Foo<V>::foo() { return 0; }
Interesting, I see the same issue with DocumentSymbols. Maybe because foo is explicit specialization (though outside Foo<1>) so both check are passed. However I can not find a way to detect such case right now.
Not very hard with a track of visited decls. It should also reslove other duplicate codelens.
https://github.com/lightmelodies/llvm-project/blob/b7d664bff5fcafb5a0758b73cd0b77e64cacb03c/clang-tools-extra/clangd/CodeLens.cpp#L69
they still show up on dtor implementations iirc