@@ -507,6 +507,7 @@ static int handleTestInvocation(TestOptions Opts, TestOptions &InitOpts) {
507
507
sourcekitd_object_t Req = sourcekitd_request_dictionary_create (nullptr ,
508
508
nullptr , 0 );
509
509
ActiveRequest = Opts.Request ;
510
+ bool ShouldIgnoreSourceInfo = true ;
510
511
switch (Opts.Request ) {
511
512
case SourceKitRequest::None:
512
513
llvm::errs () << " request is not set\n " ;
@@ -866,6 +867,7 @@ static int handleTestInvocation(TestOptions Opts, TestOptions &InitOpts) {
866
867
sourcekitd_request_dictionary_set_int64 (Req, KeyUsingSwiftArgs, true );
867
868
sourcekitd_request_dictionary_set_uid (Req, KeyRequest,
868
869
RequestEditorOpenHeaderInterface);
870
+ ShouldIgnoreSourceInfo = false ;
869
871
}
870
872
871
873
sourcekitd_request_dictionary_set_string (Req, KeyName, getInterfaceGenDocumentName ().c_str ());
@@ -959,6 +961,17 @@ static int handleTestInvocation(TestOptions Opts, TestOptions &InitOpts) {
959
961
sourcekitd_object_t Args = sourcekitd_request_array_create (nullptr , 0 );
960
962
for (auto Arg : Opts.CompilerArgs )
961
963
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
+ }
962
975
sourcekitd_request_dictionary_set_value (Req, KeyCompilerArgs, Args);
963
976
sourcekitd_request_release (Args);
964
977
}
0 commit comments