@@ -610,35 +610,35 @@ Options::processAndFilterOutInstallAPIOptions(ArrayRef<const char *> Args) {
610610
611611 for (const Arg *A : ParsedArgs.filtered (OPT_allowable_client)) {
612612 auto It = ArgToArchMap.find (A);
613- LinkerOpts.AllowableClients [ A->getValue ()] =
613+ LinkerOpts.AllowableClients . getArchSet ( A->getValue ()) =
614614 It != ArgToArchMap.end () ? It->second : ArchitectureSet ();
615615 A->claim ();
616616 }
617617
618618 for (const Arg *A : ParsedArgs.filtered (OPT_reexport_l)) {
619619 auto It = ArgToArchMap.find (A);
620- LinkerOpts.ReexportedLibraries [ A->getValue ()] =
620+ LinkerOpts.ReexportedLibraries . getArchSet ( A->getValue ()) =
621621 It != ArgToArchMap.end () ? It->second : ArchitectureSet ();
622622 A->claim ();
623623 }
624624
625625 for (const Arg *A : ParsedArgs.filtered (OPT_reexport_library)) {
626626 auto It = ArgToArchMap.find (A);
627- LinkerOpts.ReexportedLibraryPaths [ A->getValue ()] =
627+ LinkerOpts.ReexportedLibraryPaths . getArchSet ( A->getValue ()) =
628628 It != ArgToArchMap.end () ? It->second : ArchitectureSet ();
629629 A->claim ();
630630 }
631631
632632 for (const Arg *A : ParsedArgs.filtered (OPT_reexport_framework)) {
633633 auto It = ArgToArchMap.find (A);
634- LinkerOpts.ReexportedFrameworks [ A->getValue ()] =
634+ LinkerOpts.ReexportedFrameworks . getArchSet ( A->getValue ()) =
635635 It != ArgToArchMap.end () ? It->second : ArchitectureSet ();
636636 A->claim ();
637637 }
638638
639639 for (const Arg *A : ParsedArgs.filtered (OPT_rpath)) {
640640 auto It = ArgToArchMap.find (A);
641- LinkerOpts.RPaths [ A->getValue ()] =
641+ LinkerOpts.RPaths . getArchSet ( A->getValue ()) =
642642 It != ArgToArchMap.end () ? It->second : ArchitectureSet ();
643643 A->claim ();
644644 }
@@ -733,9 +733,9 @@ Options::Options(DiagnosticsEngine &Diag, FileManager *FM,
733733 llvm::for_each (DriverOpts.Targets ,
734734 [&AllArchs](const auto &T) { AllArchs.set (T.first .Arch ); });
735735 auto assignDefaultLibAttrs = [&AllArchs](LibAttrs &Attrs) {
736- for (StringMapEntry<ArchitectureSet> &Entry : Attrs)
737- if (Entry. getValue () .empty ())
738- Entry. setValue ( AllArchs) ;
736+ for (auto &[_, Archs] : Attrs. get () )
737+ if (Archs .empty ())
738+ Archs = AllArchs;
739739 };
740740 assignDefaultLibAttrs (LinkerOpts.AllowableClients );
741741 assignDefaultLibAttrs (LinkerOpts.ReexportedFrameworks );
@@ -789,7 +789,7 @@ std::pair<LibAttrs, ReexportedInterfaces> Options::getReexportedLibraries() {
789789 std::unique_ptr<InterfaceFile> Reexport = std::move (*ReexportIFOrErr);
790790 StringRef InstallName = Reexport->getInstallName ();
791791 assert (!InstallName.empty () && " Parse error for install name" );
792- Reexports.insert ({ InstallName, Archs}) ;
792+ Reexports.getArchSet ( InstallName) = Archs;
793793 ReexportIFs.emplace_back (std::move (*Reexport));
794794 return true ;
795795 };
@@ -802,39 +802,36 @@ std::pair<LibAttrs, ReexportedInterfaces> Options::getReexportedLibraries() {
802802 for (const PlatformType P : Platforms) {
803803 PathSeq PlatformSearchPaths = getPathsForPlatform (FEOpts.SystemFwkPaths , P);
804804 llvm::append_range (FwkSearchPaths, PlatformSearchPaths);
805- for (const StringMapEntry<ArchitectureSet> &Lib :
806- LinkerOpts.ReexportedFrameworks ) {
807- std::string Name = (Lib.getKey () + " .framework/" + Lib.getKey ()).str ();
805+ for (const auto &[Lib, Archs] : LinkerOpts.ReexportedFrameworks .get ()) {
806+ std::string Name = (Lib + " .framework/" + Lib);
808807 std::string Path = findLibrary (Name, *FM, FwkSearchPaths, {}, {});
809808 if (Path.empty ()) {
810- Diags->Report (diag::err_cannot_find_reexport) << false << Lib. getKey () ;
809+ Diags->Report (diag::err_cannot_find_reexport) << false << Lib;
811810 return {};
812811 }
813812 if (DriverOpts.TraceLibraryLocation )
814813 errs () << Path << " \n " ;
815814
816- AccumulateReexports (Path, Lib. getValue () );
815+ AccumulateReexports (Path, Archs );
817816 }
818817 FwkSearchPaths.resize (FwkSearchPaths.size () - PlatformSearchPaths.size ());
819818 }
820819
821- for (const StringMapEntry<ArchitectureSet> &Lib :
822- LinkerOpts.ReexportedLibraries ) {
823- std::string Name = " lib" + Lib.getKey ().str () + " .dylib" ;
820+ for (const auto &[Lib, Archs] : LinkerOpts.ReexportedLibraries .get ()) {
821+ std::string Name = " lib" + Lib + " .dylib" ;
824822 std::string Path = findLibrary (Name, *FM, {}, LinkerOpts.LibPaths , {});
825823 if (Path.empty ()) {
826- Diags->Report (diag::err_cannot_find_reexport) << true << Lib. getKey () ;
824+ Diags->Report (diag::err_cannot_find_reexport) << true << Lib;
827825 return {};
828826 }
829827 if (DriverOpts.TraceLibraryLocation )
830828 errs () << Path << " \n " ;
831829
832- AccumulateReexports (Path, Lib. getValue () );
830+ AccumulateReexports (Path, Archs );
833831 }
834832
835- for (const StringMapEntry<ArchitectureSet> &Lib :
836- LinkerOpts.ReexportedLibraryPaths )
837- AccumulateReexports (Lib.getKey (), Lib.getValue ());
833+ for (const auto &[Lib, Archs] : LinkerOpts.ReexportedLibraryPaths .get ())
834+ AccumulateReexports (Lib, Archs);
838835
839836 return {std::move (Reexports), std::move (ReexportIFs)};
840837}
0 commit comments