]> granicus.if.org Git - llvm/commitdiff
[Object] Return a symbol_iterator, rather than a basic_symbol_iterator, from
authorLang Hames <lhames@gmail.com>
Mon, 14 Jan 2019 22:05:12 +0000 (22:05 +0000)
committerLang Hames <lhames@gmail.com>
Mon, 14 Jan 2019 22:05:12 +0000 (22:05 +0000)
MachOObjectFile::getSymbolByIndex.

ObjectFile derivatives should prefer symbol_iterator/SymbolRef over
basic_symbol_iterator/BasicSymbolRef where possible, as the former
retain their link to the ObjectFile (rather than a SymbolicFile) and provide
more functionality.

No test for this: Existing code is working, and we don't have (m)any libObject
unit tests. I'll think about how we can test more systematically going forward.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351128 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Object/MachO.h
lib/Object/MachOObjectFile.cpp

index 09e0a78de44465d777082f0848e7d775853fcbcd..c2f4f4062934914139249d5284e468af0d97527c 100644 (file)
@@ -356,7 +356,7 @@ public:
   basic_symbol_iterator symbol_end() const override;
 
   // MachO specific.
-  basic_symbol_iterator getSymbolByIndex(unsigned Index) const;
+  symbol_iterator getSymbolByIndex(unsigned Index) const;
   uint64_t getSymbolIndex(DataRefImpl Symb) const;
 
   section_iterator section_begin() const override;
index 86f29365273eb6173849fc63ee3b6e1c403835b2..ce4d1cf92e207ddd3b1a1ac430f1fef13ee13194 100644 (file)
@@ -2438,7 +2438,7 @@ basic_symbol_iterator MachOObjectFile::symbol_end() const {
   return basic_symbol_iterator(SymbolRef(DRI, this));
 }
 
-basic_symbol_iterator MachOObjectFile::getSymbolByIndex(unsigned Index) const {
+symbol_iterator MachOObjectFile::getSymbolByIndex(unsigned Index) const {
   MachO::symtab_command Symtab = getSymtabLoadCommand();
   if (!SymtabLoadCmd || Index >= Symtab.nsyms)
     report_fatal_error("Requested symbol index is out of range.");