@@ -440,66 +440,6 @@ ClangImporter::~ClangImporter() {
440440
441441#pragma mark Module loading
442442
443- static Optional<StringRef> getModuleMapFilePath (StringRef name,
444- SearchPathOptions &Opts,
445- llvm::Triple triple,
446- SmallVectorImpl<char > &buffer) {
447- StringRef platform = swift::getPlatformNameForTriple (triple);
448- StringRef arch = swift::getMajorArchitectureName (triple);
449-
450- StringRef SDKPath = Opts.getSDKPath ();
451- if (!SDKPath.empty ()) {
452- buffer.clear ();
453- buffer.append (SDKPath.begin (), SDKPath.end ());
454- llvm::sys::path::append (buffer, " usr" , " lib" , " swift" );
455- llvm::sys::path::append (buffer, platform, arch, name);
456-
457- // Only specify the module map if that file actually exists. It may not;
458- // for example in the case that `swiftc -target x86_64-unknown-linux-gnu
459- // -emit-ir` is invoked using a Swift compiler not built for Linux targets.
460- if (llvm::sys::fs::exists (buffer))
461- return StringRef (buffer.data (), buffer.size ());
462- }
463-
464- if (!Opts.RuntimeResourcePath .empty ()) {
465- buffer.clear ();
466- buffer.append (Opts.RuntimeResourcePath .begin (),
467- Opts.RuntimeResourcePath .end ());
468- llvm::sys::path::append (buffer, platform, arch, name);
469-
470- // Only specify the module map if that file actually exists. It may not;
471- // for example in the case that `swiftc -target x86_64-unknown-linux-gnu
472- // -emit-ir` is invoked using a Swift compiler not built for Linux targets.
473- if (llvm::sys::fs::exists (buffer))
474- return StringRef (buffer.data (), buffer.size ());
475- }
476-
477- return None;
478- }
479-
480- // / Finds the glibc.modulemap file relative to the provided resource dir.
481- // /
482- // / Note that the module map used for Glibc depends on the target we're
483- // / compiling for, and is not included in the resource directory with the other
484- // / implicit module maps. It's at {freebsd|linux}/{arch}/glibc.modulemap.
485- static Optional<StringRef>
486- getGlibcModuleMapPath (SearchPathOptions &Opts, llvm::Triple triple,
487- SmallVectorImpl<char > &buffer) {
488- return getModuleMapFilePath (" glibc.modulemap" , Opts, triple, buffer);
489- }
490-
491- static Optional<StringRef>
492- getLibStdCxxModuleMapPath (SearchPathOptions &opts, llvm::Triple triple,
493- SmallVectorImpl<char > &buffer) {
494- return getModuleMapFilePath (" libstdcxx.modulemap" , opts, triple, buffer);
495- }
496-
497- static Optional<StringRef>
498- getLibShimCxxModuleMapPath (SearchPathOptions &Opts, llvm::Triple triple,
499- SmallVectorImpl<char > &buffer) {
500- return getModuleMapFilePath (" libcxxshim.modulemap" , Opts, triple, buffer);
501- }
502-
503443static bool clangSupportsPragmaAttributeWithSwiftAttr () {
504444 clang::AttributeCommonInfo swiftAttrInfo (clang::SourceRange (),
505445 clang::AttributeCommonInfo::AT_SwiftAttr,
@@ -613,8 +553,7 @@ importer::getNormalInvocationArguments(
613553 });
614554 }
615555
616- SmallString<128 > buffer;
617- if (auto path = getLibShimCxxModuleMapPath (searchPathOpts, triple, buffer)) {
556+ if (auto path = getCxxShimModuleMapPath (searchPathOpts, triple)) {
618557 invocationArgStrs.push_back ((Twine (" -fmodule-map-file=" ) + *path).str ());
619558 }
620559
0 commit comments