Skip to content

Commit 6528d7f

Browse files
committed
[SourceKit] Disable module system headers validation
in all SourceKit requests. This validation may call many stat(2). Since we don't expect system files are edited. Disable it for SourceKit requests. Even if they are edited, manual builds can validates and updates them. rdar://problem/58550697 (cherry picked from commit 951b853)
1 parent 9ff8bb9 commit 6528d7f

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

lib/IDE/CompletionInstance.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,6 @@ bool swift::ide::CompletionInstance::performOperation(
293293
// source text. That breaks an invariant of syntax tree building.
294294
Invocation.getLangOptions().BuildSyntaxTree = false;
295295

296-
// This validation may call stat(2) many times. Disable it to prevent
297-
// performance regression.
298-
Invocation.getSearchPathOptions().DisableModulesValidateSystemDependencies =
299-
true;
300-
301296
// FIXME: ASTScopeLookup doesn't support code completion yet.
302297
Invocation.disableASTScopeLookup();
303298

tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,11 @@ bool SwiftASTManager::initCompilerInvocation(
539539
// We don't care about LLVMArgs
540540
FrontendOpts.LLVMArgs.clear();
541541

542+
// This validation may call stat(2) many times. Disable it to prevent
543+
// performance issues.
544+
Invocation.getSearchPathOptions().DisableModulesValidateSystemDependencies =
545+
true;
546+
542547
// SwiftSourceInfo files provide source location information for decls coming
543548
// from loaded modules. For most IDE use cases it either has an undesirable
544549
// impact on performance with no benefit (code completion), results in stale

tools/swift-ide-test/swift-ide-test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3302,6 +3302,8 @@ int main(int argc, char *argv[]) {
33023302
options::DebugForbidTypecheckPrefix;
33033303
InitInvok.getTypeCheckerOptions().DebugConstraintSolver =
33043304
options::DebugConstraintSolver;
3305+
InitInvok.getSearchPathOptions().DisableModulesValidateSystemDependencies =
3306+
true;
33053307

33063308
for (auto ConfigName : options::BuildConfigs)
33073309
InitInvok.getLangOptions().addCustomConditionalCompilationFlag(ConfigName);

0 commit comments

Comments
 (0)