Skip to content

Commit fd280d7

Browse files
committed
sourcekitd-test: ignore .swiftsourcefile when invoking sourcekitd from sourcekitd-test
1 parent 52e8f3d commit fd280d7

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

test/SourceKit/CompileNotifications/arg-parsing.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// ARG_PARSE_0: {
44
// ARG_PARSE_0: key.notification: source.notification.compile-will-start
55
// ARG_PARSE_0: key.compileid: [[CID1:".*"]]
6-
// ARG_PARSE_0: key.compilerargs-string: "{{.*}}.swift -no-such-arg"
6+
// ARG_PARSE_0: key.compilerargs-string: "{{.*}}.swift -no-such-arg -Xfrontend -ignore-module-source-info"
77
// ARG_PARSE_0: }
88
// ARG_PARSE_0: {
99
// ARG_PARSE_0: key.notification: source.notification.compile-did-finish
@@ -24,7 +24,7 @@
2424
// ARG_PARSE_1: {
2525
// ARG_PARSE_1: key.notification: source.notification.compile-will-start
2626
// ARG_PARSE_1: key.compileid: [[CID1:".*"]]
27-
// ARG_PARSE_1: key.compilerargs-string: "{{.*}}.swift -no-such-arg"
27+
// ARG_PARSE_1: key.compilerargs-string: "{{.*}}.swift -no-such-arg -Xfrontend -ignore-module-source-info"
2828
// ARG_PARSE_1: }
2929
// ARG_PARSE_1: {
3030
// ARG_PARSE_1: key.notification: source.notification.compile-did-finish

tools/SourceKit/tools/sourcekitd-test/sourcekitd-test.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ static int handleTestInvocation(TestOptions Opts, TestOptions &InitOpts) {
507507
sourcekitd_object_t Req = sourcekitd_request_dictionary_create(nullptr,
508508
nullptr, 0);
509509
ActiveRequest = Opts.Request;
510+
bool ShouldIgnoreSourceInfo = true;
510511
switch (Opts.Request) {
511512
case SourceKitRequest::None:
512513
llvm::errs() << "request is not set\n";
@@ -866,6 +867,7 @@ static int handleTestInvocation(TestOptions Opts, TestOptions &InitOpts) {
866867
sourcekitd_request_dictionary_set_int64(Req, KeyUsingSwiftArgs, true);
867868
sourcekitd_request_dictionary_set_uid(Req, KeyRequest,
868869
RequestEditorOpenHeaderInterface);
870+
ShouldIgnoreSourceInfo = false;
869871
}
870872

871873
sourcekitd_request_dictionary_set_string(Req, KeyName, getInterfaceGenDocumentName().c_str());
@@ -959,6 +961,17 @@ static int handleTestInvocation(TestOptions Opts, TestOptions &InitOpts) {
959961
sourcekitd_object_t Args = sourcekitd_request_array_create(nullptr, 0);
960962
for (auto Arg : Opts.CompilerArgs)
961963
sourcekitd_request_array_set_string(Args, SOURCEKITD_ARRAY_APPEND, Arg);
964+
if (ShouldIgnoreSourceInfo) {
965+
// Ignore .swiftsourceinfo file when testing sourcekitd.
966+
// .swiftsourceinfo for stdlib will be available when sourcekitd is tested,
967+
// which may make some stdlib-depending sourcekitd tests volatile.
968+
// We cannot append the flags when the compiler arguments are for clang
969+
// invocation.
970+
sourcekitd_request_array_set_string(Args, SOURCEKITD_ARRAY_APPEND,
971+
"-Xfrontend");
972+
sourcekitd_request_array_set_string(Args, SOURCEKITD_ARRAY_APPEND,
973+
"-ignore-module-source-info");
974+
}
962975
sourcekitd_request_dictionary_set_value(Req, KeyCompilerArgs, Args);
963976
sourcekitd_request_release(Args);
964977
}

utils/gyb_sourcekit_support/UIDs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ def __init__(self, internal_name, external_name):
174174
KEY('VFSName', 'key.vfs.name'),
175175
KEY('VFSOptions', 'key.vfs.options'),
176176
KEY('Files', 'key.files'),
177-
KEY('IgnoreSourceInfoFile', 'key.ignore_source_info_file'),
178177
]
179178

180179

0 commit comments

Comments
 (0)