[clangd] Make forwarding parameter detection logic resilient
authorKadir Cetinkaya <kadircet@google.com>
Thu, 21 Jul 2022 10:43:08 +0000 (12:43 +0200)
committerKadir Cetinkaya <kadircet@google.com>
Fri, 22 Jul 2022 12:37:13 +0000 (14:37 +0200)
commit4839929bed6e69346ff689ffe88750a90ebc0dfa
treecef91e56bde9cb77c4eed80b6a52f71f8e9d8995
parentdeb3b5552f04656dee27067b2cc68c906012cfe4
[clangd] Make forwarding parameter detection logic resilient

This could crash when our heuristic picks the wrong function. Make sure
there is enough parameters in the candidate to prevent those crashes.

Also special case copy/move constructors to make the heuristic work in
presence of those.

Fixes https://github.com/llvm/llvm-project/issues/56620

Differential Revision: https://reviews.llvm.org/D130260
clang-tools-extra/clangd/AST.cpp
clang-tools-extra/clangd/unittests/InlayHintTests.cpp