Remove all uses of 'using std::error_code' from headers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210866 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-06-13 01:25:41 +00:00
parent aa48b83e80
commit a20bcb9969
22 changed files with 67 additions and 64 deletions

View File

@ -26,6 +26,7 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
using std::error_code;
enum {
SWITCH_INST_MAGIC = 0x4B5 // May 2012 => 1205 => Hex

View File

@ -26,7 +26,6 @@
#include <vector>
namespace llvm {
using std::error_code;
class MemoryBuffer;
class LLVMContext;
@ -220,8 +219,8 @@ public:
InvalidValue // Invalid version, inst number, attr number, etc
};
error_code Error(ErrorType E) {
return error_code(E, BitcodeErrorCategory());
std::error_code Error(ErrorType E) {
return std::error_code(E, BitcodeErrorCategory());
}
explicit BitcodeReader(MemoryBuffer *buffer, LLVMContext &C)
@ -250,17 +249,17 @@ public:
bool isMaterializable(const GlobalValue *GV) const override;
bool isDematerializable(const GlobalValue *GV) const override;
error_code Materialize(GlobalValue *GV) override;
error_code MaterializeModule(Module *M) override;
std::error_code Materialize(GlobalValue *GV) override;
std::error_code MaterializeModule(Module *M) override;
void Dematerialize(GlobalValue *GV) override;
/// @brief Main interface to parsing a bitcode buffer.
/// @returns true if an error occurred.
error_code ParseBitcodeInto(Module *M);
std::error_code ParseBitcodeInto(Module *M);
/// @brief Cheap mechanism to just extract module triple
/// @returns true if an error occurred.
error_code ParseTriple(std::string &Triple);
std::error_code ParseTriple(std::string &Triple);
static uint64_t decodeSignRotatedValue(uint64_t V);
@ -347,28 +346,29 @@ private:
return getFnValueByID(ValNo, Ty);
}
error_code ParseAttrKind(uint64_t Code, Attribute::AttrKind *Kind);
error_code ParseModule(bool Resume);
error_code ParseAttributeBlock();
error_code ParseAttributeGroupBlock();
error_code ParseTypeTable();
error_code ParseTypeTableBody();
std::error_code ParseAttrKind(uint64_t Code, Attribute::AttrKind *Kind);
std::error_code ParseModule(bool Resume);
std::error_code ParseAttributeBlock();
std::error_code ParseAttributeGroupBlock();
std::error_code ParseTypeTable();
std::error_code ParseTypeTableBody();
error_code ParseValueSymbolTable();
error_code ParseConstants();
error_code RememberAndSkipFunctionBody();
error_code ParseFunctionBody(Function *F);
error_code GlobalCleanup();
error_code ResolveGlobalAndAliasInits();
error_code ParseMetadata();
error_code ParseMetadataAttachment();
error_code ParseModuleTriple(std::string &Triple);
error_code ParseUseLists();
error_code InitStream();
error_code InitStreamFromBuffer();
error_code InitLazyStream();
error_code FindFunctionInStream(Function *F,
DenseMap<Function*, uint64_t>::iterator DeferredFunctionInfoIterator);
std::error_code ParseValueSymbolTable();
std::error_code ParseConstants();
std::error_code RememberAndSkipFunctionBody();
std::error_code ParseFunctionBody(Function *F);
std::error_code GlobalCleanup();
std::error_code ResolveGlobalAndAliasInits();
std::error_code ParseMetadata();
std::error_code ParseMetadataAttachment();
std::error_code ParseModuleTriple(std::string &Triple);
std::error_code ParseUseLists();
std::error_code InitStream();
std::error_code InitStreamFromBuffer();
std::error_code InitLazyStream();
std::error_code FindFunctionInStream(
Function *F,
DenseMap<Function *, uint64_t>::iterator DeferredFunctionInfoIterator);
};
} // End llvm namespace

View File

@ -23,6 +23,7 @@
using namespace llvm;
using namespace llvm::object;
using std::error_code;
#define DEBUG_TYPE "dyld"

