[PATCH] D27217: Only computeRelativePath() on new members
David Callahan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 30 14:43:17 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL288280: Only computeRelativePath() on new members (authored by david2050).
Changed prior to commit:
https://reviews.llvm.org/D27217?vs=79741&id=79821#toc
Repository:
rL LLVM
https://reviews.llvm.org/D27217
Files:
llvm/trunk/include/llvm/Object/ArchiveWriter.h
llvm/trunk/lib/Object/ArchiveWriter.cpp
llvm/trunk/test/Object/archive-thin-create.test
Index: llvm/trunk/include/llvm/Object/ArchiveWriter.h
===================================================================
--- llvm/trunk/include/llvm/Object/ArchiveWriter.h
+++ llvm/trunk/include/llvm/Object/ArchiveWriter.h
@@ -25,6 +25,7 @@
sys::TimePoint<std::chrono::seconds> ModTime;
unsigned UID = 0, GID = 0, Perms = 0644;
+ bool IsNew = false;
NewArchiveMember() = default;
NewArchiveMember(MemoryBufferRef BufRef);
Index: llvm/trunk/test/Object/archive-thin-create.test
===================================================================
--- llvm/trunk/test/Object/archive-thin-create.test
+++ llvm/trunk/test/Object/archive-thin-create.test
@@ -0,0 +1,14 @@
+RUN: mkdir -p %t
+RUN: cd %t
+RUN: mkdir -p foo
+RUN: touch foo/test1.o
+RUN: touch foo/test2.o
+RUN: llvm-ar qcT foo/libtest.a foo/test1.o
+RUN: llvm-ar qcT foo/libtest.a foo/test1.o
+RUN: llvm-ar qcT foo/libtest.a foo/test2.o
+RUN: llvm-ar t foo/libtest.a | FileCheck %s
+
+CHECK: test1.o
+CHECK: test1.o
+CHECK: test2.o
+
Index: llvm/trunk/lib/Object/ArchiveWriter.cpp
===================================================================
--- llvm/trunk/lib/Object/ArchiveWriter.cpp
+++ llvm/trunk/lib/Object/ArchiveWriter.cpp
@@ -45,6 +45,7 @@
return BufOrErr.takeError();
NewArchiveMember M;
+ assert(M.IsNew == false);
M.Buf = MemoryBuffer::getMemBuffer(*BufOrErr, false);
if (!Deterministic) {
auto ModTimeOrErr = OldMember.getLastModified();
@@ -93,6 +94,7 @@
return errorCodeToError(std::error_code(errno, std::generic_category()));
NewArchiveMember M;
+ M.IsNew = true;
M.Buf = std::move(*MemberBufferOrErr);
if (!Deterministic) {
M.ModTime = std::chrono::time_point_cast<std::chrono::seconds>(
@@ -231,9 +233,12 @@
}
StringMapIndexes.push_back(Out.tell() - StartOffset);
- if (Thin)
- Out << computeRelativePath(ArcName, Path);
- else
+ if (Thin) {
+ if (M.IsNew)
+ Out << computeRelativePath(ArcName, Path);
+ else
+ Out << M.Buf->getBufferIdentifier();
+ } else
Out << Name;
Out << "/\n";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27217.79821.patch
Type: text/x-patch
Size: 2096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161130/22a5caa4/attachment.bin>
More information about the llvm-commits
mailing list