diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-12 21:46:39 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-12 21:46:39 +0000 |
commit | 5c792faa0e5560bc148c973f3df658eb3bb2061e (patch) | |
tree | 6ede225c2e59359a60804bb1d823f9db9072892a /lib | |
parent | 7418e1f4bd5a4bda32af18f46ff2837221d12d5c (diff) | |
download | llvm-5c792faa0e5560bc148c973f3df658eb3bb2061e.tar.gz llvm-5c792faa0e5560bc148c973f3df658eb3bb2061e.tar.bz2 llvm-5c792faa0e5560bc148c973f3df658eb3bb2061e.tar.xz |
Don't use 'using std::error_code' in include/llvm.
This should make sure that most new uses use the std prefix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210835 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
45 files changed, 121 insertions, 78 deletions
diff --git a/lib/AsmParser/Parser.cpp b/lib/AsmParser/Parser.cpp index ef9328a0b1..1dfcc191cb 100644 --- a/lib/AsmParser/Parser.cpp +++ b/lib/AsmParser/Parser.cpp @@ -20,6 +20,7 @@ #include <cstring> #include <system_error> using namespace llvm; +using std::error_code; Module *llvm::ParseAssembly(MemoryBuffer *F, Module *M, diff --git a/lib/Bitcode/Reader/BitReader.cpp b/lib/Bitcode/Reader/BitReader.cpp index 716299fc68..2610e7f96e 100644 --- a/lib/Bitcode/Reader/BitReader.cpp +++ b/lib/Bitcode/Reader/BitReader.cpp @@ -16,6 +16,7 @@ #include <string> using namespace llvm; +using std::error_code; /* Builds a module from the bitcode in the specified memory buffer, returning a reference to the module via the OutModule parameter. Returns 0 on success. diff --git a/lib/Bitcode/Reader/BitcodeReader.h b/lib/Bitcode/Reader/BitcodeReader.h index 485bd1c12a..7a1b3f2d03 100644 --- a/lib/Bitcode/Reader/BitcodeReader.h +++ b/lib/Bitcode/Reader/BitcodeReader.h @@ -26,6 +26,7 @@ #include <vector> namespace llvm { +using std::error_code; class MemoryBuffer; class LLVMContext; diff --git a/lib/DebugInfo/DWARFContext.cpp b/lib/DebugInfo/DWARFContext.cpp index e52e8afab8..110fd815da 100644 --- a/lib/DebugInfo/DWARFContext.cpp +++ b/lib/DebugInfo/DWARFContext.cpp @@ -21,6 +21,7 @@ using namespace llvm; using namespace dwarf; using namespace object; +using std::error_code; #define DEBUG_TYPE "dwarf" diff --git a/lib/ExecutionEngine/Interpreter/Interpreter.cpp b/lib/ExecutionEngine/Interpreter/Interpreter.cpp index c589457b67..e3e63f4d5f 100644 --- a/lib/ExecutionEngine/Interpreter/Interpreter.cpp +++ b/lib/ExecutionEngine/Interpreter/Interpreter.cpp @@ -19,6 +19,7 @@ #include "llvm/IR/Module.h" #include <cstring> using namespace llvm; +using std::error_code; namespace { diff --git a/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp b/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp index 1b7d386adc..59860844e9 100644 --- a/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp +++ b/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp @@ -71,7 +71,7 @@ uint8_t *SectionMemoryManager::allocateSection(MemoryGroup &MemGroup, // // FIXME: Initialize the Near member for each memory group to avoid // interleaving. - error_code ec; + std::error_code ec; sys::MemoryBlock MB = sys::Memory::allocateMappedMemory(RequiredSize, &MemGroup.Near, sys::Memory::MF_READ | @@ -105,7 +105,7 @@ uint8_t *SectionMemoryManager::allocateSection(MemoryGroup &MemGroup, bool SectionMemoryManager::finalizeMemory(std::string *ErrMsg) { // FIXME: Should in-progress permissions be reverted if an error occurs? - error_code ec; + std::error_code ec; // Don't allow free memory blocks to be used after setting protection flags. CodeMem.FreeMem.clear(); @@ -143,19 +143,20 @@ bool SectionMemoryManager::finalizeMemory(std::string *ErrMsg) return false; } -error_code SectionMemoryManager::applyMemoryGroupPermissions(MemoryGroup &MemGroup, - unsigned Permissions) { +std::error_code +SectionMemoryManager::applyMemoryGroupPermissions(MemoryGroup &MemGroup, + unsigned Permissions) { for (int i = 0, e = MemGroup.AllocatedMem.size(); i != e; ++i) { - error_code ec; - ec = sys::Memory::protectMappedMemory(MemGroup.AllocatedMem[i], - Permissions); - if (ec) { - return ec; - } + std::error_code ec; + ec = + sys::Memory::protectMappedMemory(MemGroup.AllocatedMem[i], Permissions); + if (ec) { + return ec; + } } - return error_code(); + return std::error_code(); } void SectionMemoryManager::invalidateInstructionCache() { diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h index a526073bc0..53cf8f99ff 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h @@ -20,6 +20,7 @@ using namespace llvm; namespace llvm { +using std::error_code; namespace { // Helper for extensive error checking in debug builds. diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp index db3128cfa0..5dfe9a68a2 100644 --- a/lib/IR/Core.cpp +++ b/lib/IR/Core.cpp @@ -41,6 +41,7 @@ #include <system_error> using namespace llvm; +using std::error_code; #define DEBUG_TYPE "ir" diff --git a/lib/IR/GCOV.cpp b/lib/IR/GCOV.cpp index 77dd7e881b..c8dc951a9b 100644 --- a/lib/IR/GCOV.cpp +++ b/lib/IR/GCOV.cpp @@ -22,6 +22,7 @@ #include <algorithm> #include <system_error> using namespace llvm; +using std::error_code; //===----------------------------------------------------------------------===// // GCOVFile implementation. diff --git a/lib/IR/Module.cpp b/lib/IR/Module.cpp index 91b2d91c62..bc72a67917 100644 --- a/lib/IR/Module.cpp +++ b/lib/IR/Module.cpp @@ -28,6 +28,7 @@ #include <cstdarg> #include <cstdlib> using namespace llvm; +using std::error_code; //===----------------------------------------------------------------------===// // Methods to implement the globals and functions lists. diff --git a/lib/IRReader/IRReader.cpp b/lib/IRReader/IRReader.cpp index 3e928d4642..e170a3c85a 100644 --- a/lib/IRReader/IRReader.cpp +++ b/lib/IRReader/IRReader.cpp @@ -21,6 +21,7 @@ #include <system_error> using namespace llvm; +using std::error_code; namespace llvm { extern bool TimePassesIsEnabled; diff --git a/lib/LTO/LTOCodeGenerator.cpp b/lib/LTO/LTOCodeGenerator.cpp index 7c62e48bf5..c263f8f477 100644 --- a/lib/LTO/LTOCodeGenerator.cpp +++ b/lib/LTO/LTOCodeGenerator.cpp @@ -53,6 +53,7 @@ #include "llvm/Transforms/ObjCARC.h" #include <system_error> using namespace llvm; +using std::error_code; const char* LTOCodeGenerator::getVersionString() { #ifdef LLVM_VERSION_INFO diff --git a/lib/LTO/LTOModule.cpp b/lib/LTO/LTOModule.cpp index 9af79e5d85..aee0ef8cdc 100644 --- a/lib/LTO/LTOModule.cpp +++ b/lib/LTO/LTOModule.cpp @@ -43,6 +43,7 @@ #include "llvm/Transforms/Utils/GlobalStatus.h" #include <system_error> using namespace llvm; +using std::error_code; LTOModule::LTOModule(llvm::Module *m, llvm::TargetMachine *t) : _module(m), _target(t), diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp index 130bb99f98..4ec621fea0 100644 --- a/lib/MC/MCContext.cpp +++ b/lib/MC/MCContext.cpp @@ -28,6 +28,7 @@ #include <map> using namespace llvm; +using std::error_code; MCContext::MCContext(const MCAsmInfo *mai, const MCRegisterInfo *mri, const MCObjectFileInfo *mofi, const SourceMgr *mgr, diff --git a/lib/MC/MCModuleYAML.cpp b/lib/MC/MCModuleYAML.cpp index f81cb149d8..0df6afd9f0 100644 --- a/lib/MC/MCModuleYAML.cpp +++ b/lib/MC/MCModuleYAML.cpp @@ -25,6 +25,7 @@ #include <vector> namespace llvm { +using std::error_code; namespace { diff --git a/lib/Object/Archive.cpp b/lib/Object/Archive.cpp index 77421c7da3..1e66da0639 100644 --- a/lib/Object/Archive.cpp +++ b/lib/Object/Archive.cpp @@ -20,6 +20,7 @@ using namespace llvm; using namespace object; +using std::error_code; static const char *const Magic = "!<arch>\n"; diff --git a/lib/Object/Binary.cpp b/lib/Object/Binary.cpp index 63fd3ed011..c55ed0c759 100644 --- a/lib/Object/Binary.cpp +++ b/lib/Object/Binary.cpp @@ -81,7 +81,7 @@ ErrorOr<Binary *> object::createBinary(MemoryBuffer *Source, ErrorOr<Binary *> object::createBinary(StringRef Path) { std::unique_ptr<MemoryBuffer> File; - if (error_code EC = MemoryBuffer::getFileOrSTDIN(Path, File)) + if (std::error_code EC = MemoryBuffer::getFileOrSTDIN(Path, File)) return EC; return createBinary(File.release()); } diff --git a/lib/Object/COFFObjectFile.cpp b/lib/Object/COFFObjectFile.cpp index 262c040c57..8528840e12 100644 --- a/lib/Object/COFFObjectFile.cpp +++ b/lib/Object/COFFObjectFile.cpp @@ -24,6 +24,7 @@ using namespace llvm; using namespace object; +using std::error_code; using support::ulittle8_t; using support::ulittle16_t; diff --git a/lib/Object/ELFObjectFile.cpp b/lib/Object/ELFObjectFile.cpp index a2c4df2007..de05abb43b 100644 --- a/lib/Object/ELFObjectFile.cpp +++ b/lib/Object/ELFObjectFile.cpp @@ -15,6 +15,7 @@ #include "llvm/Support/MathExtras.h" namespace llvm { +using std::error_code; using namespace object; ErrorOr<ObjectFile *> ObjectFile::createELFObjectFile(MemoryBuffer *Obj, diff --git a/lib/Object/IRObjectFile.cpp b/lib/Object/IRObjectFile.cpp index a8aba26c5a..57c2232d47 100644 --- a/lib/Object/IRObjectFile.cpp +++ b/lib/Object/IRObjectFile.cpp @@ -19,6 +19,7 @@ #include "llvm/Support/raw_ostream.h" using namespace llvm; using namespace object; +using std::error_code; IRObjectFile::IRObjectFile(MemoryBuffer *Object, error_code &EC, LLVMContext &Context, bool BufferOwned) diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp index 1fb0c13407..a71a139b02 100644 --- a/lib/Object/MachOObjectFile.cpp +++ b/lib/Object/MachOObjectFile.cpp @@ -28,6 +28,8 @@ using namespace llvm; using namespace object; namespace llvm { +using std::error_code; + namespace object { struct nlist_base { @@ -316,7 +318,7 @@ static void printRelocationTargetName(const MachOObjectFile *O, uint32_t Val = O->getPlainRelocationSymbolNum(RE); for (const SymbolRef &Symbol : O->symbols()) { - error_code ec; + std::error_code ec; uint64_t Addr; StringRef Name; @@ -333,7 +335,7 @@ static void printRelocationTargetName(const MachOObjectFile *O, // If we couldn't find a symbol that this relocation refers to, try // to find a section beginning instead. for (const SectionRef &Section : O->sections()) { - error_code ec; + std::error_code ec; uint64_t Addr; StringRef Name; @@ -427,7 +429,7 @@ static uint32_t getSectionFlags(const MachOObjectFile *O, } MachOObjectFile::MachOObjectFile(MemoryBuffer *Object, bool IsLittleEndian, - bool Is64bits, error_code &EC, + bool Is64bits, std::error_code &EC, bool BufferOwned) : ObjectFile(getMachOType(IsLittleEndian, Is64bits), Object, BufferOwned), SymtabLoadCmd(nullptr), DysymtabLoadCmd(nullptr), @@ -475,8 +477,8 @@ void MachOObjectFile::moveSymbolNext(DataRefImpl &Symb) const { Symb.p += SymbolTableEntrySize; } -error_code MachOObjectFile::getSymbolName(DataRefImpl Symb, - StringRef &Res) const { +std::error_code MachOObjectFile::getSymbolName(DataRefImpl Symb, + StringRef &Res) const { StringRef StringTable = getStringTableData(); nlist_base Entry = getSymbolTableEntryBase(this, Symb); const char *Start = &StringTable.data()[Entry.n_strx]; @@ -486,8 +488,8 @@ error_code MachOObjectFile::getSymbolName(DataRefImpl Symb, // getIndirectName() returns the name of the alias'ed symbol who's string table // index is in the n_value field. -error_code MachOObjectFile::getIndirectName(DataRefImpl Symb, - StringRef &Res) const { +std::error_code MachOObjectFile::getIndirectName(DataRefImpl Symb, + StringRef &Res) const { StringRef StringTable = getStringTableData(); uint64_t NValue; if (is64Bit()) { @@ -508,8 +510,8 @@ error_code MachOObjectFile::getIndirectName(DataRefImpl Symb, return object_error::success; } -error_code MachOObjectFile::getSymbolAddress(DataRefImpl Symb, - uint64_t &Res) const { +std::error_code MachOObjectFile::getSymbolAddress(DataRefImpl Symb, + uint64_t &Res) const { if (is64Bit()) { MachO::nlist_64 Entry = getSymbol64TableEntry(Symb); if ((Entry.n_type & MachO::N_TYPE) == MachO::N_UNDF && @@ -528,8 +530,8 @@ error_code MachOObjectFile::getSymbolAddress(DataRefImpl Symb, return object_error::success; } -error_code MachOObjectFile::getSymbolAlignment(DataRefImpl DRI, - uint32_t &Result) const { +std::error_code MachOObjectFile::getSymbolAlignment(DataRefImpl DRI, + uint32_t &Result) const { uint32_t flags = getSymbolFlags(DRI); if (flags & SymbolRef::SF_Common) { nlist_base Entry = getSymbolTableEntryBase(this, DRI); @@ -540,8 +542,8 @@ error_code MachOObjectFile::getSymbolAlignment(DataRefImpl DRI, return object_error::success; } -error_code MachOObjectFile::getSymbolSize(DataRefImpl DRI, - uint64_t &Result) const { +std::error_code MachOObjectFile::getSymbolSize(DataRefImpl DRI, + uint64_t &Result) const { uint64_t BeginOffset; uint64_t EndOffset = 0; uint8_t SectionIndex; @@ -589,8 +591,8 @@ error_code MachOObjectFile::getSymbolSize(DataRefImpl DRI, return object_error::success; } -error_code MachOObjectFile::getSymbolType(DataRefImpl Symb, - SymbolRef::Type &Res) const { +std::error_code MachOObjectFile::getSymbolType(DataRefImpl Symb, + SymbolRef::Type &Res) const { nlist_base Entry = getSymbolTableEntryBase(this, Symb); uint8_t n_type = Entry.n_type; @@ -649,9 +651,8 @@ uint32_t MachOObjectFile::getSymbolFlags(DataRefImpl DRI) const { return Result; } -error_code -MachOObjectFile::getSymbolSection(DataRefImpl Symb, - section_iterator &Res) const { +std::error_code MachOObjectFile::getSymbolSection(DataRefImpl Symb, + section_iterator &Res) const { nlist_base Entry = getSymbolTableEntryBase(this, Symb); uint8_t index = Entry.n_sect; @@ -670,15 +671,15 @@ void MachOObjectFile::moveSectionNext(DataRefImpl &Sec) const { Sec.d.a++; } -error_code -MachOObjectFile::getSectionName(DataRefImpl Sec, StringRef &Result) const { +std::error_code MachOObjectFile::getSectionName(DataRefImpl Sec, + StringRef &Result) const { ArrayRef<char> Raw = getSectionRawName(Sec); Result = parseSegmentOrSectionName(Raw.data()); return object_error::success; } -error_code -MachOObjectFile::getSectionAddress(DataRefImpl Sec, uint64_t &Res) const { +std::error_code MachOObjectFile::getSectionAddress(DataRefImpl Sec, + uint64_t &Res) const { if (is64Bit()) { MachO::section_64 Sect = getSection64(Sec); Res = Sect.addr; @@ -689,8 +690,8 @@ MachOObjectFile::getSectionAddress(DataRefImpl Sec, uint64_t &Res) const { return object_error::success; } -error_code -MachOObjectFile::getSectionSize(DataRefImpl Sec, uint64_t &Res) const { +std::error_code MachOObjectFile::getSectionSize(DataRefImpl Sec, + uint64_t &Res) const { if (is64Bit()) { MachO::section_64 Sect = getSection64(Sec); Res = Sect.size; @@ -702,8 +703,8 @@ MachOObjectFile::getSectionSize(DataRefImpl Sec, uint64_t &Res) const { return object_error::success; } -error_code -MachOObjectFile::getSectionContents(DataRefImpl Sec, StringRef &Res) const { +std::error_code MachOObjectFile::getSectionContents(DataRefImpl Sec, + StringRef &Res) const { uint32_t Offset; uint64_t Size; @@ -721,8 +722,8 @@ MachOObjectFile::getSectionContents(DataRefImpl Sec, StringRef &Res) const { return object_error::success; } -error_code -MachOObjectFile::getSectionAlignment(DataRefImpl Sec, uint64_t &Res) const { +std::error_code MachOObjectFile::getSectionAlignment(DataRefImpl Sec, + uint64_t &Res) const { uint32_t Align; if (is64Bit()) { MachO::section_64 Sect = getSection64(Sec); @@ -736,14 +737,15 @@ MachOObjectFile::getSectionAlignment(DataRefImpl Sec, uint64_t &Res) const { return object_error::success; } -error_code -MachOObjectFile::isSectionText(DataRefImpl Sec, bool &Res) const { +std::error_code MachOObjectFile::isSectionText(DataRefImpl Sec, + bool &Res) const { uint32_t Flags = getSectionFlags(this, Sec); Res = Flags & MachO::S_ATTR_PURE_INSTRUCTIONS; return object_error::success; } -error_code MachOObjectFile::isSectionData(DataRefImpl Sec, bool &Result) const { +std::error_code MachOObjectFile::isSectionData(DataRefImpl Sec, + bool &Result) const { uint32_t Flags = getSectionFlags(this, Sec); unsigned SectionType = Flags & MachO::SECTION_TYPE; Result = !(Flags & MachO::S_ATTR_PURE_INSTRUCTIONS) && @@ -752,7 +754,8 @@ error_code MachOObjectFile::isSectionData(DataRefImpl Sec, bool &Result) const { return object_error::success; } -error_code MachOObjectFile::isSectionBSS(DataRefImpl Sec, bool &Result) const { +std::error_code MachOObjectFile::isSectionBSS(DataRefImpl Sec, + bool &Result) const { uint32_t Flags = getSectionFlags(this, Sec); unsigned SectionType = Flags & MachO::SECTION_TYPE; Result = !(Flags & MachO::S_ATTR_PURE_INSTRUCTIONS) && @@ -761,7 +764,7 @@ error_code MachOObjectFile::isSectionBSS(DataRefImpl Sec, bool &Result) const { return object_error::success; } -error_code +std::error_code MachOObjectFile::isSectionRequiredForExecution(DataRefImpl Sec, bool &Result) const { // FIXME: Unimplemented. @@ -769,15 +772,15 @@ MachOObjectFile::isSectionRequiredForExecution(DataRefImpl Sec, return object_error::success; } -error_code MachOObjectFile::isSectionVirtual(DataRefImpl Sec, - bool &Result) const { +std::error_code MachOObjectFile::isSectionVirtual(DataRefImpl Sec, + bool &Result) const { // FIXME: Unimplemented. Result = false; return object_error::success; } -error_code -MachOObjectFile::isSectionZeroInit(DataRefImpl Sec, bool &Res) const { +std::error_code MachOObjectFile::isSectionZeroInit(DataRefImpl Sec, + bool &Res) const { uint32_t Flags = getSectionFlags(this, Sec); unsigned SectionType = Flags & MachO::SECTION_TYPE; Res = SectionType == MachO::S_ZEROFILL || @@ -785,8 +788,8 @@ MachOObjectFile::isSectionZeroInit(DataRefImpl Sec, bool &Res) const { return object_error::success; } -error_code MachOObjectFile::isSectionReadOnlyData(DataRefImpl Sec, - bool &Result) const { +std::error_code MachOObjectFile::isSectionReadOnlyData(DataRefImpl Sec, + bool &Result) const { // Consider using the code from isSectionText to look for __const sections. // Alternately, emit S_ATTR_PURE_INSTRUCTIONS and/or S_ATTR_SOME_INSTRUCTIONS // to use section attributes to distinguish code from data. @@ -796,9 +799,9 @@ error_code MachOObjectFile::isSectionReadOnlyData(DataRefImpl Sec, return object_error::success; } -error_code -MachOObjectFile::sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb, - bool &Result) const { +std::error_code MachOObjectFile::sectionContainsSymbol(DataRefImpl Sec, + DataRefImpl Symb, + bool &Result) const { SymbolRef::Type ST; this->getSymbolType(Symb, ST); if (ST == SymbolRef::ST_Unknown) { @@ -846,8 +849,8 @@ void MachOObjectFile::moveRelocationNext(DataRefImpl &Rel) const { ++Rel.d.b; } -error_code -MachOObjectFile::getRelocationAddress(DataRefImpl Rel, uint64_t &Res) const { +std::error_code MachOObjectFile::getRelocationAddress(DataRefImpl Rel, + uint64_t &Res) const { uint64_t Offset; getRelocationOffset(Rel, Offset); @@ -859,8 +862,8 @@ MachOObjectFile::getRelocationAddress(DataRefImpl Rel, uint64_t &Res) const { return object_error::success; } -error_code MachOObjectFile::getRelocationOffset(DataRefImpl Rel, - uint64_t &Res) const { +std::error_code MachOObjectFile::getRelocationOffset(DataRefImpl Rel, + uint64_t &Res) const { assert(getHeader().filetype == MachO::MH_OBJECT && "Only implemented for MH_OBJECT"); MachO::any_relocation_info RE = getRelocation(Rel); @@ -886,14 +889,14 @@ MachOObjectFile::getRelocationSymbol(DataRefImpl Rel) const { return symbol_iterator(SymbolRef(Sym, this)); } -error_code MachOObjectFile::getRelocationType(DataRefImpl Rel, - uint64_t &Res) const { +std::error_code MachOObjectFile::getRelocationType(DataRefImpl Rel, + uint64_t &Res) const { MachO::any_relocation_info RE = getRelocation(Rel); Res = getAnyRelocationType(RE); return object_error::success; } -error_code +std::error_code MachOObjectFile::getRelocationTypeName(DataRefImpl Rel, SmallVectorImpl<char> &Result) const { StringRef res; @@ -1006,7 +1009,7 @@ MachOObjectFile::getRelocationTypeName(DataRefImpl Rel, return object_error::success; } -error_code +std::error_code MachOObjectFile::getRelocationValueString(DataRefImpl Rel, SmallVectorImpl<char> &Result) const { MachO::any_relocation_info RE = getRelocation(Rel); @@ -1182,8 +1185,8 @@ MachOObjectFile::getRelocationValueString(DataRefImpl Rel, return object_error::success; } -error_code -MachOObjectFile::getRelocationHidden(DataRefImpl Rel, bool &Result) const { +std::error_code MachOObjectFile::getRelocationHidden(DataRefImpl Rel, + bool &Result) const { unsigned Arch = getArch(); uint64_t Type; getRelocationType(Rel, Type); @@ -1210,13 +1213,13 @@ MachOObjectFile::getRelocationHidden(DataRefImpl Rel, bool &Result) const { return object_error::success; } -error_code MachOObjectFile::getLibraryNext(DataRefImpl LibData, - LibraryRef &Res) const { +std::error_code MachOObjectFile::getLibraryNext(DataRefImpl LibData, + LibraryRef &Res) const { report_fatal_error("Needed libraries unimplemented in MachOObjectFile"); } -error_code MachOObjectFile::getLibraryPath(DataRefImpl LibData, - StringRef &Res) const { +std::error_code MachOObjectFile::getLibraryPath(DataRefImpl LibData, + StringRef &Res) const { report_fatal_error("Needed libraries unimplemented in MachOObjectFile"); } @@ -1367,8 +1370,8 @@ guess_qtx: // normal two-level namespace default (that is MH_TWOLEVEL in the header). // It is passed the index (0 - based) of the library as translated from // GET_LIBRARY_ORDINAL (1 - based). -error_code MachOObjectFile::getLibraryShortNameByIndex(unsigned Index, - StringRef &Res) { +std::error_code MachOObjectFile::getLibraryShortNameByIndex(unsigned Index, + StringRef &Res) { if (Index >= Libraries.size()) return object_error::parse_failed; @@ -1818,7 +1821,7 @@ void MachOObjectFile::ReadULEB128s(uint64_t Index, ErrorOr<ObjectFile *> ObjectFile::createMachOObjectFile(MemoryBuffer *Buffer, bool BufferOwned) { StringRef Magic = Buffer->getBuffer().slice(0, 4); - error_code EC; + std::error_code EC; std::unique_ptr<MachOObjectFile> Ret; if (Magic == "\xFE\xED\xFA\xCE") Ret.reset(new MachOObjectFile(Buffer, false, false, EC, BufferOwned)); diff --git a/lib/Object/MachOUniversal.cpp b/lib/Object/MachOUniversal.cpp index 5085efde5e..1d45004273 100644 --- a/lib/Object/MachOUniversal.cpp +++ b/lib/Object/MachOUniversal.cpp @@ -21,6 +21,7 @@ using namespace llvm; using namespace object; +using std::error_code; template<typename T> static void SwapValue(T &Value) { diff --git a/lib/Object/Object.cpp b/lib/Object/Object.cpp index b0068a87b0..8792345c79 100644 --- a/lib/Object/Object.cpp +++ b/lib/Object/Object.cpp @@ -18,6 +18,7 @@ using namespace llvm; using namespace object; +using std::error_code; inline ObjectFile *unwrap(LLVMObjectFileRef OF) { return reinterpret_cast<ObjectFile*>(OF); diff --git a/lib/Object/ObjectFile.cpp b/lib/Object/ObjectFile.cpp index 0be972e26b..5d43249234 100644 --- a/lib/Object/ObjectFile.cpp +++ b/lib/Object/ObjectFile.cpp @@ -20,6 +20,7 @@ using namespace llvm; using namespace object; +using std::error_code; void ObjectFile::anchor() { } diff --git a/lib/ProfileData/InstrProfReader.cpp b/lib/ProfileData/InstrProfReader.cpp index 7014f5e5cc..8d3ec5d2a3 100644 --- a/lib/ProfileData/InstrProfReader.cpp +++ b/lib/ProfileData/InstrProfReader.cpp @@ -20,6 +20,7 @@ #include <cassert> using namespace llvm; +using std::error_code; static error_code setupMemoryBuffer(std::string Path, std::unique_ptr<MemoryBuffer> &Buffer) { diff --git a/lib/ProfileData/InstrProfWriter.cpp b/lib/ProfileData/InstrProfWriter.cpp index 83c41d93bb..e55c299181 100644 --- a/lib/ProfileData/InstrProfWriter.cpp +++ b/lib/ProfileData/InstrProfWriter.cpp @@ -66,9 +66,10 @@ public: }; } -error_code InstrProfWriter::addFunctionCounts(StringRef FunctionName, - uint64_t FunctionHash, - ArrayRef<uint64_t> Counters) { +std::error_code +InstrProfWriter::addFunctionCounts(StringRef FunctionName, + uint64_t FunctionHash, + ArrayRef<uint64_t> Counters) { auto Where = FunctionData.find(FunctionName); if (Where == FunctionData.end()) { // If this is the first time we've seen this function, just add it. diff --git a/lib/Support/DataStream.cpp b/lib/Support/DataStream.cpp index 830bd8adb9..0d8a800d70 100644 --- a/lib/Support/DataStream.cpp +++ b/lib/Support/DataStream.cpp @@ -28,6 +28,7 @@ #include <io.h> #endif using namespace llvm; +using std::error_code; #define DEBUG_TYPE "Data-stream" diff --git a/lib/Support/FileOutputBuffer.cpp b/lib/Support/FileOutputBuffer.cpp index 96fa58767e..68f6fa16f9 100644 --- a/lib/Support/FileOutputBuffer.cpp +++ b/lib/Support/FileOutputBuffer.cpp @@ -17,6 +17,7 @@ #include <system_error> using llvm::sys::fs::mapped_file_region; +using std::error_code; namespace llvm { FileOutputBuffer::FileOutputBuffer(mapped_file_region * R, diff --git a/lib/Support/FileUtilities.cpp b/lib/Support/FileUtilities.cpp index 68953d347f..729e44789c 100644 --- a/lib/Support/FileUtilities.cpp +++ b/lib/Support/FileUtilities.cpp @@ -22,6 +22,7 @@ #include <cstring> #include <system_error> using namespace llvm; +using std::error_code; static bool isSignedChar(char C) { return (C == '+' || C == '-'); diff --git a/lib/Support/GraphWriter.cpp b/lib/Support/GraphWriter.cpp index 306f3e89d0..e68ee434dd 100644 --- a/lib/Support/GraphWriter.cpp +++ b/lib/Support/GraphWriter.cpp @@ -68,7 +68,7 @@ StringRef llvm::DOT::getColorString(unsigned ColorNumber) { std::string llvm::createGraphFilename(const Twine &Name, int &FD) { FD = -1; SmallString<128> Filename; - error_code EC = sys::fs::createTemporaryFile(Name, "dot", FD, Filename); + std::error_code EC = sys::fs::createTemporaryFile(Name, "dot", FD, Filename); if (EC) { errs() << "Error: " << EC.message() << "\n"; return ""; diff --git a/lib/Support/LockFileManager.cpp b/lib/Support/LockFileManager.cpp index b050e5de8d..0204e75f84 100644 --- a/lib/Support/LockFileManager.cpp +++ b/lib/Support/LockFileManager.cpp @@ -22,6 +22,7 @@ #include <unistd.h> #endif using namespace llvm; +using std::error_code; /// \brief Attempt to read the lock file with the given name, if it exists. /// diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp index 0164443ad5..c395ce72b8 100644 --- a/lib/Support/MemoryBuffer.cpp +++ b/lib/Support/MemoryBuffer.cpp @@ -33,6 +33,7 @@ #include <io.h> #endif using namespace llvm; +using std::error_code; //===----------------------------------------------------------------------===// // MemoryBuffer implementation itself. diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp index dabf763c8d..13e3a8ad02 100644 --- a/lib/Support/Path.cpp +++ b/lib/Support/Path.cpp @@ -28,6 +28,7 @@ #endif using namespace llvm; +using std::error_code; namespace { using llvm::StringRef; diff --git a/lib/Support/Unix/Memory.inc b/lib/Support/Unix/Memory.inc index 10de038f43..cca3782949 100644 --- a/lib/Support/Unix/Memory.inc +++ b/lib/Support/Unix/Memory.inc @@ -37,6 +37,7 @@ extern "C" void sys_icache_invalidate(const void *Addr, size_t len); #else extern "C" void __clear_cache(void *, void*); #endif +using std::error_code; namespace { diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc index d927bb539e..ea2b8dcda2 100644 --- a/lib/Support/Unix/Process.inc +++ b/lib/Support/Unix/Process.inc @@ -46,7 +46,7 @@ using namespace llvm; using namespace sys; - +using std::error_code; process::id_type self_process::get_id() { return getpid(); diff --git a/lib/Support/Unix/Program.inc b/lib/Support/Unix/Program.inc index f4c6cdf7e9..d850664334 100644 --- a/lib/Support/Unix/Program.inc +++ b/lib/Support/Unix/Program.inc @@ -48,6 +48,8 @@ #endif namespace llvm { +using std::error_code; + using namespace sys; ProcessInfo::ProcessInfo() : Pid(0), ReturnCode(0) {} diff --git a/lib/Support/Windows/Memory.inc b/lib/Support/Windows/Memory.inc index d410df35aa..431cfb6cf9 100644 --- a/lib/Support/Windows/Memory.inc +++ b/lib/Support/Windows/Memory.inc @@ -19,6 +19,7 @@ // The Windows.h header must be the last one included. #include "WindowsSupport.h" +using std::error_code; namespace { diff --git a/lib/Support/Windows/Process.inc b/lib/Support/Windows/Process.inc index 0be871c695..c88557c5ee 100644 --- a/lib/Support/Windows/Process.inc +++ b/lib/Support/Windows/Process.inc @@ -48,7 +48,7 @@ using namespace llvm; using namespace sys; - +using std::error_code; process::id_type self_process::get_id() { return GetCurrentProcessId(); diff --git a/lib/Support/Windows/Program.inc b/lib/Support/Windows/Program.inc index 6c7ddbde33..8d1df5ffc9 100644 --- a/lib/Support/Windows/Program.inc +++ b/lib/Support/Windows/Program.inc @@ -24,6 +24,7 @@ //===----------------------------------------------------------------------===// namespace llvm { +using std::error_code; using namespace sys; ProcessInfo::ProcessInfo() : ProcessHandle(0), Pid(0), ReturnCode(0) {} diff --git a/lib/Support/YAMLTraits.cpp b/lib/Support/YAMLTraits.cpp index 66af33693d..0042c29036 100644 --- a/lib/Support/YAMLTraits.cpp +++ b/lib/Support/YAMLTraits.cpp @@ -18,6 +18,7 @@ #include <cstring> using namespace llvm; using namespace yaml; +using std::error_code; //===----------------------------------------------------------------------===// // IO diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index 6a61b1b2a6..f7c213ac2b 100644 --- a/lib/Support/raw_ostream.cpp +++ b/lib/Support/raw_ostream.cpp @@ -450,7 +450,7 @@ raw_fd_ostream::raw_fd_ostream(const char *Filename, std::string &ErrorInfo, return; } - error_code EC = sys::fs::openFileForWrite(Filename, FD, Flags); + std::error_code EC = sys::fs::openFileForWrite(Filename, FD, Flags); if (EC) { ErrorInfo = "Error opening output file '" + std::string(Filename) + "': " + diff --git a/lib/TableGen/Main.cpp b/lib/TableGen/Main.cpp index c932668fde..c757b852a4 100644 --- a/lib/TableGen/Main.cpp +++ b/lib/TableGen/Main.cpp @@ -27,6 +27,7 @@ #include <cstdio> #include <system_error> using namespace llvm; +using std::error_code; namespace { cl::opt<std::string> diff --git a/lib/Transforms/Scalar/SampleProfile.cpp b/lib/Transforms/Scalar/SampleProfile.cpp index 8e557aaa2f..4b97295d17 100644 --- a/lib/Transforms/Scalar/SampleProfile.cpp +++ b/lib/Transforms/Scalar/SampleProfile.cpp @@ -51,6 +51,7 @@ #include <cctype> using namespace llvm; +using std::error_code; #define DEBUG_TYPE "sample-profile" diff --git a/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/lib/Transforms/Scalar/SimplifyCFGPass.cpp index 5d5606ba47..a09e4853fb 100644 --- a/lib/Transforms/Scalar/SimplifyCFGPass.cpp +++ b/lib/Transforms/Scalar/SimplifyCFGPass.cpp @@ -36,6 +36,7 @@ #include "llvm/Pass.h" #include "llvm/Transforms/Utils/Local.h" using namespace llvm; +using std::error_code; #define DEBUG_TYPE "simplifycfg" diff --git a/lib/Transforms/Utils/SpecialCaseList.cpp b/lib/Transforms/Utils/SpecialCaseList.cpp index 0a07b8f1ab..8ae36fe833 100644 --- a/lib/Transforms/Utils/SpecialCaseList.cpp +++ b/lib/Transforms/Utils/SpecialCaseList.cpp @@ -31,6 +31,7 @@ #include <utility> namespace llvm { +using std::error_code; /// Represents a set of regular expressions. Regular expressions which are /// "literal" (i.e. no regex metacharacters) are stored in Strings, while all |