DenseMap<const Defined *, uint64_t> valueDelta;
ArrayRef<SymbolAnchor> sa = makeArrayRef(aux.anchors);
uint32_t delta = 0;
- for (auto it : llvm::enumerate(sec.relocations)) {
- for (; sa.size() && sa[0].offset <= it.value().offset; sa = sa.slice(1))
+ for (auto [i, r] : llvm::enumerate(sec.relocations)) {
+ for (; sa.size() && sa[0].offset <= r.offset; sa = sa.slice(1))
if (!sa[0].end)
valueDelta[sa[0].d] = delta;
- delta = aux.relocDeltas[it.index()];
+ delta = aux.relocDeltas[i];
}
for (const SymbolAnchor &sa : sa)
if (!sa.end)
std::fill_n(aux.relocTypes.get(), sec.relocations.size(), R_RISCV_NONE);
aux.writes.clear();
- for (auto it : llvm::enumerate(sec.relocations)) {
- Relocation &r = it.value();
- const size_t i = it.index();
+ for (auto [i, r] : llvm::enumerate(sec.relocations)) {
const uint64_t loc = secAddr + r.offset - delta;
uint32_t &cur = aux.relocDeltas[i], remove = 0;
switch (r.type) {
// Get the ELF sections to retrieve sh_flags. See the SHF_GROUP comment below.
ArrayRef<typename ELFT::Shdr> objSections = obj->template getELFShdrs<ELFT>();
assert(objSections.size() == obj->getSections().size());
- for (auto it : llvm::enumerate(obj->getSections())) {
- InputSectionBase *sec = it.value();
+ for (auto [i, sec] : llvm::enumerate(obj->getSections())) {
if (!sec)
continue;
else if (sec->name == ".debug_line_str")
lineStrSection = toStringRef(sec->data());
else if (sec->name == ".debug_info" &&
- !(objSections[it.index()].sh_flags & ELF::SHF_GROUP)) {
+ !(objSections[i].sh_flags & ELF::SHF_GROUP)) {
// In DWARF v5, -fdebug-types-section places type units in .debug_info
// sections in COMDAT groups. They are not compile units and thus should
// be ignored for .gdb_index/diagnostics purposes.
symbols.resize(obj->symbols().size());
// Process defined symbols first. See the comment in
// ObjFile<ELFT>::initializeSymbols.
- for (auto it : llvm::enumerate(obj->symbols()))
- if (!it.value().isUndefined()) {
- Symbol *&sym = symbols[it.index()];
- createBitcodeSymbol(sym, keptComdats, it.value(), *this);
- }
- for (auto it : llvm::enumerate(obj->symbols()))
- if (it.value().isUndefined()) {
- Symbol *&sym = symbols[it.index()];
- createBitcodeSymbol(sym, keptComdats, it.value(), *this);
- }
+ for (auto [i, irSym] : llvm::enumerate(obj->symbols()))
+ if (!irSym.isUndefined())
+ createBitcodeSymbol(symbols[i], keptComdats, irSym, *this);
+ for (auto [i, irSym] : llvm::enumerate(obj->symbols()))
+ if (irSym.isUndefined())
+ createBitcodeSymbol(symbols[i], keptComdats, irSym, *this);
for (auto l : obj->getDependentLibraries())
addDependentLibrary(l, this);
void BitcodeFile::parseLazy() {
SymbolTable &symtab = *elf::symtab;
symbols.resize(obj->symbols().size());
- for (auto it : llvm::enumerate(obj->symbols()))
- if (!it.value().isUndefined()) {
- auto *sym = symtab.insert(saver().save(it.value().getName()));
+ for (auto [i, irSym] : llvm::enumerate(obj->symbols()))
+ if (!irSym.isUndefined()) {
+ auto *sym = symtab.insert(saver().save(irSym.getName()));
sym->resolve(LazyObject{*this});
- symbols[it.index()] = sym;
+ symbols[i] = sym;
}
}
void BitcodeFile::postParse() {
- for (auto it : llvm::enumerate(obj->symbols())) {
- const Symbol &sym = *symbols[it.index()];
- const auto &objSym = it.value();
- if (sym.file == this || !sym.isDefined() || objSym.isUndefined() ||
- objSym.isCommon() || objSym.isWeak())
+ for (auto [i, irSym] : llvm::enumerate(obj->symbols())) {
+ const Symbol &sym = *symbols[i];
+ if (sym.file == this || !sym.isDefined() || irSym.isUndefined() ||
+ irSym.isCommon() || irSym.isWeak())
continue;
- int c = objSym.getComdatIndex();
+ int c = irSym.getComdatIndex();
if (c != -1 && !keptComdats[c])
continue;
reportDuplicate(sym, this, nullptr, 0);