[PATCH] D110904: [lld-macho] Check for errors when the response file doesn't exist.

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 4 17:14:10 PDT 2021


oontvoo updated this revision to Diff 377061.
oontvoo added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110904/new/

https://reviews.llvm.org/D110904

Files:
  lld/MachO/DriverUtils.cpp
  lld/test/MachO/reproduce.s


Index: lld/test/MachO/reproduce.s
===================================================================
--- lld/test/MachO/reproduce.s
+++ lld/test/MachO/reproduce.s
@@ -53,6 +53,11 @@
 
 # RUN: cd repro2; ld64.lld @response.txt
 
+## Error case
+# RUN: mkdir -p %t.dir/errors && cd $t.dir/errors && rm -rf foo.txt
+# RUN: not %lld @foo.txt 2>&1 | FileCheck %s --check-prefix=NOFILE
+# NOFILE: error: Error expanding response file: No such file or directory
+
 .globl _main
 _main:
   ret
Index: lld/MachO/DriverUtils.cpp
===================================================================
--- lld/MachO/DriverUtils.cpp
+++ lld/MachO/DriverUtils.cpp
@@ -82,7 +82,9 @@
 
   // Expand response files (arguments in the form of @<filename>)
   // and then parse the argument again.
-  cl::ExpandResponseFiles(saver, cl::TokenizeGNUCommandLine, vec);
+  checkError(
+      cl::ExpandResponseFilesWithError(saver, cl::TokenizeGNUCommandLine, vec));
+
   InputArgList args = ParseArgs(vec, missingIndex, missingCount);
 
   // Handle -fatal_warnings early since it converts missing argument warnings


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110904.377061.patch
Type: text/x-patch
Size: 1091 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211005/231bb7d8/attachment-0001.bin>


More information about the llvm-commits mailing list