Skip to content

Commit a383adf

Browse files
Revert "Enable SourceKit tests if building SourceKit"
1 parent 03c1259 commit a383adf

18 files changed

+32
-98
lines changed

Diff for: CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,6 @@ endif()
381381
option(SWIFT_BUILD_SOURCEKIT
382382
"Build SourceKit"
383383
${SWIFT_BUILD_SOURCEKIT_default})
384-
option(SWIFT_ENABLE_SOURCEKIT_TESTS
385-
"Enable running SourceKit tests"
386-
${SWIFT_BUILD_SOURCEKIT_default})
387384

388385
#
389386
# Assume a new enough ar to generate the index at construction time. This avoids

Diff for: test/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ normalize_boolean_spelling(LLVM_ENABLE_ASSERTIONS)
128128
normalize_boolean_spelling(SWIFT_STDLIB_ASSERTIONS)
129129
normalize_boolean_spelling(SWIFT_AST_VERIFIER)
130130
normalize_boolean_spelling(SWIFT_ASAN_BUILD)
131-
normalize_boolean_spelling(SWIFT_ENABLE_SOURCEKIT_TESTS)
132131
is_build_type_optimized("${SWIFT_STDLIB_BUILD_TYPE}" SWIFT_OPTIMIZED)
133132

134133
set(profdata_merge_worker

Diff for: test/SourceKit/CodeComplete/complete_moduleimportdepth.swift

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ func test() {
66
}
77

88
// XFAIL: broken_std_regex
9-
// REQUIRES: objc_interop
109
// RUN: %complete-test -hide-none -group=none -tok=A %s -raw -- -I %S/Inputs -F %S/../Inputs/libIDE-mock-sdk > %t
1110
// RUN: %FileCheck %s < %t
1211

Diff for: test/SourceKit/CodeComplete/complete_sort_order.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ func test() {
77

88
}
99

10-
// XFAIL: broken_std_regex, linux
10+
// XFAIL: broken_std_regex
1111
// RUN: %sourcekitd-test -req=complete -req-opts=hidelowpriority=0 -pos=7:1 %s -- %s > %t.orig
1212
// RUN: %FileCheck -check-prefix=NAME %s < %t.orig
1313
// Make sure the order is as below, foo(Int) should come before foo(String).

Diff for: test/SourceKit/CursorInfo/cursor_info.swift

-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ struct HasLocalizationKey {}
214214
/// - LocalizationKey: ABC
215215
func hasLocalizationKey2() {}
216216

217-
// REQUIRES: objc_interop
218217
// RUN: rm -rf %t.tmp
219218
// RUN: mkdir -p %t.tmp
220219
// RUN: %swiftc_driver -emit-module -o %t.tmp/FooSwiftModule.swiftmodule %S/Inputs/FooSwiftModule.swift

Diff for: test/SourceKit/CursorInfo/cursor_stdlib.swift

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ func foo2(_ a : inout [S1]) {
2121
import Swift
2222
func foo3(a: Float, b: Bool) {}
2323

24-
// REQUIRES: objc_interop
2524
// RUN: %sourcekitd-test -req=cursor -pos=3:18 %s -- %s %mcp_opt %clang-importer-sdk | %FileCheck -check-prefix=CHECK-OVERLAY %s
2625
// CHECK-OVERLAY: source.lang.swift.ref.var.global
2726
// CHECK-OVERLAY-NEXT: NSUTF8StringEncoding

Diff for: test/SourceKit/CursorInfo/cursor_usr.swift

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ struct S1 {}
88

99
func foo(x: FooStruct1) -> S1 {}
1010

11-
// REQUIRES: objc_interop
1211
// RUN: rm -rf %t
1312
// RUN: mkdir -p %t
1413
// RUN: %swiftc_driver -emit-module -o %t/FooSwiftModule.swiftmodule %S/Inputs/FooSwiftModule.swift

Diff for: test/SourceKit/DocumentStructure/structure.swift

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66

77
// RUN: %sourcekitd-test -req=structure %S/../Inputs/placeholders.swift | %sed_clean > %t.placeholders.response
88
// RUN: diff -u %s.placeholders.response %t.placeholders.response
9+

Diff for: test/SourceKit/Indexing/index_is_test_candidate.swift.response

+10-19
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
{
3737
key.kind: source.lang.swift.decl.class,
3838
key.name: "XCTestCase",
39-
key.usr: "s:23index_is_test_candidate10XCTestCaseC",
39+
key.usr: "s:C28index_is_test_candidate_objc10XCTestCase",
4040
key.line: 15,
4141
key.column: 7
4242
},
@@ -50,7 +50,7 @@
5050
{
5151
key.kind: source.lang.swift.ref.class,
5252
key.name: "XCTestCase",
53-
key.usr: "s:23index_is_test_candidate10XCTestCaseC",
53+
key.usr: "s:C28index_is_test_candidate_objc10XCTestCase",
5454
key.line: 16,
5555
key.column: 32
5656
}
@@ -59,7 +59,7 @@
5959
{
6060
key.kind: source.lang.swift.ref.class,
6161
key.name: "XCTestCase",
62-
key.usr: "s:23index_is_test_candidate10XCTestCaseC",
62+
key.usr: "s:C28index_is_test_candidate_objc10XCTestCase",
6363
key.line: 16,
6464
key.column: 32
6565
},
@@ -68,11 +68,9 @@
6868
key.name: "test_startsWithTest_takesNoParams_returnsVoid_butIsPrivate()",
6969
key.usr: "s:23index_is_test_candidate14MyPrivateClass33_E06F4E7BC5F577AB6E2EC6D3ECA1C8B9LLC0c47_startsWithTest_takesNoParams_returnsVoid_butIsF0yyF",
7070
key.line: 17,
71-
key.column: 8,
72-
key.is_dynamic: 1
71+
key.column: 8
7372
}
74-
],
75-
key.is_test_candidate: 1
73+
]
7674
},
7775
{
7876
key.kind: source.lang.swift.decl.class,
@@ -84,7 +82,7 @@
8482
{
8583
key.kind: source.lang.swift.ref.class,
8684
key.name: "XCTestCase",
87-
key.usr: "s:23index_is_test_candidate10XCTestCaseC",
85+
key.usr: "s:C28index_is_test_candidate_objc10XCTestCase",
8886
key.line: 20,
8987
key.column: 24
9088
}
@@ -93,7 +91,7 @@
9391
{
9492
key.kind: source.lang.swift.ref.class,
9593
key.name: "XCTestCase",
96-
key.usr: "s:23index_is_test_candidate10XCTestCaseC",
94+
key.usr: "s:C28index_is_test_candidate_objc10XCTestCase",
9795
key.line: 20,
9896
key.column: 24
9997
},
@@ -102,16 +100,14 @@
102100
key.name: "doesNotStartWithTest()",
103101
key.usr: "s:23index_is_test_candidate7MyClassC20doesNotStartWithTestyyF",
104102
key.line: 21,
105-
key.column: 8,
106-
key.is_dynamic: 1
103+
key.column: 8
107104
},
108105
{
109106
key.kind: source.lang.swift.decl.function.method.instance,
110107
key.name: "test_startsWithTest_butTakesAParam(param:)",
111108
key.usr: "s:23index_is_test_candidate7MyClassC0C30_startsWithTest_butTakesAParamySi5param_tF",
112109
key.line: 22,
113110
key.column: 8,
114-
key.is_dynamic: 1,
115111
key.entities: [
116112
{
117113
key.kind: source.lang.swift.ref.struct,
@@ -128,7 +124,6 @@
128124
key.usr: "s:23index_is_test_candidate7MyClassC0C50_startsWithTest_andTakesNoParams_butReturnsNonVoidSiyF",
129125
key.line: 23,
130126
key.column: 8,
131-
key.is_dynamic: 1,
132127
key.entities: [
133128
{
134129
key.kind: source.lang.swift.ref.struct,
@@ -144,16 +139,14 @@
144139
key.name: "test_startsWithTest_takesNoParams_andReturnsVoid_butIsPrivate()",
145140
key.usr: "s:23index_is_test_candidate7MyClassC0C57_startsWithTest_takesNoParams_andReturnsVoid_butIsPrivate33_E06F4E7BC5F577AB6E2EC6D3ECA1C8B9LLyyF",
146141
key.line: 24,
147-
key.column: 16,
148-
key.is_dynamic: 1
142+
key.column: 16
149143
},
150144
{
151145
key.kind: source.lang.swift.decl.function.method.instance,
152146
key.name: "test_startsWithTest_takesNoParams_returnsVoid()",
153147
key.usr: "s:23index_is_test_candidate7MyClassC0C41_startsWithTest_takesNoParams_returnsVoidyyF",
154148
key.line: 25,
155149
key.column: 8,
156-
key.is_dynamic: 1,
157150
key.is_test_candidate: 1
158151
},
159152
{
@@ -162,11 +155,9 @@
162155
key.usr: "s:23index_is_test_candidate7MyClassC0C51_startsWithTest_takesNoParams_returnsVoid_andThrowsyyKF",
163156
key.line: 26,
164157
key.column: 8,
165-
key.is_dynamic: 1,
166158
key.is_test_candidate: 1
167159
}
168-
],
169-
key.is_test_candidate: 1
160+
]
170161
}
171162
]
172163
}

