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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to