wrappers: Handle tools named [<target>-]llvm-<tool>

Normally, we'd split the string at the last dash. However if the
tool name is "llvm-<tool>", make sure to include "llvm-" in the
tool name part when splitting the executable name.

In llvm-wrapper, don't add a duplicate "llvm-" prefix for the tool
name in these cases.
This commit is contained in:
Martin Storsjö committed 2022-10-01 13:28:41 +03:00
1 parent 2f8b90b583
commit 087255e28a
2 files changed
+20 -2

No files matched your search

+5 -2
View File
@@ -21,8 +21,11 @@
int _tmain(int argc, TCHAR* argv[]) {
const TCHAR *dir;
const TCHAR *exe;
split_argv(argv[0], &dir, NULL, NULL, &exe);
TCHAR *exe_path = concat(dir, concat(_T("llvm-"), exe));
const TCHAR *basename, *target;
split_argv(argv[0], &dir, &basename, &target, &exe);
if (_tcsncmp(exe, _T("llvm-"), 5))
exe = concat(_T("llvm-"), exe);
TCHAR *exe_path = concat(dir, exe);
return run_final(exe_path, (const TCHAR *const *) argv);
}