[PATCH] D124690: [clangd] add inlay hints for std::forward-ed parameter packs
Nathan Ridge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 4 00:04:28 PDT 2022
nridge added inline comments.
================
Comment at: clang-tools-extra/clangd/InlayHints.cpp:474
+ // the parameter names from the wrapped function
+ if (Args.size() > FixedParamCount && Args.size() == Params.size()) {
+ auto ForwardedParams = matchForwardedParams(
----------------
upsj wrote:
> nridge wrote:
> > What is the reason for the `Args.size() == Params.size()` condition?
> >
> > Doesn't this break cases where there is more than one argument matching the variadic parameter? For example:
> >
> > ```
> > void foo(int a, int b);
> > template <typename... Args>
> > void bar(Args&&... args) { foo(args...); }
> > int main() {
> > bar(1, 2);
> > }
> > ```
> >
> > Here, I expect we'd have `Args.size() == 2` and `Params.size() == 1`.
> >
> > (We should probably have test coverage for such multiple-arguments cases as well. We probably don't need it for all combinations, but we should have at least one test case exercising it.)
> The function we are looking at is an already instantiated template. The check `Args.size() == Params.size()` is only necessary because of va_args
Ah, thanks, I overlooked that. A lot of things in this patch that initially confused me make a lot more sense now :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124690/new/
https://reviews.llvm.org/D124690
More information about the cfe-commits
mailing list