From 0739140b05337d97c22fd17c97ac71ab5a34f5d9 Mon Sep 17 00:00:00 2001 From: Filip Pizlo Date: Thu, 17 Oct 2013 01:38:28 +0000 Subject: Expose install_fatal_error_handler() through the C API. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I expose the API with some caveats: - The C++ API involves a traditional void* opaque pointer for the fatal error callback. The C API doesn’t do this. I don’t think that the void* opaque pointer makes any sense since this is a global callback - there will only be one of them. So if you need to pass some data to your callback, just put it in a global variable. - The bindings will ignore the gen_crash_diag boolean. I ignore it because (1) I don’t know what it does, (2) it’s not documented AFAIK, and (3) I couldn’t imagine any use for it. I made the gut call that it probably wasn’t important enough to expose through the C API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192864 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/ErrorHandling.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib/Support/ErrorHandling.cpp') diff --git a/lib/Support/ErrorHandling.cpp b/lib/Support/ErrorHandling.cpp index 9425445..a0b7619 100644 --- a/lib/Support/ErrorHandling.cpp +++ b/lib/Support/ErrorHandling.cpp @@ -20,6 +20,7 @@ #include "llvm/Support/Signals.h" #include "llvm/Support/Threading.h" #include "llvm/Support/raw_ostream.h" +#include "llvm-c/Core.h" #include #include @@ -102,3 +103,19 @@ void llvm::llvm_unreachable_internal(const char *msg, const char *file, LLVM_BUILTIN_UNREACHABLE; #endif } + +static void bindingsErrorHandler(void *user_data, const std::string& reason, + bool gen_crash_diag) { + LLVMFatalErrorHandler handler = + reinterpret_cast(user_data); + handler(reason.c_str()); +} + +void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler) { + install_fatal_error_handler( + bindingsErrorHandler, reinterpret_cast(Handler)); +} + +void LLVMResetFatalErrorHandler() { + remove_fatal_error_handler(); +} -- cgit v1.1 From 16da44c56235d4aa12c001d94f87ca1dd8e30837 Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Tue, 22 Oct 2013 12:30:55 +0000 Subject: Fix the -Werror -Wpedantic clang selfhost build This is a stopgap fix for cast warnings introduced in r192864. A proper fix should be investigated by the author when possible. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193160 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/ErrorHandling.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/Support/ErrorHandling.cpp') diff --git a/lib/Support/ErrorHandling.cpp b/lib/Support/ErrorHandling.cpp index a0b7619..1eafb96 100644 --- a/lib/Support/ErrorHandling.cpp +++ b/lib/Support/ErrorHandling.cpp @@ -107,13 +107,13 @@ void llvm::llvm_unreachable_internal(const char *msg, const char *file, static void bindingsErrorHandler(void *user_data, const std::string& reason, bool gen_crash_diag) { LLVMFatalErrorHandler handler = - reinterpret_cast(user_data); + LLVM_EXTENSION reinterpret_cast(user_data); handler(reason.c_str()); } void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler) { - install_fatal_error_handler( - bindingsErrorHandler, reinterpret_cast(Handler)); + install_fatal_error_handler(bindingsErrorHandler, + LLVM_EXTENSION reinterpret_cast(Handler)); } void LLVMResetFatalErrorHandler() { -- cgit v1.1 From 5a364c5561ec04e33a6f5d52c14f1bac6f247ea0 Mon Sep 17 00:00:00 2001 From: Juergen Ributzka Date: Fri, 15 Nov 2013 22:34:48 +0000 Subject: [weak vtables] Remove a bunch of weak vtables This patch removes most of the trivial cases of weak vtables by pinning them to a single object file. Differential Revision: http://llvm-reviews.chandlerc.com/D2068 Reviewed by Andy git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194865 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/ErrorHandling.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/Support/ErrorHandling.cpp') diff --git a/lib/Support/ErrorHandling.cpp b/lib/Support/ErrorHandling.cpp index 1eafb96..b91be9d 100644 --- a/lib/Support/ErrorHandling.cpp +++ b/lib/Support/ErrorHandling.cpp @@ -17,6 +17,7 @@ #include "llvm/ADT/Twine.h" #include "llvm/Config/config.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/ErrorOr.h" #include "llvm/Support/Signals.h" #include "llvm/Support/Threading.h" #include "llvm/Support/raw_ostream.h" @@ -119,3 +120,4 @@ void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler) { void LLVMResetFatalErrorHandler() { remove_fatal_error_handler(); } + -- cgit v1.1 From b21ab43cfc3fa0dacf5c95f04e58b6d804b59a16 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Mon, 18 Nov 2013 09:31:53 +0000 Subject: Revert r194865 and r194874. This change is incorrect. If you delete virtual destructor of both a base class and a subclass, then the following code: Base *foo = new Child(); delete foo; will not cause the destructor for members of Child class. As a result, I observe plently of memory leaks. Notable examples I investigated are: ObjectBuffer and ObjectBufferStream, AttributeImpl and StringSAttributeImpl. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194997 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/ErrorHandling.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'lib/Support/ErrorHandling.cpp') diff --git a/lib/Support/ErrorHandling.cpp b/lib/Support/ErrorHandling.cpp index b91be9d..1eafb96 100644 --- a/lib/Support/ErrorHandling.cpp +++ b/lib/Support/ErrorHandling.cpp @@ -17,7 +17,6 @@ #include "llvm/ADT/Twine.h" #include "llvm/Config/config.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/ErrorOr.h" #include "llvm/Support/Signals.h" #include "llvm/Support/Threading.h" #include "llvm/Support/raw_ostream.h" @@ -120,4 +119,3 @@ void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler) { void LLVMResetFatalErrorHandler() { remove_fatal_error_handler(); } - -- cgit v1.1