[C++11] Introduce ObjectFile::symbols() to use range-based loops.

Reviewers: rafael

Reviewed By: rafael

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3081

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204031 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alexey Samsonov
2014-03-17 07:28:19 +00:00
parent 6e3aceffd3
commit 133aacf0dd
10 changed files with 90 additions and 90 deletions

View File

@ -296,16 +296,16 @@ static void printRelocationTargetName(const MachOObjectFile *O,
if (IsScattered) {
uint32_t Val = O->getPlainRelocationSymbolNum(RE);
for (symbol_iterator SI = O->symbol_begin(), SE = O->symbol_end();
SI != SE; ++SI) {
for (const SymbolRef &Symbol : O->symbols()) {
error_code ec;
uint64_t Addr;
StringRef Name;
if ((ec = SI->getAddress(Addr)))
if ((ec = Symbol.getAddress(Addr)))
report_fatal_error(ec.message());
if (Addr != Val) continue;
if ((ec = SI->getName(Name)))
if (Addr != Val)
continue;
if ((ec = Symbol.getName(Name)))
report_fatal_error(ec.message());
fmt << Name;
return;
@ -528,8 +528,8 @@ error_code MachOObjectFile::getSymbolSize(DataRefImpl DRI,
}
// Unfortunately symbols are unsorted so we need to touch all
// symbols from load command
for (symbol_iterator I = symbol_begin(), E = symbol_end(); I != E; ++I) {
DataRefImpl DRI = I->getRawDataRefImpl();
for (const SymbolRef &Symbol : symbols()) {
DataRefImpl DRI = Symbol.getRawDataRefImpl();
Entry = getSymbolTableEntryBase(this, DRI);
getSymbolAddress(DRI, Value);
if (Entry.n_sect == SectionIndex && Value > BeginOffset)