upsj added inline comments.
================
Comment at: clang-tools-extra/clangd/AST.cpp:682
+ if (const auto *TTPD =
+ dyn_cast<TemplateTypeParmDecl>(TemplateParams.back())) {
+ const auto *TTPT =
----------------
nridge wrote:
> upsj wrote:
> > nridge wrote:
> > > I don't think there is any requirement that a pack be a trailing
> > > **template** parameter. For example, the following is valid:
> > >
> > > ```
> > > template <typename... B, typename A>
> > > void foo(A, B...);
> > >
> > > void bar() {
> > > foo(1, 2, 3);
> > > }
> > > ```
> > Do you have a suggestion for how to find this pack in general? I would like
> > to keep this function as efficient as possible, since it's used everywhere
> > Do you have a suggestion for how to find this pack in general?
>
> Just iterate backwards through `TemplateParams` rather than only considering
> `TemplateParams.back()`, I suppose.
>
> > I would like to keep this function as efficient as possible, since it's
> > used everywhere
>
> The `ParmVarDecl*` overload of `getPackTemplateParameter()` is called a lot
> via the `IsExpandedPack` lambdas, but this overload is only called once per
> depth level.
Ah thanks, of course! I got tricked by my own overloads.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124690/new/
https://reviews.llvm.org/D124690
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits