[PATCH] D42975: Don't store the full Argv in Config

Rafael Avila de Espindola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 10:48:29 PST 2018


espindola created this revision.
espindola added reviewers: ruiu, grimar.
Herald added a subscriber: emaste.

Having it there seems in conflict with the desire to part all command                                                                          
line options in the Driver.


https://reviews.llvm.org/D42975

Files:
  ELF/Config.h
  ELF/Driver.cpp
  ELF/Driver.h


Index: ELF/Driver.h
===================================================================
--- ELF/Driver.h
+++ ELF/Driver.h
@@ -31,7 +31,7 @@
   void addLibrary(StringRef Name);
 
 private:
-  void readConfigs(llvm::opt::InputArgList &Args);
+  void readConfigs(const char *Argv0, llvm::opt::InputArgList &Args);
   void createFiles(llvm::opt::InputArgList &Args);
   void inferMachineType();
   template <class ELFT> void link(llvm::opt::InputArgList &Args);
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -89,7 +89,6 @@
   Driver = make<LinkerDriver>();
   Script = make<LinkerScript>();
   Symtab = make<SymbolTable>();
-  Config->Argv = {Args.begin(), Args.end()};
 
   Driver->main(Args, CanExitEarly);
 
@@ -365,7 +364,7 @@
     }
   }
 
-  readConfigs(Args);
+  readConfigs(ArgsArr[0], Args);
   initLLVM();
   createFiles(Args);
   inferMachineType();
@@ -588,7 +587,7 @@
 }
 
 // Initializes Config members by the command line options.
-void LinkerDriver::readConfigs(opt::InputArgList &Args) {
+void LinkerDriver::readConfigs(const char *Argv0, opt::InputArgList &Args) {
   Config->AllowMultipleDefinition =
       Args.hasFlag(OPT_allow_multiple_definition,
                    OPT_no_allow_multiple_definition, false) ||
@@ -690,7 +689,7 @@
   Config->ZWxneeded = hasZOption(Args, "wxneeded");
 
   // Parse LTO plugin-related options for compatibility with gold.
-  std::vector<const char *> LTOOptions({Config->Argv[0].data()});
+  std::vector<const char *> LTOOptions({Argv0});
   for (auto *Arg : Args.filtered(OPT_plugin_opt)) {
     StringRef S = Arg->getValue();
     if (S == "disable-verify")
Index: ELF/Config.h
===================================================================
--- ELF/Config.h
+++ ELF/Config.h
@@ -94,7 +94,6 @@
   llvm::StringRef ThinLTOCacheDir;
   std::string Rpath;
   std::vector<VersionDefinition> VersionDefinitions;
-  std::vector<llvm::StringRef> Argv;
   std::vector<llvm::StringRef> AuxiliaryList;
   std::vector<llvm::StringRef> FilterList;
   std::vector<llvm::StringRef> SearchPaths;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42975.133044.patch
Type: text/x-patch
Size: 2123 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180206/2e7e2e93/attachment.bin>


More information about the llvm-commits mailing list