diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-07-26 19:03:47 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-07-26 19:04:23 +0000 |
commit | 7fa27ce4a07f19b07799a767fc29416f3b625afb (patch) | |
tree | 27825c83636c4de341eb09a74f49f5d38a15d165 /llvm/lib/TextAPI/Symbol.cpp | |
parent | e3b557809604d036af6e00c60f012c2025b59a5e (diff) |
Diffstat (limited to 'llvm/lib/TextAPI/Symbol.cpp')
-rw-r--r-- | llvm/lib/TextAPI/Symbol.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/TextAPI/Symbol.cpp b/llvm/lib/TextAPI/Symbol.cpp index 041f553c66f3..20fa6362716a 100644 --- a/llvm/lib/TextAPI/Symbol.cpp +++ b/llvm/lib/TextAPI/Symbol.cpp @@ -54,5 +54,23 @@ Symbol::targets(ArchitectureSet Architectures) const { return make_filter_range(Targets, FN); } +bool Symbol::operator==(const Symbol &O) const { + // Older Tapi files do not express all these symbol flags. In those + // cases, ignore those differences. + auto RemoveFlag = [](const Symbol &Sym, SymbolFlags &Flag) { + if (Sym.isData()) + Flag &= ~SymbolFlags::Data; + if (Sym.isText()) + Flag &= ~SymbolFlags::Text; + }; + SymbolFlags LHSFlags = Flags; + SymbolFlags RHSFlags = O.Flags; + // Ignore Text and Data for now. + RemoveFlag(*this, LHSFlags); + RemoveFlag(O, RHSFlags); + return std::tie(Name, Kind, Targets, LHSFlags) == + std::tie(O.Name, O.Kind, O.Targets, RHSFlags); +} + } // end namespace MachO. } // end namespace llvm. |