[llvm-commits] [patch] Add an emit-llvm option to the gold plugin

Nick Lewycky nicholas at mxc.ca
Wed May 12 23:43:13 PDT 2010


Rafael Espindola wrote:
> The attached patch adds the emit-llvm option to the gold plugin. It is
> a bit different from the behaviour of this option in other tools in
> that it requires a filename and gold still produces a regular ELF
> output. The reasons are
>
> *) The is no clean way for the plugin to get the name of the output file
> *) There is no clean way for the plugin to stop gold (short of calling exit(0))
>
> Is this ok? Should I rename the option to also-emit-llvm?

I think that's fine, naming the flag also-emit-llvm would be more clear.

> Cheers,

+  if (options::bc_path)
+    free(const_cast<char *>(options::bc_path));

You don't need the if-statement. free(NULL) is a guaranteed no-op. Also 
feel free to make bc_path not const or make it an std::string or something.

Nick



More information about the llvm-commits mailing list