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:
Rui Ueyama 2015-04-07 22:46:01 +00:00
parent 6cd2180b31
commit 9a736cf29f
1 changed files with 2 additions and 5 deletions

View File

@ -34,9 +34,6 @@ template <class ELFT> class ELFFile : public SimpleFile {
// A Map is used to hold the atoms that have been divided up
// after reading the section that contains Merge String attributes
struct MergeSectionKey {
MergeSectionKey(const Elf_Shdr *shdr, int64_t offset)
: _shdr(shdr), _offset(offset) {}
// Data members
const Elf_Shdr *_shdr;
int64_t _offset;
};
@ -343,7 +340,7 @@ protected:
unsigned int offset) {
ELFMergeAtom<ELFT> *mergeAtom = new (_readerStorage)
ELFMergeAtom<ELFT>(*this, sectionName, sectionHdr, contentData, offset);
const MergeSectionKey mergedSectionKey(sectionHdr, offset);
const MergeSectionKey mergedSectionKey = {sectionHdr, offset};
if (_mergedSectionMap.find(mergedSectionKey) == _mergedSectionMap.end())
_mergedSectionMap.insert(std::make_pair(mergedSectionKey, mergeAtom));
return mergeAtom;
@ -1008,7 +1005,7 @@ void ELFFile<ELFT>::updateReferenceForMergeStringAccess(ELFReference<ELFT> *ref,
if (addend < 0)
addend = 0;
const MergeSectionKey ms(shdr, addend);
const MergeSectionKey ms = {shdr, addend};
auto msec = _mergedSectionMap.find(ms);
if (msec != _mergedSectionMap.end()) {
ref->setTarget(msec->second);