diff --git a/tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp b/tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp index 1e2b1fd10a211..1ebbcfeb25441 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp @@ -539,6 +539,11 @@ bool SwiftASTManager::initCompilerInvocation( // We don't care about LLVMArgs FrontendOpts.LLVMArgs.clear(); + // This validation may call stat(2) many times. Disable it to prevent + // performance issues. + Invocation.getSearchPathOptions().DisableModulesValidateSystemDependencies = + true; + // SwiftSourceInfo files provide source location information for decls coming // from loaded modules. For most IDE use cases it either has an undesirable // impact on performance with no benefit (code completion), results in stale diff --git a/tools/swift-ide-test/swift-ide-test.cpp b/tools/swift-ide-test/swift-ide-test.cpp index d04bd53dab5f0..1b742281b9dfd 100644 --- a/tools/swift-ide-test/swift-ide-test.cpp +++ b/tools/swift-ide-test/swift-ide-test.cpp @@ -3302,6 +3302,8 @@ int main(int argc, char *argv[]) { options::DebugForbidTypecheckPrefix; InitInvok.getTypeCheckerOptions().DebugConstraintSolver = options::DebugConstraintSolver; + InitInvok.getSearchPathOptions().DisableModulesValidateSystemDependencies = + true; for (auto ConfigName : options::BuildConfigs) InitInvok.getLangOptions().addCustomConditionalCompilationFlag(ConfigName);