summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2014-01-15 22:04:35 +0000
committerQuentin Colombet <qcolombet@apple.com>2014-01-15 22:04:35 +0000
commit4c831d97bf065ae5d0fcba80b28e8396dfda7f39 (patch)
tree43d141a6a13492c3bd165514539826d1c2e60a14 /tools
parent7fa843cfef65449f559049044762c680a857e537 (diff)
downloadllvm-4c831d97bf065ae5d0fcba80b28e8396dfda7f39.tar.gz
llvm-4c831d97bf065ae5d0fcba80b28e8396dfda7f39.tar.bz2
llvm-4c831d97bf065ae5d0fcba80b28e8396dfda7f39.tar.xz
[LTO] Add a hook to map LLVM diagnostics into the clients of LTO.
Add a hook in the C API of LTO so that clients of the code generator can set their own handler for the LLVM diagnostics. The handler is defined like this: typedef void (*lto_diagnostic_handler_t)(lto_codegen_diagnostic_severity_t severity, const char *diag, void *ctxt) - severity says how bad this is. - diag is a string that contains the diagnostic message. - ctxt is the registered context for this handler. This hook is more general than the lto_get_error_message, since this function keeps only the latest message and can only be queried when something went wrong (no warning for instance). <rdar://problem/15517596> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199338 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/lto/lto.cpp7
-rw-r--r--tools/lto/lto.exports1
2 files changed, 8 insertions, 0 deletions
diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp
index a28257f6ab..3d58a577dc 100644
--- a/tools/lto/lto.cpp
+++ b/tools/lto/lto.cpp
@@ -193,6 +193,13 @@ lto_symbol_attributes lto_module_get_symbol_attribute(lto_module_t mod,
return mod->getSymbolAttributes(index);
}
+/// Set a diagnostic handler.
+void lto_codegen_set_diagnostic_handler(lto_code_gen_t cg,
+ lto_diagnostic_handler_t diag_handler,
+ void *ctxt) {
+ cg->setDiagnosticHandler(diag_handler, ctxt);
+}
+
/// lto_codegen_create - Instantiates a code generator. Returns NULL if there
/// is an error.
lto_code_gen_t lto_codegen_create(void) {
diff --git a/tools/lto/lto.exports b/tools/lto/lto.exports
index 46d0d74c82..c8f8ee873b 100644
--- a/tools/lto/lto.exports
+++ b/tools/lto/lto.exports
@@ -15,6 +15,7 @@ lto_module_is_object_file_for_target
lto_module_is_object_file_in_memory
lto_module_is_object_file_in_memory_for_target
lto_module_dispose
+lto_codegen_set_diagnostic_handler
lto_codegen_add_module
lto_codegen_add_must_preserve_symbol
lto_codegen_compile