Skip to content

Commit 3061dbe

Browse files
authored
Merge pull request #10795 from akyrtzi/sourcekit-ignore-index-store-flag
[SourceKit] Ignore the index-store-path flag for the sourcekitd requests
2 parents 9a4fb8c + 231add1 commit 3061dbe

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
var s = 10
2+
s.
3+
4+
// RUN: rm -rf %t
5+
// RUN: mkdir -p %t
6+
// RUN: touch %t/t.h
7+
// RUN: %sourcekitd-test -req=sema %s -- %s -import-objc-header %t/t.h -pch-output-dir %t/pch -index-store-path %t/idx | %FileCheck %s -check-prefix=DIAG
8+
// RUN: not find %t/idx
9+
// DIAG: expected member name
10+
11+
// RUN: rm -rf %t/pch %t/idx
12+
// RUN: %sourcekitd-test -req=complete -pos=2:3 %s -- %s -import-objc-header %t/t.h -pch-output-dir %t/pch -index-store-path %t/idx | %FileCheck %s -check-prefix=COMPLETE
13+
// RUN: not find %t/idx
14+
// COMPLETE: littleEndian

tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,10 @@ bool SwiftASTManager::initCompilerInvocation(CompilerInvocation &Invocation,
419419
FrontendOpts.PlaygroundTransform = false;
420420
}
421421

422+
// Disable the index-store functionality for the sourcekitd requests.
423+
FrontendOpts.IndexStorePath.clear();
424+
ImporterOpts.IndexStorePath.clear();
425+
422426
if (!PrimaryFile.empty()) {
423427
Optional<unsigned> PrimaryIndex;
424428
for (auto i : indices(Invocation.getFrontendOptions().InputFilenames)) {

0 commit comments

Comments
 (0)