Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks for the fix!
clang-tools-extra/clangd/IncludeCleaner.cpp | ||
---|---|---|
108 | The impl is correct but the comment is not. If ADL applies, this heuristic isn't conservative: a function in *any* namespace with the right name is a candidate, and we can't identify them all here. (We're going to have a hard time identifying such cases at the instantiation site, but that's the way it goes) | |
clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp | ||
101 | Neither the lambda or the foo template are essential here. int ^foo(char); int ^foo(float); template<class T> int x = foo(T{}); |
The impl is correct but the comment is not.
The primary reason we haven't resolved the overload is simply that we have dependent arguments, and you need to know the types to resolve overloads. This is true even if ADL doesn't apply (usually because the name is qualified).
If ADL applies, this heuristic isn't conservative: a function in *any* namespace with the right name is a candidate, and we can't identify them all here.
However if the template expects to find the callee via ADL, then the callee is quite likely not even visible here and the instantiation site rather than the template is the real user of it, so there's nothing for us to do here.
(We're going to have a hard time identifying such cases at the instantiation site, but that's the way it goes)