mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[sourcekitd] Change compile notifications to pass a single args string
... instead of an array of compiler arguments. This is good enough for seeing what's going on, and it saves significant time for long argument strings, because it doesn't create and destroy so many xpc strings, and more of the string copying that happens is on a large contiguous string instead of many small strings. rdar://39538847
This commit is contained in:
@@ -198,11 +198,25 @@ static void indexModule(llvm::MemoryBuffer *Input,
|
||||
// IndexSource
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
template <typename Str>
|
||||
static void initTraceInfoImpl(trace::SwiftInvocation &SwiftArgs,
|
||||
StringRef InputFile,
|
||||
ArrayRef<Str> Args) {
|
||||
llvm::raw_string_ostream OS(SwiftArgs.Args.Arguments);
|
||||
interleave(Args, [&OS](StringRef arg) { OS << arg; }, [&OS] { OS << ' '; });
|
||||
SwiftArgs.Args.PrimaryFile = InputFile;
|
||||
}
|
||||
|
||||
void trace::initTraceInfo(trace::SwiftInvocation &SwiftArgs,
|
||||
StringRef InputFile,
|
||||
ArrayRef<const char *> Args) {
|
||||
SwiftArgs.Args.Args.assign(Args.begin(), Args.end());
|
||||
SwiftArgs.Args.PrimaryFile = InputFile;
|
||||
initTraceInfoImpl(SwiftArgs, InputFile, Args);
|
||||
}
|
||||
|
||||
void trace::initTraceInfo(trace::SwiftInvocation &SwiftArgs,
|
||||
StringRef InputFile,
|
||||
ArrayRef<std::string> Args) {
|
||||
initTraceInfoImpl(SwiftArgs, InputFile, Args);
|
||||
}
|
||||
|
||||
void SwiftLangSupport::indexSource(StringRef InputFile,
|
||||
|
||||
Reference in New Issue
Block a user