[PATCH] D54194: [llvm-rc] Support absolute filenames in manifests
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 8 15:48:39 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL346450: [llvm-rc] Support absolute filenames in manifests (authored by phosek, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D54194?vs=173240&id=173243#toc
Repository:
rL LLVM
https://reviews.llvm.org/D54194
Files:
llvm/trunk/test/tools/llvm-rc/absolute.test
llvm/trunk/tools/llvm-rc/ResourceFileWriter.cpp
Index: llvm/trunk/test/tools/llvm-rc/absolute.test
===================================================================
--- llvm/trunk/test/tools/llvm-rc/absolute.test
+++ llvm/trunk/test/tools/llvm-rc/absolute.test
@@ -0,0 +1,3 @@
+; RUN: touch %t.manifest
+; RUN: echo "1 24 \"%t.manifest\"" > %t.rc
+; RUN: llvm-rc %t.rc
Index: llvm/trunk/tools/llvm-rc/ResourceFileWriter.cpp
===================================================================
--- llvm/trunk/tools/llvm-rc/ResourceFileWriter.cpp
+++ llvm/trunk/tools/llvm-rc/ResourceFileWriter.cpp
@@ -1502,16 +1502,19 @@
SmallString<128> Cwd;
std::unique_ptr<MemoryBuffer> Result;
+ // 0. The file path is absolute and the file exists.
+ if (sys::path::is_absolute(File))
+ return errorOrToExpected(MemoryBuffer::getFile(File, -1, false));
+
// 1. The current working directory.
sys::fs::current_path(Cwd);
Path.assign(Cwd.begin(), Cwd.end());
sys::path::append(Path, File);
if (sys::fs::exists(Path))
return errorOrToExpected(MemoryBuffer::getFile(Path, -1, false));
// 2. The directory of the input resource file, if it is different from the
- // current
- // working directory.
+ // current working directory.
StringRef InputFileDir = sys::path::parent_path(Params.InputFilePath);
Path.assign(InputFileDir.begin(), InputFileDir.end());
sys::path::append(Path, File);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54194.173243.patch
Type: text/x-patch
Size: 1376 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181108/5bbb5698/attachment.bin>
More information about the llvm-commits
mailing list