[PATCH] D14313: Add a libLTO diagnostic handler that supports lto_get_error_message API

Yunzhong Gao via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 22:37:08 PST 2015


ygao added a comment.

I am actually not too satisfied with this patch myself, because I realize that the LTO client can call lto_codegen_set_diagnostic_handler() to set a new diagnostic handler, which however does not seem to change the handleLibLTODiagnostic() method installed by this patch here (the "IRLinker" member of the LTOCodeGenerator class does not provide a method to change its diagnostic handler).


================
Comment at: include/llvm/LTO/LTOCodeGenerator.h:68
@@ -66,1 +67,3 @@
+  LTOCodeGenerator(std::unique_ptr<LLVMContext> Context,
+                   DiagnosticHandlerFunction DiagnosticHandler);
   ~LTOCodeGenerator();
----------------
joker.eph wrote:
> The combinatory explosion of constructors is not nice. I feel we should be able to avoid it with a default value (and promoting handleLTODiagnostic to a static class method):
> 
> ```
> struct LTOCodeGenerator {
>   static void handleLTODiagnostic(const DiagnosticInfo &DI);
>   LTOCodeGenerator(DiagnosticHandlerFunction DiagnosticHandler = handleLTODiagnostic);
>   ....
> ```
Thanks for looking at this. Yes that looks more clean.


http://reviews.llvm.org/D14313





More information about the llvm-commits mailing list