llvm.org GIT mirror llvm / d289ed5
Be more type-safe, add throw specs to all functions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8168 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 17 years ago
2 changed file(s) with 54 addition(s) and 26 deletion(s). Raw diff Collapse all Expand all
2828 * unexpected which are a result of an exception throw are supposed to use the
2929 * value of the handler at the time of the throw, not the currently set value.
3030 */
31 void *UnexpectedHandler;
31 void (*UnexpectedHandler)();
3232
3333 /* TerminateHandler - This contains a pointer to the "terminate" handler which
3434 * may be registered by the user program with set_terminate. Calls to
3535 * unexpected which are a result of an exception throw are supposed to use the
3636 * value of the handler at the time of the throw, not the currently set value.
3737 */
38 void *TerminateHandler;
38 void (*TerminateHandler)();
3939
4040 /* BaseException - The language independent portion of the exception state.
4141 * This is at the end of the record so that we can add additional members to
4444 llvm_exception BaseException;
4545 };
4646
47 inline llvm_cxx_exception *get_cxx_exception(llvm_exception *E) {
47 inline llvm_cxx_exception *get_cxx_exception(llvm_exception *E) throw() {
4848 assert(E->ExceptionType == CXXException && "Not a C++ exception?");
4949 return (llvm_cxx_exception*)(E+1)-1;
5050 }
5151
52 // Interface to the C++ standard library to get to the terminate and unexpected
53 // handler stuff.
54 namespace __cxxabiv1 {
55 // Invokes given handler, dying appropriately if the user handler was
56 // so inconsiderate as to return.
57 extern void __terminate(std::terminate_handler) __attribute__((noreturn));
58 extern void __unexpected(std::unexpected_handler) __attribute__((noreturn));
59
60 // The current installed user handlers.
61 extern std::terminate_handler __terminate_handler;
62 extern std::unexpected_handler __unexpected_handler;
63 }
64
5265 extern "C" {
53 void *__llvm_cxxeh_allocate_exception(unsigned NumBytes);
54 void __llvm_cxxeh_free_exception(void *ObjectPtr);
55 void __llvm_cxxeh_throw(void *ObjectPtr, const std::type_info *TypeInfoPtr,
56 void (*DtorPtr)(void*));
66 void *__llvm_cxxeh_allocate_exception(unsigned NumBytes) throw();
67 void __llvm_cxxeh_free_exception(void *ObjectPtr) throw();
68 void __llvm_cxxeh_throw(void *ObjectPtr, void *TypeInfoPtr,
69 void (*DtorPtr)(void*)) throw();
5770
58 void * __llvm_cxxeh_current_uncaught_exception_isa(const std::type_info *Ty);
59 void *__llvm_cxxeh_begin_catch(void);
60 void *__llvm_cxxeh_begin_catch_if_isa(const std::type_info *CatchType);
61 void __llvm_cxxeh_end_catch(void);
62
63 void __llvm_cxxeh_rethrow(void);
71 void * __llvm_cxxeh_current_uncaught_exception_isa(void *Ty)
72 throw();
73 void *__llvm_cxxeh_begin_catch() throw();
74 void *__llvm_cxxeh_begin_catch_if_isa(void *CatchType) throw();
75 void __llvm_cxxeh_end_catch() /* might throw */;
76 void __llvm_cxxeh_rethrow() throw();
77 void __llvm_cxxeh_check_eh_spec(void *Info, ...);
6478 }
6579
6680 #endif
2828 * unexpected which are a result of an exception throw are supposed to use the
2929 * value of the handler at the time of the throw, not the currently set value.
3030 */
31 void *UnexpectedHandler;
31 void (*UnexpectedHandler)();
3232
3333 /* TerminateHandler - This contains a pointer to the "terminate" handler which
3434 * may be registered by the user program with set_terminate. Calls to
3535 * unexpected which are a result of an exception throw are supposed to use the
3636 * value of the handler at the time of the throw, not the currently set value.
3737 */
38 void *TerminateHandler;
38 void (*TerminateHandler)();
3939
4040 /* BaseException - The language independent portion of the exception state.
4141 * This is at the end of the record so that we can add additional members to
4444 llvm_exception BaseException;
4545 };
4646
47 inline llvm_cxx_exception *get_cxx_exception(llvm_exception *E) {
47 inline llvm_cxx_exception *get_cxx_exception(llvm_exception *E) throw() {
4848 assert(E->ExceptionType == CXXException && "Not a C++ exception?");
4949 return (llvm_cxx_exception*)(E+1)-1;
5050 }
5151
52 // Interface to the C++ standard library to get to the terminate and unexpected
53 // handler stuff.
54 namespace __cxxabiv1 {
55 // Invokes given handler, dying appropriately if the user handler was
56 // so inconsiderate as to return.
57 extern void __terminate(std::terminate_handler) __attribute__((noreturn));
58 extern void __unexpected(std::unexpected_handler) __attribute__((noreturn));
59
60 // The current installed user handlers.
61 extern std::terminate_handler __terminate_handler;
62 extern std::unexpected_handler __unexpected_handler;
63 }
64
5265 extern "C" {
53 void *__llvm_cxxeh_allocate_exception(unsigned NumBytes);
54 void __llvm_cxxeh_free_exception(void *ObjectPtr);
55 void __llvm_cxxeh_throw(void *ObjectPtr, const std::type_info *TypeInfoPtr,
56 void (*DtorPtr)(void*));
66 void *__llvm_cxxeh_allocate_exception(unsigned NumBytes) throw();
67 void __llvm_cxxeh_free_exception(void *ObjectPtr) throw();
68 void __llvm_cxxeh_throw(void *ObjectPtr, void *TypeInfoPtr,
69 void (*DtorPtr)(void*)) throw();
5770
58 void * __llvm_cxxeh_current_uncaught_exception_isa(const std::type_info *Ty);
59 void *__llvm_cxxeh_begin_catch(void);
60 void *__llvm_cxxeh_begin_catch_if_isa(const std::type_info *CatchType);
61 void __llvm_cxxeh_end_catch(void);
62
63 void __llvm_cxxeh_rethrow(void);
71 void * __llvm_cxxeh_current_uncaught_exception_isa(void *Ty)
72 throw();
73 void *__llvm_cxxeh_begin_catch() throw();
74 void *__llvm_cxxeh_begin_catch_if_isa(void *CatchType) throw();
75 void __llvm_cxxeh_end_catch() /* might throw */;
76 void __llvm_cxxeh_rethrow() throw();
77 void __llvm_cxxeh_check_eh_spec(void *Info, ...);
6478 }
6579
6680 #endif