diff options
| author | Cyndy Ishida <cyndy_ishida@apple.com> | 2023-07-24 11:55:01 -0700 |
|---|---|---|
| committer | Cyndy Ishida <cyndy_ishida@apple.com> | 2023-07-24 12:01:25 -0700 |
| commit | 0882c70df222a89c15f2776b85a60696e6ecd712 (patch) | |
| tree | 967b31d8485722b578adc53f7a011471054af14a /llvm/lib/TextAPI/InterfaceFile.cpp | |
| parent | 23821568f6b9faec12a1cc1c046c69eb2cad5047 (diff) | |
[TextAPI] Introduce SymbolSet
SymbolSet is a structure that acts as a simple container class for exported symbols that
belong to a library interface. It allows tapi to decouple the globals
from the other library attributes. It's uniqued by symbol name and `kind`, which all contain their assigned target triples.
Reviewed By: zixuw
Differential Revision: https://reviews.llvm.org/D149860
Diffstat (limited to 'llvm/lib/TextAPI/InterfaceFile.cpp')
| -rw-r--r-- | llvm/lib/TextAPI/InterfaceFile.cpp | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/llvm/lib/TextAPI/InterfaceFile.cpp b/llvm/lib/TextAPI/InterfaceFile.cpp index 8c0b65916026..bb98c92f7178 100644 --- a/llvm/lib/TextAPI/InterfaceFile.cpp +++ b/llvm/lib/TextAPI/InterfaceFile.cpp @@ -17,31 +17,6 @@ using namespace llvm; using namespace llvm::MachO; -namespace { -template <typename C> -typename C::iterator addEntry(C &Container, StringRef InstallName) { - auto I = partition_point(Container, [=](const InterfaceFileRef &O) { - return O.getInstallName() < InstallName; - }); - if (I != Container.end() && I->getInstallName() == InstallName) - return I; - - return Container.emplace(I, InstallName); -} - -template <typename C> -typename C::iterator addEntry(C &Container, const Target &Target_) { - auto Iter = - lower_bound(Container, Target_, [](const Target &LHS, const Target &RHS) { - return LHS < RHS; - }); - if ((Iter != std::end(Container)) && !(Target_ < *Iter)) - return Iter; - - return Container.insert(Iter, Target_); -} -} // end namespace - void InterfaceFileRef::addTarget(const Target &Target) { addEntry(Targets, Target); } @@ -120,17 +95,6 @@ InterfaceFile::targets(ArchitectureSet Archs) const { return make_filter_range(Targets, fn); } -void InterfaceFile::addSymbol(SymbolKind Kind, StringRef Name, - const TargetList &Targets, SymbolFlags Flags) { - Name = copyString(Name); - auto result = Symbols.try_emplace(SymbolsMapKey{Kind, Name}, nullptr); - if (result.second) - result.first->second = new (Allocator) Symbol{Kind, Name, Targets, Flags}; - else - for (const auto &Target : Targets) - result.first->second->addTarget(Target); -} - void InterfaceFile::addDocument(std::shared_ptr<InterfaceFile> &&Document) { auto Pos = llvm::lower_bound(Documents, Document, [](const std::shared_ptr<InterfaceFile> &LHS, @@ -167,7 +131,7 @@ bool InterfaceFile::operator==(const InterfaceFile &O) const { return false; if (ReexportedLibraries != O.ReexportedLibraries) return false; - if (Symbols != O.Symbols) + if (*SymbolsSet != *O.SymbolsSet) return false; // Don't compare run search paths for older filetypes that cannot express // them. |
