This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Sort targets before printing for tests
ClosedPublic

Authored by kadircet on Jan 18 2022, 2:06 AM.

Details

Summary

Targets are not necessarily inserted in the order they appear in source
code. For example we could traverse overload sets, or selectively insert
template patterns after all other decls.
So order the targets before printing to make sure tests are not dependent on
such implementation details. We can also do it in production, but that might be
wasteful as we haven't seen any complaints in the wild around these orderings
yet.

Diff Detail

Event Timeline

kadircet created this revision.Jan 18 2022, 2:06 AM
kadircet requested review of this revision.Jan 18 2022, 2:06 AM
sammccall accepted this revision.Jan 18 2022, 12:07 PM

Thanks!

clang-tools-extra/clangd/FindTarget.cpp
1176

No real objection to this form, but mutating the (copied) argument is a bit of a WTF.
An altervative would be to render Targets into an array, sort them (as strings), and then llvm::join them.

This revision is now accepted and ready to land.Jan 18 2022, 12:07 PM
kadircet updated this revision to Diff 401178.Jan 19 2022, 5:00 AM
kadircet marked an inline comment as done.
  • Store in vector and sort
This revision was landed with ongoing or failed builds.Jan 19 2022, 5:07 AM
This revision was automatically updated to reflect the committed changes.