diff options
| author | Chris Lattner <sabre@nondot.org> | 2003-08-27 04:50:45 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2003-08-27 04:50:45 +0000 |
| commit | c9661eeaabe111ea052c2d3aa822fa157ce36d35 (patch) | |
| tree | 25c119888a7efa7e4c816a7416acc2be5f4cd6e7 /llvm/runtime/GCCLibraries/libexception | |
| parent | 8596f4ff327f9f81c79a63fa863cc754e70e9625 (diff) | |
| download | bcm5719-llvm-c9661eeaabe111ea052c2d3aa822fa157ce36d35.tar.gz bcm5719-llvm-c9661eeaabe111ea052c2d3aa822fa157ce36d35.zip | |
C++ify, add new get_cxx_exception function to convert from generic llvm_exceptions to llvm_cxx_exception's
llvm-svn: 8156
Diffstat (limited to 'llvm/runtime/GCCLibraries/libexception')
| -rw-r--r-- | llvm/runtime/GCCLibraries/libexception/C++-Exception.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/runtime/GCCLibraries/libexception/C++-Exception.h b/llvm/runtime/GCCLibraries/libexception/C++-Exception.h index 9c5447b88a4..6ff384e84d0 100644 --- a/llvm/runtime/GCCLibraries/libexception/C++-Exception.h +++ b/llvm/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); |

