[PATCH] D18666: Object: Correctly read thin archives containing absolute paths.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 31 15:14:00 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL265065: Object: Correctly read thin archives containing absolute paths. (authored by pcc).
Changed prior to commit:
http://reviews.llvm.org/D18666?vs=52263&id=52297#toc
Repository:
rL LLVM
http://reviews.llvm.org/D18666
Files:
llvm/trunk/lib/Object/Archive.cpp
llvm/trunk/test/Object/archive-thin-read.test
Index: llvm/trunk/test/Object/archive-thin-read.test
===================================================================
--- llvm/trunk/test/Object/archive-thin-read.test
+++ llvm/trunk/test/Object/archive-thin-read.test
@@ -0,0 +1,5 @@
+RUN: echo hello > %t.file
+RUN: llvm-ar rcsT %t.a %t.file
+RUN: llvm-ar p %t.a | FileCheck %s
+
+CHECK: hello
Index: llvm/trunk/lib/Object/Archive.cpp
===================================================================
--- llvm/trunk/lib/Object/Archive.cpp
+++ llvm/trunk/lib/Object/Archive.cpp
@@ -146,9 +146,14 @@
ErrorOr<StringRef> Name = getName();
if (std::error_code EC = Name.getError())
return EC;
- SmallString<128> FullName = sys::path::parent_path(
- Parent->getMemoryBufferRef().getBufferIdentifier());
- sys::path::append(FullName, *Name);
+ SmallString<128> FullName;
+ if (sys::path::is_absolute(*Name))
+ FullName = *Name;
+ else {
+ FullName = sys::path::parent_path(
+ Parent->getMemoryBufferRef().getBufferIdentifier());
+ sys::path::append(FullName, *Name);
+ }
ErrorOr<std::unique_ptr<MemoryBuffer>> Buf = MemoryBuffer::getFile(FullName);
if (std::error_code EC = Buf.getError())
return EC;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18666.52297.patch
Type: text/x-patch
Size: 1199 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160331/85722a9b/attachment.bin>
More information about the llvm-commits
mailing list