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/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
using namespace llvm; using namespace llvm;
using std::error_code;
enum { enum {
SWITCH_INST_MAGIC = 0x4B5 // May 2012 => 1205 => Hex SWITCH_INST_MAGIC = 0x4B5 // May 2012 => 1205 => Hex

View File

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

View File

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

View File

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

View File

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

View File

@ -29,6 +29,7 @@
using namespace llvm; using namespace llvm;
using namespace object; using namespace object;
using namespace llvm::Win64EH; using namespace llvm::Win64EH;
using std::error_code;
// Returns the name of the unwind code. // Returns the name of the unwind code.
static StringRef getUnwindCodeTypeName(uint8_t Code) { static StringRef getUnwindCodeTypeName(uint8_t Code) {

View File

@ -42,6 +42,7 @@
#include <system_error> #include <system_error>
using namespace llvm; using namespace llvm;
using namespace object; using namespace object;
using std::error_code;
static cl::opt<bool> static cl::opt<bool>
UseDbg("g", cl::desc("Print line information from debug info if available")); UseDbg("g", cl::desc("Print line information from debug info if available"));

View File

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

View File

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

View File

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

View File

@ -15,7 +15,6 @@
#include "llvm/Support/ErrorOr.h" #include "llvm/Support/ErrorOr.h"
namespace llvm { namespace llvm {
using std::error_code;
namespace ARM { namespace ARM {
namespace WinEH { namespace WinEH {
class RuntimeFunction; class RuntimeFunction;
@ -110,7 +109,7 @@ class Decoder {
public: public:
Decoder(StreamWriter &SW) : SW(SW), OS(SW.getOStream()) {} 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;
using namespace llvm::object; using namespace llvm::object;
using namespace llvm::Win64EH; using namespace llvm::Win64EH;
using std::error_code;
namespace { namespace {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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