[llvm] r214199 - Small gold plugin simplifications.

Rafael Espindola rafael.espindola at gmail.com
Tue Jul 29 12:17:44 PDT 2014


Author: rafael
Date: Tue Jul 29 14:17:44 2014
New Revision: 214199

URL: http://llvm.org/viewvc/llvm-project?rev=214199&view=rev
Log:
Small gold plugin simplifications.

* Use a range loop.
* Store the extra options as "const char *".

Modified:
    llvm/trunk/tools/gold/gold-plugin.cpp

Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=214199&r1=214198&r2=214199&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Tue Jul 29 14:17:44 2014
@@ -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();





More information about the llvm-commits mailing list