Change how symbol sizes are handled in lib/Object.
COFF and MachO only define symbol sizes for common symbols. Reflect that
in the class hierarchy by having a method for common symbols only in the base
and a general one in ELF.
This avoids the need of using a magic value for the size, which had a few
problems
* Most callers didn't check for it.
* The ones that did could not tell the magic value from a file actually having
that value.
llvm-svn: 240529
diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp
index b803e41..b1e6abc 100644
--- a/llvm/tools/dsymutil/MachODebugMapParser.cpp
+++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp
@@ -160,7 +160,7 @@
// symbol table to find its address as it might not be in the
// debug map (for common symbols).
Value = getMainBinarySymbolAddress(Name);
- if (Value == UnknownAddressOrSize)
+ if (Value == UnknownAddress)
return;
break;
case MachO::N_FUN:
@@ -199,8 +199,7 @@
for (auto Sym : CurrentObjectHolder.Get().symbols()) {
StringRef Name;
uint64_t Addr;
- if (Sym.getAddress(Addr) || Addr == UnknownAddressOrSize ||
- Sym.getName(Name))
+ if (Sym.getAddress(Addr) || Addr == UnknownAddress || Sym.getName(Name))
continue;
CurrentObjectAddresses[Name] = Addr;
}
@@ -212,7 +211,7 @@
uint64_t MachODebugMapParser::getMainBinarySymbolAddress(StringRef Name) {
auto Sym = MainBinarySymbolAddresses.find(Name);
if (Sym == MainBinarySymbolAddresses.end())
- return UnknownAddressOrSize;
+ return UnknownAddress;
return Sym->second;
}
@@ -233,7 +232,7 @@
// are the only ones that need to be queried because the address
// of common data won't be described in the debug map. All other
// addresses should be fetched for the debug map.
- if (Sym.getAddress(Addr) || Addr == UnknownAddressOrSize ||
+ if (Sym.getAddress(Addr) || Addr == UnknownAddress ||
!(Sym.getFlags() & SymbolRef::SF_Global) || Sym.getSection(Section) ||
Section->isText() || Sym.getName(Name) || Name.size() == 0 ||
Name[0] == '\0')