ELF2: Remove ArgParser class and define parseArgs() function instead.

ArgParser was a class with only one member function, so it didn't
have to be a class.

llvm-svn: 249988
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 8566deb..271ebde 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -112,7 +112,7 @@
 void LinkerDriver::main(ArrayRef<const char *> ArgsArr) {
   initSymbols();
 
-  opt::InputArgList Args = ArgParser(&Alloc).parse(ArgsArr);
+  opt::InputArgList Args = parseArgs(&Alloc, ArgsArr);
   createFiles(Args);
 
   switch (Config->ElfKind) {
diff --git a/lld/ELF/Driver.h b/lld/ELF/Driver.h
index 0bc84a5..6a7ca8f 100644
--- a/lld/ELF/Driver.h
+++ b/lld/ELF/Driver.h
@@ -14,7 +14,6 @@
 #include "lld/Core/LLVM.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Option/ArgList.h"
-#include "llvm/Support/StringSaver.h"
 
 namespace lld {
 namespace elf2 {
@@ -24,17 +23,6 @@
 // Entry point of the ELF linker.
 void link(ArrayRef<const char *> Args);
 
-class ArgParser {
-public:
-  ArgParser(llvm::BumpPtrAllocator *A);
-
-  // Parses command line options.
-  llvm::opt::InputArgList parse(ArrayRef<const char *> Args);
-
-private:
-  llvm::StringSaver Saver;
-};
-
 class LinkerDriver {
 public:
   void main(ArrayRef<const char *> Args);
@@ -54,6 +42,10 @@
   std::vector<std::unique_ptr<MemoryBuffer>> OwningMBs;
 };
 
+// Parses command line options.
+llvm::opt::InputArgList parseArgs(llvm::BumpPtrAllocator *A,
+                                  ArrayRef<const char *> Args);
+
 // Create enum with OPT_xxx values for each option in Options.td
 enum {
   OPT_INVALID = 0,
diff --git a/lld/ELF/DriverUtils.cpp b/lld/ELF/DriverUtils.cpp
index c15cb51..d26e0cf 100644
--- a/lld/ELF/DriverUtils.cpp
+++ b/lld/ELF/DriverUtils.cpp
@@ -19,6 +19,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/StringSaver.h"
 
 using namespace llvm;
 
@@ -49,10 +50,9 @@
   ELFOptTable() : OptTable(infoTable, array_lengthof(infoTable)) {}
 };
 
-ArgParser::ArgParser(BumpPtrAllocator *A) : Saver(*A) {}
-
 // Parses a given list of options.
-opt::InputArgList ArgParser::parse(ArrayRef<const char *> Argv) {
+opt::InputArgList lld::elf2::parseArgs(llvm::BumpPtrAllocator *A,
+                                       ArrayRef<const char *> Argv) {
   // Make InputArgList from string vectors.
   ELFOptTable Table;
   unsigned MissingIndex;
@@ -60,6 +60,7 @@
 
   // Expand response files. '@<filename>' is replaced by the file's contents.
   SmallVector<const char *, 256> Vec(Argv.data(), Argv.data() + Argv.size());
+  StringSaver Saver(*A);
   llvm::cl::ExpandResponseFiles(Saver, llvm::cl::TokenizeGNUCommandLine, Vec);
 
   // Parse options and then do error checking.