[lld] r226146 - Remove InputGraph::addInputElement{,Front}.
Rui Ueyama
ruiu at google.com
Thu Jan 15 00:18:14 PST 2015
Author: ruiu
Date: Thu Jan 15 02:18:14 2015
New Revision: 226146
URL: http://llvm.org/viewvc/llvm-project?rev=226146&view=rev
Log:
Remove InputGraph::addInputElement{,Front}.
They were the last member functions of InputGraph (besides members()).
Now InputGraph is just a container of a vector. We are ready to replace
InputGraph with plain File vector.
Modified:
lld/trunk/include/lld/Core/InputGraph.h
lld/trunk/lib/Driver/CoreDriver.cpp
lld/trunk/lib/Driver/DarwinLdDriver.cpp
lld/trunk/lib/Driver/Driver.cpp
lld/trunk/lib/Driver/GnuLdDriver.cpp
lld/trunk/lib/Driver/WinLinkDriver.cpp
lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
Modified: lld/trunk/include/lld/Core/InputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/InputGraph.h?rev=226146&r1=226145&r2=226146&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/InputGraph.h (original)
+++ lld/trunk/include/lld/Core/InputGraph.h Thu Jan 15 02:18:14 2015
@@ -35,16 +35,6 @@ class LinkingContext;
class InputGraph {
public:
- /// \brief Adds a node into the InputGraph
- void addInputElement(std::unique_ptr<InputElement> ie) {
- _members.push_back(std::move(ie));
- }
-
- /// \brief Adds a node at the beginning of the InputGraph
- void addInputElementFront(std::unique_ptr<InputElement> ie) {
- _members.insert(_members.begin(), std::move(ie));
- }
-
std::vector<std::unique_ptr<InputElement>> &members() {
return _members;
}
Modified: lld/trunk/lib/Driver/CoreDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/CoreDriver.cpp?rev=226146&r1=226145&r2=226146&view=diff
==============================================================================
--- lld/trunk/lib/Driver/CoreDriver.cpp (original)
+++ lld/trunk/lib/Driver/CoreDriver.cpp Thu Jan 15 02:18:14 2015
@@ -153,7 +153,7 @@ bool CoreDriver::parse(int argc, const c
std::vector<std::unique_ptr<File>> files
= loadFile(ctx, inputArg->getValue(), false);
for (std::unique_ptr<File> &file : files) {
- inputGraph->addInputElement(std::unique_ptr<InputElement>(
+ inputGraph->members().push_back(std::unique_ptr<InputElement>(
new FileNode(std::move(file))));
}
break;
Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=226146&r1=226145&r2=226146&view=diff
==============================================================================
--- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Thu Jan 15 02:18:14 2015
@@ -119,7 +119,7 @@ static void addFile(StringRef path, std:
std::vector<std::unique_ptr<File>> files =
loadFile(ctx, path, diag, loadWholeArchive, upwardDylib);
for (std::unique_ptr<File> &file : files)
- inputGraph->addInputElement(
+ inputGraph->members().push_back(
llvm::make_unique<FileNode>(std::move(file)));
}
Modified: lld/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/Driver.cpp?rev=226146&r1=226145&r2=226146&view=diff
==============================================================================
--- lld/trunk/lib/Driver/Driver.cpp (original)
+++ lld/trunk/lib/Driver/Driver.cpp Thu Jan 15 02:18:14 2015
@@ -118,16 +118,16 @@ bool Driver::link(LinkingContext &contex
std::vector<std::unique_ptr<File>> internalFiles;
context.createInternalFiles(internalFiles);
for (auto i = internalFiles.rbegin(), e = internalFiles.rend(); i != e; ++i) {
- context.getInputGraph().addInputElementFront(
- llvm::make_unique<FileNode>(std::move(*i)));
+ auto &members = context.getInputGraph().members();
+ members.insert(members.begin(), llvm::make_unique<FileNode>(std::move(*i)));
}
// Give target a chance to add files.
std::vector<std::unique_ptr<File>> implicitFiles;
context.createImplicitFiles(implicitFiles);
for (auto i = implicitFiles.rbegin(), e = implicitFiles.rend(); i != e; ++i) {
- context.getInputGraph().addInputElementFront(
- llvm::make_unique<FileNode>(std::move(*i)));
+ auto &members = context.getInputGraph().members();
+ members.insert(members.begin(), llvm::make_unique<FileNode>(std::move(*i)));
}
// Give target a chance to sort the input files.
Modified: lld/trunk/lib/Driver/GnuLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=226146&r1=226145&r2=226146&view=diff
==============================================================================
--- lld/trunk/lib/Driver/GnuLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/GnuLdDriver.cpp Thu Jan 15 02:18:14 2015
@@ -274,12 +274,12 @@ evaluateLinkerScript(ELFLinkingContext &
for (std::unique_ptr<File> &file : files) {
if (ctx.logInputFiles())
diag << file->path() << "\n";
- inputGraph->addInputElement(
+ inputGraph->members().push_back(
std::unique_ptr<InputElement>(new FileNode(std::move(file))));
++numfiles;
}
}
- inputGraph->addInputElement(llvm::make_unique<GroupEnd>(numfiles));
+ inputGraph->members().push_back(llvm::make_unique<GroupEnd>(numfiles));
}
return std::error_code();
}
@@ -550,7 +550,7 @@ bool GnuLdDriver::parse(int argc, const
return false;
}
int startGroupPos = groupStack.top();
- inputGraph->addInputElement(
+ inputGraph->members().push_back(
llvm::make_unique<GroupEnd>(numfiles - startGroupPos));
groupStack.pop();
break;
@@ -615,7 +615,7 @@ bool GnuLdDriver::parse(int argc, const
for (std::unique_ptr<File> &file : files) {
if (ctx->logInputFiles())
diagnostics << file->path() << "\n";
- inputGraph->addInputElement(
+ inputGraph->members().push_back(
std::unique_ptr<InputElement>(new FileNode(std::move(file))));
}
numfiles += files.size();
Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=226146&r1=226145&r2=226146&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Thu Jan 15 02:18:14 2015
@@ -1416,14 +1416,14 @@ bool WinLinkDriver::parse(int argc, cons
if (file->parse())
return false;
ctx.getResolvableSymsFile()->add(file.get());
- ctx.getInputGraph().addInputElement(
+ ctx.getInputGraph().members().push_back(
std::unique_ptr<InputElement>(new FileNode(std::move(file))));
}
// Add the library group to the input graph.
if (!isReadingDirectiveSection) {
// Add a group-end marker.
- ctx.getInputGraph().addInputElement(llvm::make_unique<GroupEnd>(0));
+ ctx.getInputGraph().members().push_back(llvm::make_unique<GroupEnd>(0));
}
// Add the library files to the library group.
Modified: lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp?rev=226146&r1=226145&r2=226146&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp Thu Jan 15 02:18:14 2015
@@ -107,21 +107,23 @@ void PECOFFLinkingContext::addLibraryFil
bool PECOFFLinkingContext::createImplicitFiles(
std::vector<std::unique_ptr<File>> &) {
pecoff::ResolvableSymbols* syms = getResolvableSymsFile();
+ std::vector<std::unique_ptr<InputElement>> &members
+ = getInputGraph().members();
// Create a file for the entry point function.
std::unique_ptr<FileNode> entry(new FileNode(
llvm::make_unique<pecoff::EntryPointFile>(*this, syms)));
- getInputGraph().addInputElementFront(std::move(entry));
+ members.insert(members.begin(), std::move(entry));
// Create a file for __ImageBase.
std::unique_ptr<FileNode> fileNode(new FileNode(
llvm::make_unique<pecoff::LinkerGeneratedSymbolFile>(*this)));
- getInputGraph().addInputElement(std::move(fileNode));
+ members.push_back(std::move(fileNode));
// Create a file for _imp_ symbols.
std::unique_ptr<FileNode> impFileNode(new FileNode(
llvm::make_unique<pecoff::LocallyImportedSymbolFile>(*this)));
- getInputGraph().addInputElement(std::move(impFileNode));
+ members.push_back(std::move(impFileNode));
// Create a file for dllexported symbols.
std::unique_ptr<FileNode> exportNode(new FileNode(
More information about the llvm-commits
mailing list