[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:44:25 PST 2018


phosek updated this revision to Diff 173240.
phosek marked an inline comment as done.

Repository:
  rL LLVM

https://reviews.llvm.org/D54194

Files:
  llvm/test/tools/llvm-rc/absolute.test
  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);
Index: llvm/test/tools/llvm-rc/absolute.test
===================================================================
--- /dev/null
+++ llvm/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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54194.173240.patch
Type: text/x-patch
Size: 1312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181108/8d6d51e0/attachment.bin>


More information about the llvm-commits mailing list