Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Unit tests: unknown.
clang-tidy: unknown.
clang-format: unknown.
Build artifacts: CMakeCache.txt, console-log.txt
Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.
clang-tools-extra/clangd/unittests/XRefsTests.cpp | ||
---|---|---|
674 | we need to avoid the underlying decl in this case. |
clang-tools-extra/clangd/unittests/XRefsTests.cpp | ||
---|---|---|
695 | Why is it useful to give the using-declaration itself as a result? It seems like the more useful behaviour from the user's point of view is to jump directly to the definition of class Foo, without having to choose from a popup first. |
Sorry about being late coming back to this.
clang-tools-extra/clangd/XRefs.cpp | ||
---|---|---|
306 | I believe this is going to do the wrong thing on overload sets. namespace ns { int x(char); int x(double); } using ns::x; int y = ^x('a'); getDeclAtPosition(..., TemplatePattern|Alias) will yield UsingDecl, and then targetDecl(UsingDecl, Underlying) will yield both overloads of x. This is awkward to work around, it's a failure of the targetDecl API. Maybe for now, call getDeclAtPosition with TemplatePattern|Alias, and if there's exactly one result, replace D with it? And leave a fixme to address more complicated cases somehow. | |
clang-tools-extra/clangd/unittests/XRefsTests.cpp | ||
695 | +1, that would mean adding a continue after the addresultdecl |
Thanks!
clang-tools-extra/clangd/unittests/XRefsTests.cpp | ||
---|---|---|
720 | this is basically the same as the above case (which is fine) (maybe this is tested elsewhere already, but it should be moved here) |
I believe this is going to do the wrong thing on overload sets.
getDeclAtPosition(..., TemplatePattern|Alias) will yield UsingDecl, and then targetDecl(UsingDecl, Underlying) will yield both overloads of x.
However getDeclAtPosition(..., Underlying) would correctly return only the desired overload.
(Please add a test like this!)
This is awkward to work around, it's a failure of the targetDecl API. Maybe for now, call getDeclAtPosition with TemplatePattern|Alias, and if there's exactly one result, replace D with it? And leave a fixme to address more complicated cases somehow.