summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2014-04-11 07:25:29 +0000
committerSimon Atanasyan <simon@atanasyan.com>2014-04-11 07:25:29 +0000
commite5b156810a5315d6eb958f10fc47f1ef5e21a1cd (patch)
tree3d6b976d6cae47a4d6fdf16a9beaeefc53305bd9
parent53c55d993f01e7efb430bac75c8b1a03f938eb22 (diff)
downloadbcm5719-llvm-e5b156810a5315d6eb958f10fc47f1ef5e21a1cd.tar.gz
bcm5719-llvm-e5b156810a5315d6eb958f10fc47f1ef5e21a1cd.zip
[ELF] Remove redundant conversion of section content from ArrayRef to
StringRef before calling the createSectionAtom() method and reverse conversion inside the method. No functional changes. llvm-svn: 206022
-rw-r--r--lld/lib/ReaderWriter/ELF/ELFFile.h11
1 files changed, 3 insertions, 8 deletions
diff --git a/lld/lib/ReaderWriter/ELF/ELFFile.h b/lld/lib/ReaderWriter/ELF/ELFFile.h
index 522fd0b9073..8fea9eadda4 100644
--- a/lld/lib/ReaderWriter/ELF/ELFFile.h
+++ b/lld/lib/ReaderWriter/ELF/ELFFile.h
@@ -201,7 +201,7 @@ protected:
/// section that have no symbols.
virtual ELFDefinedAtom<ELFT> *createSectionAtom(const Elf_Shdr *section,
StringRef sectionName,
- StringRef sectionContents);
+ ArrayRef<uint8_t> contents);
/// Return the default reloc addend for references.
virtual int64_t defaultRelocAddend(const Reference &) const;
@@ -621,12 +621,9 @@ template <class ELFT> error_code ELFFile<ELFT>::createAtoms() {
if (error_code ec = sectionContents.getError())
return ec;
- StringRef secCont(reinterpret_cast<const char *>(sectionContents->begin()),
- sectionContents->size());
-
if (handleSectionWithNoSymbols(section, symbols)) {
ELFDefinedAtom<ELFT> *newAtom =
- createSectionAtom(section, *sectionName, secCont);
+ createSectionAtom(section, *sectionName, *sectionContents);
_definedAtoms._atoms.push_back(newAtom);
newAtom->setOrdinal(++_ordinal);
continue;
@@ -879,7 +876,7 @@ bool ELFFile<ELFT>::isMergeableStringSection(const Elf_Shdr *section) {
template <class ELFT>
ELFDefinedAtom<ELFT> *
ELFFile<ELFT>::createSectionAtom(const Elf_Shdr *section, StringRef sectionName,
- StringRef sectionContents) {
+ ArrayRef<uint8_t> content) {
Elf_Sym *sym = new (_readerStorage) Elf_Sym;
sym->st_name = 0;
sym->setBindingAndType(llvm::ELF::STB_LOCAL, llvm::ELF::STT_SECTION);
@@ -887,8 +884,6 @@ ELFFile<ELFT>::createSectionAtom(const Elf_Shdr *section, StringRef sectionName,
sym->st_shndx = 0;
sym->st_value = 0;
sym->st_size = 0;
- ArrayRef<uint8_t> content((const uint8_t *)sectionContents.data(),
- sectionContents.size());
auto *newAtom = new (_readerStorage) ELFDefinedAtom<ELFT>(
*this, "", sectionName, sym, section, content, 0, 0, _references);
newAtom->setOrdinal(++_ordinal);
OpenPOWER on IntegriCloud