View File

@ -27,6 +27,7 @@
using namespace llvm;
using namespace llvm::object;
using std::error_code;
#define DEBUG_TYPE "dyld"

View File

@ -20,11 +20,9 @@
using namespace llvm;
namespace llvm {
using std::error_code;
namespace {
// Helper for extensive error checking in debug builds.
error_code Check(error_code Err) {
std::error_code Check(std::error_code Err) {
if (Err) {
report_fatal_error(Err.message());
}

View File

@ -29,6 +29,7 @@
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) {

View File

@ -42,6 +42,7 @@
#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"));

View File

@ -16,8 +16,6 @@
#include "llvm/Support/StringRefMemoryObject.h"
namespace llvm {
using std::error_code;
namespace object {
class COFFObjectFile;
class ObjectFile;
@ -28,7 +26,7 @@ extern cl::opt<std::string> TripleName;
extern cl::opt<std::string> ArchName;
// Various helper functions.
bool error(error_code ec);
bool error(std::error_code ec);
bool RelocAddressLess(object::RelocationRef a, object::RelocationRef b);
void DumpBytes(StringRef bytes);
void DisassembleInputMachO(StringRef Filename);

View File

@ -22,7 +22,6 @@
#include "llvm/Support/type_traits.h"
namespace llvm {
using std::error_code;
namespace ARM {
namespace EHABI {

View File

@ -189,9 +189,9 @@ Decoder::getSectionContaining(const COFFObjectFile &COFF, uint64_t VA) {
uint64_t Address;
uint64_t Size;
if (error_code EC = Section.getAddress(Address))
if (std::error_code EC = Section.getAddress(Address))
return EC;
if (error_code EC = Section.getSize(Size))
if (std::error_code EC = Section.getSize(Size))
return EC;
if (VA >= Address && (VA - Address) <= Size)
@ -205,14 +205,14 @@ ErrorOr<object::SymbolRef> Decoder::getSymbol(const COFFObjectFile &COFF,
for (const auto &Symbol : COFF.symbols()) {
if (FunctionOnly) {
SymbolRef::Type Type;
if (error_code EC = Symbol.getType(Type))
if (std::error_code EC = Symbol.getType(Type))
return EC;
if (Type != SymbolRef::ST_Function)
continue;
}
uint64_t Address;
if (error_code EC = Symbol.getAddress(Address))
if (std::error_code EC = Symbol.getAddress(Address))
return EC;
if (Address == VA)
return Symbol;
@ -728,17 +728,17 @@ void Decoder::dumpProcedureData(const COFFObjectFile &COFF,
break;
}
error_code Decoder::dumpProcedureData(const COFFObjectFile &COFF) {
std::error_code Decoder::dumpProcedureData(const COFFObjectFile &COFF) {
for (const auto &Section : COFF.sections()) {
StringRef SectionName;
if (error_code EC = COFF.getSectionName(COFF.getCOFFSection(Section),
SectionName))
if (std::error_code EC =
COFF.getSectionName(COFF.getCOFFSection(Section), SectionName))
return EC;
if (SectionName.startswith(".pdata"))
dumpProcedureData(COFF, Section);
}
return error_code();
return std::error_code();
}
}
}

View File

@ -15,7 +15,6 @@
#include "llvm/Support/ErrorOr.h"
namespace llvm {
using std::error_code;
namespace ARM {
namespace WinEH {
class RuntimeFunction;
@ -110,7 +109,7 @@ class Decoder {
public:
Decoder(StreamWriter &SW) : SW(SW), OS(SW.getOStream()) {}
error_code dumpProcedureData(const object::COFFObjectFile &COFF);
std::error_code dumpProcedureData(const object::COFFObjectFile &COFF);
};
}
}

View File

@ -38,6 +38,7 @@
using namespace llvm;
using namespace llvm::object;
using namespace llvm::Win64EH;
using std::error_code;
namespace {

View File

@ -30,6 +30,7 @@
using namespace llvm;
using namespace llvm::object;
using namespace ELF;
using std::error_code;
#define LLVM_READOBJ_ENUM_CASE(ns, enum) \
case ns::enum: return #enum;

View File

@ -17,7 +17,6 @@
#include <system_error>
namespace llvm {
using std::error_code;
const std::error_category &readobj_category();
enum class readobj_error {
@ -29,8 +28,8 @@ enum class readobj_error {
unknown_symbol
};
inline error_code make_error_code(readobj_error e) {
return error_code(static_cast<int>(e), readobj_category());
inline std::error_code make_error_code(readobj_error e) {
return std::error_code(static_cast<int>(e), readobj_category());
}
} // namespace llvm

View File

@ -21,6 +21,7 @@
using namespace llvm;
using namespace object;
using std::error_code;
namespace {

View File

@ -14,7 +14,6 @@
#include <system_error>
namespace llvm {
using std::error_code;
namespace object {
class ObjectFile;
}
@ -45,15 +44,17 @@ protected:
StreamWriter& W;
};
error_code createCOFFDumper(const object::ObjectFile *Obj, StreamWriter &Writer,
std::unique_ptr<ObjDumper> &Result);
std::error_code createCOFFDumper(const object::ObjectFile *Obj,
StreamWriter &Writer,
std::unique_ptr<ObjDumper> &Result);
error_code createELFDumper(const object::ObjectFile *Obj, StreamWriter &Writer,
std::unique_ptr<ObjDumper> &Result);
std::error_code createELFDumper(const object::ObjectFile *Obj,
StreamWriter &Writer,
std::unique_ptr<ObjDumper> &Result);
error_code createMachODumper(const object::ObjectFile *Obj,
StreamWriter &Writer,
std::unique_ptr<ObjDumper> &Result);
std::error_code createMachODumper(const object::ObjectFile *Obj,
StreamWriter &Writer,
std::unique_ptr<ObjDumper> &Result);
} // namespace llvm

View File

@ -14,7 +14,6 @@
#include "llvm/Support/Win64EH.h"
namespace llvm {
using std::error_code;
namespace object {
class COFFObjectFile;
class SymbolRef;
@ -27,8 +26,9 @@ class Dumper {
raw_ostream &OS;
public:
typedef error_code (*SymbolResolver)(const object::coff_section *, uint64_t,
object::SymbolRef &, void *);
typedef std::error_code (*SymbolResolver)(const object::coff_section *,
uint64_t, object::SymbolRef &,
void *);
struct Context {
const object::COFFObjectFile &COFF;

View File

@ -41,6 +41,7 @@
using namespace llvm;
using namespace llvm::object;
using std::error_code;
namespace opts {
cl::list<std::string> InputFilenames(cl::Positional,

View File

@ -14,13 +14,12 @@
#include <string>
namespace llvm {
using std::error_code;
namespace object {
class RelocationRef;
}
// Various helper functions.
bool error(error_code ec);
bool error(std::error_code ec);
bool relocAddressLess(object::RelocationRef A,
object::RelocationRef B);
} // namespace llvm

View File

@ -13,7 +13,6 @@
#include <system_error>
namespace llvm {
using std::error_code;
const std::error_category &obj2yaml_category();
enum class obj2yaml_error {
@ -23,8 +22,8 @@ enum class obj2yaml_error {
unsupported_obj_file_format
};
inline error_code make_error_code(obj2yaml_error e) {
return error_code(static_cast<int>(e), obj2yaml_category());
inline std::error_code make_error_code(obj2yaml_error e) {
return std::error_code(static_cast<int>(e), obj2yaml_category());
}
} // namespace llvm

View File

@ -16,6 +16,7 @@
#include "llvm/Support/YAMLTraits.h"
using namespace llvm;
using std::error_code;
namespace {

View File

@ -18,6 +18,7 @@
using namespace llvm;
using namespace llvm::object;
using std::error_code;
static error_code dumpObject(const ObjectFile &Obj) {
if (Obj.isCOFF())