Switch a vector<pair<const T &, const U &>> to a vector<pair<const T *,

const U *>>. Even in C++11 it doesn't seem this is valid as vector's
emplace support requires move assignment, and there is no way to move
assign a reference.

The real motivation however is that this fixes the build of lld with
libstdc++ 4.6.

llvm-svn: 175481
This commit is contained in:
Chandler Carruth 2013-02-19 01:58:11 +00:00
parent b4a99d3194
commit 21aaf2534d
1 changed files with 7 additions and 7 deletions

View File

@ -690,7 +690,7 @@ public:
}
void addRelocation(const DefinedAtom &da, const Reference &r) {
_relocs.emplace_back(da, r);
_relocs.emplace_back(&da, &r);
this->_fsize = _relocs.size() * sizeof(Elf_Rela);
this->_msize = this->_fsize;
}
@ -700,21 +700,21 @@ public:
uint8_t *dest = chunkBuffer + this->fileOffset();
for (const auto &rel : _relocs) {
Elf_Rela *r = reinterpret_cast<Elf_Rela *>(dest);
r->setSymbolAndType(0, rel.second.kind());
r->setSymbolAndType(0, rel.second->kind());
r->r_offset =
writer->addressOfAtom(&rel.first) + rel.second.offsetInAtom();
writer->addressOfAtom(rel.first) + rel.second->offsetInAtom();
r->r_addend =
writer->addressOfAtom(rel.second.target()) + rel.second.addend();
writer->addressOfAtom(rel.second->target()) + rel.second->addend();
dest += sizeof(Elf_Rela);
DEBUG_WITH_TYPE("ELFRelocationTable", llvm::dbgs()
<< "IRELATIVE relocation at " << rel.first.name() << "@"
<< r->r_offset << " to " << rel.second.target()->name()
<< "IRELATIVE relocation at " << rel.first->name() << "@"
<< r->r_offset << " to " << rel.second->target()->name()
<< "@" << r->r_addend << "\n");
}
}
private:
std::vector<std::pair<const DefinedAtom &, const Reference &>> _relocs;
std::vector<std::pair<const DefinedAtom *, const Reference *>> _relocs;
};
} // end namespace elf
} // end namespace lld