aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
diff options
context:
space:
mode:
authorOwen Reynolds <gbreynoo@gmail.com>2019-06-04 10:13:03 +0000
committerOwen Reynolds <gbreynoo@gmail.com>2019-06-04 10:13:03 +0000
commit5d5078e341f593944d9badd53e374e6b319282da (patch)
treefb8ff535fd53402c5d82253f8c11143aed9ca321 /llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
parent3018d505a3643f1b191da1e2cc99493708ede186 (diff)
downloadllvm-5d5078e341f593944d9badd53e374e6b319282da.zip
llvm-5d5078e341f593944d9badd53e374e6b319282da.tar.gz
llvm-5d5078e341f593944d9badd53e374e6b319282da.tar.bz2
[llvm-ar] Reapply Fix relative thin archive path handling
Includes a fix for an introduced build failure due to a post c++11 use of std::mismatch. This fixes some thin archive relative path issues, paths are shortened where possible and paths are output correctly when using the display table command. Differential Revision: https://reviews.llvm.org/D59491 llvm-svn: 362484
Diffstat (limited to 'llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp')
-rw-r--r--llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp b/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
index 34a8314..2d44686 100644
--- a/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
+++ b/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
@@ -211,9 +211,14 @@ int llvm::libDriverMain(ArrayRef<const char *> ArgsArr) {
// 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.
- for (NewArchiveMember &Member : Members)
- Member.MemberName =
- Saver.save(computeArchiveRelativePath(OutputPath, Member.MemberName));
+ for (NewArchiveMember &Member : Members) {
+ if (sys::path::is_relative(Member.MemberName)) {
+ Expected<std::string> PathOrErr =
+ computeArchiveRelativePath(OutputPath, Member.MemberName);
+ if (PathOrErr)
+ Member.MemberName = Saver.save(*PathOrErr);
+ }
+ }
if (Error E =
writeArchive(OutputPath, Members,