diff options
author | Petr Hosek <phosek@chromium.org> | 2018-11-08 23:45:00 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2018-11-08 23:45:00 +0000 |
commit | 1f597e6e6b75309557b591f5c5b2ca13bb7c31e5 (patch) | |
tree | e9007fefe689586f721f3d42ebc2c1a5c590fd40 /llvm/tools/llvm-rc/ResourceFileWriter.cpp | |
parent | 7010ef34d5cc4f9bc32585fe1ada3d1c2a22b700 (diff) | |
download | bcm5719-llvm-1f597e6e6b75309557b591f5c5b2ca13bb7c31e5.tar.gz bcm5719-llvm-1f597e6e6b75309557b591f5c5b2ca13bb7c31e5.zip |
[llvm-rc] Support absolute filenames in manifests
CMake generate manifests that contain absolute filenames and these
currently result in assertion error. This change ensures that we
handle these correctly.
Differential Revision: https://reviews.llvm.org/D54194
llvm-svn: 346450
Diffstat (limited to 'llvm/tools/llvm-rc/ResourceFileWriter.cpp')
-rw-r--r-- | llvm/tools/llvm-rc/ResourceFileWriter.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/tools/llvm-rc/ResourceFileWriter.cpp b/llvm/tools/llvm-rc/ResourceFileWriter.cpp index 4b561940d2e..95d92a93c89 100644 --- a/llvm/tools/llvm-rc/ResourceFileWriter.cpp +++ b/llvm/tools/llvm-rc/ResourceFileWriter.cpp @@ -1502,6 +1502,10 @@ ResourceFileWriter::loadFile(StringRef File) const { 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()); @@ -1510,8 +1514,7 @@ ResourceFileWriter::loadFile(StringRef File) const { 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); |