From 115b2eb8bf50a09a2999efc560baacdfb1715990 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 3 Jul 2015 18:02:36 +0000 Subject: [PATCH] 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 --- .../X86/MCTargetDesc/X86MachORelocationInfo.cpp | 5 ++--- tools/dsymutil/DebugMap.cpp | 4 +--- tools/dsymutil/MachODebugMapParser.cpp | 11 +++++------ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp b/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp index c9479b62f7b..9bfe999424f 100644 --- a/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp +++ b/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp @@ -34,7 +34,7 @@ public: if (std::error_code EC = SymNameOrErr.getError()) report_fatal_error(EC.message()); StringRef SymName = *SymNameOrErr; - uint64_t SymAddr; SymI->getAddress(SymAddr); + uint64_t SymAddr = SymI->getValue(); any_relocation_info RE = Obj->getRelocation(Rel.getRawDataRefImpl()); bool isPCRel = Obj->getAnyRelocationPCRel(RE); @@ -90,8 +90,7 @@ public: const MCExpr *LHS = MCSymbolRefExpr::create(Sym, Ctx); symbol_iterator RSymI = Rel.getSymbol(); - uint64_t RSymAddr; - RSymI->getAddress(RSymAddr); + uint64_t RSymAddr = RSymI->getValue(); ErrorOr RSymName = RSymI->getName(); if (std::error_code EC = RSymName.getError()) report_fatal_error(EC.message()); diff --git a/tools/dsymutil/DebugMap.cpp b/tools/dsymutil/DebugMap.cpp index cc7c0dc778b..e5cc87b3f31 100644 --- a/tools/dsymutil/DebugMap.cpp +++ b/tools/dsymutil/DebugMap.cpp @@ -216,9 +216,7 @@ MappingTraits::YamlDMO::denormalize(IO &IO) { // during the test, we can't hardcode the symbols addresses, so // look them up here and rewrite them. for (const auto &Sym : ErrOrObjectFile->symbols()) { - uint64_t Address; - if (Sym.getAddress(Address)) - continue; + uint64_t Address = Sym.getValue(); ErrorOr Name = Sym.getName(); if (!Name) continue; diff --git a/tools/dsymutil/MachODebugMapParser.cpp b/tools/dsymutil/MachODebugMapParser.cpp index c58545aec99..bec95915a0f 100644 --- a/tools/dsymutil/MachODebugMapParser.cpp +++ b/tools/dsymutil/MachODebugMapParser.cpp @@ -198,8 +198,8 @@ void MachODebugMapParser::loadCurrentObjectFileSymbols() { for (auto Sym : CurrentObjectHolder.Get().symbols()) { - uint64_t Addr; - if (Sym.getAddress(Addr) || Addr == UnknownAddress) + uint64_t Addr = Sym.getValue(); + if (Addr == UnknownAddress) continue; ErrorOr Name = Sym.getName(); if (!Name) @@ -228,14 +228,13 @@ void MachODebugMapParser::loadMainBinarySymbols() { // Skip undefined and STAB entries. if ((Type & SymbolRef::ST_Debug) || (Type & SymbolRef::ST_Unknown)) continue; - uint64_t Addr; + uint64_t Addr = Sym.getValue(); // The only symbols of interest are the global variables. These // 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 == UnknownAddress || - !(Sym.getFlags() & SymbolRef::SF_Global) || Sym.getSection(Section) || - Section->isText()) + if (Addr == UnknownAddress || !(Sym.getFlags() & SymbolRef::SF_Global) || + Sym.getSection(Section) || Section->isText()) continue; ErrorOr NameOrErr = Sym.getName(); if (!NameOrErr)