Diff for: test/SourceKit/lit.local.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if 'sourcekit' not in config.available_features:
1+
if 'OS=macosx' not in config.available_features:
22
config.unsupported = True
33

44
else:

Diff for: test/lit.site.cfg.in

-3
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ if "@CMAKE_GENERATOR@" == "Xcode":
8383

8484
config.available_features.add("CMAKE_GENERATOR=@CMAKE_GENERATOR@")
8585

86-
if "@SWIFT_ENABLE_SOURCEKIT_TESTS@" == "TRUE":
87-
config.available_features.add('sourcekit')
88-
8986
# Let the main config do the real work.
9087
if config.test_exec_root is None:
9188
config.test_exec_root = os.path.dirname(os.path.realpath(__file__))

Diff for: tools/SourceKit/lib/SwiftLang/SwiftDocSupport.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -762,9 +762,8 @@ class DocSyntaxWalker : public SyntaxModelWalker {
762762
};
763763
} // end anonymous namespace
764764

765-
static bool makeParserAST(CompilerInstance &CI, StringRef Text,
766-
CompilerInvocation Invocation) {
767-
Invocation.clearInputs();
765+
static bool makeParserAST(CompilerInstance &CI, StringRef Text) {
766+
CompilerInvocation Invocation;
768767
Invocation.setModuleName("main");
769768
Invocation.setInputKind(InputFileKind::IFK_Swift);
770769

@@ -975,7 +974,7 @@ static bool reportModuleDocInfo(CompilerInvocation Invocation,
975974
return true;
976975

977976
CompilerInstance ParseCI;
978-
if (makeParserAST(ParseCI, IFaceInfo.Text, Invocation))
977+
if (makeParserAST(ParseCI, IFaceInfo.Text))
979978
return true;
980979
addParameterEntities(ParseCI, IFaceInfo);
981980

Diff for: tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp

+9-18
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,8 @@ class DocSyntaxWalker : public SyntaxModelWalker {
225225

226226
} // end anonymous namespace
227227

228-
static bool makeParserAST(CompilerInstance &CI, StringRef Text,
229-
CompilerInvocation Invocation) {
230-
Invocation.clearInputs();
228+
static bool makeParserAST(CompilerInstance &CI, StringRef Text) {
229+
CompilerInvocation Invocation;
231230
Invocation.setModuleName("main");
232231
Invocation.setInputKind(InputFileKind::IFK_Swift);
233232

@@ -359,7 +358,6 @@ SwiftInterfaceGenContextRef
359358
SwiftInterfaceGenContext::createForSwiftSource(StringRef DocumentName,
360359
StringRef SourceFileName,
361360
ASTUnitRef AstUnit,
362-
CompilerInvocation Invocation,
363361
std::string &ErrMsg) {
364362
SwiftInterfaceGenContextRef IFaceGenCtx{ new SwiftInterfaceGenContext() };
365363
IFaceGenCtx->Impl.DocumentName = DocumentName;
@@ -373,8 +371,7 @@ SwiftInterfaceGenContext::createForSwiftSource(StringRef DocumentName,
373371
AnnotatingPrinter Printer(IFaceGenCtx->Impl.Info, OS);
374372
printSwiftSourceInterface(AstUnit->getPrimarySourceFile(), Printer, Options);
375373
IFaceGenCtx->Impl.Info.Text = OS.str();
376-
if (makeParserAST(IFaceGenCtx->Impl.TextCI, IFaceGenCtx->Impl.Info.Text,
377-
Invocation)) {
374+
if (makeParserAST(IFaceGenCtx->Impl.TextCI, IFaceGenCtx->Impl.Info.Text)) {
378375
ErrMsg = "Error during syntactic parsing";
379376
return nullptr;
380377
}
@@ -437,8 +434,7 @@ SwiftInterfaceGenContext::create(StringRef DocumentName,
437434
return nullptr;
438435
}
439436

440-
if (makeParserAST(IFaceGenCtx->Impl.TextCI, IFaceGenCtx->Impl.Info.Text,
441-
Invocation)) {
437+
if (makeParserAST(IFaceGenCtx->Impl.TextCI, IFaceGenCtx->Impl.Info.Text)) {
442438
ErrMsg = "Error during syntactic parsing";
443439
return nullptr;
444440
}
@@ -486,8 +482,7 @@ SwiftInterfaceGenContext::createForTypeInterface(CompilerInvocation Invocation,
486482
IFaceGenCtx->Impl.DocumentName, ErrorMsg))
487483
return nullptr;
488484
IFaceGenCtx->Impl.Info.Text = OS.str();
489-
if (makeParserAST(IFaceGenCtx->Impl.TextCI, IFaceGenCtx->Impl.Info.Text,
490-
Invocation)) {
485+
if (makeParserAST(IFaceGenCtx->Impl.TextCI, IFaceGenCtx->Impl.Info.Text)) {
491486
ErrorMsg = "Error during syntactic parsing";
492487
return nullptr;
493488
}
@@ -743,26 +738,22 @@ class PrimaryFileInterfaceConsumer : public SwiftASTConsumer {
743738
std::string SourceFileName;
744739
SwiftInterfaceGenMap &Contexts;
745740
std::shared_ptr<EditorConsumer> Consumer;
746-
SwiftInvocationRef ASTInvok;
747741

748742
public:
749743
PrimaryFileInterfaceConsumer(StringRef Name, StringRef SourceFileName,
750744
SwiftInterfaceGenMap &Contexts,
751-
std::shared_ptr<EditorConsumer> Consumer,
752-
SwiftInvocationRef ASTInvok) :
745+
std::shared_ptr<EditorConsumer> Consumer) :
753746
Name(Name), SourceFileName(SourceFileName), Contexts(Contexts),
754-
Consumer(Consumer), ASTInvok(ASTInvok) {}
747+
Consumer(Consumer) {}
755748

756749
void failed(StringRef Error) override {
757750
Consumer->handleRequestError(Error.data());
758751
}
759752

760753
void handlePrimaryAST(ASTUnitRef AstUnit) override {
761-
CompilerInvocation CompInvok;
762-
ASTInvok->applyTo(CompInvok);
763754
std::string Error;
764755
auto IFaceGenRef = SwiftInterfaceGenContext::createForSwiftSource(Name,
765-
SourceFileName, AstUnit, CompInvok, Error);
756+
SourceFileName, AstUnit, Error);
766757
if (!Error.empty())
767758
Consumer->handleRequestError(Error.data());
768759
Contexts.set(Name, IFaceGenRef);
@@ -791,7 +782,7 @@ void SwiftLangSupport::editorOpenSwiftSourceInterface(StringRef Name,
791782
std::make_pair("SourceName", SourceName)});
792783
}
793784
auto AstConsumer = std::make_shared<PrimaryFileInterfaceConsumer>(Name,
794-
SourceName, IFaceGenContexts, Consumer, Invocation);
785+
SourceName, IFaceGenContexts, Consumer);
795786
static const char OncePerASTToken = 0;
796787
getASTManager().processASTAsync(Invocation, AstConsumer, &OncePerASTToken);
797788
}

Diff for: tools/SourceKit/lib/SwiftLang/SwiftInterfaceGenContext.h

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class SwiftInterfaceGenContext :
5050
static SwiftInterfaceGenContextRef createForSwiftSource(StringRef DocumentName,
5151
StringRef SourceFileName,
5252
ASTUnitRef AstUnit,
53-
swift::CompilerInvocation Invocation,
5453
std::string &ErrMsg);
5554

5655
~SwiftInterfaceGenContext();

Diff for: tools/SourceKit/tools/sourcekitd/bin/InProc/CMakeLists.txt

+7-15
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,13 @@ set(sourcekitdInProc_args
1010
)
1111

1212
if (SOURCEKIT_INSTALLING_INPROC)
13-
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
14-
add_sourcekit_framework(sourcekitdInProc
15-
${SOURCEKITD_SOURCE_DIR}/include/sourcekitd/sourcekitd.h
16-
${sourcekitdInProc_args}
17-
MODULEMAP module.modulemap
18-
INSTALL_IN_COMPONENT sourcekit-inproc
19-
)
20-
set_property(TARGET sourcekitdInProc APPEND_STRING PROPERTY LINK_FLAGS " -fapplication-extension")
21-
else()
22-
add_sourcekit_library(sourcekitdInProc
23-
${sourcekitdInProc_args}
24-
INSTALL_IN_COMPONENT sourcekit-inproc
25-
SHARED
26-
)
27-
endif()
13+
add_sourcekit_framework(sourcekitdInProc
14+
${SOURCEKITD_SOURCE_DIR}/include/sourcekitd/sourcekitd.h
15+
${sourcekitdInProc_args}
16+
MODULEMAP module.modulemap
17+
INSTALL_IN_COMPONENT sourcekit-inproc
18+
)
19+
set_property(TARGET sourcekitdInProc APPEND_STRING PROPERTY LINK_FLAGS " -fapplication-extension")
2820
else()
2921
add_sourcekit_library(sourcekitdInProc
3022
${sourcekitdInProc_args}

Diff for: tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-InProc.cpp

-17
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "sourcekitd/sourcekitd.h"
1515
#include "sourcekitd/Internal.h"
1616
#include "sourcekitd/CodeCompletionResultsArray.h"
17-
#include "sourcekitd/DocStructureArray.h"
1817
#include "sourcekitd/DocSupportAnnotationArray.h"
1918
#include "sourcekitd/TokenAnnotationsArray.h"
2019
#include "sourcekitd/Logging.h"
@@ -250,10 +249,6 @@ class SKDCustomData: public SKDObject {
250249
case CustomBufferKind::TokenAnnotationsArray:
251250
case CustomBufferKind::DocSupportAnnotationArray:
252251
case CustomBufferKind::CodeCompletionResultsArray:
253-
case CustomBufferKind::DocStructureArray:
254-
case CustomBufferKind::InheritedTypesArray:
255-
case CustomBufferKind::DocStructureElementArray:
256-
case CustomBufferKind::AttributesArray:
257252
return SOURCEKITD_VARIANT_TYPE_ARRAY;
258253
}
259254
llvm::report_fatal_error("sourcekitd object did not resolve to a known type");
@@ -932,18 +927,6 @@ static sourcekitd_variant_t variantFromSKDObject(SKDObjectRef Object) {
932927
case CustomBufferKind::CodeCompletionResultsArray:
933928
return {{ (uintptr_t)getVariantFunctionsForCodeCompletionResultsArray(),
934929
(uintptr_t)DataObject->getDataPtr(), 0 }};
935-
case CustomBufferKind::DocStructureArray:
936-
return {{ (uintptr_t)getVariantFunctionsForDocStructureArray(),
937-
(uintptr_t)DataObject->getDataPtr(), ~size_t(0) }};
938-
case CustomBufferKind::InheritedTypesArray:
939-
return {{ (uintptr_t)getVariantFunctionsForInheritedTypesArray(),
940-
(uintptr_t)DataObject->getDataPtr(), 0 }};
941-
case CustomBufferKind::DocStructureElementArray:
942-
return {{ (uintptr_t)getVariantFunctionsForDocStructureElementArray(),
943-
(uintptr_t)DataObject->getDataPtr(), 0 }};
944-
case CustomBufferKind::AttributesArray:
945-
return {{ (uintptr_t)getVariantFunctionsForAttributesArray(),
946-
(uintptr_t)DataObject->getDataPtr(), 0 }};
947930
}
948931
}
949932

0 commit comments

Comments
 (0)