This is an archive of the discontinued LLVM Phabricator instance.

[clangd] don't add inlay hint for dependent type in structured binding
ClosedPublic

Authored by v1nh1shungry on Aug 15 2023, 2:23 AM.

Details

Summary

Currently clangd will display useless inlay hint for dependent type in
structured binding, e.g.

template <class T>
void foobar(T arg) {
  auto [a/*: <dependent type>*/, b/*: <dependent type>*/] = arg;
}

Diff Detail

Event Timeline

v1nh1shungry created this revision.Aug 15 2023, 2:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 15 2023, 2:23 AM
v1nh1shungry requested review of this revision.Aug 15 2023, 2:23 AM
nridge accepted this revision.Aug 20 2023, 12:01 AM

Thanks!

A future enhancement to consider could be, in the following testcase:

template <typename T, typename U>
struct Pair {
  T t;
  U u;
};

template <class T, class U>
void foobar(Pair<T, U> arg) {
  auto [a, b] = arg;
}

to get the hints to be T and U. (Today they are <dependent type>, so the patch is still an improvement in this case.)

This revision is now accepted and ready to land.Aug 20 2023, 12:01 AM

Thank you for the review!