Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 8c1c568

Browse files
committed
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346450 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 0429e0b commit 8c1c568

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

test/tools/llvm-rc/absolute.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
; RUN: touch %t.manifest
2+
; RUN: echo "1 24 \"%t.manifest\"" > %t.rc
3+
; RUN: llvm-rc %t.rc

tools/llvm-rc/ResourceFileWriter.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,10 @@ ResourceFileWriter::loadFile(StringRef File) const {
15021502
SmallString<128> Cwd;
15031503
std::unique_ptr<MemoryBuffer> Result;
15041504

1505+
// 0. The file path is absolute and the file exists.
1506+
if (sys::path::is_absolute(File))
1507+
return errorOrToExpected(MemoryBuffer::getFile(File, -1, false));
1508+
15051509
// 1. The current working directory.
15061510
sys::fs::current_path(Cwd);
15071511
Path.assign(Cwd.begin(), Cwd.end());
@@ -1510,8 +1514,7 @@ ResourceFileWriter::loadFile(StringRef File) const {
15101514
return errorOrToExpected(MemoryBuffer::getFile(Path, -1, false));
15111515

15121516
// 2. The directory of the input resource file, if it is different from the
1513-
// current
1514-
// working directory.
1517+
// current working directory.
15151518
StringRef InputFileDir = sys::path::parent_path(Params.InputFilePath);
15161519
Path.assign(InputFileDir.begin(), InputFileDir.end());
15171520
sys::path::append(Path, File);

0 commit comments

Comments
 (0)