Remove duplicate methods.

llvm-svn: 198034
This commit is contained in:
Rui Ueyama 2013-12-26 06:35:35 +00:00
parent b561f9eb0d
commit 61b851ab06
3 changed files with 16 additions and 19 deletions

View File

@ -323,9 +323,11 @@ protected:
/// Method to create a internal file for the entry symbol
virtual std::unique_ptr<File> createEntrySymbolFile() const;
std::unique_ptr<File> createEntrySymbolFile(StringRef filename) const;
/// Method to create a internal file for an undefined symbol
virtual std::unique_ptr<File> createUndefinedSymbolFile() const;
std::unique_ptr<File> createUndefinedSymbolFile(StringRef filename) const;
StringRef _outputPath;
StringRef _entrySymbolName;

View File

@ -43,20 +43,28 @@ bool LinkingContext::createImplicitFiles(
}
std::unique_ptr<File> LinkingContext::createEntrySymbolFile() const {
return createEntrySymbolFile("command line option -u");
}
std::unique_ptr<File>
LinkingContext::createEntrySymbolFile(StringRef filename) const {
if (entrySymbolName().empty())
return nullptr;
std::unique_ptr<SimpleFile> entryFile(
new SimpleFile("command line option -entry"));
std::unique_ptr<SimpleFile> entryFile(new SimpleFile(filename));
entryFile->addAtom(
*(new (_allocator) SimpleUndefinedAtom(*entryFile, entrySymbolName())));
return std::move(entryFile);
}
std::unique_ptr<File> LinkingContext::createUndefinedSymbolFile() const {
return createUndefinedSymbolFile("command line option -u");
}
std::unique_ptr<File>
LinkingContext::createUndefinedSymbolFile(StringRef filename) const {
if (_initialUndefinedSymbols.empty())
return nullptr;
std::unique_ptr<SimpleFile> undefinedSymFile(
new SimpleFile("command line option -u"));
std::unique_ptr<SimpleFile> undefinedSymFile(new SimpleFile(filename));
for (auto undefSymStr : _initialUndefinedSymbols)
undefinedSymFile->addAtom(*(new (_allocator) SimpleUndefinedAtom(
*undefinedSymFile, undefSymStr)));

View File

@ -97,24 +97,11 @@ bool PECOFFLinkingContext::validateImpl(raw_ostream &diagnostics) {
}
std::unique_ptr<File> PECOFFLinkingContext::createEntrySymbolFile() const {
if (entrySymbolName().empty())
return nullptr;
std::unique_ptr<SimpleFile> entryFile(
new SimpleFile("command line option /entry"));
entryFile->addAtom(
*(new (_allocator) SimpleUndefinedAtom(*entryFile, entrySymbolName())));
return std::move(entryFile);
return LinkingContext::createEntrySymbolFile("command line option /entry");
}
std::unique_ptr<File> PECOFFLinkingContext::createUndefinedSymbolFile() const {
if (_initialUndefinedSymbols.empty())
return nullptr;
std::unique_ptr<SimpleFile> undefinedSymFile(
new SimpleFile("command line option /include"));
for (auto undefSymStr : _initialUndefinedSymbols)
undefinedSymFile->addAtom(*(new (_allocator) SimpleUndefinedAtom(
*undefinedSymFile, undefSymStr)));
return std::move(undefinedSymFile);
return LinkingContext::createUndefinedSymbolFile("command line option /include");
}
bool PECOFFLinkingContext::createImplicitFiles(