[lld] r234371 - ELF: Minor simplification.

Rui Ueyama ruiu at google.com
Tue Apr 7 15:46:02 PDT 2015


Author: ruiu
Date: Tue Apr  7 17:46:01 2015
New Revision: 234371

URL: http://llvm.org/viewvc/llvm-project?rev=234371&view=rev
Log:
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.

Modified:
    lld/trunk/lib/ReaderWriter/ELF/ELFFile.h

Modified: lld/trunk/lib/ReaderWriter/ELF/ELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFFile.h?rev=234371&r1=234370&r2=234371&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFFile.h Tue Apr  7 17:46:01 2015
@@ -34,9 +34,6 @@ template <class ELFT> class ELFFile : pu
   // 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>::updateReferenceForMe
   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);





More information about the llvm-commits mailing list