forked from OSchip/llvm-project
Add a symbols() range and use a range loop.
llvm-svn: 211222
This commit is contained in:
parent
794112a91f
commit
1fe2c5ab27
|
@ -136,6 +136,10 @@ public:
|
||||||
basic_symbol_iterator symbol_end() const {
|
basic_symbol_iterator symbol_end() const {
|
||||||
return symbol_end_impl();
|
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.
|
// construction aux.
|
||||||
static ErrorOr<SymbolicFile *> createIRObjectFile(MemoryBuffer *Object,
|
static ErrorOr<SymbolicFile *> createIRObjectFile(MemoryBuffer *Object,
|
||||||
|
|
|
@ -710,17 +710,15 @@ static void writeSymbolTable(
|
||||||
print32BE(Out, 0);
|
print32BE(Out, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (object::basic_symbol_iterator I = Obj->symbol_begin(),
|
for (const object::BasicSymbolRef &S : Obj->symbols()) {
|
||||||
E = Obj->symbol_end();
|
uint32_t Symflags = S.getFlags();
|
||||||
I != E; ++I) {
|
|
||||||
uint32_t Symflags = I->getFlags();
|
|
||||||
if (Symflags & object::SymbolRef::SF_FormatSpecific)
|
if (Symflags & object::SymbolRef::SF_FormatSpecific)
|
||||||
continue;
|
continue;
|
||||||
if (!(Symflags & object::SymbolRef::SF_Global))
|
if (!(Symflags & object::SymbolRef::SF_Global))
|
||||||
continue;
|
continue;
|
||||||
if (Symflags & object::SymbolRef::SF_Undefined)
|
if (Symflags & object::SymbolRef::SF_Undefined)
|
||||||
continue;
|
continue;
|
||||||
failIfError(I->printName(NameOS));
|
failIfError(S.printName(NameOS));
|
||||||
NameOS << '\0';
|
NameOS << '\0';
|
||||||
++NumSyms;
|
++NumSyms;
|
||||||
MemberOffsetRefs.push_back(std::make_pair(Out.tell(), MemberNum));
|
MemberOffsetRefs.push_back(std::make_pair(Out.tell(), MemberNum));
|
||||||
|
|
Loading…
Reference in New Issue