[llvm-commits] [patch] Small cleanups to the gold plugin

Nick Lewycky nlewycky at google.com
Sun Jun 6 12:56:14 PDT 2010


-        as_path = strdup(opt + 3);
+        as_path = opt.substr(3);

Please use opt.substr(strlen("as="));. I really like that idiom which you
used later on in the function. :-)

         (*message)(LDPL_WARNING, "Path to the output IL file specified
twice. "
-                   "Discarding %s", opt);
+                   "Discarding %s", opt.str());

How does that work? opt is an llvm::StringRef whose str() method returns an
std::string not a char*.

The rest of the patch looks great, thanks!

Nick

On 3 June 2010 15:11, Rafael Espindola <espindola at google.com> wrote:

> The attached patch contains some cleanups to the plugin code. Mostly
> using std::string and llvm::StringRef.
>
> Cheers,
> --
> Rafael Ávila de Espíndola
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100606/2b16f5ca/attachment.html>


More information about the llvm-commits mailing list