[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
Fri Oct 1 11:14:02 PDT 2021


oontvoo updated this revision to Diff 376579.
oontvoo marked an inline comment as done.
oontvoo added a comment.

addressed comments


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
@@ -25,6 +25,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/TextAPI/InterfaceFile.h"
 #include "llvm/TextAPI/TextAPIReader.h"
 
@@ -82,7 +83,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.376579.patch
Type: text/x-patch
Size: 1347 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211001/416b41d6/attachment.bin>


More information about the llvm-commits mailing list