[PATCH] D140775: [clangd] Hover: show CalleeArgInfo for literals

Tom Praschan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 2 10:58:43 PST 2023


tom-anders added a comment.

In D140775#4021634 <https://reviews.llvm.org/D140775#4021634>, @nridge wrote:

> Do you want to add a simple test case for a non-literal expression? Something like hovering over the `+` in `2 + 3` should work.

Will do!

> Also, this is pre-existing, but I noticed that in a case like this:
>
>   void bar(int);
>   void func() {
>     int x = 42;
>     bar(x);
>   }
>
> the hover for `x` includes a line that just says `Passed` -- is that useful in any way? Should we just omit the CalleeArgInfo a case like that?

Hmm, the thing is that if the function signature is `void bar(int&)`, then "Passed by reference" would be useful again, so we can't just add a `if (!CalleeArgInfo->Name.empty())` around the `OS << "Passed ";` Maybe we could instead display "Passed **by value**" if and only if the name is empty?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140775



More information about the cfe-commits mailing list