blob: 1e82f2ffbe3784767eb7a79df24903266728eeeb [file] [log] [blame]
Chris Lattner53375212003-08-25 22:35:36 +00001//===- exception.h - Generic language-independent exceptions ----*- C++ -*-===//
2//
3// This file defines the the shared data structures used by all language
4// specific exception handling runtime libraries.
5//
6//===----------------------------------------------------------------------===//
7
8#ifndef EXCEPTION_H
9#define EXCEPTION_H
10
Chris Lattnerc2c70fa2003-08-27 04:50:12 +000011struct llvm_exception {
Chris Lattner53375212003-08-25 22:35:36 +000012 // ExceptionDestructor - This call-back function is used to destroy the
13 // current exception, without requiring the caller to know what the concrete
14 // exception type is.
15 //
Chris Lattnerc2c70fa2003-08-27 04:50:12 +000016 void (*ExceptionDestructor)(llvm_exception *);
Chris Lattner53375212003-08-25 22:35:36 +000017
18 // ExceptionType - This field identifies what runtime library this exception
19 // came from. Currently defined values are:
20 // 0 - Error
21 // 1 - longjmp exception (see longjmp-exception.c)
22 // 2 - C++ exception (see c++-exception.c)
23 //
24 unsigned ExceptionType;
25
26 // Next - This points to the next exception in the current stack.
Chris Lattnerc2c70fa2003-08-27 04:50:12 +000027 llvm_exception *Next;
Chris Lattner53375212003-08-25 22:35:36 +000028
29 // HandlerCount - This is a count of the number of handlers which have
30 // currently caught this exception. If the handler is caught and this number
31 // falls to zero, the exception is destroyed.
32 //
33 unsigned HandlerCount;
Chris Lattnerc2c70fa2003-08-27 04:50:12 +000034};
Chris Lattner53375212003-08-25 22:35:36 +000035
36enum {
37 ErrorException = 0,
38 LongjmpException = 1,
39 CXXException = 2,
40};
41
42// Language independent exception handling API...
43//
44extern "C" {
45 bool __llvm_eh_has_uncaught_exception(void);
46 void *__llvm_eh_current_uncaught_exception_type(unsigned HandlerType);
47}
48
49#endif