Add a symbols() range and use a range loop.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211222 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-06-18 21:14:57 +00:00
parent d8fc64e0d1
commit 6c59006684
2 changed files with 7 additions and 5 deletions

View File

@ -136,6 +136,10 @@ public:
basic_symbol_iterator symbol_end() const {
return symbol_end_impl();
}
typedef iterator_range<basic_symbol_iterator> basic_symbol_iterator_range;
basic_symbol_iterator_range symbols() const {
return basic_symbol_iterator_range(symbol_begin(), symbol_end());
}
// construction aux.
static ErrorOr<SymbolicFile *> createIRObjectFile(MemoryBuffer *Object,

View File

@ -710,17 +710,15 @@ static void writeSymbolTable(
print32BE(Out, 0);
}
for (object::basic_symbol_iterator I = Obj->symbol_begin(),
E = Obj->symbol_end();
I != E; ++I) {
uint32_t Symflags = I->getFlags();
for (const object::BasicSymbolRef &S : Obj->symbols()) {
uint32_t Symflags = S.getFlags();
if (Symflags & object::SymbolRef::SF_FormatSpecific)
continue;
if (!(Symflags & object::SymbolRef::SF_Global))
continue;
if (Symflags & object::SymbolRef::SF_Undefined)
continue;
failIfError(I->printName(NameOS));
failIfError(S.printName(NameOS));
NameOS << '\0';
++NumSyms;
MemberOffsetRefs.push_back(std::make_pair(Out.tell(), MemberNum));