[PATCH] D54194: [llvm-rc] Support absolute filenames in manifests
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 6 18:14:19 PST 2018
phosek created this revision.
phosek added reviewers: mstorsjo, amccarth, zturner, thakis.
Herald added a subscriber: llvm-commits.
CMake generate manifests that contain absolute filenames and these
currently result in assertion error. This change ensures that we
handle these correctly.
Repository:
rL LLVM
https://reviews.llvm.org/D54194
Files:
llvm/tools/llvm-rc/ResourceFileWriter.cpp
Index: llvm/tools/llvm-rc/ResourceFileWriter.cpp
===================================================================
--- llvm/tools/llvm-rc/ResourceFileWriter.cpp
+++ llvm/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.172888.patch
Type: text/x-patch
Size: 1035 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181107/dfba0bca/attachment.bin>
More information about the llvm-commits
mailing list