This is an archive of the discontinued LLVM Phabricator instance.

[clangd] resolve forwarded parameters in Hover
Needs ReviewPublic

Authored by upsj on Jul 21 2022, 6:09 AM.



This uses resolveForwardedParameters to get parameter names in Hover. The patch currently produces a slight inconsistency, since the definition uses the original function decl, while the parameters are resolved correctly.
I could use some feedback on how this should be handled - maybe add a comment in the style of "This function involves forwarding" that explains why the parameter names don't match?

Diff Detail

Event Timeline

upsj created this revision.Jul 21 2022, 6:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2022, 6:09 AM
upsj requested review of this revision.Jul 21 2022, 6:09 AM
nridge added a subscriber: nridge.Jul 23 2022, 11:47 PM

This looks like a nice idea, but i think we definitely need annotations to prevent confusion. I'd prefer something like:
assume foo(int x, Args... args);

function foo
-> void
- int x
- int a : forwarded to [bar:a](it'd be great if we could have location links here)
- int b : forwarded to [bar:b](again location links)

There's for asking to support links in hover, maybe we just need a way to point at a range inside a file