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

llvm-svn: 211222
This commit is contained in:
Rafael Espindola 2014-06-18 21:14:57 +00:00
parent 794112a91f
commit 1fe2c5ab27
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));