[lld] r195582 - [Gnu] Move code from .h to .cpp.
Shankar Easwaran
shankare at codeaurora.org
Sun Nov 24 14:29:19 PST 2013
Author: shankare
Date: Sun Nov 24 16:29:19 2013
New Revision: 195582
URL: http://llvm.org/viewvc/llvm-project?rev=195582&view=rev
Log:
[Gnu] Move code from .h to .cpp.
No change in functionality.
Added:
lld/trunk/lib/Driver/GnuLdInputGraph.cpp
Modified:
lld/trunk/include/lld/Driver/GnuLdInputGraph.h
lld/trunk/lib/Driver/CMakeLists.txt
Modified: lld/trunk/include/lld/Driver/GnuLdInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/GnuLdInputGraph.h?rev=195582&r1=195581&r2=195582&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/GnuLdInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/GnuLdInputGraph.h Sun Nov 24 16:29:19 2013
@@ -71,51 +71,7 @@ public:
}
/// \brief Parse the input file to lld::File.
- error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) {
- ErrorOr<StringRef> filePath = getPath(ctx);
- if (!filePath)
- return error_code(filePath);
-
- if (error_code ec = getBuffer(*filePath))
- return ec;
-
- if (ctx.logInputFiles())
- diagnostics << *filePath << "\n";
-
- if (filePath->endswith(".objtxt"))
- return ctx.getYAMLReader().parseFile(_buffer, _files);
-
- // Identify File type
- llvm::sys::fs::file_magic FileType =
- llvm::sys::fs::identify_magic(_buffer->getBuffer());
-
- switch (FileType) {
- case llvm::sys::fs::file_magic::elf_relocatable:
- case llvm::sys::fs::file_magic::elf_shared_object:
- // Call the default reader to read object files and shared objects
- return _elfLinkingContext.getDefaultReader().parseFile(_buffer, _files);
-
- case llvm::sys::fs::file_magic::archive: {
- // Process archive files. If Whole Archive option is set,
- // parse all members of the archive.
- error_code ec;
- std::unique_ptr<FileArchive> fileArchive(
- new FileArchive(ctx, std::move(_buffer), ec, _isWholeArchive));
- if (_isWholeArchive) {
- fileArchive->parseAllMembers(_files);
- _archiveFile = std::move(fileArchive);
- } else {
- _files.push_back(std::move(fileArchive));
- }
- return ec;
- }
-
- default:
- // Process Linker script
- return _elfLinkingContext.getLinkerScriptReader().parseFile(_buffer,
- _files);
- }
- }
+ error_code parse(const LinkingContext &, raw_ostream &);
/// \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
Modified: lld/trunk/lib/Driver/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/CMakeLists.txt?rev=195582&r1=195581&r2=195582&view=diff
==============================================================================
--- lld/trunk/lib/Driver/CMakeLists.txt (original)
+++ lld/trunk/lib/Driver/CMakeLists.txt Sun Nov 24 16:29:19 2013
@@ -15,6 +15,7 @@ add_lld_library(lldDriver
DarwinLdDriver.cpp
Driver.cpp
GnuLdDriver.cpp
+ GnuLdInputGraph.cpp
WinLinkDriver.cpp
WinLinkInputGraph.cpp
UniversalDriver.cpp
Added: lld/trunk/lib/Driver/GnuLdInputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdInputGraph.cpp?rev=195582&view=auto
==============================================================================
--- lld/trunk/lib/Driver/GnuLdInputGraph.cpp (added)
+++ lld/trunk/lib/Driver/GnuLdInputGraph.cpp Sun Nov 24 16:29:19 2013
@@ -0,0 +1,61 @@
+//===- lib/Driver/GnuLdInputGraph.cpp -------------------------------------===//
+//
+// The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lld/Driver/GnuLdInputGraph.h"
+#include "lld/ReaderWriter/LinkerScript.h"
+
+using namespace lld;
+
+/// \brief Parse the input file to lld::File.
+error_code ELFFileNode::parse(const LinkingContext &ctx,
+ raw_ostream &diagnostics) {
+ ErrorOr<StringRef> filePath = getPath(ctx);
+ if (!filePath)
+ return error_code(filePath);
+
+ if (error_code ec = getBuffer(*filePath))
+ return ec;
+
+ if (ctx.logInputFiles())
+ diagnostics << *filePath << "\n";
+
+ if (filePath->endswith(".objtxt"))
+ return ctx.getYAMLReader().parseFile(_buffer, _files);
+
+ // Identify File type
+ llvm::sys::fs::file_magic FileType =
+ llvm::sys::fs::identify_magic(_buffer->getBuffer());
+
+ switch (FileType) {
+ case llvm::sys::fs::file_magic::elf_relocatable:
+ case llvm::sys::fs::file_magic::elf_shared_object:
+ // Call the default reader to read object files and shared objects
+ return _elfLinkingContext.getDefaultReader().parseFile(_buffer, _files);
+
+ case llvm::sys::fs::file_magic::archive: {
+ // Process archive files. If Whole Archive option is set,
+ // parse all members of the archive.
+ error_code ec;
+ std::unique_ptr<FileArchive> fileArchive(
+ new FileArchive(ctx, std::move(_buffer), ec, _isWholeArchive));
+ if (_isWholeArchive) {
+ fileArchive->parseAllMembers(_files);
+ _archiveFile = std::move(fileArchive);
+ } else {
+ _files.push_back(std::move(fileArchive));
+ }
+ return ec;
+ }
+ default:
+ // Process Linker script
+ return _elfLinkingContext.getLinkerScriptReader().parseFile(_buffer,
+ _files);
+ break;
+ }
+}
More information about the llvm-commits
mailing list