@@ -213,22 +213,29 @@ void ClangImporter::recordModuleDependencies(
213
213
swiftArgs.push_back (" -Xcc" );
214
214
swiftArgs.push_back (arg.str ());
215
215
};
216
- // Add all args inheritted from creating the importer.
216
+
217
+ // Add all args inherited from creating the importer.
217
218
auto It = allArgs.begin ();
219
+
220
+ {
221
+ StringRef arg = *It;
222
+ if (arg == " clang" ||
223
+ arg.endswith (llvm::sys::path::get_separator ().str () + " clang" )) {
224
+ // Remove the initial path to clang executable argument, to avoid
225
+ // treating it as an executable input to compilation. It is not needed
226
+ // because the consumer of this command-line will invoke the emit-PCM
227
+ // action via swift-frontend.
228
+ It += 1 ;
229
+ }
230
+ }
231
+
218
232
while (It != allArgs.end ()) {
219
233
StringRef arg = *It;
220
234
// Remove the -target arguments because we should use the target triple
221
235
// specified with `-clang-target` on the scanner invocation, or
222
236
// from the depending Swift modules.
223
237
if (arg == " -target" ) {
224
238
It += 2 ;
225
- } else if (arg == " clang" ||
226
- arg.endswith (llvm::sys::path::get_separator ().str () + " clang" )) {
227
- // Remove the initial path to clang executable argument, to avoid
228
- // treating it as an executable input to compilation. It is not needed
229
- // because the consumer of this command-line will invoke the emit-PCM
230
- // action via swift-frontend.
231
- It += 1 ;
232
239
} else if (arg.startswith (" -fapinotes-swift-version=" )) {
233
240
// Remove the apinotes version because we should use the language version
234
241
// specified in the interface file.
0 commit comments