mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[SourceKit] Reuse compiler instance between multiple completion
- Introduce ide::CompletionInstance to manage CompilerInstance - `CompletionInstance` vends the cached CompilerInstance when: -- The compiler arguments (i.e. CompilerInvocation) has has not changed -- The primary file is the same -- The completion happens inside function bodies in both previous and current completion -- The interface hash of the primary file has not changed - Otherwise, it vends a fresh CompilerInstance and cache it for the next completion rdar://problem/20787086
This commit is contained in:
@@ -58,7 +58,7 @@ class ImportDepth {
|
||||
|
||||
public:
|
||||
ImportDepth() = default;
|
||||
ImportDepth(ASTContext &context, CompilerInvocation &invocation);
|
||||
ImportDepth(ASTContext &context, const CompilerInvocation &invocation);
|
||||
|
||||
Optional<uint8_t> lookup(StringRef module) {
|
||||
auto I = depths.find(module);
|
||||
@@ -320,7 +320,8 @@ CodeCompletionViewRef CodeCompletionOrganizer::takeResultsView() {
|
||||
// ImportDepth
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
ImportDepth::ImportDepth(ASTContext &context, CompilerInvocation &invocation) {
|
||||
ImportDepth::ImportDepth(ASTContext &context,
|
||||
const CompilerInvocation &invocation) {
|
||||
llvm::DenseSet<ModuleDecl *> seen;
|
||||
std::deque<std::pair<ModuleDecl *, uint8_t>> worklist;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user