diff options
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. |