mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-29 16:23:44 +00:00
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
This commit is contained in:
parent
c2c70fa79e
commit
5cf1199059
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user