[llvm] r351128 - [Object] Return a symbol_iterator, rather than a basic_symbol_iterator, from
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 14 14:05:13 PST 2019
Author: lhames
Date: Mon Jan 14 14:05:12 2019
New Revision: 351128
URL: http://llvm.org/viewvc/llvm-project?rev=351128&view=rev
Log:
[Object] Return a symbol_iterator, rather than a basic_symbol_iterator, from
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.
Modified:
llvm/trunk/include/llvm/Object/MachO.h
llvm/trunk/lib/Object/MachOObjectFile.cpp
Modified: llvm/trunk/include/llvm/Object/MachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachO.h?rev=351128&r1=351127&r2=351128&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/MachO.h (original)
+++ llvm/trunk/include/llvm/Object/MachO.h Mon Jan 14 14:05:12 2019
@@ -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;
Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=351128&r1=351127&r2=351128&view=diff
==============================================================================
--- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/MachOObjectFile.cpp Mon Jan 14 14:05:12 2019
@@ -2438,7 +2438,7 @@ basic_symbol_iterator MachOObjectFile::s
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.");
More information about the llvm-commits
mailing list