diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-12 14:53:47 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-12 14:53:47 +0000 |
commit | b1a4d3a26c8bf3a688c1a9833a61b6e92b39c9d4 (patch) | |
tree | c5f1c160d077bcd15871ce612efcf636b71b7c0e /lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp | |
parent | fd61fd3b6f1eff215905f57efcec0804b5b0be28 (diff) | |
download | bcm5719-llvm-b1a4d3a26c8bf3a688c1a9833a61b6e92b39c9d4.tar.gz bcm5719-llvm-b1a4d3a26c8bf3a688c1a9833a61b6e92b39c9d4.zip |
Don't import error_code into the lld namespace.
llvm-svn: 210785
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp')
-rw-r--r-- | lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp index 8e3bd4e7cc1..69f62ef0df1 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp @@ -63,13 +63,13 @@ public: /// Writes the normalized file as a binary mach-o file to the specified /// path. This does not have a stream interface because the generated /// file may need the 'x' bit set. - error_code writeBinary(StringRef path); + std::error_code writeBinary(StringRef path); private: uint32_t loadCommandsSize(uint32_t &count); void buildFileOffsets(); void writeMachHeader(); - error_code writeLoadCommands(); + std::error_code writeLoadCommands(); void writeSectionContent(); void writeRelocations(); void writeSymbolTable(); @@ -103,9 +103,8 @@ private: }; template <typename T> - error_code writeSingleSegmentLoadCommand(uint8_t *&lc); - template <typename T> - error_code writeSegmentLoadCommands(uint8_t *&lc); + std::error_code writeSingleSegmentLoadCommand(uint8_t *&lc); + template <typename T> std::error_code writeSegmentLoadCommands(uint8_t *&lc); uint32_t pointerAlign(uint32_t value); static StringRef dyldPath(); @@ -154,7 +153,7 @@ private: typedef std::map<const Section*, SectionExtraInfo> SectionMap; const NormalizedFile &_file; - error_code _ec; + std::error_code _ec; uint8_t *_buffer; const bool _is64; const bool _swap; @@ -480,10 +479,8 @@ uint32_t MachOFileLayout::indirectSymbolElementSize(const Section §) { return sect.content.size() / sect.indirectSymbols.size(); } - - template <typename T> -error_code MachOFileLayout::writeSingleSegmentLoadCommand(uint8_t *&lc) { +std::error_code MachOFileLayout::writeSingleSegmentLoadCommand(uint8_t *&lc) { typename T::command* seg = reinterpret_cast<typename T::command*>(lc); seg->cmd = T::LC; seg->cmdsize = sizeof(typename T::command) @@ -524,12 +521,11 @@ error_code MachOFileLayout::writeSingleSegmentLoadCommand(uint8_t *&lc) { ++sout; } lc = next; - return error_code(); + return std::error_code(); } - template <typename T> -error_code MachOFileLayout::writeSegmentLoadCommands(uint8_t *&lc) { +std::error_code MachOFileLayout::writeSegmentLoadCommands(uint8_t *&lc) { uint32_t indirectSymRunningIndex = 0; for (const Segment &seg : _file.segments) { // Write segment command with trailing sections. @@ -587,12 +583,11 @@ error_code MachOFileLayout::writeSegmentLoadCommands(uint8_t *&lc) { if (_swap) swapStruct(*cmd); lc = next; - return error_code(); + return std::error_code(); } - -error_code MachOFileLayout::writeLoadCommands() { - error_code ec; +std::error_code MachOFileLayout::writeLoadCommands() { + std::error_code ec; uint8_t *lc = &_buffer[_startOfLoadCommands]; if (_file.fileType == llvm::MachO::MH_OBJECT) { // Object files have one unnamed segment which holds all sections. @@ -929,8 +924,7 @@ void MachOFileLayout::writeLinkEditContent() { } } - -error_code MachOFileLayout::writeBinary(StringRef path) { +std::error_code MachOFileLayout::writeBinary(StringRef path) { // Check for pending error from constructor. if (_ec) return _ec; @@ -939,7 +933,7 @@ error_code MachOFileLayout::writeBinary(StringRef path) { unsigned flags = 0; if (_file.fileType != llvm::MachO::MH_OBJECT) flags = llvm::FileOutputBuffer::F_executable; - error_code ec; + std::error_code ec; ec = llvm::FileOutputBuffer::create(path, size(), fob, flags); if (ec) return ec; @@ -954,14 +948,13 @@ error_code MachOFileLayout::writeBinary(StringRef path) { writeLinkEditContent(); fob->commit(); - return error_code(); + return std::error_code(); } /// Takes in-memory normalized view and writes a mach-o object file. -error_code -writeBinary(const NormalizedFile &file, StringRef path) { +std::error_code writeBinary(const NormalizedFile &file, StringRef path) { MachOFileLayout layout(file); return layout.writeBinary(path); } |