[llvm-commits] [lld] r160864 - /lld/trunk/lib/ReaderWriter/ELF/ReaderELF.cpp
Sid Manning
sidneym at codeaurora.org
Fri Jul 27 07:52:18 PDT 2012
Author: sidneym
Date: Fri Jul 27 09:52:18 2012
New Revision: 160864
URL: http://llvm.org/viewvc/llvm-project?rev=160864&view=rev
Log:
Fix warning from -Wshadow. Report errors back to caller rather than calling
llvm::report_fatal_error.
Modified:
lld/trunk/lib/ReaderWriter/ELF/ReaderELF.cpp
Modified: lld/trunk/lib/ReaderWriter/ELF/ReaderELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ReaderELF.cpp?rev=160864&r1=160863&r2=160864&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ReaderELF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ReaderELF.cpp Fri Jul 27 09:52:18 2012
@@ -132,7 +132,7 @@
, SectionName(SN)
, Symbol(E)
, Section(S)
- , Data(D) {
+ , ContentData(D) {
static uint64_t ordernumber = 0;
_ordinal = ++ordernumber;
}
@@ -157,7 +157,7 @@
|| Symbol->st_shndx == llvm::ELF::SHN_COMMON)
return (uint64_t)0;
- return Data.size();
+ return ContentData.size();
}
@@ -281,7 +281,7 @@
}
virtual llvm::ArrayRef<uint8_t> rawContent() const {
- return Data;
+ return ContentData;
}
virtual reference_iterator begin() const {
@@ -305,8 +305,8 @@
const Elf_Sym *Symbol;
const Elf_Shdr *Section;
- // Data will hold the bits that make up the atom.
- llvm::ArrayRef<uint8_t> Data;
+ // ContentData will hold the bits that make up the atom.
+ llvm::ArrayRef<uint8_t> ContentData;
uint64_t _ordinal;
};
@@ -343,28 +343,24 @@
std::map< const Elf_Shdr *, std::vector<const Elf_Sym *>> SectionSymbols;
- llvm::object::SectionRef SR;
- llvm::object::section_iterator section(SR);
- llvm::object::symbol_iterator si(Obj->begin_symbols());
- llvm::object::symbol_iterator se(Obj->end_symbols());
+ llvm::object::symbol_iterator it(Obj->begin_symbols());
+ llvm::object::symbol_iterator ie(Obj->end_symbols());
- for (; si != se; si.increment(EC)) {
+ for (; it != ie; it.increment(EC)) {
if (EC)
- llvm::report_fatal_error("Could not read all symbols");
+ return;
llvm::object::SectionRef SR;
llvm::object::section_iterator section(SR);
- EC = si->getSection(section);
- if (EC)
- llvm::report_fatal_error("Could not get section iterator");
+ if ((EC = it->getSection(section)))
+ return;
const Elf_Shdr *Section = Obj->getElfSection(section);
- const Elf_Sym *Symbol = Obj->getElfSymbol(si);
+ const Elf_Sym *Symbol = Obj->getElfSymbol(it);
llvm::StringRef SymbolName;
- EC = Obj->getSymbolName(Section, Symbol, SymbolName);
- if (EC)
- llvm::report_fatal_error("Could not get symbol name");
+ if ((EC = Obj->getSymbolName(Section, Symbol, SymbolName)))
+ return;
if (Symbol->st_shndx == llvm::ELF::SHN_ABS) {
// Create an absolute atom.
@@ -420,17 +416,14 @@
for (auto si = Symbs.begin(), se = Symbs.end(); si != se; ++si) {
StringRef symbolContents;
- EC = Obj->getSectionContents(i.first, symbolContents);
- if (EC)
- llvm::report_fatal_error("Could not get section iterator");
-
- EC = Obj->getSymbolName(i.first, *si, SymbolName);
- if (EC)
- llvm::report_fatal_error("Could not get symbol name");
-
- EC = Obj->getSectionName(i.first, SectionName);
- if (EC)
- llvm::report_fatal_error("Could not get section name");
+ if ((EC = Obj->getSectionContents(i.first, symbolContents)))
+ return;
+
+ if ((EC = Obj->getSymbolName(i.first, *si, SymbolName)))
+ return;
+
+ if ((EC = Obj->getSectionName(i.first, SectionName)))
+ return;
bool IsCommon = false;
if (((*si)->getType() == llvm::ELF::STT_COMMON)
More information about the llvm-commits
mailing list