[llvm-ar] Remove leading slash when printing thin archive members

Reviewers: ruiu

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D57845

llvm-svn: 353347
This commit is contained in:
Jordan Rupprecht 2019-02-06 21:50:45 +00:00
parent 351314a14f
commit db5036504e
2 changed files with 13 additions and 2 deletions

View File

@ -0,0 +1,10 @@
RUN: mkdir -p %t/foo
RUN: touch %t/foo/a.txt
RUN: rm -f %t/foo/archive.a
RUN: cd %t && llvm-ar rcST foo/archive.a foo/a.txt
RUN: cd %t && llvm-ar t foo/archive.a | FileCheck %s --match-full-lines --check-prefix=PARENT-DIR
RUN: cd %t/foo && llvm-ar t archive.a | FileCheck %s --match-full-lines --check-prefix=CHILD-DIR
PARENT-DIR: foo/a.txt
CHILD-DIR: a.txt

View File

@ -429,8 +429,9 @@ static void doDisplayTable(StringRef Name, const object::Archive::Child &C) {
} }
if (C.getParent()->isThin()) { if (C.getParent()->isThin()) {
outs() << sys::path::parent_path(ArchiveName); StringRef ParentDir = sys::path::parent_path(ArchiveName);
outs() << '/'; if (!ParentDir.empty())
outs() << ParentDir << '/';
} }
outs() << Name << "\n"; outs() << Name << "\n";
} }