diff options
| author | Rui Ueyama <ruiu@google.com> | 2013-12-26 06:35:35 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2013-12-26 06:35:35 +0000 |
| commit | 61b851ab06eeb63852766f8c757398fa25d54987 (patch) | |
| tree | fae41554b86e04a96614543420eea2c1146f08e0 | |
| parent | b561f9eb0d7cd994457fc44f8a6d1e965e429def (diff) | |
| download | bcm5719-llvm-61b851ab06eeb63852766f8c757398fa25d54987.tar.gz bcm5719-llvm-61b851ab06eeb63852766f8c757398fa25d54987.zip | |
Remove duplicate methods.
llvm-svn: 198034
| -rw-r--r-- | lld/include/lld/Core/LinkingContext.h | 2 | ||||
| -rw-r--r-- | lld/lib/Core/LinkingContext.cpp | 16 | ||||
| -rw-r--r-- | lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp | 17 |
3 files changed, 16 insertions, 19 deletions
diff --git a/lld/include/lld/Core/LinkingContext.h b/lld/include/lld/Core/LinkingContext.h index d6f7bea0362..2b40bbadaf9 100644 --- a/lld/include/lld/Core/LinkingContext.h +++ b/lld/include/lld/Core/LinkingContext.h @@ -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; diff --git a/lld/lib/Core/LinkingContext.cpp b/lld/lib/Core/LinkingContext.cpp index a9072103d8e..8ac6f591253 100644 --- a/lld/lib/Core/LinkingContext.cpp +++ b/lld/lib/Core/LinkingContext.cpp @@ -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))); diff --git a/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp b/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp index 936b5fdd08c..c5c68333190 100644 --- a/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp +++ b/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp @@ -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( |

