Skip to content

Commit bb2e003

Browse files
authored
Merge pull request #25628 from akyrtzi/index-disable-typo-correction
2 parents 543632d + e23d3e3 commit bb2e003

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
@@ -424,6 +424,12 @@ ToolChain::constructInvocation(const CompileJobAction &job,
424424
if (context.Args.hasArg(options::OPT_embed_bitcode_marker))
425425
Arguments.push_back("-embed-bitcode-marker");
426426

427+
// For `-index-file` mode add `-disable-typo-correction`, since the errors
428+
// will be ignored and it can be expensive to do typo-correction.
429+
if (job.getType() == file_types::TY_IndexData) {
430+
Arguments.push_back("-disable-typo-correction");
431+
}
432+
427433
if (context.Args.hasArg(options::OPT_index_store_path)) {
428434
context.Args.AddLastArg(Arguments, options::OPT_index_store_path);
429435
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)