Skip to content

Commit 951b853

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
1 parent faf3be4 commit 951b853

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

lib/IDE/CompletionInstance.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,6 @@ bool swift::ide::CompletionInstance::performOperation(
324324
// source text. That breaks an invariant of syntax tree building.
325325
Invocation.getLangOptions().BuildSyntaxTree = false;
326326

327-
// This validation may call stat(2) many times. Disable it to prevent
328-
// performance regression.
329-
Invocation.getSearchPathOptions().DisableModulesValidateSystemDependencies =
330-
true;
331-
332327
// FIXME: ASTScopeLookup doesn't support code completion yet.
333328
Invocation.disableASTScopeLookup();
334329

tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp

+5
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

+2
Original file line numberDiff line numberDiff line change
@@ -3436,6 +3436,8 @@ int main(int argc, char *argv[]) {
34363436
options::DebugForbidTypecheckPrefix;
34373437
InitInvok.getTypeCheckerOptions().DebugConstraintSolver =
34383438
options::DebugConstraintSolver;
3439+
InitInvok.getSearchPathOptions().DisableModulesValidateSystemDependencies =
3440+
true;
34393441

34403442
for (auto ConfigName : options::BuildConfigs)
34413443
InitInvok.getLangOptions().addCustomConditionalCompilationFlag(ConfigName);

0 commit comments

Comments
 (0)