From ec70a40205396a9bd9e0310b3b81b4b41838976a Mon Sep 17 00:00:00 2001 From: Rintaro Ishizaki Date: Mon, 13 Jan 2020 17:47:47 -0800 Subject: [PATCH] [CodeCompletion] Disable module system headers validation This validation may call many `stat(2)`. Since we don't expect system files are edited. Disable it for code completion, even if they are edited, they are validated when the user manually build the project. rdar://problem/58550697 --- lib/IDE/CompletionInstance.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/IDE/CompletionInstance.cpp b/lib/IDE/CompletionInstance.cpp index 632a3b5f6542a..44dbf98a3fadd 100644 --- a/lib/IDE/CompletionInstance.cpp +++ b/lib/IDE/CompletionInstance.cpp @@ -324,6 +324,11 @@ bool swift::ide::CompletionInstance::performOperation( // source text. That breaks an invariant of syntax tree building. Invocation.getLangOptions().BuildSyntaxTree = false; + // This validation may call stat(2) many times. Disable it to prevent + // performance regression. + Invocation.getSearchPathOptions().DisableModulesValidateSystemDependencies = + true; + // FIXME: ASTScopeLookup doesn't support code completion yet. Invocation.disableASTScopeLookup();