[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
Sat May 7 06:03:04 PDT 2022


upsj marked 10 inline comments as done.
upsj added a comment.

This almost works now, the only thing that needs to be fixed is `isExpandedParameter`, which for some reason picks up the first call, but not the second: (Compare `ParameterHints.Forwarded` and `ParameterHints.VariadicPlain`)

  cpp
  void foo(int a);
      template <typename... Args>
      void bar(Args&&... args) { return foo(args...); }
      void baz() {
        int b;
        bar(42); // This parameter is recognized as expanded
        bar(b); // This one doesn't, so its inlay hint is @args: instead of a:
      }



================
Comment at: clang-tools-extra/clangd/unittests/InlayHintTests.cpp:178
+  // No hint for anonymous variadic parameter
+  // The prototype is not correct, but is converted into builtin anyways.
+  assertParameterHints(R"cpp(
----------------
nridge wrote:
> What does "converted into builtin" mean here?
I am talking about std::forward being a builtin function, which can be detected by its BuiltinID, so it doesn't matter if the signature doesn't match 100%.


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