[Dependency Scanning] Emit path to clang from PCM build command-line

It gets interpreted as just an executable we feed to the linker, since we launch `emit-pcm` actions via `swift-frontend` invocations, not `clang`.
This commit is contained in:
Artem Chikin
2021-09-29 10:43:50 -07:00
parent 14eefd1162
commit a17d5ee012
3 changed files with 10 additions and 5 deletions

View File

@@ -242,6 +242,13 @@ void ClangImporter::recordModuleDependencies(
// from the depending Swift modules.
if (arg == "-target") {
It += 2;
} else if (arg == "clang" ||
arg.endswith(llvm::sys::path::get_separator().str() + "clang")) {
// Remove the initial path to clang executable argument, to avoid
// treating it as an executable input to compilation. It is not needed
// because the consumer of this command-line will invoke the emit-PCM
// action via swift-frontend.
It += 1;
} else if (arg.startswith("-fapinotes-swift-version=")) {
// Remove the apinotes version because we should use the language version
// specified in the interface file.