summaryrefslogtreecommitdiffstats
path: root/llvm/tools/dsymutil/MachODebugMapParser.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-08-07 23:27:14 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-08-07 23:27:14 +0000
commit8bab889b0f271665239fa1a7546a49f221ce4ac7 (patch)
treeb573c2c60588c1566182c94733f38aca1b8be07b /llvm/tools/dsymutil/MachODebugMapParser.cpp
parenteeebc41b580cc5d77f22da312a8d413f96c63edd (diff)
downloadbcm5719-llvm-8bab889b0f271665239fa1a7546a49f221ce4ac7.tar.gz
bcm5719-llvm-8bab889b0f271665239fa1a7546a49f221ce4ac7.zip
Convert getSymbolSection to return an ErrorOr.
This function can actually fail since the symbol contains an index to the section and that can be invalid. llvm-svn: 244375
Diffstat (limited to 'llvm/tools/dsymutil/MachODebugMapParser.cpp')
-rw-r--r--llvm/tools/dsymutil/MachODebugMapParser.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp
index cd427cb1d94..bd29f004b09 100644
--- a/llvm/tools/dsymutil/MachODebugMapParser.cpp
+++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp
@@ -265,8 +265,13 @@ void MachODebugMapParser::loadMainBinarySymbols(
// 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.getFlags() & SymbolRef::SF_Global) || Sym.getSection(Section) ||
- Section == MainBinary.section_end() || Section->isText())
+ if (!(Sym.getFlags() & SymbolRef::SF_Global))
+ continue;
+ ErrorOr<section_iterator> SectionOrErr = Sym.getSection();
+ if (!SectionOrErr)
+ continue;
+ Section = *SectionOrErr;
+ if (Section == MainBinary.section_end() || Section->isText())
continue;
uint64_t Addr = Sym.getValue();
ErrorOr<StringRef> NameOrErr = Sym.getName();
OpenPOWER on IntegriCloud