[lld] r234273 - ELF: Do not return error from handle{CommonSymbol, MergeString}.

Rui Ueyama ruiu at google.com
Mon Apr 6 18:14:25 PDT 2015


Author: ruiu
Date: Mon Apr  6 20:14:24 2015
New Revision: 234273

URL: http://llvm.org/viewvc/llvm-project?rev=234273&view=rev
Log:
ELF: Do not return error from handle{CommonSymbol,MergeString}.

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

Modified: lld/trunk/lib/ReaderWriter/ELF/ELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFFile.h?rev=234273&r1=234272&r2=234273&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFFile.h Mon Apr  6 20:14:24 2015
@@ -318,8 +318,8 @@ protected:
   }
 
   /// Process the common symbol and create an atom for it.
-  virtual ErrorOr<ELFCommonAtom<ELFT> *>
-  handleCommonSymbol(StringRef symName, const Elf_Sym *sym) {
+  virtual ELFCommonAtom<ELFT> *createCommonAtom(StringRef symName,
+                                                const Elf_Sym *sym) {
     return new (_readerStorage) ELFCommonAtom<ELFT>(*this, symName, sym);
   }
 
@@ -347,9 +347,10 @@ protected:
   }
 
   /// Process the Merge string and create an atom for it.
-  ErrorOr<ELFMergeAtom<ELFT> *>
-  handleMergeString(StringRef sectionName, const Elf_Shdr *sectionHdr,
-                    ArrayRef<uint8_t> contentData, unsigned int offset) {
+  ELFMergeAtom<ELFT> *createMergedString(StringRef sectionName,
+                                         const Elf_Shdr *sectionHdr,
+                                         ArrayRef<uint8_t> contentData,
+                                         unsigned int offset) {
     ELFMergeAtom<ELFT> *mergeAtom = new (_readerStorage)
         ELFMergeAtom<ELFT>(*this, sectionName, sectionHdr, contentData, offset);
     const MergeSectionKey mergedSectionKey(sectionHdr, offset);
@@ -607,11 +608,11 @@ template <class ELFT> std::error_code EL
   for (const MergeString *tai : tokens) {
     ArrayRef<uint8_t> content((const uint8_t *)tai->_string.data(),
                               tai->_string.size());
-    ErrorOr<ELFMergeAtom<ELFT> *> mergeAtom =
-        handleMergeString(tai->_sectionName, tai->_shdr, content, tai->_offset);
-    (*mergeAtom)->setOrdinal(++_ordinal);
-    _definedAtoms._atoms.push_back(*mergeAtom);
-    _mergeAtoms.push_back(*mergeAtom);
+    ELFMergeAtom<ELFT> *atom = createMergedString(tai->_sectionName, tai->_shdr,
+                                                  content, tai->_offset);
+    atom->setOrdinal(++_ordinal);
+    _definedAtoms._atoms.push_back(atom);
+    _mergeAtoms.push_back(atom);
   }
   return std::error_code();
 }
@@ -651,11 +652,10 @@ std::error_code ELFFile<ELFT>::createSym
       _undefinedAtoms._atoms.push_back(undefAtom);
       _symbolToAtomMapping.insert(std::make_pair(&*SymI, undefAtom));
     } else if (isCommonSymbol(&*SymI)) {
-      ErrorOr<ELFCommonAtom<ELFT> *> commonAtom =
-          handleCommonSymbol(*symbolName, &*SymI);
-      (*commonAtom)->setOrdinal(++_ordinal);
-      _definedAtoms._atoms.push_back(*commonAtom);
-      _symbolToAtomMapping.insert(std::make_pair(&*SymI, *commonAtom));
+      ELFCommonAtom<ELFT> *commonAtom = createCommonAtom(*symbolName, &*SymI);
+      commonAtom->setOrdinal(++_ordinal);
+      _definedAtoms._atoms.push_back(commonAtom);
+      _symbolToAtomMapping.insert(std::make_pair(&*SymI, commonAtom));
     } else if (isDefinedSymbol(&*SymI)) {
       _sectionSymbols[section].push_back(SymI);
     } else {

Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonELFFile.h?rev=234273&r1=234272&r2=234273&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonELFFile.h Mon Apr  6 20:14:24 2015
@@ -140,8 +140,8 @@ public:
   }
 
   /// Process the Common symbol and create an atom for it.
-  ErrorOr<ELFCommonAtom<ELFT> *>
-  handleCommonSymbol(StringRef symName, const Elf_Sym *sym) override {
+  ELFCommonAtom<ELFT> *createCommonAtom(StringRef symName,
+                                        const Elf_Sym *sym) override {
     return new (this->_readerStorage)
         HexagonELFCommonAtom<ELFT>(*this, symName, sym);
   }





More information about the llvm-commits mailing list