Skip to content

Commit f89e213

Browse files
author
Nathan Hawes
authored
Merge pull request #32281 from nathawes/handle-filelists-in-sourcekit-driver-args
[Driver/SourceKit] Handle filelist driver args in getSingleFrontendInvocationFromDriverArguments
2 parents a3ce462 + 50dc7d8 commit f89e213

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

lib/Driver/FrontendUtil.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include "swift/Driver/Job.h"
2020
#include "swift/Driver/ToolChain.h"
2121
#include "llvm/Option/ArgList.h"
22+
#include "llvm/Support/CommandLine.h"
23+
#include "llvm/Support/StringSaver.h"
2224

2325
using namespace swift;
2426
using namespace swift::driver;
@@ -46,6 +48,16 @@ bool swift::driver::getSingleFrontendInvocationFromDriverArguments(
4648
Args.push_back("-driver-filelist-threshold");
4749
Args.push_back(neverThreshold.c_str());
4850

51+
// Expand any file list args.
52+
llvm::BumpPtrAllocator Allocator;
53+
llvm::StringSaver Saver(Allocator);
54+
llvm::cl::ExpandResponseFiles(
55+
Saver,
56+
llvm::Triple(llvm::sys::getProcessTriple()).isOSWindows()
57+
? llvm::cl::TokenizeWindowsCommandLine
58+
: llvm::cl::TokenizeGNUCommandLine,
59+
Args);
60+
4961
// Force the driver into batch mode by specifying "swiftc" as the name.
5062
Driver TheDriver("swiftc", "swiftc", Args, Diags);
5163

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
let x = 10
2+
x.littleEndian
3+
4+
// RUN: %empty-directory(%t)
5+
// RUN: echo %s > %t/tmp.SwiftFileList
6+
// RUN: %target-swiftc_driver -typecheck @%t/tmp.SwiftFileList
7+
// RUN: %sourcekitd-test -req=complete -pos=2:3 %s -- @%t/tmp.SwiftFileList | %FileCheck %s -check-prefix=COMPLETE
8+
// COMPLETE: littleEndian

0 commit comments

Comments
 (0)