[lld] r210785 - Don't import error_code into the lld namespace.
Rafael Espindola
rafael.espindola at gmail.com
Thu Jun 12 07:53:48 PDT 2014
Author: rafael
Date: Thu Jun 12 09:53:47 2014
New Revision: 210785
URL: http://llvm.org/viewvc/llvm-project?rev=210785&view=rev
Log:
Don't import error_code into the lld namespace.
Modified:
lld/trunk/include/lld/Core/ArchiveLibraryFile.h
lld/trunk/include/lld/Core/InputGraph.h
lld/trunk/include/lld/Core/LLVM.h
lld/trunk/include/lld/Core/LinkingContext.h
lld/trunk/include/lld/Core/PassManager.h
lld/trunk/include/lld/Driver/CoreInputGraph.h
lld/trunk/include/lld/Driver/DarwinInputGraph.h
lld/trunk/include/lld/Driver/GnuLdInputGraph.h
lld/trunk/include/lld/Driver/WinLinkInputGraph.h
lld/trunk/include/lld/ReaderWriter/Reader.h
lld/trunk/include/lld/ReaderWriter/Writer.h
lld/trunk/lib/Core/InputGraph.cpp
lld/trunk/lib/Core/LinkingContext.cpp
lld/trunk/lib/Core/Resolver.cpp
lld/trunk/lib/Driver/Driver.cpp
lld/trunk/lib/Driver/GnuLdDriver.cpp
lld/trunk/lib/Driver/GnuLdInputGraph.cpp
lld/trunk/lib/Driver/WinLinkInputGraph.cpp
lld/trunk/lib/Passes/RoundTripNativePass.cpp
lld/trunk/lib/Passes/RoundTripYAMLPass.cpp
lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h
lld/trunk/lib/ReaderWriter/ELF/ELFFile.h
lld/trunk/lib/ReaderWriter/ELF/ELFReader.h
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h
lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h
lld/trunk/lib/ReaderWriter/ELF/Writer.h
lld/trunk/lib/ReaderWriter/FileArchive.cpp
lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h
lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
lld/trunk/lib/ReaderWriter/MachO/WriterMachO.cpp
lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp
lld/trunk/lib/ReaderWriter/Native/WriterNative.cpp
lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h
lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.h
lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
lld/trunk/lib/ReaderWriter/Reader.cpp
lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
Modified: lld/trunk/include/lld/Core/ArchiveLibraryFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/ArchiveLibraryFile.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/ArchiveLibraryFile.h (original)
+++ lld/trunk/include/lld/Core/ArchiveLibraryFile.h Thu Jun 12 09:53:47 2014
@@ -35,7 +35,7 @@ public:
/// specified name and return the File object for that member, or nullptr.
virtual const File *find(StringRef name, bool dataSymbolOnly) const = 0;
- virtual error_code
+ virtual std::error_code
parseAllMembers(std::vector<std::unique_ptr<File>> &result) const = 0;
/// Returns a set of all defined symbols in the archive, i.e. all
Modified: lld/trunk/include/lld/Core/InputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/InputGraph.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/InputGraph.h (original)
+++ lld/trunk/include/lld/Core/InputGraph.h Thu Jun 12 09:53:47 2014
@@ -125,7 +125,7 @@ public:
virtual bool dump(raw_ostream &diagnostics) { return true; }
/// \brief parse the input element
- virtual error_code parse(const LinkingContext &, raw_ostream &) = 0;
+ virtual std::error_code parse(const LinkingContext &, raw_ostream &) = 0;
/// \brief functions for the resolver to use
@@ -184,11 +184,11 @@ public:
}
/// \brief Parse the group members.
- error_code parse(const LinkingContext &ctx, raw_ostream &diag) override {
+ std::error_code parse(const LinkingContext &ctx, raw_ostream &diag) override {
for (std::unique_ptr<InputElement> &ei : _elements)
- if (error_code ec = ei->parse(ctx, diag))
+ if (std::error_code ec = ei->parse(ctx, diag))
return ec;
- return error_code();
+ return std::error_code();
}
/// If Resolver made a progress using the current file, it's ok to revisit
@@ -243,7 +243,7 @@ public:
}
/// \brief create an error string for printing purposes
- virtual std::string errStr(error_code errc) {
+ virtual std::string errStr(std::error_code errc) {
std::string msg = errc.message();
Twine twine = Twine("Cannot open ") + _path + ": " + msg;
return twine.str();
@@ -266,7 +266,7 @@ public:
protected:
/// \brief Read the file into _buffer.
- error_code getBuffer(StringRef filePath);
+ std::error_code getBuffer(StringRef filePath);
StringRef _path; // The path of the Input file
InputGraph::FileVectorT _files; // A vector of lld File objects
@@ -289,8 +289,8 @@ public:
}
/// \brief parse the input element
- error_code parse(const LinkingContext &, raw_ostream &) override {
- return error_code();
+ std::error_code parse(const LinkingContext &, raw_ostream &) override {
+ return std::error_code();
}
/// \brief Return the next File thats part of this node to the
Modified: lld/trunk/include/lld/Core/LLVM.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/LLVM.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/LLVM.h (original)
+++ lld/trunk/include/lld/Core/LLVM.h Thu Jun 12 09:53:47 2014
@@ -61,7 +61,6 @@ namespace lld {
using llvm::SaveAndRestore;
using llvm::ErrorOr;
- using std::error_code;
using llvm::raw_ostream;
} // end namespace lld.
Modified: lld/trunk/include/lld/Core/LinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/LinkingContext.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/LinkingContext.h (original)
+++ lld/trunk/include/lld/Core/LinkingContext.h Thu Jun 12 09:53:47 2014
@@ -299,7 +299,7 @@ public:
/// Calls through to the writeFile() method on the specified Writer.
///
/// \param linkedFile This is the merged/linked graph of all input file Atoms.
- virtual error_code writeFile(const File &linkedFile) const;
+ virtual std::error_code writeFile(const File &linkedFile) const;
/// Return the next ordinal and Increment it.
virtual uint64_t getNextOrdinalAndIncrement() const { return _nextOrdinal++; }
Modified: lld/trunk/include/lld/Core/PassManager.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/PassManager.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/PassManager.h (original)
+++ lld/trunk/include/lld/Core/PassManager.h Thu Jun 12 09:53:47 2014
@@ -32,10 +32,10 @@ public:
_passes.push_back(std::move(pass));
}
- error_code runOnFile(std::unique_ptr<MutableFile> &file) {
+ std::error_code runOnFile(std::unique_ptr<MutableFile> &file) {
for (std::unique_ptr<Pass> &pass : _passes)
pass->perform(file);
- return error_code();
+ return std::error_code();
}
private:
Modified: lld/trunk/include/lld/Driver/CoreInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/CoreInputGraph.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/CoreInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/CoreInputGraph.h Thu Jun 12 09:53:47 2014
@@ -32,7 +32,8 @@ public:
CoreFileNode(CoreLinkingContext &, StringRef path) : FileNode(path) {}
/// \brief Parse the input file to lld::File.
- error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) override {
+ std::error_code parse(const LinkingContext &ctx,
+ raw_ostream &diagnostics) override {
using std::make_error_code;
ErrorOr<StringRef> filePath = getPath(ctx);
if (filePath.getError() == std::errc::no_such_file_or_directory)
@@ -40,7 +41,7 @@ public:
// Create a memory buffer
std::unique_ptr<MemoryBuffer> mb;
- if (error_code ec = MemoryBuffer::getFileOrSTDIN(*filePath, mb))
+ if (std::error_code ec = MemoryBuffer::getFileOrSTDIN(*filePath, mb))
return ec;
_buffer = std::move(mb);
Modified: lld/trunk/include/lld/Driver/DarwinInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/DarwinInputGraph.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/DarwinInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/DarwinInputGraph.h Thu Jun 12 09:53:47 2014
@@ -32,12 +32,13 @@ public:
: FileNode(path), _isWholeArchive(isWholeArchive) {}
/// \brief Parse the input file to lld::File.
- error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) override {
+ std::error_code parse(const LinkingContext &ctx,
+ raw_ostream &diagnostics) override {
ErrorOr<StringRef> filePath = getPath(ctx);
- if (error_code ec = filePath.getError())
+ if (std::error_code ec = filePath.getError())
return ec;
- if (error_code ec = getBuffer(*filePath))
+ if (std::error_code ec = getBuffer(*filePath))
return ec;
if (ctx.logInputFiles())
@@ -45,7 +46,7 @@ public:
if (_isWholeArchive) {
std::vector<std::unique_ptr<File>> parsedFiles;
- error_code ec = ctx.registry().parseFile(_buffer, parsedFiles);
+ std::error_code ec = ctx.registry().parseFile(_buffer, parsedFiles);
if (ec)
return ec;
assert(parsedFiles.size() == 1);
@@ -58,7 +59,7 @@ public:
} else {
// if --whole-archive is around non-archive, just use it as normal.
_files.push_back(std::move(f));
- return error_code();
+ return std::error_code();
}
}
return ctx.registry().parseFile(_buffer, _files);
Modified: lld/trunk/include/lld/Driver/GnuLdInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/GnuLdInputGraph.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/GnuLdInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/GnuLdInputGraph.h Thu Jun 12 09:53:47 2014
@@ -57,7 +57,7 @@ public:
ErrorOr<StringRef> getPath(const LinkingContext &ctx) const override;
/// \brief create an error string for printing purposes
- std::string errStr(error_code) override;
+ std::string errStr(std::error_code) override;
/// \brief Dump the Input Element
bool dump(raw_ostream &diagnostics) override {
@@ -72,7 +72,7 @@ public:
}
/// \brief Parse the input file to lld::File.
- error_code parse(const LinkingContext &, raw_ostream &) override;
+ std::error_code parse(const LinkingContext &, raw_ostream &) override;
/// \brief This is used by Group Nodes, when there is a need to reset the
/// the file to be processed next. When handling a group node that contains
@@ -111,7 +111,7 @@ public:
: FileNode(userPath), _elfLinkingContext(ctx), _linkerScript(nullptr) {}
/// \brief Parse the linker script.
- error_code parse(const LinkingContext &, raw_ostream &) override;
+ std::error_code parse(const LinkingContext &, raw_ostream &) override;
protected:
ELFLinkingContext &_elfLinkingContext;
@@ -126,7 +126,8 @@ public:
ELFGNULdScript(ELFLinkingContext &ctx, StringRef userPath)
: GNULdScript(ctx, userPath) {}
- error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) override;
+ std::error_code parse(const LinkingContext &ctx,
+ raw_ostream &diagnostics) override;
bool getReplacements(InputGraph::InputElementVectorT &result) override {
for (std::unique_ptr<InputElement> &elt : _expandElements)
Modified: lld/trunk/include/lld/Driver/WinLinkInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/WinLinkInputGraph.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/WinLinkInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/WinLinkInputGraph.h Thu Jun 12 09:53:47 2014
@@ -35,7 +35,8 @@ public:
ErrorOr<StringRef> getPath(const LinkingContext &ctx) const override;
/// \brief Parse the input file to lld::File.
- error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) override;
+ std::error_code parse(const LinkingContext &ctx,
+ raw_ostream &diagnostics) override;
ErrorOr<File &> getNextFile() override;
@@ -61,7 +62,7 @@ public:
PECOFFGroup(PECOFFLinkingContext &ctx) : Group(), _ctx(ctx) {}
/// \brief Parse the group members.
- error_code parse(const LinkingContext &ctx, raw_ostream &diag) override {
+ std::error_code parse(const LinkingContext &ctx, raw_ostream &diag) override {
std::lock_guard<std::recursive_mutex> lock(_ctx.getMutex());
return Group::parse(ctx, diag);
}
Modified: lld/trunk/include/lld/ReaderWriter/Reader.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/Reader.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/Reader.h (original)
+++ lld/trunk/include/lld/ReaderWriter/Reader.h Thu Jun 12 09:53:47 2014
@@ -55,7 +55,7 @@ public:
/// file) and create a File object.
///
/// The resulting File object may take ownership of the MemoryBuffer.
- virtual error_code
+ virtual std::error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
std::vector<std::unique_ptr<File>> &result) const = 0;
};
@@ -94,8 +94,8 @@ public:
/// Walk the list of registered Readers and find one that can parse the
/// supplied file and parse it.
- error_code parseFile(std::unique_ptr<MemoryBuffer> &mb,
- std::vector<std::unique_ptr<File>> &result) const;
+ std::error_code parseFile(std::unique_ptr<MemoryBuffer> &mb,
+ std::vector<std::unique_ptr<File>> &result) const;
/// Walk the list of registered kind tables to convert a Reference Kind
/// name to a value.
Modified: lld/trunk/include/lld/ReaderWriter/Writer.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/Writer.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/Writer.h (original)
+++ lld/trunk/include/lld/ReaderWriter/Writer.h Thu Jun 12 09:53:47 2014
@@ -31,7 +31,7 @@ public:
virtual ~Writer();
/// \brief Write a file from the supplied File object
- virtual error_code writeFile(const File &linkedFile, StringRef path) = 0;
+ virtual std::error_code writeFile(const File &linkedFile, StringRef path) = 0;
/// \brief This method is called by Core Linking to give the Writer a chance
/// to add file format specific "files" to set of files to be linked. This is
Modified: lld/trunk/lib/Core/InputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/InputGraph.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/Core/InputGraph.cpp (original)
+++ lld/trunk/lib/Core/InputGraph.cpp Thu Jun 12 09:53:47 2014
@@ -84,13 +84,13 @@ void InputGraph::normalize() {
}
/// \brief Read the file into _buffer.
-error_code FileNode::getBuffer(StringRef filePath) {
+std::error_code FileNode::getBuffer(StringRef filePath) {
// Create a memory buffer
std::unique_ptr<MemoryBuffer> mb;
- if (error_code ec = MemoryBuffer::getFileOrSTDIN(filePath, mb))
+ if (std::error_code ec = MemoryBuffer::getFileOrSTDIN(filePath, mb))
return ec;
_buffer = std::move(mb);
- return error_code();
+ return std::error_code();
}
/// \brief Return the next file that need to be processed by the resolver.
Modified: lld/trunk/lib/Core/LinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/LinkingContext.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/Core/LinkingContext.cpp (original)
+++ lld/trunk/lib/Core/LinkingContext.cpp Thu Jun 12 09:53:47 2014
@@ -33,7 +33,7 @@ bool LinkingContext::validate(raw_ostrea
return validateImpl(diagnostics);
}
-error_code LinkingContext::writeFile(const File &linkedFile) const {
+std::error_code LinkingContext::writeFile(const File &linkedFile) const {
return this->writer().writeFile(linkedFile, _outputPath);
}
Modified: lld/trunk/lib/Core/Resolver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/Resolver.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/Core/Resolver.cpp (original)
+++ lld/trunk/lib/Core/Resolver.cpp Thu Jun 12 09:53:47 2014
@@ -242,7 +242,7 @@ bool Resolver::resolveUndefines() {
for (;;) {
ErrorOr<File &> file = _context.getInputGraph().getNextFile();
- error_code ec = file.getError();
+ std::error_code ec = file.getError();
if (ec == InputGraphError::no_more_files)
return true;
if (!file) {
Modified: lld/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/Driver.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/Driver/Driver.cpp (original)
+++ lld/trunk/lib/Driver/Driver.cpp Thu Jun 12 09:53:47 2014
@@ -63,7 +63,7 @@ bool Driver::link(LinkingContext &contex
std::string buf;
llvm::raw_string_ostream stream(buf);
- if (error_code ec = ie->parse(context, stream)) {
+ if (std::error_code ec = ie->parse(context, stream)) {
if (FileNode *fileNode = dyn_cast<FileNode>(ie.get()))
stream << fileNode->errStr(ec) << "\n";
else if (dyn_cast<Group>(ie.get()))
@@ -130,7 +130,7 @@ bool Driver::link(LinkingContext &contex
// Give linked atoms to Writer to generate output file.
ScopedTask writeTask(getDefaultDomain(), "Write");
- if (error_code ec = context.writeFile(*merged)) {
+ if (std::error_code ec = context.writeFile(*merged)) {
diagnostics << "Failed to write file '" << context.outputPath()
<< "': " << ec.message() << "\n";
return false;
Modified: lld/trunk/lib/Driver/GnuLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/Driver/GnuLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/GnuLdDriver.cpp Thu Jun 12 09:53:47 2014
@@ -112,9 +112,9 @@ maybeExpandResponseFiles(int argc, const
}
// Get the Input file magic for creating appropriate InputGraph nodes.
-static error_code getFileMagic(ELFLinkingContext &ctx, StringRef path,
- llvm::sys::fs::file_magic &magic) {
- error_code ec = llvm::sys::fs::identify_magic(path, magic);
+static std::error_code getFileMagic(ELFLinkingContext &ctx, StringRef path,
+ llvm::sys::fs::file_magic &magic) {
+ std::error_code ec = llvm::sys::fs::identify_magic(path, magic);
if (ec)
return ec;
switch (magic) {
@@ -122,7 +122,7 @@ static error_code getFileMagic(ELFLinkin
case llvm::sys::fs::file_magic::elf_relocatable:
case llvm::sys::fs::file_magic::elf_shared_object:
case llvm::sys::fs::file_magic::unknown:
- return error_code();
+ return std::error_code();
default:
break;
}
@@ -158,7 +158,7 @@ llvm::ErrorOr<StringRef> ELFFileNode::ge
return _elfLinkingContext.searchFile(_path, _attributes._isSysRooted);
}
-std::string ELFFileNode::errStr(error_code errc) {
+std::string ELFFileNode::errStr(std::error_code errc) {
if (errc == std::errc::no_such_file_or_directory) {
if (_attributes._isDashlPrefix)
return (Twine("Unable to find library -l") + _path).str();
@@ -485,7 +485,7 @@ bool GnuLdDriver::parse(int argc, const
// FIXME: Calling getFileMagic() is expensive. It would be better to
// wire up the LdScript parser into the registry.
llvm::sys::fs::file_magic magic = llvm::sys::fs::file_magic::unknown;
- error_code ec = getFileMagic(*ctx, resolvedInputPath, magic);
+ std::error_code ec = getFileMagic(*ctx, resolvedInputPath, magic);
if (ec) {
diagnostics << "lld: unknown input file format for file " << userPath
<< "\n";
Modified: lld/trunk/lib/Driver/GnuLdInputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdInputGraph.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/Driver/GnuLdInputGraph.cpp (original)
+++ lld/trunk/lib/Driver/GnuLdInputGraph.cpp Thu Jun 12 09:53:47 2014
@@ -16,19 +16,19 @@
using namespace lld;
/// \brief Parse the input file to lld::File.
-error_code ELFFileNode::parse(const LinkingContext &ctx,
- raw_ostream &diagnostics) {
+std::error_code ELFFileNode::parse(const LinkingContext &ctx,
+ raw_ostream &diagnostics) {
ErrorOr<StringRef> filePath = getPath(ctx);
- if (error_code ec = filePath.getError())
+ if (std::error_code ec = filePath.getError())
return ec;
- if (error_code ec = getBuffer(*filePath))
+ if (std::error_code ec = getBuffer(*filePath))
return ec;
if (ctx.logInputFiles())
diagnostics << *filePath << "\n";
if (_attributes._isWholeArchive) {
std::vector<std::unique_ptr<File>> parsedFiles;
- if (error_code ec = ctx.registry().parseFile(_buffer, parsedFiles))
+ if (std::error_code ec = ctx.registry().parseFile(_buffer, parsedFiles))
return ec;
assert(parsedFiles.size() == 1);
std::unique_ptr<File> f(parsedFiles[0].release());
@@ -41,18 +41,18 @@ error_code ELFFileNode::parse(const Link
}
// if --whole-archive is around non-archive, just use it as normal.
_files.push_back(std::move(f));
- return error_code();
+ return std::error_code();
}
return ctx.registry().parseFile(_buffer, _files);
}
/// \brief Parse the GnuLD Script
-error_code GNULdScript::parse(const LinkingContext &ctx,
- raw_ostream &diagnostics) {
+std::error_code GNULdScript::parse(const LinkingContext &ctx,
+ raw_ostream &diagnostics) {
ErrorOr<StringRef> filePath = getPath(ctx);
- if (error_code ec = filePath.getError())
+ if (std::error_code ec = filePath.getError())
return ec;
- if (error_code ec = getBuffer(*filePath))
+ if (std::error_code ec = getBuffer(*filePath))
return ec;
if (ctx.logInputFiles())
@@ -66,7 +66,7 @@ error_code GNULdScript::parse(const Link
if (!_linkerScript)
return LinkerScriptReaderError::parse_error;
- return error_code();
+ return std::error_code();
}
static bool isPathUnderSysroot(StringRef sysroot, StringRef path) {
@@ -82,10 +82,10 @@ static bool isPathUnderSysroot(StringRef
}
/// \brief Handle GnuLD script for ELF.
-error_code ELFGNULdScript::parse(const LinkingContext &ctx,
- raw_ostream &diagnostics) {
+std::error_code ELFGNULdScript::parse(const LinkingContext &ctx,
+ raw_ostream &diagnostics) {
ELFFileNode::Attributes attributes;
- if (error_code ec = GNULdScript::parse(ctx, diagnostics))
+ if (std::error_code ec = GNULdScript::parse(ctx, diagnostics))
return ec;
StringRef sysRoot = _elfLinkingContext.getSysroot();
if (!sysRoot.empty() && isPathUnderSysroot(sysRoot, *getPath(ctx)))
@@ -106,5 +106,5 @@ error_code ELFGNULdScript::parse(const L
}
_expandElements.push_back(std::move(groupStart));
}
- return error_code();
+ return std::error_code();
}
Modified: lld/trunk/lib/Driver/WinLinkInputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkInputGraph.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkInputGraph.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkInputGraph.cpp Thu Jun 12 09:53:47 2014
@@ -16,18 +16,18 @@ bool isCOFFLibraryFileExtension(StringRe
}
/// \brief Parse the input file to lld::File.
-error_code PECOFFFileNode::parse(const LinkingContext &ctx,
- raw_ostream &diagnostics) {
+std::error_code PECOFFFileNode::parse(const LinkingContext &ctx,
+ raw_ostream &diagnostics) {
if (_parsed)
- return error_code();
+ return std::error_code();
_parsed = true;
ErrorOr<StringRef> filePath = getPath(ctx);
- if (error_code ec = filePath.getError()) {
+ if (std::error_code ec = filePath.getError()) {
diagnostics << "File not found: " << _path << "\n";
return ec;
}
- if (error_code ec = getBuffer(*filePath)) {
+ if (std::error_code ec = getBuffer(*filePath)) {
diagnostics << "Cannot open file: " << *filePath << "\n";
return ec;
}
Modified: lld/trunk/lib/Passes/RoundTripNativePass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/RoundTripNativePass.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/Passes/RoundTripNativePass.cpp (original)
+++ lld/trunk/lib/Passes/RoundTripNativePass.cpp Thu Jun 12 09:53:47 2014
@@ -41,7 +41,7 @@ void RoundTripNativePass::perform(std::u
if (MemoryBuffer::getFile(tmpNativeFile.str(), mb))
return;
- error_code ec = _context.registry().parseFile(mb, _nativeFile);
+ std::error_code ec = _context.registry().parseFile(mb, _nativeFile);
if (ec) {
// Note: we need a way for Passes to report errors.
llvm_unreachable("native reader not registered or read error");
Modified: lld/trunk/lib/Passes/RoundTripYAMLPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/RoundTripYAMLPass.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/Passes/RoundTripYAMLPass.cpp (original)
+++ lld/trunk/lib/Passes/RoundTripYAMLPass.cpp Thu Jun 12 09:53:47 2014
@@ -41,7 +41,7 @@ void RoundTripYAMLPass::perform(std::uni
if (MemoryBuffer::getFile(tmpYAMLFile.str(), mb))
return;
- error_code ec = _context.registry().parseFile(mb, _yamlFile);
+ std::error_code ec = _context.registry().parseFile(mb, _yamlFile);
if (ec) {
// Note: we need a way for Passes to report errors.
llvm_unreachable("yaml reader not registered or read error");
Modified: lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h Thu Jun 12 09:53:47 2014
@@ -85,7 +85,7 @@ DynamicFile<ELFT>::create(std::unique_pt
bool useShlibUndefines) {
std::unique_ptr<DynamicFile> file(new DynamicFile(mb->getBufferIdentifier()));
- error_code ec;
+ std::error_code ec;
file->_objFile.reset(new llvm::object::ELFFile<ELFT>(mb.release(), ec));
if (ec)
Modified: lld/trunk/lib/ReaderWriter/ELF/ELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFFile.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFFile.h Thu Jun 12 09:53:47 2014
@@ -129,19 +129,19 @@ public:
/// \brief Read input sections and populate necessary data structures
/// to read them later and create atoms
- virtual error_code createAtomizableSections();
+ virtual std::error_code createAtomizableSections();
/// \brief Create mergeable atoms from sections that have the merge attribute
/// set
- virtual error_code createMergeableAtoms();
+ virtual std::error_code createMergeableAtoms();
/// \brief Add the symbols that the sections contain. The symbols will be
/// converted to atoms for
/// Undefined symbols, absolute symbols
- virtual error_code createSymbolsFromAtomizableSections();
+ virtual std::error_code createSymbolsFromAtomizableSections();
/// \brief Create individual atoms
- virtual error_code createAtoms();
+ virtual std::error_code createAtoms();
const atom_collection<DefinedAtom> &defined() const override {
return _definedAtoms;
@@ -410,7 +410,7 @@ public:
template <class ELFT>
ErrorOr<std::unique_ptr<ELFFile<ELFT>>>
ELFFile<ELFT>::create(std::unique_ptr<MemoryBuffer> mb, bool atomizeStrings) {
- error_code ec;
+ std::error_code ec;
std::unique_ptr<ELFFile<ELFT>> file(
new ELFFile<ELFT>(mb->getBufferIdentifier(), atomizeStrings));
@@ -459,7 +459,8 @@ template <class ELFT> Reference::KindArc
llvm_unreachable("unsupported e_machine value");
}
-template <class ELFT> error_code ELFFile<ELFT>::createAtomizableSections() {
+template <class ELFT>
+std::error_code ELFFile<ELFT>::createAtomizableSections() {
// Handle: SHT_REL and SHT_RELA sections:
// Increment over the sections, when REL/RELA section types are found add
// the contents to the RelocationReferences map.
@@ -484,7 +485,7 @@ template <class ELFT> error_code ELFFile
auto sHdr = _objFile->getSection(section.sh_info);
auto sectionName = _objFile->getSectionName(sHdr);
- if (error_code ec = sectionName.getError())
+ if (std::error_code ec = sectionName.getError())
return ec;
auto rai(_objFile->begin_rela(§ion));
@@ -498,7 +499,7 @@ template <class ELFT> error_code ELFFile
auto sHdr = _objFile->getSection(section.sh_info);
auto sectionName = _objFile->getSectionName(sHdr);
- if (error_code ec = sectionName.getError())
+ if (std::error_code ec = sectionName.getError())
return ec;
auto ri(_objFile->begin_rel(§ion));
@@ -509,10 +510,10 @@ template <class ELFT> error_code ELFFile
}
}
_references.reserve(totalRelocs);
- return error_code();
+ return std::error_code();
}
-template <class ELFT> error_code ELFFile<ELFT>::createMergeableAtoms() {
+template <class ELFT> std::error_code ELFFile<ELFT>::createMergeableAtoms() {
// Divide the section that contains mergeable strings into tokens
// TODO
// a) add resolver support to recognize multibyte chars
@@ -520,11 +521,11 @@ template <class ELFT> error_code ELFFile
std::vector<MergeString *> tokens;
for (const Elf_Shdr *msi : _mergeStringSections) {
auto sectionName = getSectionName(msi);
- if (error_code ec = sectionName.getError())
+ if (std::error_code ec = sectionName.getError())
return ec;
auto sectionContents = getSectionContents(msi);
- if (error_code ec = sectionContents.getError())
+ if (std::error_code ec = sectionContents.getError())
return ec;
StringRef secCont(reinterpret_cast<const char *>(sectionContents->begin()),
@@ -550,11 +551,11 @@ template <class ELFT> error_code ELFFile
_definedAtoms._atoms.push_back(*mergeAtom);
_mergeAtoms.push_back(*mergeAtom);
}
- return error_code();
+ return std::error_code();
}
template <class ELFT>
-error_code ELFFile<ELFT>::createSymbolsFromAtomizableSections() {
+std::error_code ELFFile<ELFT>::createSymbolsFromAtomizableSections() {
// Increment over all the symbols collecting atoms and symbol names for
// later use.
auto SymI = _objFile->begin_symbols(), SymE = _objFile->end_symbols();
@@ -567,7 +568,7 @@ error_code ELFFile<ELFT>::createSymbolsF
const Elf_Shdr *section = _objFile->getSection(&*SymI);
auto symbolName = _objFile->getSymbolName(SymI);
- if (error_code ec = symbolName.getError())
+ if (std::error_code ec = symbolName.getError())
return ec;
if (isAbsoluteSymbol(&*SymI)) {
@@ -594,10 +595,10 @@ error_code ELFFile<ELFT>::createSymbolsF
}
}
- return error_code();
+ return std::error_code();
}
-template <class ELFT> error_code ELFFile<ELFT>::createAtoms() {
+template <class ELFT> std::error_code ELFFile<ELFT>::createAtoms() {
for (auto &i : _sectionSymbols) {
const Elf_Shdr *section = i.first;
@@ -613,11 +614,11 @@ template <class ELFT> error_code ELFFile
Elf_Sym_Iter B) { return A->st_value < B->st_value; });
ErrorOr<StringRef> sectionName = this->getSectionName(section);
- if (error_code ec = sectionName.getError())
+ if (std::error_code ec = sectionName.getError())
return ec;
auto sectionContents = getSectionContents(section);
- if (error_code ec = sectionContents.getError())
+ if (std::error_code ec = sectionContents.getError())
return ec;
if (handleSectionWithNoSymbols(section, symbols)) {
@@ -637,7 +638,7 @@ template <class ELFT> error_code ELFFile
StringRef symbolName = "";
if (symbol->getType() != llvm::ELF::STT_SECTION) {
auto symName = _objFile->getSymbolName(symbol);
- if (error_code ec = symName.getError())
+ if (std::error_code ec = symName.getError())
return ec;
symbolName = *symName;
}
@@ -736,7 +737,7 @@ template <class ELFT> error_code ELFFile
}
updateReferences();
- return error_code();
+ return std::error_code();
}
template <class ELFT>
Modified: lld/trunk/lib/ReaderWriter/ELF/ELFReader.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFReader.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFReader.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFReader.h Thu Jun 12 09:53:47 2014
@@ -48,7 +48,7 @@ public:
return (magic == llvm::sys::fs::file_magic::elf_relocatable);
}
- error_code
+ std::error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
std::vector<std::unique_ptr<File>> &result) const override {
std::size_t maxAlignment =
@@ -56,10 +56,10 @@ public:
auto f = createELF<ELFFileCreateELFTraits>(
llvm::object::getElfArchType(&*mb), maxAlignment, std::move(mb),
_atomizeStrings);
- if (error_code ec = f.getError())
+ if (std::error_code ec = f.getError())
return ec;
result.push_back(std::move(*f));
- return error_code();
+ return std::error_code();
}
protected:
@@ -75,7 +75,7 @@ public:
return (magic == llvm::sys::fs::file_magic::elf_shared_object);
}
- error_code
+ std::error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
std::vector<std::unique_ptr<File>> &result) const override {
std::size_t maxAlignment =
@@ -83,10 +83,10 @@ public:
auto f = createELF<DynamicFileCreateELFTraits>(
llvm::object::getElfArchType(&*mb), maxAlignment, std::move(mb),
_useUndefines);
- if (error_code ec = f.getError())
+ if (std::error_code ec = f.getError())
return ec;
result.push_back(std::move(*f));
- return error_code();
+ return std::error_code();
}
protected:
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h Thu Jun 12 09:53:47 2014
@@ -68,12 +68,12 @@ public:
: ELFFile<ELFT>(name, atomizeStrings) {}
MipsELFFile(std::unique_ptr<MemoryBuffer> mb, bool atomizeStrings,
- error_code &ec)
+ std::error_code &ec)
: ELFFile<ELFT>(std::move(mb), atomizeStrings, ec) {}
static ErrorOr<std::unique_ptr<MipsELFFile>>
create(std::unique_ptr<MemoryBuffer> mb, bool atomizeStrings) {
- error_code ec;
+ std::error_code ec;
std::unique_ptr<MipsELFFile<ELFT>> file(
new MipsELFFile<ELFT>(mb->getBufferIdentifier(), atomizeStrings));
@@ -142,13 +142,13 @@ private:
referenceStart, referenceEnd, referenceList);
}
- error_code readAuxData() {
+ std::error_code readAuxData() {
typedef llvm::object::Elf_RegInfo<ELFT> Elf_RegInfo;
for (const Elf_Shdr §ion : this->_objFile->sections()) {
if (!_gp0.hasValue() && section.sh_type == llvm::ELF::SHT_MIPS_REGINFO) {
auto contents = this->getSectionContents(§ion);
- if (error_code ec = contents.getError())
+ if (std::error_code ec = contents.getError())
return ec;
ArrayRef<uint8_t> raw = contents.get();
@@ -162,7 +162,7 @@ private:
_dtpOff = section.sh_addr + DTP_OFFSET;
}
}
- return error_code();
+ return std::error_code();
}
void createRelocationReferences(const Elf_Sym &symbol,
Modified: lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h Thu Jun 12 09:53:47 2014
@@ -42,9 +42,9 @@ template <class ELFT> class TargetLayout
template <class ELFT> class TargetRelocationHandler {
public:
- virtual error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
- const lld::AtomLayout &,
- const Reference &) const = 0;
+ virtual std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
+ const lld::AtomLayout &,
+ const Reference &) const = 0;
virtual ~TargetRelocationHandler() {}
};
Modified: lld/trunk/lib/ReaderWriter/ELF/Writer.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Writer.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Writer.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Writer.h Thu Jun 12 09:53:47 2014
@@ -27,7 +27,7 @@ public:
virtual void buildChunks(const File &file) = 0;
/// \brief Writes the chunks into the output file specified by path
- virtual error_code writeFile(const File &file, StringRef path) = 0;
+ virtual std::error_code writeFile(const File &file, StringRef path) = 0;
/// \brief Get the virtual address of \p atom after layout.
virtual uint64_t addressOfAtom(const Atom *atom) = 0;
Modified: lld/trunk/lib/ReaderWriter/FileArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/FileArchive.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/FileArchive.cpp (original)
+++ lld/trunk/lib/ReaderWriter/FileArchive.cpp Thu Jun 12 09:53:47 2014
@@ -77,14 +77,14 @@ public:
virtual bool isWholeArchive() const { return _isWholeArchive; }
/// \brief parse each member
- error_code
+ std::error_code
parseAllMembers(std::vector<std::unique_ptr<File>> &result) const override {
for (auto mf = _archive->child_begin(), me = _archive->child_end();
mf != me; ++mf) {
- if (error_code ec = instantiateMember(mf, result))
+ if (std::error_code ec = instantiateMember(mf, result))
return ec;
}
- return error_code();
+ return std::error_code();
}
const atom_collection<DefinedAtom> &defined() const override {
@@ -103,7 +103,7 @@ public:
return _absoluteAtoms;
}
- error_code buildTableOfContents() {
+ std::error_code buildTableOfContents() {
DEBUG_WITH_TYPE("FileArchive", llvm::dbgs()
<< "Table of contents for archive '"
<< _archive->getFileName() << "':\n");
@@ -111,9 +111,9 @@ public:
i != e; ++i) {
StringRef name;
Archive::child_iterator member;
- if (error_code ec = i->getName(name))
+ if (std::error_code ec = i->getName(name))
return ec;
- if (error_code ec = i->getMember(member))
+ if (std::error_code ec = i->getMember(member))
return ec;
DEBUG_WITH_TYPE(
"FileArchive",
@@ -121,7 +121,7 @@ public:
<< "'" << name << "'\n");
_symbolMemberMap[name] = member;
}
- return error_code();
+ return std::error_code();
}
/// Returns a set of all defined symbols in the archive.
@@ -133,24 +133,25 @@ public:
}
protected:
- error_code
+ std::error_code
instantiateMember(Archive::child_iterator member,
std::vector<std::unique_ptr<File>> &result) const {
std::unique_ptr<MemoryBuffer> mb;
- if (error_code ec = member->getMemoryBuffer(mb, true))
+ if (std::error_code ec = member->getMemoryBuffer(mb, true))
return ec;
if (_logLoading)
llvm::outs() << mb->getBufferIdentifier() << "\n";
_registry.parseFile(mb, result);
const char *memberStart = member->getBuffer().data();
_membersInstantiated.insert(memberStart);
- return error_code();
+ return std::error_code();
}
// Parses the given memory buffer as an object file, and returns success error
// code if the given symbol is a data symbol. If the symbol is not a data
// symbol or does not exist, returns a failure.
- error_code isDataSymbol(std::unique_ptr<MemoryBuffer> mb, StringRef symbol) const {
+ std::error_code isDataSymbol(std::unique_ptr<MemoryBuffer> mb,
+ StringRef symbol) const {
auto objOrErr(ObjectFile::createObjectFile(mb.release()));
if (auto ec = objOrErr.getError())
return ec;
@@ -163,7 +164,7 @@ protected:
for (symbol_iterator i = ibegin; i != iend; ++i) {
// Get symbol name
- if (error_code ec = i->getName(symbolname))
+ if (std::error_code ec = i->getName(symbolname))
return ec;
if (symbolname != symbol)
continue;
@@ -175,11 +176,11 @@ protected:
continue;
// Get Symbol Type
- if (error_code ec = i->getType(symtype))
+ if (std::error_code ec = i->getType(symtype))
return ec;
if (symtype == SymbolRef::ST_Data)
- return error_code();
+ return std::error_code();
}
return object_error::parse_failed;
}
@@ -209,11 +210,11 @@ public:
return (magic == llvm::sys::fs::file_magic::archive);
}
- error_code
+ std::error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const Registry ®,
std::vector<std::unique_ptr<File>> &result) const override {
// Make Archive object which will be owned by FileArchive object.
- error_code ec;
+ std::error_code ec;
Archive *archive = new Archive(mb.get(), ec);
if (ec)
return ec;
@@ -229,7 +230,7 @@ public:
mb.release();
result.push_back(std::move(file));
- return error_code();
+ return std::error_code();
}
private:
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h Thu Jun 12 09:53:47 2014
@@ -249,8 +249,7 @@ readBinary(std::unique_ptr<MemoryBuffer>
const MachOLinkingContext::Arch arch);
/// 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);
size_t headerAndLoadCommandsSize(const NormalizedFile &file);
@@ -260,9 +259,7 @@ ErrorOr<std::unique_ptr<NormalizedFile>>
readYaml(std::unique_ptr<MemoryBuffer> &mb);
/// Writes a yaml encoded mach-o files given an in-memory normalized view.
-error_code
-writeYaml(const NormalizedFile &file, raw_ostream &out);
-
+std::error_code writeYaml(const NormalizedFile &file, raw_ostream &out);
/// Takes in-memory normalized dylib or object and parses it into lld::File
ErrorOr<std::unique_ptr<lld::File>>
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp Thu Jun 12 09:53:47 2014
@@ -50,10 +50,9 @@ namespace mach_o {
namespace normalized {
// Utility to call a lambda expression on each load command.
-static error_code
-forEachLoadCommand(StringRef lcRange, unsigned lcCount, bool swap, bool is64,
- std::function<bool (uint32_t cmd, uint32_t size,
- const char* lc)> func) {
+static std::error_code forEachLoadCommand(
+ StringRef lcRange, unsigned lcCount, bool swap, bool is64,
+ std::function<bool(uint32_t cmd, uint32_t size, const char *lc)> func) {
const char* p = lcRange.begin();
for (unsigned i=0; i < lcCount; ++i) {
const load_command *lc = reinterpret_cast<const load_command*>(p);
@@ -68,18 +67,17 @@ forEachLoadCommand(StringRef lcRange, un
return std::make_error_code(std::errc::executable_format_error);
if (func(slc->cmd, slc->cmdsize, p))
- return error_code();
+ return std::error_code();
p += slc->cmdsize;
}
- return error_code();
+ return std::error_code();
}
-
-static error_code
-appendRelocations(Relocations &relocs, StringRef buffer, bool swap,
- bool bigEndian, uint32_t reloff, uint32_t nreloc) {
+static std::error_code appendRelocations(Relocations &relocs, StringRef buffer,
+ bool swap, bool bigEndian,
+ uint32_t reloff, uint32_t nreloc) {
if ((reloff + nreloc*8) > buffer.size())
return std::make_error_code(std::errc::executable_format_error);
const any_relocation_info* relocsArray =
@@ -88,10 +86,10 @@ appendRelocations(Relocations &relocs, S
for(uint32_t i=0; i < nreloc; ++i) {
relocs.push_back(unpackRelocation(relocsArray[i], swap, bigEndian));
}
- return error_code();
+ return std::error_code();
}
-static error_code
+static std::error_code
appendIndirectSymbols(IndirectSymbols &isyms, StringRef buffer, bool swap,
bool bigEndian, uint32_t istOffset, uint32_t istCount,
uint32_t startIndex, uint32_t count) {
@@ -105,7 +103,7 @@ appendIndirectSymbols(IndirectSymbols &i
for(uint32_t i=0; i < count; ++i) {
isyms.push_back(read32(swap, indirectSymbolArray[startIndex+i]));
}
- return error_code();
+ return std::error_code();
}
@@ -206,8 +204,9 @@ readBinary(std::unique_ptr<MemoryBuffer>
// Pre-scan load commands looking for indirect symbol table.
uint32_t indirectSymbolTableOffset = 0;
uint32_t indirectSymbolTableCount = 0;
- error_code ec = forEachLoadCommand(lcRange, lcCount, swap, is64,
- [&] (uint32_t cmd, uint32_t size, const char* lc) -> bool {
+ std::error_code ec = forEachLoadCommand(lcRange, lcCount, swap, is64,
+ [&](uint32_t cmd, uint32_t size,
+ const char *lc) -> bool {
if (cmd == LC_DYSYMTAB) {
const dysymtab_command *d = reinterpret_cast<const dysymtab_command*>(lc);
indirectSymbolTableOffset = read32(swap, d->indirectsymoff);
@@ -412,21 +411,21 @@ public:
return true;
}
- error_code
+ std::error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const Registry ®istry,
- std::vector<std::unique_ptr<File> > &result) const override {
+ std::vector<std::unique_ptr<File>> &result) const override {
// Convert binary file to normalized mach-o.
auto normFile = readBinary(mb, _arch);
- if (error_code ec = normFile.getError())
+ if (std::error_code ec = normFile.getError())
return ec;
// Convert normalized mach-o to atoms.
auto file = normalizedToAtoms(**normFile, mb->getBufferIdentifier(), false);
- if (error_code ec = file.getError())
+ if (std::error_code ec = file.getError())
return ec;
result.push_back(std::move(*file));
- return error_code();
+ return std::error_code();
}
private:
MachOLinkingContext::Arch _arch;
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp Thu Jun 12 09:53:47 2014
@@ -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::indirectSymbol
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::writeSingleS
++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::writeSegment
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::writeLinkEditConte
}
}
-
-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(
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(
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);
}
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp Thu Jun 12 09:53:47 2014
@@ -244,10 +244,10 @@ void atomFromSymbol(DefinedAtom::Content
}
}
-error_code processSymboledSection(DefinedAtom::ContentType atomType,
- const Section §ion,
- const NormalizedFile &normalizedFile,
- MachOFile &file, bool copyRefs) {
+std::error_code processSymboledSection(DefinedAtom::ContentType atomType,
+ const Section §ion,
+ const NormalizedFile &normalizedFile,
+ MachOFile &file, bool copyRefs) {
// Find section's index.
uint32_t sectIndex = 1;
for (auto § : normalizedFile.sections) {
@@ -282,7 +282,7 @@ error_code processSymboledSection(Define
// If section has no symbols and no content, there are no atoms.
if (symbols.empty() && section.content.empty())
- return error_code();
+ return std::error_code();
const uint64_t firstSymbolAddr = symbols.front()->value;
if (firstSymbolAddr != section.address) {
@@ -304,13 +304,13 @@ error_code processSymboledSection(Define
lastSym->desc, atomScope(lastSym->scope),
section.address + section.content.size(), copyRefs);
}
- return error_code();
+ return std::error_code();
}
-error_code processSection(DefinedAtom::ContentType atomType,
- const Section §ion,
- const NormalizedFile &normalizedFile,
- MachOFile &file, bool copyRefs) {
+std::error_code processSection(DefinedAtom::ContentType atomType,
+ const Section §ion,
+ const NormalizedFile &normalizedFile,
+ MachOFile &file, bool copyRefs) {
const bool is64 = MachOLinkingContext::is64Bit(normalizedFile.arch);
const bool swap = !MachOLinkingContext::isHostEndian(normalizedFile.arch);
@@ -400,7 +400,7 @@ error_code processSection(DefinedAtom::C
offset += size;
}
}
- return error_code();
+ return std::error_code();
}
ErrorOr<std::unique_ptr<lld::File>>
@@ -410,8 +410,8 @@ normalizedObjectToAtoms(const Normalized
// Create atoms from each section.
for (auto § : normalizedFile.sections) {
DefinedAtom::ContentType atomType = atomTypeFromSection(sect);
- if (error_code ec = processSection(atomType, sect, normalizedFile, *file,
- copyRefs))
+ if (std::error_code ec =
+ processSection(atomType, sect, normalizedFile, *file, copyRefs))
return ec;
}
// Create atoms from undefined symbols.
Modified: lld/trunk/lib/ReaderWriter/MachO/WriterMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/WriterMachO.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/WriterMachO.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/WriterMachO.cpp Thu Jun 12 09:53:47 2014
@@ -32,11 +32,11 @@ class MachOWriter : public Writer {
public:
MachOWriter(const MachOLinkingContext &ctxt) : _context(ctxt) { }
- error_code writeFile(const lld::File &file, StringRef path) override {
+ std::error_code writeFile(const lld::File &file, StringRef path) override {
// Construct empty normalized file from atoms.
ErrorOr<std::unique_ptr<NormalizedFile>> nFile =
normalized::normalizedFromAtoms(file, _context);
- if (error_code ec = nFile.getError())
+ if (std::error_code ec = nFile.getError())
return ec;
// For testing, write out yaml form of normalized file.
Modified: lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp (original)
+++ lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp Thu Jun 12 09:53:47 2014
@@ -261,8 +261,8 @@ public:
/// Instantiates a File object from a native object file. Ownership
/// of the MemoryBuffer is transferred to the resulting File object.
- static error_code make(std::unique_ptr<MemoryBuffer> mb,
- std::vector<std::unique_ptr<lld::File>> &result) {
+ static std::error_code make(std::unique_ptr<MemoryBuffer> mb,
+ std::vector<std::unique_ptr<lld::File>> &result) {
const uint8_t *const base =
reinterpret_cast<const uint8_t *>(mb->getBufferStart());
StringRef path(mb->getBufferIdentifier());
@@ -290,7 +290,7 @@ public:
// process each chunk
for (uint32_t i = 0; i < header->chunkCount; ++i) {
- error_code ec;
+ std::error_code ec;
const NativeChunk* chunk = &chunks[i];
// sanity check chunk is within file
if ( chunk->fileOffset > fileSize )
@@ -400,8 +400,8 @@ private:
friend NativeReferenceV2;
// instantiate array of DefinedAtoms from v1 ivar data in file
- error_code processDefinedAtomsV1(const uint8_t *base,
- const NativeChunk *chunk) {
+ std::error_code processDefinedAtomsV1(const uint8_t *base,
+ const NativeChunk *chunk) {
const size_t atomSize = sizeof(NativeDefinedAtomV1);
size_t atomsArraySize = chunk->elementCount * atomSize;
uint8_t* atomsStart = reinterpret_cast<uint8_t*>
@@ -437,8 +437,8 @@ private:
// set up pointers to attributes array
- error_code processAttributesV1(const uint8_t *base,
- const NativeChunk *chunk) {
+ std::error_code processAttributesV1(const uint8_t *base,
+ const NativeChunk *chunk) {
this->_attributes = base + chunk->fileOffset;
this->_attributesMaxOffset = chunk->fileSize;
DEBUG_WITH_TYPE("ReaderNative", llvm::dbgs()
@@ -450,8 +450,8 @@ private:
}
// set up pointers to attributes array
- error_code processAbsoluteAttributesV1(const uint8_t *base,
- const NativeChunk *chunk) {
+ std::error_code processAbsoluteAttributesV1(const uint8_t *base,
+ const NativeChunk *chunk) {
this->_absAttributes = base + chunk->fileOffset;
this->_absAbsoluteMaxOffset = chunk->fileSize;
DEBUG_WITH_TYPE("ReaderNative", llvm::dbgs()
@@ -463,8 +463,8 @@ private:
}
// instantiate array of UndefinedAtoms from v1 ivar data in file
- error_code processUndefinedAtomsV1(const uint8_t *base,
- const NativeChunk *chunk) {
+ std::error_code processUndefinedAtomsV1(const uint8_t *base,
+ const NativeChunk *chunk) {
const size_t atomSize = sizeof(NativeUndefinedAtomV1);
size_t atomsArraySize = chunk->elementCount * atomSize;
uint8_t* atomsStart = reinterpret_cast<uint8_t*>
@@ -499,8 +499,8 @@ private:
// instantiate array of ShareLibraryAtoms from v1 ivar data in file
- error_code processSharedLibraryAtomsV1(const uint8_t *base,
- const NativeChunk *chunk) {
+ std::error_code processSharedLibraryAtomsV1(const uint8_t *base,
+ const NativeChunk *chunk) {
const size_t atomSize = sizeof(NativeSharedLibraryAtomV1);
size_t atomsArraySize = chunk->elementCount * atomSize;
uint8_t* atomsStart = reinterpret_cast<uint8_t*>
@@ -535,8 +535,8 @@ private:
// instantiate array of AbsoluteAtoms from v1 ivar data in file
- error_code processAbsoluteAtomsV1(const uint8_t *base,
- const NativeChunk *chunk) {
+ std::error_code processAbsoluteAtomsV1(const uint8_t *base,
+ const NativeChunk *chunk) {
const size_t atomSize = sizeof(NativeAbsoluteAtomV1);
size_t atomsArraySize = chunk->elementCount * atomSize;
uint8_t* atomsStart = reinterpret_cast<uint8_t*>
@@ -569,9 +569,10 @@ private:
return make_error_code(NativeReaderError::success);
}
- template<class T, class U>
- error_code processReferences(const uint8_t *base, const NativeChunk *chunk,
- uint8_t *&refsStart, uint8_t *&refsEnd) const {
+ template <class T, class U>
+ std::error_code
+ processReferences(const uint8_t *base, const NativeChunk *chunk,
+ uint8_t *&refsStart, uint8_t *&refsEnd) const {
if (chunk->elementCount == 0)
return make_error_code(NativeReaderError::success);
size_t refsArraySize = chunk->elementCount * sizeof(T);
@@ -592,11 +593,11 @@ private:
}
// instantiate array of References from v1 ivar data in file
- error_code processReferencesV1(const uint8_t *base,
- const NativeChunk *chunk) {
+ std::error_code processReferencesV1(const uint8_t *base,
+ const NativeChunk *chunk) {
uint8_t *refsStart, *refsEnd;
- if (error_code ec
- = processReferences<NativeReferenceV1, NativeReferenceIvarsV1>(
+ if (std::error_code ec =
+ processReferences<NativeReferenceV1, NativeReferenceIvarsV1>(
base, chunk, refsStart, refsEnd))
return ec;
this->_referencesV1.arrayStart = refsStart;
@@ -612,11 +613,11 @@ private:
}
// instantiate array of References from v2 ivar data in file
- error_code processReferencesV2(const uint8_t *base,
- const NativeChunk *chunk) {
+ std::error_code processReferencesV2(const uint8_t *base,
+ const NativeChunk *chunk) {
uint8_t *refsStart, *refsEnd;
- if (error_code ec
- = processReferences<NativeReferenceV2, NativeReferenceIvarsV2>(
+ if (std::error_code ec =
+ processReferences<NativeReferenceV2, NativeReferenceIvarsV2>(
base, chunk, refsStart, refsEnd))
return ec;
this->_referencesV2.arrayStart = refsStart;
@@ -632,8 +633,8 @@ private:
}
// set up pointers to target table
- error_code processTargetsTable(const uint8_t *base,
- const NativeChunk *chunk) {
+ std::error_code processTargetsTable(const uint8_t *base,
+ const NativeChunk *chunk) {
const uint32_t* targetIndexes = reinterpret_cast<const uint32_t*>
(base + chunk->fileOffset);
this->_targetsTableCount = chunk->elementCount;
@@ -682,8 +683,8 @@ private:
// set up pointers to addend pool in file
- error_code processAddendsTable(const uint8_t *base,
- const NativeChunk *chunk) {
+ std::error_code processAddendsTable(const uint8_t *base,
+ const NativeChunk *chunk) {
this->_addends = reinterpret_cast<const Reference::Addend*>
(base + chunk->fileOffset);
this->_addendsMaxIndex = chunk->elementCount;
@@ -696,8 +697,8 @@ private:
}
// set up pointers to string pool in file
- error_code processStrings(const uint8_t *base,
- const NativeChunk *chunk) {
+ std::error_code processStrings(const uint8_t *base,
+ const NativeChunk *chunk) {
this->_strings = reinterpret_cast<const char*>(base + chunk->fileOffset);
this->_stringsMaxOffset = chunk->fileSize;
DEBUG_WITH_TYPE("ReaderNative", llvm::dbgs()
@@ -708,8 +709,8 @@ private:
}
// set up pointers to content area in file
- error_code processContent(const uint8_t *base,
- const NativeChunk *chunk) {
+ std::error_code processContent(const uint8_t *base,
+ const NativeChunk *chunk) {
this->_contentStart = base + chunk->fileOffset;
this->_contentEnd = base + chunk->fileOffset + chunk->fileSize;
DEBUG_WITH_TYPE("ReaderNative", llvm::dbgs()
@@ -1004,11 +1005,11 @@ public:
sizeof(header->magic)) == 0);
}
- virtual error_code
+ virtual std::error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
std::vector<std::unique_ptr<File>> &result) const override {
return lld::native::File::make(std::move(mb), result);
- return error_code();
+ return std::error_code();
}
};
}
Modified: lld/trunk/lib/ReaderWriter/Native/WriterNative.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/Native/WriterNative.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/Native/WriterNative.cpp (original)
+++ lld/trunk/lib/ReaderWriter/Native/WriterNative.cpp Thu Jun 12 09:53:47 2014
@@ -32,7 +32,7 @@ class Writer : public lld::Writer {
public:
Writer(const LinkingContext &context) {}
- error_code writeFile(const lld::File &file, StringRef outPath) override {
+ std::error_code writeFile(const lld::File &file, StringRef outPath) override {
// reserve first byte for unnamed atoms
_stringPool.push_back('\0');
// visit all atoms
@@ -73,11 +73,11 @@ public:
llvm::raw_fd_ostream out(outPath.data(), errorInfo,
llvm::sys::fs::F_None);
if (!errorInfo.empty())
- return error_code(); // FIXME
+ return std::error_code(); // FIXME
this->write(out);
- return error_code();
+ return std::error_code();
}
virtual ~Writer() {
Modified: lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h Thu Jun 12 09:53:47 2014
@@ -76,9 +76,9 @@ public:
return _absoluteAtoms;
}
- error_code
+ std::error_code
parseAllMembers(std::vector<std::unique_ptr<File>> &result) const override {
- return error_code();
+ return std::error_code();
}
private:
Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Thu Jun 12 09:53:47 2014
@@ -68,9 +68,9 @@ private:
public:
typedef const std::map<std::string, std::string> StringMap;
- FileCOFF(std::unique_ptr<MemoryBuffer> mb, error_code &ec);
+ FileCOFF(std::unique_ptr<MemoryBuffer> mb, std::error_code &ec);
- error_code parse();
+ std::error_code parse();
StringRef getLinkerDirectives() const { return _directives; }
bool isCompatibleWithSEH() const { return _compatibleWithSEH; }
@@ -97,44 +97,48 @@ public:
mutable llvm::BumpPtrAllocator _alloc;
private:
- error_code readSymbolTable(std::vector<const coff_symbol *> &result);
+ std::error_code readSymbolTable(std::vector<const coff_symbol *> &result);
void createAbsoluteAtoms(const SymbolVectorT &symbols,
std::vector<const AbsoluteAtom *> &result);
- error_code createUndefinedAtoms(const SymbolVectorT &symbols,
- std::vector<const UndefinedAtom *> &result);
+ std::error_code
+ createUndefinedAtoms(const SymbolVectorT &symbols,
+ std::vector<const UndefinedAtom *> &result);
+
+ std::error_code
+ createDefinedSymbols(const SymbolVectorT &symbols,
+ std::vector<const DefinedAtom *> &result);
- error_code createDefinedSymbols(const SymbolVectorT &symbols,
- std::vector<const DefinedAtom *> &result);
+ std::error_code cacheSectionAttributes();
+ std::error_code maybeCreateSXDataAtoms();
- error_code cacheSectionAttributes();
- error_code maybeCreateSXDataAtoms();
-
- error_code
+ std::error_code
AtomizeDefinedSymbolsInSection(const coff_section *section,
std::vector<const coff_symbol *> &symbols,
std::vector<COFFDefinedFileAtom *> &atoms);
- error_code
+ std::error_code
AtomizeDefinedSymbols(SectionToSymbolsT &definedSymbols,
std::vector<const DefinedAtom *> &definedAtoms);
- error_code findAtomAt(const coff_section *section, uint32_t targetAddress,
- COFFDefinedFileAtom *&result, uint32_t &offsetInAtom);
+ std::error_code findAtomAt(const coff_section *section,
+ uint32_t targetAddress,
+ COFFDefinedFileAtom *&result,
+ uint32_t &offsetInAtom);
- error_code getAtomBySymbolIndex(uint32_t index, Atom *&ret);
+ std::error_code getAtomBySymbolIndex(uint32_t index, Atom *&ret);
- error_code
+ std::error_code
addRelocationReference(const coff_relocation *rel,
const coff_section *section,
const std::vector<COFFDefinedFileAtom *> &atoms);
- error_code getSectionContents(StringRef sectionName,
- ArrayRef<uint8_t> &result);
- error_code getReferenceArch(Reference::KindArch &result);
- error_code addRelocationReferenceToAtoms();
- error_code findSection(StringRef name, const coff_section *&result);
+ std::error_code getSectionContents(StringRef sectionName,
+ ArrayRef<uint8_t> &result);
+ std::error_code getReferenceArch(Reference::KindArch &result);
+ std::error_code addRelocationReferenceToAtoms();
+ std::error_code findSection(StringRef name, const coff_section *&result);
StringRef ArrayRefToString(ArrayRef<uint8_t> array);
std::unique_ptr<const llvm::object::COFFObjectFile> _obj;
@@ -277,7 +281,7 @@ DefinedAtom::Merge getMerge(const coff_a
}
}
-FileCOFF::FileCOFF(std::unique_ptr<MemoryBuffer> mb, error_code &ec)
+FileCOFF::FileCOFF(std::unique_ptr<MemoryBuffer> mb, std::error_code &ec)
: File(mb->getBufferIdentifier(), kindObject), _compatibleWithSEH(false),
_ordinal(0) {
auto binaryOrErr = llvm::object::createBinary(mb.release());
@@ -300,46 +304,48 @@ FileCOFF::FileCOFF(std::unique_ptr<Memor
_directives = ArrayRefToString(directives);
}
-error_code FileCOFF::parse() {
- if (error_code ec = getReferenceArch(_referenceArch))
+std::error_code FileCOFF::parse() {
+ if (std::error_code ec = getReferenceArch(_referenceArch))
return ec;
// Read the symbol table and atomize them if possible. Defined atoms
// cannot be atomized in one pass, so they will be not be atomized but
// added to symbolToAtom.
SymbolVectorT symbols;
- if (error_code ec = readSymbolTable(symbols))
+ if (std::error_code ec = readSymbolTable(symbols))
return ec;
createAbsoluteAtoms(symbols, _absoluteAtoms._atoms);
- if (error_code ec = createUndefinedAtoms(symbols, _undefinedAtoms._atoms))
+ if (std::error_code ec =
+ createUndefinedAtoms(symbols, _undefinedAtoms._atoms))
return ec;
- if (error_code ec = createDefinedSymbols(symbols, _definedAtoms._atoms))
+ if (std::error_code ec = createDefinedSymbols(symbols, _definedAtoms._atoms))
return ec;
- if (error_code ec = addRelocationReferenceToAtoms())
+ if (std::error_code ec = addRelocationReferenceToAtoms())
return ec;
- if (error_code ec = maybeCreateSXDataAtoms())
+ if (std::error_code ec = maybeCreateSXDataAtoms())
return ec;
- return error_code();
+ return std::error_code();
}
/// Iterate over the symbol table to retrieve all symbols.
-error_code FileCOFF::readSymbolTable(std::vector<const coff_symbol *> &result) {
+std::error_code
+FileCOFF::readSymbolTable(std::vector<const coff_symbol *> &result) {
const llvm::object::coff_file_header *header = nullptr;
- if (error_code ec = _obj->getHeader(header))
+ if (std::error_code ec = _obj->getHeader(header))
return ec;
for (uint32_t i = 0, e = header->NumberOfSymbols; i != e; ++i) {
// Retrieve the symbol.
const coff_symbol *sym;
StringRef name;
- if (error_code ec = _obj->getSymbol(i, sym))
+ if (std::error_code ec = _obj->getSymbol(i, sym))
return ec;
if (sym->SectionNumber == llvm::COFF::IMAGE_SYM_DEBUG)
goto next;
result.push_back(sym);
- if (error_code ec = _obj->getSymbolName(sym, name))
+ if (std::error_code ec = _obj->getSymbolName(sym, name))
return ec;
// Existence of the symbol @feat.00 indicates that object file is compatible
@@ -359,14 +365,14 @@ error_code FileCOFF::readSymbolTable(std
// store it to _auxSymbol.
if (sym->NumberOfAuxSymbols > 0) {
const coff_symbol *aux = nullptr;
- if (error_code ec = _obj->getAuxSymbol(i + 1, aux))
+ if (std::error_code ec = _obj->getAuxSymbol(i + 1, aux))
return ec;
_auxSymbol[sym] = aux;
}
next:
i += sym->NumberOfAuxSymbols;
}
- return error_code();
+ return std::error_code();
}
/// Create atoms for the absolute symbols.
@@ -390,7 +396,7 @@ void FileCOFF::createAbsoluteAtoms(const
/// it's linked normally. If not, sym1 is resolved as if it has sym2's
/// name. This relationship between sym1 and sym2 is represented using
/// fallback mechanism of undefined symbol.
-error_code
+std::error_code
FileCOFF::createUndefinedAtoms(const SymbolVectorT &symbols,
std::vector<const UndefinedAtom *> &result) {
// Sort out undefined symbols from all symbols.
@@ -409,7 +415,7 @@ FileCOFF::createUndefinedAtoms(const Sym
const coff_aux_weak_external *aux =
reinterpret_cast<const coff_aux_weak_external *>(iter->second);
const coff_symbol *sym2;
- if (error_code ec = _obj->getSymbol(aux->TagIndex, sym2))
+ if (std::error_code ec = _obj->getSymbol(aux->TagIndex, sym2))
return ec;
weakExternal[sym] = sym2;
}
@@ -438,20 +444,20 @@ FileCOFF::createUndefinedAtoms(const Sym
result.push_back(atom);
_symbolAtom[sym] = atom;
}
- return error_code();
+ return std::error_code();
}
/// Create atoms for the defined symbols. This pass is a bit complicated than
/// the other two, because in order to create the atom for the defined symbol
/// we need to know the adjacent symbols.
-error_code
+std::error_code
FileCOFF::createDefinedSymbols(const SymbolVectorT &symbols,
std::vector<const DefinedAtom *> &result) {
// A defined atom can be merged if its section attribute allows its contents
// to be merged. In COFF, it's not very easy to get the section attribute
// for the symbol, so scan all sections in advance and cache the attributes
// for later use.
- if (error_code ec = cacheSectionAttributes())
+ if (std::error_code ec = cacheSectionAttributes())
return ec;
// Filter non-defined atoms, and group defined atoms by its section.
@@ -497,7 +503,7 @@ FileCOFF::createDefinedSymbols(const Sym
continue;
const coff_section *sec;
- if (error_code ec = _obj->getSection(sym->SectionNumber, sec))
+ if (std::error_code ec = _obj->getSection(sym->SectionNumber, sec))
return ec;
assert(sec && "SectionIndex > 0, Sec must be non-null!");
@@ -506,7 +512,7 @@ FileCOFF::createDefinedSymbols(const Sym
// multiple COMDAT sections whose section name are the same. We don't want
// to make atoms for them as they would become duplicate symbols.
StringRef sectionName;
- if (error_code ec = _obj->getSectionName(sec, sectionName))
+ if (std::error_code ec = _obj->getSectionName(sec, sectionName))
return ec;
if (_symbolName[sym] == sectionName && sym->Value == 0 &&
_merge[sec] != DefinedAtom::mergeNo)
@@ -526,15 +532,15 @@ FileCOFF::createDefinedSymbols(const Sym
}
// Atomize the defined symbols.
- if (error_code ec = AtomizeDefinedSymbols(definedSymbols, result))
+ if (std::error_code ec = AtomizeDefinedSymbols(definedSymbols, result))
return ec;
- return error_code();
+ return std::error_code();
}
// Cache the COMDAT attributes, which indicate whether the symbols in the
// section can be merged or not.
-error_code FileCOFF::cacheSectionAttributes() {
+std::error_code FileCOFF::cacheSectionAttributes() {
// The COMDAT section attribute is not an attribute of coff_section, but is
// stored in the auxiliary symbol for the first symbol referring a COMDAT
// section. It feels to me that it's unnecessarily complicated, but this is
@@ -546,7 +552,7 @@ error_code FileCOFF::cacheSectionAttribu
continue;
const coff_section *sec;
- if (error_code ec = _obj->getSection(sym->SectionNumber, sec))
+ if (std::error_code ec = _obj->getSection(sym->SectionNumber, sec))
return ec;
if (_merge.count(sec))
@@ -570,12 +576,12 @@ error_code FileCOFF::cacheSectionAttribu
if (!_merge.count(sec))
_merge[sec] = DefinedAtom::mergeNo;
}
- return error_code();
+ return std::error_code();
}
/// Atomize \p symbols and append the results to \p atoms. The symbols are
/// assumed to have been defined in the \p section.
-error_code FileCOFF::AtomizeDefinedSymbolsInSection(
+std::error_code FileCOFF::AtomizeDefinedSymbolsInSection(
const coff_section *section, std::vector<const coff_symbol *> &symbols,
std::vector<COFFDefinedFileAtom *> &atoms) {
// Sort symbols by position.
@@ -589,7 +595,7 @@ error_code FileCOFF::AtomizeDefinedSymbo
-> bool { return a->Value < b->Value; }));
StringRef sectionName;
- if (error_code ec = _obj->getSectionName(section, sectionName))
+ if (std::error_code ec = _obj->getSectionName(section, sectionName))
return ec;
// BSS section does not have contents. If this is the BSS section, create
@@ -605,18 +611,18 @@ error_code FileCOFF::AtomizeDefinedSymbo
atoms.push_back(atom);
_symbolAtom[sym] = atom;
}
- return error_code();
+ return std::error_code();
}
ArrayRef<uint8_t> secData;
- if (error_code ec = _obj->getSectionContents(section, secData))
+ if (std::error_code ec = _obj->getSectionContents(section, secData))
return ec;
// A section with IMAGE_SCN_LNK_{INFO,REMOVE} attribute will never become
// a part of the output image. That's what the COFF spec says.
if (section->Characteristics & llvm::COFF::IMAGE_SCN_LNK_INFO ||
section->Characteristics & llvm::COFF::IMAGE_SCN_LNK_REMOVE)
- return error_code();
+ return std::error_code();
// Supporting debug info needs more work than just linking and combining
// .debug sections. We don't support it yet. Let's discard .debug sections at
@@ -624,7 +630,7 @@ error_code FileCOFF::AtomizeDefinedSymbo
// blobs that nobody would understand.
if ((section->Characteristics & llvm::COFF::IMAGE_SCN_MEM_DISCARDABLE) &&
(sectionName == ".debug" || sectionName.startswith(".debug$"))) {
- return error_code();
+ return std::error_code();
}
DefinedAtom::ContentType type = getContentType(section);
@@ -639,7 +645,7 @@ error_code FileCOFF::AtomizeDefinedSymbo
perms, _merge[section], data, _ordinal++);
atoms.push_back(atom);
_definedAtomLocations[section][0].push_back(atom);
- return error_code();
+ return std::error_code();
}
// Create an unnamed atom if the first atom isn't at the start of the
@@ -671,10 +677,10 @@ error_code FileCOFF::AtomizeDefinedSymbo
// Finally, set alignment to the first atom so that the section contents
// will be aligned as specified by the object section header.
_definedAtomLocations[section][0][0]->setAlignment(getAlignment(section));
- return error_code();
+ return std::error_code();
}
-error_code FileCOFF::AtomizeDefinedSymbols(
+std::error_code FileCOFF::AtomizeDefinedSymbols(
SectionToSymbolsT &definedSymbols,
std::vector<const DefinedAtom *> &definedAtoms) {
// For each section, make atoms for all the symbols defined in the
@@ -683,7 +689,8 @@ error_code FileCOFF::AtomizeDefinedSymbo
const coff_section *section = i.first;
std::vector<const coff_symbol *> &symbols = i.second;
std::vector<COFFDefinedFileAtom *> atoms;
- if (error_code ec = AtomizeDefinedSymbolsInSection(section, symbols, atoms))
+ if (std::error_code ec =
+ AtomizeDefinedSymbolsInSection(section, symbols, atoms))
return ec;
// Connect atoms with layout-before/layout-after edges.
@@ -694,14 +701,14 @@ error_code FileCOFF::AtomizeDefinedSymbo
definedAtoms.push_back(atom);
}
}
- return error_code();
+ return std::error_code();
}
/// Find the atom that is at \p targetAddress in \p section.
-error_code FileCOFF::findAtomAt(const coff_section *section,
- uint32_t targetAddress,
- COFFDefinedFileAtom *&result,
- uint32_t &offsetInAtom) {
+std::error_code FileCOFF::findAtomAt(const coff_section *section,
+ uint32_t targetAddress,
+ COFFDefinedFileAtom *&result,
+ uint32_t &offsetInAtom) {
for (auto i : _definedAtomLocations[section]) {
uint32_t atomAddress = i.first;
std::vector<COFFDefinedAtom *> &atomsAtSameLocation = i.second;
@@ -710,7 +717,7 @@ error_code FileCOFF::findAtomAt(const co
targetAddress < atomAddress + atom->size()) {
result = atom;
offsetInAtom = targetAddress - atomAddress;
- return error_code();
+ return std::error_code();
}
}
// Relocation target is out of range
@@ -719,19 +726,19 @@ error_code FileCOFF::findAtomAt(const co
/// Find the atom for the symbol that was at the \p index in the symbol
/// table.
-error_code FileCOFF::getAtomBySymbolIndex(uint32_t index, Atom *&ret) {
+std::error_code FileCOFF::getAtomBySymbolIndex(uint32_t index, Atom *&ret) {
const coff_symbol *symbol;
- if (error_code ec = _obj->getSymbol(index, symbol))
+ if (std::error_code ec = _obj->getSymbol(index, symbol))
return ec;
ret = _symbolAtom[symbol];
assert(ret);
- return error_code();
+ return std::error_code();
}
/// Add relocation information to an atom based on \p rel. \p rel is an
/// relocation entry for the \p section, and \p atoms are all the atoms
/// defined in the \p section.
-error_code FileCOFF::addRelocationReference(
+std::error_code FileCOFF::addRelocationReference(
const coff_relocation *rel, const coff_section *section,
const std::vector<COFFDefinedFileAtom *> &atoms) {
assert(atoms.size() > 0);
@@ -741,54 +748,55 @@ error_code FileCOFF::addRelocationRefere
uint32_t itemAddress = rel->VirtualAddress + section->VirtualAddress;
Atom *targetAtom = nullptr;
- if (error_code ec = getAtomBySymbolIndex(rel->SymbolTableIndex, targetAtom))
+ if (std::error_code ec =
+ getAtomBySymbolIndex(rel->SymbolTableIndex, targetAtom))
return ec;
COFFDefinedFileAtom *atom;
uint32_t offsetInAtom;
- if (error_code ec = findAtomAt(section, itemAddress, atom, offsetInAtom))
+ if (std::error_code ec = findAtomAt(section, itemAddress, atom, offsetInAtom))
return ec;
atom->addReference(std::unique_ptr<COFFReference>(
new COFFReference(targetAtom, offsetInAtom, rel->Type,
Reference::KindNamespace::COFF, _referenceArch)));
- return error_code();
+ return std::error_code();
}
// Read section contents.
-error_code FileCOFF::getSectionContents(StringRef sectionName,
- ArrayRef<uint8_t> &result) {
+std::error_code FileCOFF::getSectionContents(StringRef sectionName,
+ ArrayRef<uint8_t> &result) {
const coff_section *section = nullptr;
- if (error_code ec = findSection(sectionName, section))
+ if (std::error_code ec = findSection(sectionName, section))
return ec;
if (!section)
- return error_code();
- if (error_code ec = _obj->getSectionContents(section, result))
+ return std::error_code();
+ if (std::error_code ec = _obj->getSectionContents(section, result))
return ec;
- return error_code();
+ return std::error_code();
}
/// Returns the target machine type of the current object file.
-error_code FileCOFF::getReferenceArch(Reference::KindArch &result) {
+std::error_code FileCOFF::getReferenceArch(Reference::KindArch &result) {
const llvm::object::coff_file_header *header = nullptr;
- if (error_code ec = _obj->getHeader(header))
+ if (std::error_code ec = _obj->getHeader(header))
return ec;
switch (header->Machine) {
case llvm::COFF::IMAGE_FILE_MACHINE_I386:
result = Reference::KindArch::x86;
- return error_code();
+ return std::error_code();
case llvm::COFF::IMAGE_FILE_MACHINE_AMD64:
result = Reference::KindArch::x86_64;
- return error_code();
+ return std::error_code();
case llvm::COFF::IMAGE_FILE_MACHINE_UNKNOWN:
result = Reference::KindArch::all;
- return error_code();
+ return std::error_code();
}
llvm::errs() << "Unsupported machine type: " << header->Machine << "\n";
return llvm::object::object_error::parse_failed;
}
/// Add relocation information to atoms.
-error_code FileCOFF::addRelocationReferenceToAtoms() {
+std::error_code FileCOFF::addRelocationReferenceToAtoms() {
// Relocation entries are defined for each section.
for (const auto &sec : _obj->sections()) {
const coff_section *section = _obj->getCOFFSection(sec);
@@ -806,7 +814,7 @@ error_code FileCOFF::addRelocationRefere
return ec;
}
}
- return error_code();
+ return std::error_code();
}
// Read .sxdata section if exists. .sxdata is a x86-only section that contains a
@@ -822,12 +830,12 @@ error_code FileCOFF::addRelocationRefere
// What we want to emit from the linker is a vector of SEH handler VAs, but here
// we have a vector of offsets to the symbol table. So we convert the latter to
// the former.
-error_code FileCOFF::maybeCreateSXDataAtoms() {
+std::error_code FileCOFF::maybeCreateSXDataAtoms() {
ArrayRef<uint8_t> sxdata;
- if (error_code ec = getSectionContents(".sxdata", sxdata))
+ if (std::error_code ec = getSectionContents(".sxdata", sxdata))
return ec;
if (sxdata.empty())
- return error_code();
+ return std::error_code();
std::vector<uint8_t> atomContent =
*new (_alloc) std::vector<uint8_t>((size_t)sxdata.size());
@@ -842,7 +850,7 @@ error_code FileCOFF::maybeCreateSXDataAt
for (int i = 0; i < numSymbols; ++i) {
Atom *handlerFunc;
- if (error_code ec = getAtomBySymbolIndex(symbolIndex[i], handlerFunc))
+ if (std::error_code ec = getAtomBySymbolIndex(symbolIndex[i], handlerFunc))
return ec;
int offsetInAtom = i * sizeof(uint32_t);
atom->addReference(std::unique_ptr<COFFReference>(new COFFReference(
@@ -851,11 +859,12 @@ error_code FileCOFF::maybeCreateSXDataAt
}
_definedAtoms._atoms.push_back(atom);
- return error_code();
+ return std::error_code();
}
/// Find a section by name.
-error_code FileCOFF::findSection(StringRef name, const coff_section *&result) {
+std::error_code FileCOFF::findSection(StringRef name,
+ const coff_section *&result) {
for (const auto &sec : _obj->sections()) {
const coff_section *section = _obj->getCOFFSection(sec);
StringRef sectionName;
@@ -863,12 +872,12 @@ error_code FileCOFF::findSection(StringR
return ec;
if (sectionName == name) {
result = section;
- return error_code();
+ return std::error_code();
}
}
// Section was not found, but it's not an error. This method returns
// an error only when there's a read error.
- return error_code();
+ return std::error_code();
}
// Convert ArrayRef<uint8_t> to std::string. The array contains a string which
@@ -911,27 +920,27 @@ public:
return (magic == llvm::sys::fs::file_magic::windows_resource);
}
- error_code
+ std::error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
std::vector<std::unique_ptr<File>> &result) const override {
// Convert RC file to COFF
ErrorOr<std::string> coffPath = convertResourceFileToCOFF(std::move(mb));
- if (error_code ec = coffPath.getError())
+ if (std::error_code ec = coffPath.getError())
return ec;
llvm::FileRemover coffFileRemover(*coffPath);
// Read and parse the COFF
std::unique_ptr<MemoryBuffer> newmb;
- if (error_code ec = MemoryBuffer::getFile(*coffPath, newmb))
+ if (std::error_code ec = MemoryBuffer::getFile(*coffPath, newmb))
return ec;
- error_code ec;
+ std::error_code ec;
std::unique_ptr<FileCOFF> file(new FileCOFF(std::move(newmb), ec));
if (ec)
return ec;
- if (error_code ec = file->parse())
+ if (std::error_code ec = file->parse())
return ec;
result.push_back(std::move(file));
- return error_code();
+ return std::error_code();
}
private:
@@ -939,18 +948,18 @@ private:
writeResToTemporaryFile(std::unique_ptr<MemoryBuffer> mb) {
// Get a temporary file path for .res file.
SmallString<128> tempFilePath;
- if (error_code ec =
+ if (std::error_code ec =
llvm::sys::fs::createTemporaryFile("tmp", "res", tempFilePath))
return ec;
// Write the memory buffer contents to .res file, so that we can run
// cvtres.exe on it.
std::unique_ptr<llvm::FileOutputBuffer> buffer;
- if (error_code ec = llvm::FileOutputBuffer::create(
+ if (std::error_code ec = llvm::FileOutputBuffer::create(
tempFilePath.str(), mb->getBufferSize(), buffer))
return ec;
memcpy(buffer->getBufferStart(), mb->getBufferStart(), mb->getBufferSize());
- if (error_code ec = buffer->commit())
+ if (std::error_code ec = buffer->commit())
return ec;
// Convert SmallString -> StringRef -> std::string.
@@ -961,13 +970,13 @@ private:
convertResourceFileToCOFF(std::unique_ptr<MemoryBuffer> mb) {
// Write the resource file to a temporary file.
ErrorOr<std::string> inFilePath = writeResToTemporaryFile(std::move(mb));
- if (error_code ec = inFilePath.getError())
+ if (std::error_code ec = inFilePath.getError())
return ec;
llvm::FileRemover inFileRemover(*inFilePath);
// Create an output file path.
SmallString<128> outFilePath;
- if (error_code ec =
+ if (std::error_code ec =
llvm::sys::fs::createTemporaryFile("tmp", "obj", outFilePath))
return ec;
std::string outFileArg = ("/out:" + outFilePath).str();
@@ -1011,12 +1020,12 @@ public:
return magic == llvm::sys::fs::file_magic::coff_object;
}
- error_code
+ std::error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const Registry ®istry,
std::vector<std::unique_ptr<File>> &result) const override {
// Parse the memory buffer as PECOFF file.
const char *mbName = mb->getBufferIdentifier();
- error_code ec;
+ std::error_code ec;
std::unique_ptr<FileCOFF> file(new FileCOFF(std::move(mb), ec));
if (ec)
return ec;
@@ -1024,10 +1033,10 @@ public:
// Interpret .drectve section if the section has contents.
StringRef directives = file->getLinkerDirectives();
if (!directives.empty())
- if (error_code ec = handleDirectiveSection(registry, directives))
+ if (std::error_code ec = handleDirectiveSection(registry, directives))
return ec;
- if (error_code ec = file->parse())
+ if (std::error_code ec = file->parse())
return ec;
// Check for /SAFESEH.
@@ -1048,7 +1057,7 @@ public:
createAlternateNameAtoms(*file);
result.push_back(std::move(file));
- return error_code();
+ return std::error_code();
}
private:
@@ -1058,8 +1067,8 @@ private:
//
// The section mainly contains /defaultlib (-l in Unix), but can contain any
// options as long as they are valid.
- error_code handleDirectiveSection(const Registry ®istry,
- StringRef directives) const {
+ std::error_code handleDirectiveSection(const Registry ®istry,
+ StringRef directives) const {
DEBUG(llvm::dbgs() << ".drectve: " << directives << "\n");
// Split the string into tokens, as the shell would do for argv.
@@ -1086,7 +1095,7 @@ private:
if (!errorMessage.empty()) {
llvm::errs() << "lld warning: " << errorMessage << "\n";
}
- return error_code();
+ return std::error_code();
}
AliasAtom *createAlias(FileCOFF &file, StringRef name,
Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.h?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.h Thu Jun 12 09:53:47 2014
@@ -23,9 +23,10 @@ class File;
namespace pecoff {
-error_code parseCOFFImportLibrary(const LinkingContext &context,
- std::unique_ptr<MemoryBuffer> &mb,
- std::vector<std::unique_ptr<File> > &result);
+std::error_code
+parseCOFFImportLibrary(const LinkingContext &context,
+ std::unique_ptr<MemoryBuffer> &mb,
+ std::vector<std::unique_ptr<File>> &result);
}
}
Modified: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp Thu Jun 12 09:53:47 2014
@@ -832,7 +832,7 @@ public:
_imageSizeOnDisk(0) {}
template <class PEHeader> void build(const File &linkedFile);
- error_code writeFile(const File &linkedFile, StringRef path) override;
+ std::error_code writeFile(const File &linkedFile, StringRef path) override;
private:
void applyAllRelocations(uint8_t *bufferStart);
@@ -1008,7 +1008,8 @@ void PECOFFWriter::build(const File &lin
peHeader->setSizeOfHeaders(sectionTable->fileOffset() + sectionTable->size());
}
-error_code PECOFFWriter::writeFile(const File &linkedFile, StringRef path) {
+std::error_code PECOFFWriter::writeFile(const File &linkedFile,
+ StringRef path) {
if (_ctx.is64Bit()) {
this->build<llvm::object::pe32plus_header>(linkedFile);
} else {
@@ -1017,7 +1018,7 @@ error_code PECOFFWriter::writeFile(const
uint64_t totalSize = _chunks.back()->fileOffset() + _chunks.back()->size();
std::unique_ptr<llvm::FileOutputBuffer> buffer;
- error_code ec = llvm::FileOutputBuffer::create(
+ std::error_code ec = llvm::FileOutputBuffer::create(
path, totalSize, buffer, llvm::FileOutputBuffer::F_executable);
if (ec)
return ec;
Modified: lld/trunk/lib/ReaderWriter/Reader.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/Reader.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/Reader.cpp (original)
+++ lld/trunk/lib/ReaderWriter/Reader.cpp Thu Jun 12 09:53:47 2014
@@ -29,7 +29,7 @@ void Registry::add(std::unique_ptr<YamlI
_yamlHandlers.push_back(std::move(handler));
}
-error_code
+std::error_code
Registry::parseFile(std::unique_ptr<MemoryBuffer> &mb,
std::vector<std::unique_ptr<File>> &result) const {
// Get file type.
Modified: lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp?rev=210785&r1=210784&r2=210785&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp (original)
+++ lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp Thu Jun 12 09:53:47 2014
@@ -635,9 +635,9 @@ template <> struct MappingTraits<const l
return nullptr;
}
- virtual error_code
+ virtual std::error_code
parseAllMembers(std::vector<std::unique_ptr<File>> &result) const override {
- return error_code();
+ return std::error_code();
}
StringRef _path;
@@ -1246,7 +1246,7 @@ class Writer : public lld::Writer {
public:
Writer(const LinkingContext &context) : _context(context) {}
- error_code writeFile(const lld::File &file, StringRef outPath) override {
+ std::error_code writeFile(const lld::File &file, StringRef outPath) override {
// Create stream to path.
std::string errorInfo;
llvm::raw_fd_ostream out(outPath.data(), errorInfo, llvm::sys::fs::F_Text);
@@ -1263,7 +1263,7 @@ public:
const lld::File *fileRef = &file;
yout << fileRef;
- return error_code();
+ return std::error_code();
}
private:
@@ -1307,7 +1307,7 @@ public:
return (ext.equals(".objtxt") || ext.equals(".yaml"));
}
- error_code
+ std::error_code
parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
std::vector<std::unique_ptr<File>> &result) const override {
// Note: we do not take ownership of the MemoryBuffer. That is
More information about the llvm-commits
mailing list