summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-27 04:50:45 +0000
committerChris Lattner <sabre@nondot.org>2003-08-27 04:50:45 +0000
commit5cf1199059db83e3f4ad1616da60f1792c435acf (patch)
tree760d4358e09dc5dfd53fd70fdf5c4d81540407e0 /runtime
parentc2c70fa79e2ed26dc90bbe4176982e21d06886bf (diff)
downloadllvm-5cf1199059db83e3f4ad1616da60f1792c435acf.tar.gz
llvm-5cf1199059db83e3f4ad1616da60f1792c435acf.tar.bz2
llvm-5cf1199059db83e3f4ad1616da60f1792c435acf.tar.xz
C++ify, add new get_cxx_exception function to convert from generic llvm_exceptions to llvm_cxx_exception's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8156 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'runtime')
-rw-r--r--runtime/GCCLibraries/crtend/C++-Exception.h10
-rw-r--r--runtime/GCCLibraries/libexception/C++-Exception.h10
2 files changed, 14 insertions, 6 deletions
diff --git a/runtime/GCCLibraries/crtend/C++-Exception.h b/runtime/GCCLibraries/crtend/C++-Exception.h
index 9c5447b88a..6ff384e84d 100644
--- a/runtime/GCCLibraries/crtend/C++-Exception.h
+++ b/runtime/GCCLibraries/crtend/C++-Exception.h
@@ -10,8 +10,9 @@
#include "exception.h"
#include <typeinfo>
+#include <cassert>
-typedef struct llvm_cxx_exception {
+struct llvm_cxx_exception {
/* TypeInfo - A pointer to the C++ std::type_info object for this exception
* class. This is required because the class may not be polymorphic.
*/
@@ -42,9 +43,12 @@ typedef struct llvm_cxx_exception {
* this structure without breaking binary compatibility.
*/
llvm_exception BaseException;
-} llvm_cxx_exception;
-
+};
+inline llvm_cxx_exception *get_cxx_exception(llvm_exception *E) {
+ assert(E->ExceptionType == CXXException && "Not a C++ exception?");
+ return (llvm_cxx_exception*)(E+1)-1;
+}
extern "C" {
void *__llvm_cxxeh_allocate_exception(unsigned NumBytes);
diff --git a/runtime/GCCLibraries/libexception/C++-Exception.h b/runtime/GCCLibraries/libexception/C++-Exception.h
index 9c5447b88a..6ff384e84d 100644
--- a/runtime/GCCLibraries/libexception/C++-Exception.h
+++ b/runtime/GCCLibraries/libexception/C++-Exception.h
@@ -10,8 +10,9 @@
#include "exception.h"
#include <typeinfo>
+#include <cassert>
-typedef struct llvm_cxx_exception {
+struct llvm_cxx_exception {
/* TypeInfo - A pointer to the C++ std::type_info object for this exception
* class. This is required because the class may not be polymorphic.
*/
@@ -42,9 +43,12 @@ typedef struct llvm_cxx_exception {
* this structure without breaking binary compatibility.
*/
llvm_exception BaseException;
-} llvm_cxx_exception;
-
+};
+inline llvm_cxx_exception *get_cxx_exception(llvm_exception *E) {
+ assert(E->ExceptionType == CXXException && "Not a C++ exception?");
+ return (llvm_cxx_exception*)(E+1)-1;
+}
extern "C" {
void *__llvm_cxxeh_allocate_exception(unsigned NumBytes);