non-exiting diagnostic handler for LTO code generator

Rafael EspĂ­ndola via llvm-commits llvm-commits at
Fri Sep 11 05:56:56 PDT 2015

As you point out llvm-lto is just a testing tool, so this is fine.

Can you avoid the code duplication between the two constructors? The
lambda uses no local state, so it can be converted to a static global
function, no?

On 10 September 2015 at 22:02, Gao, Yunzhong
<yunzhong_gao at> wrote:
> Hi Rafael,
> Writing a test with llvm-lto turns out to be slightly more tricky than I thought it would be. llvm-lto does something like:
>   if (!CodeGen.addModule(Module.get()))
>     return 1;
> So with my patch, addModule() will no longer call exit(1) on errors in modules, but when it returns to the main()
> function of llvm-lto, it silently returns 1, and I cannot distinguish between exit(1) and "return 1" within lit. My
> current attempt (attached) is to make llvm-lto print an extra message before returning 1, so that lit can FileCheck
> that. Is this acceptable? I think it does make llvm-lto print excessive diagnostics, but hopefully llvm-lto is used only
> for testing and therefore it does not matter,
> - Gao
> ________________________________________
> From: Rafael EspĂ­ndola [rafael.espindola at]
> Sent: Wednesday, September 09, 2015 5:33 AM
> To: Gao, Yunzhong
> Cc: Duncan P. N. Exon Smith (dexonsmith at; Peter Collingbourne (peter at; llvm-commits at
> Subject: Re: non-exiting diagnostic handler for LTO code generator
> I think the included patch is correct. You should be able to write a
> test for it with llvm-lto, no?

More information about the llvm-commits mailing list