Replace the createImplicitFiles method return type with void

All instances of the `createImplicitFiles` always return `true` and this
return value is used nowhere.

llvm-svn: 234205
This commit is contained in:
Simon Atanasyan 2015-04-06 20:43:35 +00:00
parent 230d2ec75f
commit c437888f5a
23 changed files with 38 additions and 61 deletions

View File

@ -292,7 +292,7 @@ public:
/// 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
/// how file format specific atoms can be added to the link.
virtual bool createImplicitFiles(std::vector<std::unique_ptr<File> > &);
virtual void createImplicitFiles(std::vector<std::unique_ptr<File>> &);
/// This method is called by core linking to build the list of Passes to be
/// run on the merged/linked graph of all input files.

View File

@ -34,7 +34,7 @@ public:
/// \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
/// how file format specific atoms can be added to the link.
virtual bool createImplicitFiles(std::vector<std::unique_ptr<File> > &);
virtual void createImplicitFiles(std::vector<std::unique_ptr<File>> &) {}
protected:
// only concrete subclasses can be instantiated

View File

@ -72,7 +72,7 @@ public:
bool validateImpl(raw_ostream &diagnostics) override;
std::string demangle(StringRef symbolName) const override;
bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
uint32_t getCPUType() const;
uint32_t getCPUSubType() const;

View File

