non-exiting diagnostic handler for LTO code generator

Gao, Yunzhong via llvm-commits llvm-commits at
Thu Sep 10 19:02:09 PDT 2015

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?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lto.patch
Type: text/x-patch
Size: 2597 bytes
Desc: lto.patch
URL: <>

More information about the llvm-commits mailing list