forked from OSchip/llvm-project
ELF: Minor simplification.
MergeSectionKey is a tiny struct. We don't need a constructor for that. The good old way to initialize a struct works fine. llvm-svn: 234371
This commit is contained in:
parent
6cd2180b31
commit
9a736cf29f
|
@ -34,9 +34,6 @@ template <class ELFT> class ELFFile : public SimpleFile {
|
||||||
// A Map is used to hold the atoms that have been divided up
|
// A Map is used to hold the atoms that have been divided up
|
||||||
// after reading the section that contains Merge String attributes
|
// after reading the section that contains Merge String attributes
|
||||||
struct MergeSectionKey {
|
struct MergeSectionKey {
|
||||||
MergeSectionKey(const Elf_Shdr *shdr, int64_t offset)
|
|
||||||
: _shdr(shdr), _offset(offset) {}
|
|
||||||
// Data members
|
|
||||||
const Elf_Shdr *_shdr;
|
const Elf_Shdr *_shdr;
|
||||||
int64_t _offset;
|
int64_t _offset;
|
||||||
};
|
};
|
||||||
|
@ -343,7 +340,7 @@ protected:
|
||||||
unsigned int offset) {
|
unsigned int offset) {
|
||||||
ELFMergeAtom<ELFT> *mergeAtom = new (_readerStorage)
|
ELFMergeAtom<ELFT> *mergeAtom = new (_readerStorage)
|
||||||
ELFMergeAtom<ELFT>(*this, sectionName, sectionHdr, contentData, offset);
|
ELFMergeAtom<ELFT>(*this, sectionName, sectionHdr, contentData, offset);
|
||||||
const MergeSectionKey mergedSectionKey(sectionHdr, offset);
|
const MergeSectionKey mergedSectionKey = {sectionHdr, offset};
|
||||||
if (_mergedSectionMap.find(mergedSectionKey) == _mergedSectionMap.end())
|
if (_mergedSectionMap.find(mergedSectionKey) == _mergedSectionMap.end())
|
||||||
_mergedSectionMap.insert(std::make_pair(mergedSectionKey, mergeAtom));
|
_mergedSectionMap.insert(std::make_pair(mergedSectionKey, mergeAtom));
|
||||||
return mergeAtom;
|
return mergeAtom;
|
||||||
|
@ -1008,7 +1005,7 @@ void ELFFile<ELFT>::updateReferenceForMergeStringAccess(ELFReference<ELFT> *ref,
|
||||||
if (addend < 0)
|
if (addend < 0)
|
||||||
addend = 0;
|
addend = 0;
|
||||||
|
|
||||||
const MergeSectionKey ms(shdr, addend);
|
const MergeSectionKey ms = {shdr, addend};
|
||||||
auto msec = _mergedSectionMap.find(ms);
|
auto msec = _mergedSectionMap.find(ms);
|
||||||
if (msec != _mergedSectionMap.end()) {
|
if (msec != _mergedSectionMap.end()) {
|
||||||
ref->setTarget(msec->second);
|
ref->setTarget(msec->second);
|
||||||
|
|
Loading…
Reference in New Issue