|
25 | 25 | #include "clang/Tooling/DependencyScanning/DependencyScanningTool.h" |
26 | 26 | #include "llvm/ADT/STLExtras.h" |
27 | 27 | #include "llvm/Support/Allocator.h" |
28 | | -#include "llvm/Support/Error.h" |
29 | 28 | #include "llvm/Support/FileSystem.h" |
30 | 29 | #include "llvm/Support/Signals.h" |
31 | 30 | #include "llvm/Support/Path.h" |
@@ -266,34 +265,17 @@ ModuleDependencyVector ClangImporter::bridgeClangModuleDependencies( |
266 | 265 | swiftArgs.push_back(IncludeTree); |
267 | 266 | } |
268 | 267 |
|
269 | | - // Ensure we get the external path to the modulemap because it is used as an |
270 | | - // explicit input for the resulting compilation task. |
271 | | - auto moduleMapFile = |
272 | | - getClangInstance().getFileManager().getFileRef( |
273 | | - clangModuleDep.ClangModuleMapFile); |
274 | | - StringRef externalModuleMapPath; |
275 | | - if (auto E = moduleMapFile.takeError()) { |
276 | | - ctx.Diags.diagnose(SourceLoc(), |
277 | | - diag::clang_dependency_no_modulemap_fileref, |
278 | | - clangModuleDep.ClangModuleMapFile, |
279 | | - llvm::toString(std::move(E))); |
280 | | - externalModuleMapPath = clangModuleDep.ClangModuleMapFile; |
281 | | - } else |
282 | | - externalModuleMapPath = moduleMapFile.get().getName(); |
283 | | - |
284 | 268 | // Module-level dependencies. |
285 | 269 | llvm::StringSet<> alreadyAddedModules; |
286 | 270 | auto dependencies = ModuleDependencyInfo::forClangModule( |
287 | | - pcmPath, externalModuleMapPath.str(), clangModuleDep.ID.ContextHash, |
288 | | - swiftArgs, fileDeps, capturedPCMArgs, RootID, IncludeTree, |
289 | | - /*module-cache-key*/ ""); |
| 271 | + pcmPath, clangModuleDep.ClangModuleMapFile, |
| 272 | + clangModuleDep.ID.ContextHash, swiftArgs, fileDeps, capturedPCMArgs, |
| 273 | + RootID, IncludeTree, /*module-cache-key*/ ""); |
290 | 274 | for (const auto &moduleName : clangModuleDep.ClangModuleDeps) { |
291 | 275 | dependencies.addModuleImport(moduleName.ModuleName, &alreadyAddedModules); |
292 | | - // It is safe to assume that all dependencies of a Clang module are Clang |
293 | | - // modules. Doing this allows us to skip "resolving" Clang modules down |
294 | | - // the line. |
295 | | - dependencies.addModuleDependency( |
296 | | - {moduleName.ModuleName, ModuleDependencyKind::Clang}); |
| 276 | + // It is safe to assume that all dependencies of a Clang module are Clang modules. |
| 277 | + // Doing this allows us to skip "resolving" Clang modules down the line. |
| 278 | + dependencies.addModuleDependency({moduleName.ModuleName, ModuleDependencyKind::Clang}); |
297 | 279 | } |
298 | 280 | dependencies.setIsResolved(true); |
299 | 281 |
|
|
0 commit comments