[PATCH] D18666: Object: Correctly read thin archives containing absolute paths.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 31 12:47:33 PDT 2016
pcc created this revision.
pcc added a reviewer: rafael.
pcc added a subscriber: llvm-commits.
http://reviews.llvm.org/D18666
Files:
lib/Object/Archive.cpp
test/Object/archive-thin-read.test
Index: test/Object/archive-thin-read.test
===================================================================
--- /dev/null
+++ 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: lib/Object/Archive.cpp
===================================================================
--- lib/Object/Archive.cpp
+++ 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.52263.patch
Type: text/x-patch
Size: 1108 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160331/b57c956c/attachment.bin>
More information about the llvm-commits
mailing list