From bb67c782fcd65ac4001277af2b1bfb07ae4a7dab Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Thu, 17 Oct 2024 11:02:08 -0700 Subject: [PATCH] [Driver] Always parse response files as GNU command line arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit clang parses response files in GNU mode, even on Windows except - If you explicitly pass `--rsp-quoting=windows` in the command line invocation or - If no `--rsp-quoting` is specified and clang is running `cl` mode, which is the case if clang is invoked as `cl` or `clang-cl`, which is the compatibility mode to Window’s `cl` compiler as far as I can tell. The Swift driver always outputs response files in GNU mode (https://github.com/swiftlang/swift-driver/pull/1000). Since Swift does not need to support a compatibility mode with another compiler, there is no need for it to parse response files in Windows mode. We should unconditionally parse the response files in GNU mode. --- lib/Driver/FrontendUtil.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/Driver/FrontendUtil.cpp b/lib/Driver/FrontendUtil.cpp index b0c0b7f47af72..bd1414bdf3ba2 100644 --- a/lib/Driver/FrontendUtil.cpp +++ b/lib/Driver/FrontendUtil.cpp @@ -31,11 +31,8 @@ void swift::driver::ExpandResponseFilesWithRetry(llvm::StringSaver &Saver, llvm::SmallVectorImpl &Args) { const unsigned MAX_COUNT = 30; for (unsigned I = 0; I != MAX_COUNT; ++I) { - if (llvm::cl::ExpandResponseFiles(Saver, - llvm::Triple(llvm::sys::getProcessTriple()).isOSWindows() - ? llvm::cl::TokenizeWindowsCommandLine - : llvm::cl::TokenizeGNUCommandLine, - Args)) { + if (llvm::cl::ExpandResponseFiles(Saver, llvm::cl::TokenizeGNUCommandLine, + Args)) { return; } }