@ -76,8 +76,7 @@ public:
void addPasses(PassManager &pm) override;
bool createImplicitFiles(
std::vector<std::unique_ptr<File> > &result) override;
void createImplicitFiles(std::vector<std::unique_ptr<File>> &result) override;
bool is64Bit() const {
return _machineType == llvm::COFF::IMAGE_FILE_MACHINE_AMD64;

View File

@ -37,9 +37,9 @@ std::error_code LinkingContext::writeFile(const File &linkedFile) const {
return this->writer().writeFile(linkedFile, _outputPath);
}
bool LinkingContext::createImplicitFiles(
std::vector<std::unique_ptr<File> > &result) {
return this->writer().createImplicitFiles(result);
void LinkingContext::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
this->writer().createImplicitFiles(result);
}
std::unique_ptr<File> LinkingContext::createEntrySymbolFile() const {

View File

@ -16,8 +16,4 @@ Writer::Writer() {
Writer::~Writer() {
}
bool Writer::createImplicitFiles(std::vector<std::unique_ptr<File> > &) {
return true;
}
} // end namespace lld

View File

@ -24,7 +24,7 @@ public:
protected:
// Add any runtime files and their atoms to the output
bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void finalizeDefaultAtomValues() override {
return DynamicLibraryWriter<ELFT>::finalizeDefaultAtomValues();
@ -53,13 +53,12 @@ AArch64DynamicLibraryWriter<ELFT>::AArch64DynamicLibraryWriter(
_ctx(ctx), _layout(layout) {}
template <class ELFT>
bool AArch64DynamicLibraryWriter<ELFT>::createImplicitFiles(
void AArch64DynamicLibraryWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
DynamicLibraryWriter<ELFT>::createImplicitFiles(result);
_gotFile->addAtom(*new (_gotFile->_alloc) GlobalOffsetTableAtom(*_gotFile));
_gotFile->addAtom(*new (_gotFile->_alloc) DynamicAtom(*_gotFile));
result.push_back(std::move(_gotFile));
return true;
}
} // namespace elf

View File

@ -23,7 +23,7 @@ public:
protected:
// Add any runtime files and their atoms to the output
bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void finalizeDefaultAtomValues() override {
return ExecutableWriter<ELFT>::finalizeDefaultAtomValues();
@ -52,14 +52,13 @@ AArch64ExecutableWriter<ELFT>::AArch64ExecutableWriter(
_ctx(ctx), _layout(layout) {}
template <class ELFT>
bool AArch64ExecutableWriter<ELFT>::createImplicitFiles(
void AArch64ExecutableWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
ExecutableWriter<ELFT>::createImplicitFiles(result);
_gotFile->addAtom(*new (_gotFile->_alloc) GlobalOffsetTableAtom(*_gotFile));
if (_ctx.isDynamic())
_gotFile->addAtom(*new (_gotFile->_alloc) DynamicAtom(*_gotFile));
result.push_back(std::move(_gotFile));
return true;
}
} // namespace elf

View File

@ -29,7 +29,7 @@ public:
protected:
// Add any runtime files and their atoms to the output
bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void finalizeDefaultAtomValues() override;
@ -57,10 +57,9 @@ ARMExecutableWriter<ELFT>::ARMExecutableWriter(ARMLinkingContext &ctx,
: ExecutableWriter<ELFT>(ctx, layout), _ctx(ctx), _armLayout(layout) {}
template <class ELFT>
bool ARMExecutableWriter<ELFT>::createImplicitFiles(
void ARMExecutableWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
ExecutableWriter<ELFT>::createImplicitFiles(result);
return true;
}
template <class ELFT>

View File

@ -29,7 +29,7 @@ public:
protected:
void buildDynamicSymbolTable(const File &file) override;
void addDefaultAtoms() override;
bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void finalizeDefaultAtomValues() override;
protected:
@ -66,13 +66,12 @@ template <class ELFT> void DynamicLibraryWriter<ELFT>::addDefaultAtoms() {
/// \brief Hook in lld to add CRuntime file
template <class ELFT>
bool DynamicLibraryWriter<ELFT>::createImplicitFiles(
void DynamicLibraryWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File> > &result) {
// Add the default atoms as defined by executables
DynamicLibraryWriter<ELFT>::addDefaultAtoms();
OutputELFWriter<ELFT>::createImplicitFiles(result);
result.push_back(std::move(_runtimeFile));
return true;
}
template <class ELFT>

View File

@ -29,7 +29,7 @@ public:
protected:
void buildDynamicSymbolTable(const File &file) override;
void addDefaultAtoms() override;
bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void finalizeDefaultAtomValues() override;
void createDefaultSections() override;
@ -100,13 +100,12 @@ void ExecutableWriter<ELFT>::addDefaultAtoms() {
/// \brief Hook in lld to add CRuntime file
template <class ELFT>
bool ExecutableWriter<ELFT>::createImplicitFiles(
void ExecutableWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File> > &result) {
// Add the default atoms as defined by executables
ExecutableWriter<ELFT>::addDefaultAtoms();
OutputELFWriter<ELFT>::createImplicitFiles(result);
result.push_back(std::move(_runtimeFile));
return true;
}
template <class ELFT> void ExecutableWriter<ELFT>::createDefaultSections() {

View File

@ -26,7 +26,7 @@ public:
protected:
// Add any runtime files and their atoms to the output
bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void finalizeDefaultAtomValues() override;
@ -54,13 +54,12 @@ HexagonDynamicLibraryWriter<ELFT>::HexagonDynamicLibraryWriter(
_runtimeFile(new HexagonRuntimeFile<ELFT>(ctx)) {}
template <class ELFT>
bool HexagonDynamicLibraryWriter<ELFT>::createImplicitFiles(
void HexagonDynamicLibraryWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
DynamicLibraryWriter<ELFT>::createImplicitFiles(result);
// Add the default atoms as defined for hexagon
addDefaultAtoms();
result.push_back(std::move(_runtimeFile));
return true;
}
template <class ELFT>

View File

@ -26,7 +26,7 @@ public:
protected:
// Add any runtime files and their atoms to the output
bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void finalizeDefaultAtomValues() override;
@ -57,13 +57,12 @@ HexagonExecutableWriter<ELFT>::HexagonExecutableWriter(
_runtimeFile(new HexagonRuntimeFile<ELFT>(ctx)) {}
template <class ELFT>
bool HexagonExecutableWriter<ELFT>::createImplicitFiles(
void HexagonExecutableWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
ExecutableWriter<ELFT>::createImplicitFiles(result);
// Add the default atoms as defined for hexagon
addDefaultAtoms();
result.push_back(std::move(_runtimeFile));
return true;
}
template <class ELFT>

View File

@ -30,7 +30,7 @@ public:
protected:
// Add any runtime files and their atoms to the output
bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void finalizeDefaultAtomValues() override;
void createDefaultSections() override;
@ -58,11 +58,10 @@ MipsDynamicLibraryWriter<ELFT>::MipsDynamicLibraryWriter(
_targetLayout(layout) {}
template <class ELFT>
bool MipsDynamicLibraryWriter<ELFT>::createImplicitFiles(
void MipsDynamicLibraryWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
DynamicLibraryWriter<ELFT>::createImplicitFiles(result);
result.push_back(std::move(_writeHelper.createRuntimeFile()));
return true;
}
template <class ELFT>

View File

@ -28,7 +28,7 @@ protected:
void buildDynamicSymbolTable(const File &file) override;
// Add any runtime files and their atoms to the output
bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void finalizeDefaultAtomValues() override;
void createDefaultSections() override;
@ -110,11 +110,10 @@ void MipsExecutableWriter<ELFT>::buildDynamicSymbolTable(const File &file) {
}
template <class ELFT>
bool MipsExecutableWriter<ELFT>::createImplicitFiles(
void MipsExecutableWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
ExecutableWriter<ELFT>::createImplicitFiles(result);
result.push_back(std::move(_writeHelper.createRuntimeFile()));
return true;
}
template <class ELFT>

View File

@ -133,7 +133,7 @@ protected:
virtual void addDefaultAtoms();
// Add any runtime files and their atoms to the output
bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
// Finalize the default atom values
virtual void finalizeDefaultAtomValues();
@ -363,7 +363,7 @@ template <class ELFT> void OutputELFWriter<ELFT>::addDefaultAtoms() {
}
template <class ELFT>
bool OutputELFWriter<ELFT>::createImplicitFiles(
void OutputELFWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
// Add the virtual archive to resolve undefined symbols.
// The file will be added later in the linking context.
@ -375,7 +375,6 @@ bool OutputELFWriter<ELFT>::createImplicitFiles(
llvm::make_unique<DynamicSymbolFile<ELFT>>(ctx, std::move(callback)));
// Add script defined symbols
result.push_back(std::move(_scriptFile));
return true;
}
template <class ELFT>

View File

@ -22,7 +22,7 @@ public:
protected:
// Add any runtime files and their atoms to the output
bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void finalizeDefaultAtomValues() override {
return DynamicLibraryWriter<ELFT>::finalizeDefaultAtomValues();
@ -51,13 +51,12 @@ X86DynamicLibraryWriter<ELFT>::X86DynamicLibraryWriter(
_ctx(ctx), _layout(layout) {}
template <class ELFT>
bool X86DynamicLibraryWriter<ELFT>::createImplicitFiles(
void X86DynamicLibraryWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
DynamicLibraryWriter<ELFT>::createImplicitFiles(result);
_gotFile->addAtom(*new (_gotFile->_alloc) GlobalOffsetTableAtom(*_gotFile));
_gotFile->addAtom(*new (_gotFile->_alloc) DynamicAtom(*_gotFile));
result.push_back(std::move(_gotFile));
return true;
}
} // namespace elf

View File

@ -22,7 +22,7 @@ public:
protected:
// Add any runtime files and their atoms to the output
bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void finalizeDefaultAtomValues() override {
return ExecutableWriter<ELFT>::finalizeDefaultAtomValues();
@ -43,10 +43,9 @@ X86ExecutableWriter<ELFT>::X86ExecutableWriter(X86LinkingContext &ctx,
: ExecutableWriter<ELFT>(ctx, layout), _ctx(ctx), _layout(layout) {}
template <class ELFT>
bool X86ExecutableWriter<ELFT>::createImplicitFiles(
void X86ExecutableWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
ExecutableWriter<ELFT>::createImplicitFiles(result);
return true;
}
} // namespace elf

View File

@ -24,7 +24,7 @@ public:
protected:
// Add any runtime files and their atoms to the output
bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
void finalizeDefaultAtomValues() override {
return DynamicLibraryWriter::finalizeDefaultAtomValues();
@ -48,13 +48,12 @@ X86_64DynamicLibraryWriter::X86_64DynamicLibraryWriter(
X86_64LinkingContext &ctx, X86_64TargetLayout &layout)
: DynamicLibraryWriter(ctx, layout), _gotFile(new GOTFile(ctx)) {}
bool X86_64DynamicLibraryWriter::createImplicitFiles(
void X86_64DynamicLibraryWriter::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
DynamicLibraryWriter::createImplicitFiles(result);
_gotFile->addAtom(*new (_gotFile->_alloc) GlobalOffsetTableAtom(*_gotFile));
_gotFile->addAtom(*new (_gotFile->_alloc) DynamicAtom(*_gotFile));
result.push_back(std::move(_gotFile));
return true;
}
} // namespace elf

View File

@ -23,7 +23,7 @@ public:
protected:
// Add any runtime files and their atoms to the output
bool
void
createImplicitFiles(std::vector<std::unique_ptr<File>> &result) override {
ExecutableWriter::createImplicitFiles(result);
_gotFile->addAtom(*new (_gotFile->_alloc)
@ -31,7 +31,6 @@ protected:
if (_ctx.isDynamic())
_gotFile->addAtom(*new (_gotFile->_alloc) DynamicAtom(*_gotFile));
result.push_back(std::move(_gotFile));
return true;
}
void finalizeDefaultAtomValues() override {

View File

@ -685,7 +685,7 @@ uint32_t MachOLinkingContext::dylibCompatVersion(StringRef installName) const {
return 0x1000; // 1.0
}
bool MachOLinkingContext::createImplicitFiles(
void MachOLinkingContext::createImplicitFiles(
std::vector<std::unique_ptr<File> > &result) {
// Add indirect dylibs by asking each linked dylib to add its indirects.
// Iterate until no more dylibs get loaded.
@ -699,7 +699,7 @@ bool MachOLinkingContext::createImplicitFiles(
}
// Let writer add output type specific extras.
return writer().createImplicitFiles(result);
writer().createImplicitFiles(result);
}

View File

@ -45,7 +45,7 @@ public:
return writeBinary(*nFile->get(), path);
}
bool createImplicitFiles(std::vector<std::unique_ptr<File> > &r) override {
void createImplicitFiles(std::vector<std::unique_ptr<File>> &r) override {
// When building main executables, add _main as required entry point.
if (_context.outputTypeHasEntry())
r.emplace_back(new CEntryFile(_context));
@ -55,8 +55,6 @@ public:
// Final linked images can access a symbol for their mach_header.
if (_context.outputMachOType() != llvm::MachO::MH_OBJECT)
r.emplace_back(new MachHeaderAliasFile(_context));
return true;
}
private:
const MachOLinkingContext &_context;

View File

@ -137,7 +137,7 @@ void PECOFFLinkingContext::addLibraryFile(std::unique_ptr<FileNode> file) {
currentGroupEnd->getSize() + 1);
}
bool PECOFFLinkingContext::createImplicitFiles(
void PECOFFLinkingContext::createImplicitFiles(
std::vector<std::unique_ptr<File>> &) {
std::vector<std::unique_ptr<Node>> &members = getNodes();
@ -160,8 +160,6 @@ bool PECOFFLinkingContext::createImplicitFiles(
std::unique_ptr<FileNode> exportNode(new FileNode(
llvm::make_unique<pecoff::ExportedSymbolRenameFile>(*this)));
addLibraryFile(std::move(exportNode));
return true;
}
/// Returns the section name in the resulting executable.