[PATCH] D79227: [ms] llvm-lib gives a more useful error if no inputs and no output path are provided
Eric Astor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 1 04:45:52 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1428f86cf986: [ms] llvm-lib gives a more useful error if no inputs and no output path areā¦ (authored by epastor).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79227/new/
https://reviews.llvm.org/D79227
Files:
llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
Index: llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
===================================================================
--- llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
+++ llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
@@ -59,10 +59,7 @@
}
-static std::string getOutputPath(opt::InputArgList *Args,
- const NewArchiveMember &FirstMember) {
- if (auto *Arg = Args->getLastArg(OPT_out))
- return Arg->getValue();
+static std::string getDefaultOutputPath(const NewArchiveMember &FirstMember) {
SmallString<128> Val = StringRef(FirstMember.Buf->getBufferIdentifier());
sys::path::replace_extension(Val, ".lib");
return std::string(Val.str());
@@ -353,7 +350,15 @@
}
// Create an archive file.
- std::string OutputPath = getOutputPath(&Args, Members[0]);
+ std::string OutputPath;
+ if (auto *Arg = Args.getLastArg(OPT_out)) {
+ OutputPath = Arg->getValue();
+ } else if (!Members.empty()) {
+ OutputPath = getDefaultOutputPath(Members[0]);
+ } else {
+ llvm::errs() << "no output path given, and cannot infer with no inputs\n";
+ return 1;
+ }
// llvm-lib uses relative paths for both regular and thin archives, unlike
// standard GNU ar, which only uses relative paths for thin archives and
// basenames for regular archives.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79227.261454.patch
Type: text/x-patch
Size: 1304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200501/d0b41aed/attachment.bin>
More information about the llvm-commits
mailing list