summaryrefslogtreecommitdiff
path: root/tools/llvm-objdump
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-06-13 03:07:50 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-06-13 03:07:50 +0000
commit1ad45020ec8518a5c9bea7ec1007798a456bff56 (patch)
tree07430093f7f8e4eaf7cfa61b960406627e961c54 /tools/llvm-objdump
parent7532b4038f2ce16cc285ed6b3254053f30088faa (diff)
downloadllvm-1ad45020ec8518a5c9bea7ec1007798a456bff56.tar.gz
llvm-1ad45020ec8518a5c9bea7ec1007798a456bff56.tar.bz2
llvm-1ad45020ec8518a5c9bea7ec1007798a456bff56.tar.xz
Remove 'using std::error_code' from tools.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210876 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-objdump')
-rw-r--r--tools/llvm-objdump/COFFDump.cpp42
-rw-r--r--tools/llvm-objdump/MachODump.cpp5
-rw-r--r--tools/llvm-objdump/llvm-objdump.cpp11
3 files changed, 27 insertions, 31 deletions
diff --git a/tools/llvm-objdump/COFFDump.cpp b/tools/llvm-objdump/COFFDump.cpp
index 84799ec8b0..39d8e8e39f 100644
--- a/tools/llvm-objdump/COFFDump.cpp
+++ b/tools/llvm-objdump/COFFDump.cpp
@@ -29,7 +29,6 @@
using namespace llvm;
using namespace object;
using namespace llvm::Win64EH;
-using std::error_code;
// Returns the name of the unwind code.
static StringRef getUnwindCodeTypeName(uint8_t Code) {
@@ -158,14 +157,14 @@ static void printAllUnwindCodes(ArrayRef<UnwindCode> UCs) {
}
// Given a symbol sym this functions returns the address and section of it.
-static error_code resolveSectionAndAddress(const COFFObjectFile *Obj,
- const SymbolRef &Sym,
- const coff_section *&ResolvedSection,
- uint64_t &ResolvedAddr) {
- if (error_code EC = Sym.getAddress(ResolvedAddr))
+static std::error_code
+resolveSectionAndAddress(const COFFObjectFile *Obj, const SymbolRef &Sym,
+ const coff_section *&ResolvedSection,
+ uint64_t &ResolvedAddr) {
+ if (std::error_code EC = Sym.getAddress(ResolvedAddr))
return EC;
section_iterator iter(Obj->section_begin());
- if (error_code EC = Sym.getSection(iter))
+ if (std::error_code EC = Sym.getSection(iter))
return EC;
ResolvedSection = Obj->getCOFFSection(*iter);
return object_error::success;
@@ -173,13 +172,13 @@ static error_code resolveSectionAndAddress(const COFFObjectFile *Obj,
// Given a vector of relocations for a section and an offset into this section
// the function returns the symbol used for the relocation at the offset.
-static error_code resolveSymbol(const std::vector<RelocationRef> &Rels,
- uint64_t Offset, SymbolRef &Sym) {
+static std::error_code resolveSymbol(const std::vector<RelocationRef> &Rels,
+ uint64_t Offset, SymbolRef &Sym) {
for (std::vector<RelocationRef>::const_iterator I = Rels.begin(),
E = Rels.end();
I != E; ++I) {
uint64_t Ofs;
- if (error_code EC = I->getOffset(Ofs))
+ if (std::error_code EC = I->getOffset(Ofs))
return EC;
if (Ofs == Offset) {
Sym = *I->getSymbol();
@@ -193,18 +192,17 @@ static error_code resolveSymbol(const std::vector<RelocationRef> &Rels,
// the function resolves the symbol used for the relocation at the offset and
// returns the section content and the address inside the content pointed to
// by the symbol.
-static error_code getSectionContents(const COFFObjectFile *Obj,
- const std::vector<RelocationRef> &Rels,
- uint64_t Offset,
- ArrayRef<uint8_t> &Contents,
- uint64_t &Addr) {
+static std::error_code
+getSectionContents(const COFFObjectFile *Obj,
+ const std::vector<RelocationRef> &Rels, uint64_t Offset,
+ ArrayRef<uint8_t> &Contents, uint64_t &Addr) {
SymbolRef Sym;
- if (error_code EC = resolveSymbol(Rels, Offset, Sym))
+ if (std::error_code EC = resolveSymbol(Rels, Offset, Sym))
return EC;
const coff_section *Section;
- if (error_code EC = resolveSectionAndAddress(Obj, Sym, Section, Addr))
+ if (std::error_code EC = resolveSectionAndAddress(Obj, Sym, Section, Addr))
return EC;
- if (error_code EC = Obj->getSectionContents(Section, Contents))
+ if (std::error_code EC = Obj->getSectionContents(Section, Contents))
return EC;
return object_error::success;
}
@@ -212,12 +210,12 @@ static error_code getSectionContents(const COFFObjectFile *Obj,
// Given a vector of relocations for a section and an offset into this section
// the function returns the name of the symbol used for the relocation at the
// offset.
-static error_code resolveSymbolName(const std::vector<RelocationRef> &Rels,
- uint64_t Offset, StringRef &Name) {
+static std::error_code resolveSymbolName(const std::vector<RelocationRef> &Rels,
+ uint64_t Offset, StringRef &Name) {
SymbolRef Sym;
- if (error_code EC = resolveSymbol(Rels, Offset, Sym))
+ if (std::error_code EC = resolveSymbol(Rels, Offset, Sym))
return EC;
- if (error_code EC = Sym.getName(Name))
+ if (std::error_code EC = Sym.getName(Name))
return EC;
return object_error::success;
}
diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp
index cba7318354..21c4c96d4c 100644
--- a/tools/llvm-objdump/MachODump.cpp
+++ b/tools/llvm-objdump/MachODump.cpp
@@ -42,7 +42,6 @@
#include <system_error>
using namespace llvm;
using namespace object;
-using std::error_code;
static cl::opt<bool>
UseDbg("g", cl::desc("Print line information from debug info if available"));
@@ -198,7 +197,7 @@ static void DisassembleInputMachO2(StringRef Filename,
void llvm::DisassembleInputMachO(StringRef Filename) {
std::unique_ptr<MemoryBuffer> Buff;
- if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename, Buff)) {
+ if (std::error_code ec = MemoryBuffer::getFileOrSTDIN(Filename, Buff)) {
errs() << "llvm-objdump: " << Filename << ": " << ec.message() << "\n";
return;
}
@@ -290,7 +289,7 @@ static void DisassembleInputMachO2(StringRef Filename,
// get the sections and supply it to the section name parsing machinery.
if (!DSYMFile.empty()) {
std::unique_ptr<MemoryBuffer> Buf;
- if (error_code ec = MemoryBuffer::getFileOrSTDIN(DSYMFile, Buf)) {
+ if (std::error_code ec = MemoryBuffer::getFileOrSTDIN(DSYMFile, Buf)) {
errs() << "llvm-objdump: " << Filename << ": " << ec.message() << '\n';
return;
}
diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp
index 254c802aec..e12ff3de2b 100644
--- a/tools/llvm-objdump/llvm-objdump.cpp
+++ b/tools/llvm-objdump/llvm-objdump.cpp
@@ -64,7 +64,6 @@
using namespace llvm;
using namespace object;
-using std::error_code;
static cl::list<std::string>
InputFilenames(cl::Positional, cl::desc("<input object files>"),cl::ZeroOrMore);
@@ -149,7 +148,7 @@ YAMLCFG("yaml-cfg",
static StringRef ToolName;
-bool llvm::error(error_code EC) {
+bool llvm::error(std::error_code EC) {
if (!EC)
return false;
@@ -396,7 +395,7 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
// Create a mapping, RelocSecs = SectionRelocMap[S], where sections
// in RelocSecs contain the relocations for section S.
- error_code EC;
+ std::error_code EC;
std::map<SectionRef, SmallVector<SectionRef, 1>> SectionRelocMap;
for (const SectionRef &Section : Obj->sections()) {
section_iterator Sec2 = Section.getRelocatedSection();
@@ -621,7 +620,7 @@ static void PrintSectionHeaders(const ObjectFile *Obj) {
}
static void PrintSectionContents(const ObjectFile *Obj) {
- error_code EC;
+ std::error_code EC;
for (const SectionRef &Section : Obj->sections()) {
StringRef Name;
StringRef Contents;
@@ -852,7 +851,7 @@ static void DumpArchive(const Archive *a) {
for (Archive::child_iterator i = a->child_begin(), e = a->child_end(); i != e;
++i) {
std::unique_ptr<Binary> child;
- if (error_code EC = i->getAsBinary(child)) {
+ if (std::error_code EC = i->getAsBinary(child)) {
// Ignore non-object files.
if (EC != object_error::invalid_file_type)
errs() << ToolName << ": '" << a->getFileName() << "': " << EC.message()
@@ -882,7 +881,7 @@ static void DumpInput(StringRef file) {
// Attempt to open the binary.
ErrorOr<Binary *> BinaryOrErr = createBinary(file);
- if (error_code EC = BinaryOrErr.getError()) {
+ if (std::error_code EC = BinaryOrErr.getError()) {
errs() << ToolName << ": '" << file << "': " << EC.message() << ".\n";
return;
}