[index] Disable typo-correction when indexing

The errors won't be captured in the response, and it can be expensive to
do typo-correction when there are many errors, which is common in
indexing.

rdar://problem/28963058
This commit is contained in:
Ben Langmuir
2016-11-09 10:53:26 -08:00
parent 2d833547d0
commit c8f53ff8c4

View File

@@ -196,7 +196,7 @@ void trace::initTraceFiles(trace::SwiftInvocation &SwiftArgs,
void SwiftLangSupport::indexSource(StringRef InputFile,
IndexingConsumer &IdxConsumer,
ArrayRef<const char *> Args,
ArrayRef<const char *> OrigArgs,
StringRef Hash) {
std::string Error;
auto InputBuf = ASTMgr->getMemoryBuffer(InputFile, Error);
@@ -214,6 +214,12 @@ void SwiftLangSupport::indexSource(StringRef InputFile,
PrintingDiagnosticConsumer PrintDiags;
CI.addDiagnosticConsumer(&PrintDiags);
// Add -disable-typo-correction, since the errors won't be captured in the
// response, and it can be expensive to do typo-correction when there are many
// errors, which is common in indexing.
SmallVector<const char *, 16> Args(OrigArgs.begin(), OrigArgs.end());
Args.push_back("-disable-typo-correction");
CompilerInvocation Invocation;
bool Failed = getASTManager().initCompilerInvocation(Invocation, Args,
CI.getDiags(),