Small gold plugin simplifications.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 29 Jul 2014 19:17:44 +0000 (19:17 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 29 Jul 2014 19:17:44 +0000 (19:17 +0000)
* Use a range loop.
* Store the extra options as "const char *".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214199 91177308-0d34-0410-b5e6-96231b3b80d8

tools/gold/gold-plugin.cpp

index b90851019feaea88c06877b4d21f6e042f9d92bc..8c30ba2a428b8688400acb12edab1bd5a9f8451f 100644 (file)
@@ -89,7 +89,7 @@ namespace options {
   // as plugin exclusive to pass to the code generator.
   // For example, "generate-api-file" and "as"options are for the plugin
   // use only and will not be passed.
-  static std::vector<std::string> extra;
+  static std::vector<const char *> extra;
 
   static void process_plugin_option(const char* opt_)
   {
@@ -122,7 +122,7 @@ namespace options {
       }
     } else {
       // Save this option to pass to the code generator.
-      extra.push_back(opt);
+      extra.push_back(opt_);
     }
   }
 }
@@ -237,10 +237,8 @@ ld_plugin_status onload(ld_plugin_tv *tv) {
 
   // Pass through extra options to the code generator.
   if (!options::extra.empty()) {
-    for (std::vector<std::string>::iterator it = options::extra.begin();
-         it != options::extra.end(); ++it) {
-      CodeGen->setCodeGenDebugOptions((*it).c_str());
-    }
+    for (const char *Opt : options::extra)
+      CodeGen->setCodeGenDebugOptions(Opt);
   }
 
   CodeGen->parseCodeGenDebugOptions();