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 /// Method to create a internal file for the entry symbol
virtual std::unique_ptr<File> createEntrySymbolFile() const; 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 /// Method to create a internal file for an undefined symbol
virtual std::unique_ptr<File> createUndefinedSymbolFile() const; virtual std::unique_ptr<File> createUndefinedSymbolFile() const;
std::unique_ptr<File> createUndefinedSymbolFile(StringRef filename) const;
StringRef _outputPath; StringRef _outputPath;
StringRef _entrySymbolName; StringRef _entrySymbolName;

View File

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

View File

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