[PATCH] D119219: [llvm-rc]: Find <target>-clang over just clang
Tobias Hieta via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 9 00:05:10 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7cca34acc4ac: [llvm-rc]: Find <target>-clang over just clang (authored by thieta).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119219/new/
https://reviews.llvm.org/D119219
Files:
llvm/tools/llvm-rc/llvm-rc.cpp
Index: llvm/tools/llvm-rc/llvm-rc.cpp
===================================================================
--- llvm/tools/llvm-rc/llvm-rc.cpp
+++ llvm/tools/llvm-rc/llvm-rc.cpp
@@ -124,13 +124,14 @@
return static_cast<std::string>(FileName);
}
-ErrorOr<std::string> findClang(const char *Argv0) {
+ErrorOr<std::string> findClang(const char *Argv0, StringRef Triple) {
StringRef Parent = llvm::sys::path::parent_path(Argv0);
ErrorOr<std::string> Path = std::error_code();
+ std::string TargetClang = (Triple + "-clang").str();
if (!Parent.empty()) {
// First look for the tool with all potential names in the specific
// directory of Argv0, if known
- for (const auto *Name : {"clang", "clang-cl"}) {
+ for (const auto *Name : {TargetClang.c_str(), "clang", "clang-cl"}) {
Path = sys::findProgramByName(Name, Parent);
if (Path)
return Path;
@@ -219,7 +220,7 @@
if (Opts.PrintCmdAndExit) {
Clang = "clang";
} else {
- ErrorOr<std::string> ClangOrErr = findClang(Argv0);
+ ErrorOr<std::string> ClangOrErr = findClang(Argv0, Opts.Triple);
if (ClangOrErr) {
Clang = *ClangOrErr;
} else {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119219.407059.patch
Type: text/x-patch
Size: 1171 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220209/611e6641/attachment.bin>
More information about the llvm-commits
mailing list