@@ -91,18 +91,16 @@ void WorkProcessor::ProcessWorkRequest(
9191 std::string prev_arg;
9292 for (std::string arg : request.arguments ) {
9393 std::string original_arg = arg;
94- // Peel off the `-output-file-map` argument, so we can rewrite it if
95- // necessary later.
96- if (StripPrefix (" -Xwrapped-swift=" , arg)) {
97- if (arg == " -emit-swiftsourceinfo" ) {
98- emit_swift_source_info = true ;
99- }
100- arg.clear ();
101- } else if (arg == " -output-file-map" ) {
94+
95+ // Handle arguments, in some cases we rewrite the argument entirely and in others we simply use it to determine
96+ // specific behavior.
97+ if (arg == " -output-file-map" ) {
98+ // Peel off the `-output-file-map` argument, so we can rewrite it if necessary later.
10299 arg.clear ();
103100 } else if (arg == " -dump-ast" ) {
104101 is_dump_ast = true ;
105102 } else if (prev_arg == " -output-file-map" ) {
103+ // Peel off the `-output-file-map` argument, so we can rewrite it if necessary later.
106104 output_file_map_path = arg;
107105 arg.clear ();
108106 } else if (prev_arg == " -emit-module-path" ) {
@@ -111,6 +109,8 @@ void WorkProcessor::ProcessWorkRequest(
111109 emit_objc_header_path = arg;
112110 } else if (ArgumentEnablesWMO (arg)) {
113111 is_wmo = true ;
112+ } else if (prev_arg == " -Xwrapped-swift=-emit-swiftsourceinfo" ) {
113+ emit_swift_source_info = true ;
114114 }
115115
116116 if (!arg.empty ()) {
@@ -167,7 +167,7 @@ void WorkProcessor::ProcessWorkRequest(
167167 // When using non-sandboxed mode, previous builds will contain these files and cause build failures
168168 // when Swift tries to use them, in order to work around this compatibility issue, we remove them if they are
169169 // present but not requested.
170- if (expected_object_path.extension () == " .swiftsourceinfo" && !emit_swift_source_info ) {
170+ if (!emit_swift_source_info && expected_object_path.extension () == " .swiftsourceinfo" ) {
171171 std::filesystem::remove (expected_object_path);
172172 }
173173
0 commit comments