Replace a few more MachO only uses of getSymbolAddress.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241365 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2015-07-03 18:02:36 +00:00
parent e235dc4936
commit 115b2eb8bf
3 changed files with 8 additions and 12 deletions

View File

@@ -34,7 +34,7 @@ public:
if (std::error_code EC = SymNameOrErr.getError()) if (std::error_code EC = SymNameOrErr.getError())
report_fatal_error(EC.message()); report_fatal_error(EC.message());
StringRef SymName = *SymNameOrErr; StringRef SymName = *SymNameOrErr;
uint64_t SymAddr; SymI->getAddress(SymAddr); uint64_t SymAddr = SymI->getValue();
any_relocation_info RE = Obj->getRelocation(Rel.getRawDataRefImpl()); any_relocation_info RE = Obj->getRelocation(Rel.getRawDataRefImpl());
bool isPCRel = Obj->getAnyRelocationPCRel(RE); bool isPCRel = Obj->getAnyRelocationPCRel(RE);
@@ -90,8 +90,7 @@ public:
const MCExpr *LHS = MCSymbolRefExpr::create(Sym, Ctx); const MCExpr *LHS = MCSymbolRefExpr::create(Sym, Ctx);
symbol_iterator RSymI = Rel.getSymbol(); symbol_iterator RSymI = Rel.getSymbol();
uint64_t RSymAddr; uint64_t RSymAddr = RSymI->getValue();
RSymI->getAddress(RSymAddr);
ErrorOr<StringRef> RSymName = RSymI->getName(); ErrorOr<StringRef> RSymName = RSymI->getName();
if (std::error_code EC = RSymName.getError()) if (std::error_code EC = RSymName.getError())
report_fatal_error(EC.message()); report_fatal_error(EC.message());

View File

@@ -216,9 +216,7 @@ MappingTraits<dsymutil::DebugMapObject>::YamlDMO::denormalize(IO &IO) {
// during the test, we can't hardcode the symbols addresses, so // during the test, we can't hardcode the symbols addresses, so
// look them up here and rewrite them. // look them up here and rewrite them.
for (const auto &Sym : ErrOrObjectFile->symbols()) { for (const auto &Sym : ErrOrObjectFile->symbols()) {
uint64_t Address; uint64_t Address = Sym.getValue();
if (Sym.getAddress(Address))
continue;
ErrorOr<StringRef> Name = Sym.getName(); ErrorOr<StringRef> Name = Sym.getName();
if (!Name) if (!Name)
continue; continue;

View File

@@ -198,8 +198,8 @@ void MachODebugMapParser::loadCurrentObjectFileSymbols() {
for (auto Sym : CurrentObjectHolder.Get().symbols()) { for (auto Sym : CurrentObjectHolder.Get().symbols()) {
uint64_t Addr; uint64_t Addr = Sym.getValue();
if (Sym.getAddress(Addr) || Addr == UnknownAddress) if (Addr == UnknownAddress)
continue; continue;
ErrorOr<StringRef> Name = Sym.getName(); ErrorOr<StringRef> Name = Sym.getName();
if (!Name) if (!Name)
@@ -228,14 +228,13 @@ void MachODebugMapParser::loadMainBinarySymbols() {
// Skip undefined and STAB entries. // Skip undefined and STAB entries.
if ((Type & SymbolRef::ST_Debug) || (Type & SymbolRef::ST_Unknown)) if ((Type & SymbolRef::ST_Debug) || (Type & SymbolRef::ST_Unknown))
continue; continue;
uint64_t Addr; uint64_t Addr = Sym.getValue();
// The only symbols of interest are the global variables. These // The only symbols of interest are the global variables. These
// are the only ones that need to be queried because the address // 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 // of common data won't be described in the debug map. All other
// addresses should be fetched for the debug map. // addresses should be fetched for the debug map.
if (Sym.getAddress(Addr) || Addr == UnknownAddress || if (Addr == UnknownAddress || !(Sym.getFlags() & SymbolRef::SF_Global) ||
!(Sym.getFlags() & SymbolRef::SF_Global) || Sym.getSection(Section) || Sym.getSection(Section) || Section->isText())
Section->isText())
continue; continue;
ErrorOr<StringRef> NameOrErr = Sym.getName(); ErrorOr<StringRef> NameOrErr = Sym.getName();
if (!NameOrErr) if (!NameOrErr)