[Driver/SourceKit] Handle filelist driver args in getSingleFrontendInvocationFromDriverArguments

getSingleFrontendInvocationFromDriverArguments is set up to never produce file
lists in the output frontend arguments, but since the driver accepts file lists
as input arguments, this should too.
This commit is contained in:
Nathan Hawes
2020-06-09 14:49:22 -07:00
parent 28f60a09bf
commit 50dc7d85dd
2 changed files with 20 additions and 0 deletions

View File

@@ -19,6 +19,8 @@
#include "swift/Driver/Job.h"
#include "swift/Driver/ToolChain.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/StringSaver.h"
using namespace swift;
using namespace swift::driver;
@@ -46,6 +48,16 @@ bool swift::driver::getSingleFrontendInvocationFromDriverArguments(
Args.push_back("-driver-filelist-threshold");
Args.push_back(neverThreshold.c_str());
// Expand any file list args.
llvm::BumpPtrAllocator Allocator;
llvm::StringSaver Saver(Allocator);
llvm::cl::ExpandResponseFiles(
Saver,
llvm::Triple(llvm::sys::getProcessTriple()).isOSWindows()
? llvm::cl::TokenizeWindowsCommandLine
: llvm::cl::TokenizeGNUCommandLine,
Args);
// Force the driver into batch mode by specifying "swiftc" as the name.
Driver TheDriver("swiftc", "swiftc", Args, Diags);