[all-commits] [llvm/llvm-project] a63864: [clangd] add inlay hints for std::forward-ed param...

Tobias Ribizel via All-commits all-commits at lists.llvm.org
Wed Jul 6 13:32:47 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a638648fef76146634c2199ce7b90c4bc6bfed01
      https://github.com/llvm/llvm-project/commit/a638648fef76146634c2199ce7b90c4bc6bfed01
  Author: Tobias Ribizel <ribizel at kit.edu>
  Date:   2022-07-06 (Wed, 06 Jul 2022)

  Changed paths:
    M clang-tools-extra/clangd/AST.cpp
    M clang-tools-extra/clangd/AST.h
    M clang-tools-extra/clangd/InlayHints.cpp
    M clang-tools-extra/clangd/unittests/InlayHintTests.cpp

  Log Message:
  -----------
  [clangd] add inlay hints for std::forward-ed parameter packs

This adds special-case treatment for parameter packs in
make_unique-like functions to forward parameter names to inlay hints.
The parameter packs are being resolved recursively by traversing the
function body of forwarding functions looking for expressions matching
the (std::forwarded) parameters expanded from a pack.
The implementation checks whether parameters are being passed by
(rvalue) reference or value and adds reference inlay hints accordingly.
The traversal has a limited recursion stack depth, and recursive calls
like std::make_tuple are cut off to avoid hinting duplicate parameter
names.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D124690




More information about the All-commits mailing list