[lld] r198034 - Remove duplicate methods.

Rui Ueyama ruiu at google.com
Wed Dec 25 22:35:35 PST 2013


Author: ruiu
Date: Thu Dec 26 00:35:35 2013
New Revision: 198034

URL: http://llvm.org/viewvc/llvm-project?rev=198034&view=rev
Log:
Remove duplicate methods.

Modified:
    lld/trunk/include/lld/Core/LinkingContext.h
    lld/trunk/lib/Core/LinkingContext.cpp
    lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp

Modified: lld/trunk/include/lld/Core/LinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/LinkingContext.h?rev=198034&r1=198033&r2=198034&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/LinkingContext.h (original)
+++ lld/trunk/include/lld/Core/LinkingContext.h Thu Dec 26 00:35:35 2013
@@ -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;

Modified: lld/trunk/lib/Core/LinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/LinkingContext.cpp?rev=198034&r1=198033&r2=198034&view=diff
==============================================================================
--- lld/trunk/lib/Core/LinkingContext.cpp (original)
+++ lld/trunk/lib/Core/LinkingContext.cpp Thu Dec 26 00:35:35 2013
@@ -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)));

Modified: lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp?rev=198034&r1=198033&r2=198034&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp Thu Dec 26 00:35:35 2013
@@ -97,24 +97,11 @@ bool PECOFFLinkingContext::validateImpl(
 }
 
 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(





More information about the llvm-commits mailing list