[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
Sun May 22 05:41:27 PDT 2022


upsj planned changes to this revision.
upsj marked 15 inline comments as done.
upsj added a comment.

I will update this to split up the control flow into a visitor just collecting a single recursion level and the high-level mapping. A general question here would be whether we should do the resolution by parameter or by parameter pack. Doing it by parameter (like I did it right now) is much easier for inlay hints, especially if the pack gets split up into different parts, but that may not necessarily be the case for template functions and more fuzzy cases like signature help/autocomplete.



================
Comment at: clang-tools-extra/clangd/InlayHints.cpp:261
+private:
+  void handleParmVarDeclName(const FunctionDecl *Callee, size_t I) {
+    const auto *Param = Callee->getParamDecl(I);
----------------
sammccall wrote:
> Unless I'm missing something, going looking in the redecls of the function for a parameter name doesn't seem in scope for this patch.
> 
> We don't support it in inlay hints elsewhere, and it's not clear it has anything to do with forwarding functions.
> Maybe the added complexity is justifiable if this logic can be shared with different functions (hover, signature help) but I don't think it belongs in this patch.
This was already functionality previously available in `chooseParameterNames`, I thought I would need to do the same thing here, but turns out that I can get the `FunctionDecl` from a `ParmVarDecl`, so this can stay in its previous place.


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