[PATCH] D142014: [clangd] fix wrong CalleeArgInfo in the hover

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 26 16:15:54 PST 2023


nridge added a comment.

In D142014#4081922 <https://reviews.llvm.org/D142014#4081922>, @v1nh1shungry wrote:

> I just came up with a case where the original implementation and this patch behave differently.
>
>   void foobar(const float &);
>   int main() {
>     foobar(0);
>            ^
>   }
>
> Used to `Passed by value`, now it is `Passed by const reference`. I think the former one is apparently better.

Why is "passed by value" better?

My mental model here is that the value does not get copied; for a built-in type that may not be much of a distinction, but if you imagine generalizing to a class type constructed using a user-defined literal, it could be a noncopyable (and in C++17, even non-moveable) type that can't be passed around by value.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142014/new/

https://reviews.llvm.org/D142014



More information about the cfe-commits mailing list