[llvm-driver] Check more specific tools first
authorAlex Brachet <abrachet@google.com>
Mon, 17 Apr 2023 21:38:08 +0000 (21:38 +0000)
committerAlex Brachet <abrachet@google.com>
Mon, 17 Apr 2023 21:39:13 +0000 (21:39 +0000)
commitf1da04b7357bf0efef2ab881f31bdfb30c3e3b10
tree47f31a642e4089c4e97016c54519ba73165ef7bd
parente3d764597f5ec041a2e38fc7c39bc7bfbca827fd
[llvm-driver] Check more specific tools first

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.

Differential Revision: https://reviews.llvm.org/D148543
llvm/tools/llvm-driver/CMakeLists.txt