[PATCH] D124690: [clangd] add inlay hints for std::forward-ed parameter packs
Tobias Ribizel via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 2 07:32:52 PDT 2022
upsj 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(
----------------
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
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