[PATCH] D119219: [llvm-rc]: Find <target>-clang over just clang
Tobias Hieta via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 8 02:04:38 PST 2022
thieta updated this revision to Diff 406736.
thieta marked 2 inline comments as done.
thieta added a comment.
Addressed comments from Martin.
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.406736.patch
Type: text/x-patch
Size: 1171 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220208/7cac1145/attachment.bin>
More information about the llvm-commits
mailing list