This is an archive of the discontinued LLVM Phabricator instance.

[llvm-driver] Check more specific tools first
ClosedPublic

Authored by abrachet on Apr 17 2023, 10:05 AM.

Details

Summary

We allow tools to be called {tool}-{suffix} to support tools being
called something like clang-17. Many clang tools follow this pattern
too for example, clang-scan-deps. It is pure luck wether clang or
clang-scan-deps will appear first in the LLVMDriverTools.def file. If
the former appears first, clang-scan-deps will match against clang,
which is not preferable. Instead we can control the order that tools
are checked so that we always look at more specific tool names first.

Diff Detail

Event Timeline

abrachet created this revision.Apr 17 2023, 10:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2023, 10:05 AM
abrachet requested review of this revision.Apr 17 2023, 10:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2023, 10:05 AM
MaskRay added inline comments.
llvm/tools/llvm-driver/llvm-driver.cpp
32 ↗(On Diff #514281)

This leaves a dynamic initialization. It'd be better to keep LLVMDriverTools.def and reverse iterate ToolMap.

32 ↗(On Diff #514281)

I mean "keep LLVMDriverTools.def sorted".

abrachet updated this revision to Diff 514323.Apr 17 2023, 11:06 AM
abrachet marked 2 inline comments as done.
MaskRay accepted this revision.Apr 17 2023, 12:37 PM
This revision is now accepted and ready to land.Apr 17 2023, 12:37 PM
This revision was landed with ongoing or failed builds.Apr 17 2023, 2:39 PM
This revision was automatically updated to reflect the committed changes.