Skip to content

Commit 54d37f5

Browse files
committed
[driver] For -index-file mode add -disable-typo-correction
We don't need typo-correction for that since the errors will be ignored and it can be expensive to do typo-correction.
1 parent 542b10c commit 54d37f5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/Driver/ToolChains.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,12 @@ ToolChain::constructInvocation(const CompileJobAction &job,
380380
if (context.Args.hasArg(options::OPT_embed_bitcode_marker))
381381
Arguments.push_back("-embed-bitcode-marker");
382382

383+
// For `-index-file` mode add `-disable-typo-correction`, since the errors
384+
// will be ignored and it can be expensive to do typo-correction.
385+
if (job.getType() == file_types::TY_IndexData) {
386+
Arguments.push_back("-disable-typo-correction");
387+
}
388+
383389
if (context.Args.hasArg(options::OPT_index_store_path)) {
384390
context.Args.AddLastArg(Arguments, options::OPT_index_store_path);
385391
if (!context.Args.hasArg(options::OPT_index_ignore_system_modules))

test/Index/Store/driver-index.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// RUN: %swiftc_driver -driver-print-jobs -index-file -index-file-path %s %S/Inputs/SwiftModuleA.swift %s -o %t.output_for_index -index-store-path %t.index_store -module-name driver_index 2>&1 | %FileCheck %s
2-
// CHECK: {{.*}}swift{{(c.EXE")?}} -frontend -typecheck {{.*}}SwiftModuleA.swift{{"?}} -primary-file {{.*}}driver-index.swift{{"?}} {{.*}}-o {{.*}}.output_for_index{{"?}} {{.*}}-index-store-path {{.*}}.index_store{{"?}} -index-system-modules
2+
// CHECK: {{.*}}swift{{(c.EXE")?}} -frontend -typecheck {{.*}}SwiftModuleA.swift{{"?}} -primary-file {{.*}}driver-index.swift{{"?}} {{.*}}-o {{.*}}.output_for_index{{"?}} {{.*}}-disable-typo-correction {{.*}}-index-store-path {{.*}}.index_store{{"?}} -index-system-modules

0 commit comments

Comments
 (0)