Home | History | Annotate | Download | only in CodeGen
      1 //===-- 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 
     18 #include "llvm/ADT/StringRef.h"
     19 
     20 namespace clang {
     21 class LangOptions;
     22 
     23 namespace CodeGen {
     24 
     25 /// The exceptions personality for a function.  When
     26 class EHPersonality {
     27   llvm::StringRef PersonalityFn;
     28 
     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*).
     32   llvm::StringRef CatchallRethrowFn;
     33 
     34   EHPersonality(llvm::StringRef PersonalityFn,
     35                 llvm::StringRef CatchallRethrowFn = llvm::StringRef())
     36     : PersonalityFn(PersonalityFn),
     37       CatchallRethrowFn(CatchallRethrowFn) {}
     38 
     39 public:
     40   static const EHPersonality &get(const LangOptions &Lang);
     41   static const EHPersonality GNU_C;
     42   static const EHPersonality GNU_C_SJLJ;
     43   static const EHPersonality GNU_ObjC;
     44   static const EHPersonality GNU_ObjCXX;
     45   static const EHPersonality NeXT_ObjC;
     46   static const EHPersonality GNU_CPlusPlus;
     47   static const EHPersonality GNU_CPlusPlus_SJLJ;
     48 
     49   llvm::StringRef getPersonalityFnName() const { return PersonalityFn; }
     50   llvm::StringRef getCatchallRethrowFnName() const { return CatchallRethrowFn; }
     51 };
     52 
     53 }
     54 }
     55 
     56 #endif
     57