blob: d0216160d50f6a7f307e317c5af2aa7ae2442be9 [file] [log] [blame]
John McCallf1549f62010-07-06 01:34:17 +00001//===-- CGException.h - Classes for exceptions IR generation ----*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// These classes support the generation of LLVM IR for exceptions in
11// C++ and Objective C.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef CLANG_CODEGEN_CGEXCEPTION_H
16#define CLANG_CODEGEN_CGEXCEPTION_H
17
John McCall36f893c2011-01-28 11:13:47 +000018#include "llvm/ADT/StringRef.h"
John McCallf1549f62010-07-06 01:34:17 +000019
20namespace clang {
John McCall36f893c2011-01-28 11:13:47 +000021class LangOptions;
22
John McCallf1549f62010-07-06 01:34:17 +000023namespace CodeGen {
24
John McCall8262b6a2010-07-17 00:43:08 +000025/// The exceptions personality for a function. When
26class EHPersonality {
Chris Lattner686775d2011-07-20 06:58:45 +000027 StringRef PersonalityFn;
John McCall8262b6a2010-07-17 00:43:08 +000028
29 // If this is non-null, this personality requires a non-standard
30 // function for rethrowing an exception after a catchall cleanup.
31 // This function must have prototype void(void*).
Chris Lattner686775d2011-07-20 06:58:45 +000032 StringRef CatchallRethrowFn;
John McCall8262b6a2010-07-17 00:43:08 +000033
Chris Lattner686775d2011-07-20 06:58:45 +000034 EHPersonality(StringRef PersonalityFn,
35 StringRef CatchallRethrowFn = StringRef())
John McCall8262b6a2010-07-17 00:43:08 +000036 : PersonalityFn(PersonalityFn),
37 CatchallRethrowFn(CatchallRethrowFn) {}
38
39public:
40 static const EHPersonality &get(const LangOptions &Lang);
41 static const EHPersonality GNU_C;
John McCall44680782010-11-07 02:35:25 +000042 static const EHPersonality GNU_C_SJLJ;
John McCall8262b6a2010-07-17 00:43:08 +000043 static const EHPersonality GNU_ObjC;
David Chisnall80558d22011-03-20 21:35:39 +000044 static const EHPersonality GNU_ObjCXX;
John McCall8262b6a2010-07-17 00:43:08 +000045 static const EHPersonality NeXT_ObjC;
46 static const EHPersonality GNU_CPlusPlus;
47 static const EHPersonality GNU_CPlusPlus_SJLJ;
48
Chris Lattner686775d2011-07-20 06:58:45 +000049 StringRef getPersonalityFnName() const { return PersonalityFn; }
50 StringRef getCatchallRethrowFnName() const { return CatchallRethrowFn; }
John McCall8262b6a2010-07-17 00:43:08 +000051};
52
John McCallf1549f62010-07-06 01:34:17 +000053}
54}
55
56#endif