Index: lld/trunk/COFF/Driver.h =================================================================== --- lld/trunk/COFF/Driver.h +++ lld/trunk/COFF/Driver.h @@ -41,6 +41,11 @@ // Implemented in ICF.cpp. void doICF(const std::vector &Chunks); +class COFFOptTable : public llvm::opt::OptTable { +public: + COFFOptTable(); +}; + class ArgParser { public: // Parses command line options. @@ -54,8 +59,9 @@ private: std::vector tokenize(StringRef S); - std::vector replaceResponseFiles(std::vector); + + COFFOptTable Table; }; class LinkerDriver { @@ -71,7 +77,6 @@ StringRef ParentName); private: - ArgParser Parser; SymbolTable Symtab; std::unique_ptr Tar; // for /linkrepro Index: lld/trunk/COFF/Driver.cpp =================================================================== --- lld/trunk/COFF/Driver.cpp +++ lld/trunk/COFF/Driver.cpp @@ -197,6 +197,7 @@ // Parses .drectve section contents and returns a list of files // specified by /defaultlib. void LinkerDriver::parseDirectives(StringRef S) { + ArgParser Parser; opt::InputArgList Args = Parser.parse(S); for (auto *Arg : Args) { @@ -691,6 +692,7 @@ InitializeAllDisassemblers(); // Parse command line options. + ArgParser Parser; opt::InputArgList Args = Parser.parseLINK(ArgsArr.slice(1)); // Parse and evaluate -mllvm options. Index: lld/trunk/COFF/DriverUtils.cpp =================================================================== --- lld/trunk/COFF/DriverUtils.cpp +++ lld/trunk/COFF/DriverUtils.cpp @@ -716,10 +716,7 @@ #undef OPTION }; -class COFFOptTable : public llvm::opt::OptTable { -public: - COFFOptTable() : OptTable(InfoTable, true) {} -}; +COFFOptTable::COFFOptTable() : OptTable(InfoTable, true) {} // Parses a given list of options. opt::InputArgList ArgParser::parse(ArrayRef ArgsArr) { @@ -727,7 +724,6 @@ std::vector Argv = replaceResponseFiles(ArgsArr); // Make InputArgList from string vectors. - COFFOptTable Table; unsigned MissingIndex; unsigned MissingCount; opt::InputArgList Args = Table.ParseArgs(Argv, MissingIndex, MissingCount);