[PATCH] D37217: Keep an instance of COFFOptTable alive as long as InputArgList is alive.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 28 13:47:41 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL311930: Keep an instance of COFFOptTable alive as long as InputArgList is alive. (authored by ruiu).

Changed prior to commit:
  https://reviews.llvm.org/D37217?vs=112907&id=112960#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D37217

Files:
  lld/trunk/COFF/Driver.cpp
  lld/trunk/COFF/Driver.h
  lld/trunk/COFF/DriverUtils.cpp


Index: lld/trunk/COFF/DriverUtils.cpp
===================================================================
--- lld/trunk/COFF/DriverUtils.cpp
+++ lld/trunk/COFF/DriverUtils.cpp
@@ -716,18 +716,14 @@
 #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<const char *> ArgsArr) {
   // First, replace respnose files (@<file>-style options).
   std::vector<const char *> Argv = replaceResponseFiles(ArgsArr);
 
   // Make InputArgList from string vectors.
-  COFFOptTable Table;
   unsigned MissingIndex;
   unsigned MissingCount;
   opt::InputArgList Args = Table.ParseArgs(Argv, MissingIndex, MissingCount);
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/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<Chunk *> &Chunks);
 
+class COFFOptTable : public llvm::opt::OptTable {
+public:
+  COFFOptTable();
+};
+
 class ArgParser {
 public:
   // Parses command line options.
@@ -54,8 +59,9 @@
 
 private:
   std::vector<const char *> tokenize(StringRef S);
-
   std::vector<const char *> replaceResponseFiles(std::vector<const char *>);
+
+  COFFOptTable Table;
 };
 
 class LinkerDriver {
@@ -71,7 +77,6 @@
                             StringRef ParentName);
 
 private:
-  ArgParser Parser;
   SymbolTable Symtab;
 
   std::unique_ptr<llvm::TarWriter> Tar; // for /linkrepro


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37217.112960.patch
Type: text/x-patch
Size: 2273 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170828/e0d767e5/attachment.bin>


More information about the llvm-commits mailing list