Replace a few more MachO only uses of getSymbolAddress.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 3 Jul 2015 18:02:36 +0000 (18:02 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 3 Jul 2015 18:02:36 +0000 (18:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241365 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp
tools/dsymutil/DebugMap.cpp
tools/dsymutil/MachODebugMapParser.cpp

index c9479b62f7b6fb3fc02d409e5ddb11fe5396cdec..9bfe999424fa849ed076005ac8bb4aee9001d0fc 100644 (file)
@@ -34,7 +34,7 @@ public:
     if (std::error_code EC = SymNameOrErr.getError())
       report_fatal_error(EC.message());
     StringRef SymName = *SymNameOrErr;
     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);
 
     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();
         const MCExpr *LHS = MCSymbolRefExpr::create(Sym, Ctx);
 
         symbol_iterator RSymI = Rel.getSymbol();
-        uint64_t RSymAddr;
-        RSymI->getAddress(RSymAddr);
+        uint64_t RSymAddr = RSymI->getValue();
         ErrorOr<StringRef> RSymName = RSymI->getName();
         if (std::error_code EC = RSymName.getError())
           report_fatal_error(EC.message());
         ErrorOr<StringRef> RSymName = RSymI->getName();
         if (std::error_code EC = RSymName.getError())
           report_fatal_error(EC.message());
index cc7c0dc778b3a9e45892a2a21ada7ae4a4b3d17c..e5cc87b3f3181edc09cfa21db71f62bec364bb5b 100644 (file)
@@ -216,9 +216,7 @@ MappingTraits<dsymutil::DebugMapObject>::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()) {
     // 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<StringRef> Name = Sym.getName();
       if (!Name)
         continue;
       ErrorOr<StringRef> Name = Sym.getName();
       if (!Name)
         continue;
index c58545aec999e8f20d4720bd6b6e0e85a8a6a474..bec95915a0fb4c39de78262cc298de6ab2050b3f 100644 (file)
@@ -198,8 +198,8 @@ void MachODebugMapParser::loadCurrentObjectFileSymbols() {
 
   for (auto Sym : CurrentObjectHolder.Get().symbols()) {
 
 
   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<StringRef> Name = Sym.getName();
     if (!Name)
       continue;
     ErrorOr<StringRef> 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;
     // 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.
     // 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<StringRef> NameOrErr = Sym.getName();
     if (!NameOrErr)
       continue;
     ErrorOr<StringRef> NameOrErr = Sym.getName();
     if (!NameOrErr)