forked from OSchip/llvm-project
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. llvm-svn: 226146
This commit is contained in:
parent
423177a54b
commit
861c2d6c3a
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ bool CoreDriver::parse(int argc, const char *argv[], CoreLinkingContext &ctx,
|
|||
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;
|
||||
|
|
|
@ -119,7 +119,7 @@ static void addFile(StringRef path, std::unique_ptr<InputGraph> &inputGraph,
|
|||
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)));
|
||||
}
|
||||
|
||||
|
|
|
@ -118,16 +118,16 @@ bool Driver::link(LinkingContext &context, raw_ostream &diagnostics) {
|
|||
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.
|
||||
|
|
|
@ -274,12 +274,12 @@ evaluateLinkerScript(ELFLinkingContext &ctx, InputGraph *inputGraph,
|
|||
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 char *argv[],
|
|||
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 char *argv[],
|
|||
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();
|
||||
|
|
|
@ -1416,14 +1416,14 @@ bool WinLinkDriver::parse(int argc, const char *argv[],
|
|||
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.
|
||||
|
|
|
@ -107,21 +107,23 @@ void PECOFFLinkingContext::addLibraryFile(std::unique_ptr<FileNode> file) {
|
|||
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(
|
||||
|
|
Loading…
Reference in New Issue