@@ -188,20 +188,6 @@ static ClangModuleDependenciesCacheImpl *getOrCreateClangImpl(
188
188
return clangImpl;
189
189
}
190
190
191
- static std::string getModuleFilePath (StringRef moduleCacheDir,
192
- StringRef moduleName,
193
- StringRef contextHash) {
194
- SmallString<128 > outputPath (moduleCacheDir);
195
- llvm::sys::path::append (outputPath, (llvm::Twine (moduleName)
196
- + " -" + contextHash + " .pcm" ).str ());
197
- return outputPath.str ().str ();
198
- }
199
-
200
- static std::string getModuleFilePath (StringRef moduleCacheDir,
201
- const ModuleDeps &dep) {
202
- return getModuleFilePath (moduleCacheDir, dep.ModuleName , dep.ContextHash );
203
- }
204
-
205
191
// / Record the module dependencies we found by scanning Clang modules into
206
192
// / the module dependencies cache.
207
193
void ClangImporter::recordModuleDependencies (
@@ -213,23 +199,7 @@ void ClangImporter::recordModuleDependencies(
213
199
};
214
200
auto ModuleCacheDir = swift::getModuleCachePathFromClang (getClangInstance ());
215
201
216
- // A map keyed by module name and context hash.
217
- llvm::StringMap<llvm::StringMap<ModuleInfo>> moduleInfoMap;
218
-
219
- // Traverse all Clang modules to populate moduleInfoMap for cross
220
- // referencing later.
221
202
for (const auto &clangModuleDep : clangDependencies.DiscoveredModules ) {
222
- moduleInfoMap[clangModuleDep.ModuleName ][clangModuleDep.ContextHash ] =
223
- {
224
- // Keep track of pcm path for output.
225
- getModuleFilePath (ModuleCacheDir, clangModuleDep),
226
- // Keep track of modulemap file for input.
227
- clangModuleDep.ClangModuleMapFile
228
- };
229
- }
230
- for (const auto &clangModuleDep : clangDependencies.DiscoveredModules ) {
231
- assert (moduleInfoMap[clangModuleDep.ModuleName ]
232
- .count (clangModuleDep.ContextHash ));
233
203
// If we've already cached this information, we're done.
234
204
if (cache.hasDependencies (clangModuleDep.ModuleName ,
235
205
ModuleDependenciesKind::Clang))
@@ -265,24 +235,11 @@ void ClangImporter::recordModuleDependencies(
265
235
addClangArg (arg);
266
236
}
267
237
268
- // Add -fmodule-map-file and -fmodule-file for direct dependencies.
269
- for (auto &dep: clangModuleDep.ClangModuleDeps ) {
270
- assert (moduleInfoMap[dep.ModuleName ].count (dep.ContextHash ));
271
- addClangArg ((llvm::Twine (" -fmodule-map-file=" )
272
- + moduleInfoMap[dep.ModuleName ][dep.ContextHash ].ModuleMapPath ).str ());
273
- addClangArg ((llvm::Twine (" -fmodule-file=" )
274
- + moduleInfoMap[dep.ModuleName ][dep.ContextHash ].PCMPath ).str ());
275
- }
276
238
// Swift frontend action: -emit-pcm
277
239
swiftArgs.push_back (" -emit-pcm" );
278
240
swiftArgs.push_back (" -module-name" );
279
241
swiftArgs.push_back (clangModuleDep.ModuleName );
280
242
281
- // Swift frontend option for output file path (Foo.pcm).
282
- swiftArgs.push_back (" -o" );
283
- swiftArgs.push_back (moduleInfoMap[clangModuleDep.ModuleName ]
284
- [clangModuleDep.ContextHash ].PCMPath );
285
-
286
243
// Swift frontend option for input file path (Foo.modulemap).
287
244
swiftArgs.push_back (clangModuleDep.ClangModuleMapFile );
288
245
// Module-level dependencies.
0 commit comments