clang 8.0.0

Functions
CGException.cpp File Reference
`#include "CodeGenFunction.h"`
`#include "CGCXXABI.h"`
`#include "CGCleanup.h"`
`#include "CGObjCRuntime.h"`
`#include "ConstantEmitter.h"`
`#include "TargetInfo.h"`
`#include "clang/AST/Mangle.h"`
`#include "clang/AST/StmtCXX.h"`
`#include "clang/AST/StmtObjC.h"`
`#include "clang/AST/StmtVisitor.h"`
`#include "clang/Basic/TargetBuiltins.h"`
`#include "llvm/IR/CallSite.h"`
`#include "llvm/IR/Intrinsics.h"`
`#include "llvm/IR/IntrinsicInst.h"`
`#include "llvm/Support/SaveAndRestore.h"`
Include dependency graph for CGException.cpp:

Go to the source code of this file.

## Functions
static llvm::Constant * | getFreeExceptionFn (CodeGenModule &CGM)
static llvm::Constant * | getUnexpectedFn (CodeGenModule &CGM)
static llvm::Constant * | getCatchallRethrowFn (CodeGenModule &CGM, StringRef Name)
static const EHPersonality & | getCPersonality (const TargetInfo &Target, const LangOptions &L)
static const EHPersonality & | getObjCPersonality (const TargetInfo &Target, const LangOptions &L)
static const EHPersonality & | getCXXPersonality (const TargetInfo &Target, const LangOptions &L)
static const EHPersonality & | getObjCXXPersonality (const TargetInfo &Target, const LangOptions &L)
| Determines the personality function to use when both C++ and Objective-C exceptions are being caught. More...
static const EHPersonality & | getSEHPersonalityMSVC (const llvm::Triple &T)
static llvm::Constant * | getPersonalityFn (CodeGenModule &CGM, const EHPersonality &Personality)
static llvm::Constant * | getOpaquePersonalityFn (CodeGenModule &CGM, const EHPersonality &Personality)
static bool | LandingPadHasOnlyCXXUses (llvm::LandingPadInst *LPI)
| Check whether a landingpad instruction only uses C++ features. More...
static bool | PersonalityHasOnlyCXXUses (llvm::Constant *Fn)
| Check whether a personality function could reasonably be swapped for a C++ personality function. More...
static llvm::Constant * | getCatchAllValue (CodeGenFunction &CGF)
| Returns the value to inject into a selector to indicate the presence of a catch-all. More...
static void | emitFilterDispatchBlock (CodeGenFunction &CGF, EHFilterScope &filterScope)
| Emit the dispatch block for a filter scope if necessary. More...
static bool | isNonEHScope (const EHScope &S)
| Check whether this is a non-EH scope, i.e. More...
static void | emitCatchPadBlock (CodeGenFunction &CGF, EHCatchScope &CatchScope)
static void | emitWasmCatchPadBlock (CodeGenFunction &CGF, EHCatchScope &CatchScope)
static void | emitCatchDispatchBlock (CodeGenFunction &CGF, EHCatchScope &catchScope)
| Emit the structure of the dispatch block for the given catch scope. More...

## Function Documentation

## ◆ emitCatchDispatchBlock()

static void emitCatchDispatchBlock | ( | CodeGenFunction & | CGF,
|  | EHCatchScope & | catchScope
| ) |  |
| static

Emit the structure of the dispatch block for the given catch scope.

It is an invariant that the dispatch block already exists.

Definition at line 1050 of file CGException.cpp.

References clang::CodeGen::EHCatchScope::Handler::Block, clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CGBuilderTy::CreateBitCast(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitBlockAfterUses(), emitCatchPadBlock(), emitWasmCatchPadBlock(), clang::CodeGen::CatchTypeInfo::Flags, clang::CodeGen::EHPersonality::get(), clang::CodeGen::EHScope::getCachedEHDispatchBlock(), clang::CodeGen::CodeGenFunction::getEHDispatchBlock(), clang::CodeGen::EHScope::getEnclosingEHScope(), clang::CodeGen::EHCatchScope::getHandler(), clang::CodeGen::CodeGenModule::getIntrinsic(), clang::CodeGen::EHCatchScope::getNumHandlers(), clang::CodeGen::CodeGenFunction::getSelectorFromSlot(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::CodeGen::EHCatchScope::Handler::isCatchAll(), clang::CodeGen::CatchTypeInfo::RTTI, and clang::CodeGen::EHCatchScope::Handler::Type.

Referenced by clang::CodeGen::CodeGenFunction::popCatchScope().

## ◆ emitCatchPadBlock()

static void emitCatchPadBlock | ( | CodeGenFunction & | CGF,
|  | EHCatchScope & | CatchScope
| ) |  |
| static

Definition at line 899 of file CGException.cpp.

References clang::CodeGen::EHCatchScope::Handler::Block, clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CurrentFuncletPad, clang::CodeGen::CodeGenFunction::EmitBlockAfterUses(), clang::CodeGen::CatchTypeInfo::Flags, clang::CodeGen::EHPersonality::get(), clang::CodeGen::EHScope::getCachedEHDispatchBlock(), clang::CodeGen::CodeGenFunction::getEHDispatchBlock(), clang::CodeGen::EHScope::getEnclosingEHScope(), clang::CodeGen::EHCatchScope::getHandler(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::CodeGen::EHCatchScope::getNumHandlers(), clang::CodeGen::CatchTypeInfo::RTTI, clang::CodeGen::EHCatchScope::Handler::Type, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

Referenced by emitCatchDispatchBlock().

## ◆ emitFilterDispatchBlock()

static void emitFilterDispatchBlock | ( | CodeGenFunction & | CGF,
|  | EHFilterScope & | filterScope
| ) |  |
| static

Emit the dispatch block for a filter scope if necessary.

Definition at line 487 of file CGException.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitBlockAfterUses(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::EHScope::getCachedEHDispatchBlock(), clang::CodeGen::CodeGenFunction::getEHResumeBlock(), clang::CodeGen::CodeGenFunction::getExceptionFromSlot(), clang::CodeGen::EHFilterScope::getNumFilters(), clang::CodeGen::CodeGenFunction::getSelectorFromSlot(), and getUnexpectedFn().

Referenced by clang::CodeGen::CodeGenFunction::EmitEndEHSpec().

## ◆ emitWasmCatchPadBlock()

static void emitWasmCatchPadBlock | ( | CodeGenFunction & | CGF,
|  | EHCatchScope & | CatchScope
| ) |  |
| static

Definition at line 942 of file CGException.cpp.

References clang::CodeGen::EHCatchScope::Handler::Block, clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CGBuilderTy::CreateStore(), clang::CodeGen::CodeGenFunction::CurrentFuncletPad, clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitBlockAfterUses(), clang::CodeGen::EHScope::getCachedEHDispatchBlock(), clang::CodeGen::CodeGenFunction::getEHDispatchBlock(), clang::CodeGen::EHScope::getEnclosingEHScope(), clang::CodeGen::CodeGenFunction::getExceptionSlot(), clang::CodeGen::EHCatchScope::getHandler(), clang::CodeGen::CodeGenModule::getIntrinsic(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::CodeGen::EHCatchScope::getNumHandlers(), clang::CodeGen::EHCatchScope::Handler::isCatchAll(), clang::CodeGen::CatchTypeInfo::RTTI, clang::CodeGen::EHCatchScope::Handler::Type, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

Referenced by emitCatchDispatchBlock().

## ◆ getCatchallRethrowFn()

static llvm::Constant* getCatchallRethrowFn | ( | CodeGenModule & | CGM,
|  | StringRef | Name
| ) |  |
| static

Definition at line 77 of file CGException.cpp.

## ◆ getCatchAllValue()

static llvm::Constant* getCatchAllValue | ( | CodeGenFunction & | CGF | ) |
| static

Returns the value to inject into a selector to indicate the presence of a catch-all.

Definition at line 359 of file CGException.cpp.

References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitNounwindRuntimeCall(), getFreeExceptionFn(), and clang::CodeGen::CodeGenTypeCache::Int8PtrTy.

## ◆ getCPersonality()

static const EHPersonality& getCPersonality | ( | const TargetInfo & | Target,
|  | const LangOptions & | L
| ) |  |
| static

Definition at line 117 of file CGException.cpp.

References clang::TargetInfo::getTriple(), clang::CodeGen::EHPersonality::GNU_C, clang::CodeGen::EHPersonality::GNU_C_SEH, and clang::CodeGen::EHPersonality::GNU_C_SJLJ.

Referenced by clang::CodeGen::EHPersonality::get(), and getObjCPersonality().

## ◆ getCXXPersonality()

static const EHPersonality& getCXXPersonality | ( | const TargetInfo & | Target,
|  | const LangOptions & | L
| ) |  |
| static

Definition at line 159 of file CGException.cpp.

References clang::TargetInfo::getTriple(), clang::CodeGen::EHPersonality::GNU_CPlusPlus, clang::CodeGen::EHPersonality::GNU_CPlusPlus_SEH, clang::CodeGen::EHPersonality::GNU_CPlusPlus_SJLJ, clang::CodeGen::EHPersonality::GNU_Wasm_CPlusPlus, and clang::TargetInfo::hasFeature().

Referenced by clang::CodeGen::EHPersonality::get(), getObjCXXPersonality(), and PersonalityHasOnlyCXXUses().

## ◆ getFreeExceptionFn()

static llvm::Constant* getFreeExceptionFn | ( | CodeGenModule & | CGM | ) |
| static

Definition at line 33 of file CGException.cpp.

References clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, and clang::CodeGen::CodeGenTypeCache::VoidTy.

Referenced by getCatchAllValue().

## ◆ getObjCPersonality()

static const EHPersonality& getObjCPersonality | ( | const TargetInfo & | Target,
|  | const LangOptions & | L
| ) |  |
| static

Definition at line 131 of file CGException.cpp.

References clang::ObjCRuntime::FragileMacOSX, clang::ObjCRuntime::GCC, getCPersonality(), clang::ObjCRuntime::getKind(), clang::TargetInfo::getTriple(), clang::ObjCRuntime::getVersion(), clang::CodeGen::EHPersonality::GNU_ObjC, clang::CodeGen::EHPersonality::GNU_ObjC_SEH, clang::CodeGen::EHPersonality::GNU_ObjC_SJLJ, clang::ObjCRuntime::GNUstep, clang::ObjCRuntime::iOS, clang::ObjCRuntime::MacOSX, clang::CodeGen::EHPersonality::NeXT_ObjC, clang::LangOptions::ObjCRuntime, clang::ObjCRuntime::ObjFW, and clang::ObjCRuntime::WatchOS.

Referenced by clang::CodeGen::EHPersonality::get(), and getObjCXXPersonality().

## ◆ getObjCXXPersonality()

static const EHPersonality& getObjCXXPersonality | ( | const TargetInfo & | Target,
|  | const LangOptions & | L
| ) |  |
| static

Determines the personality function to use when both C++ and Objective-C exceptions are being caught.

Definition at line 180 of file CGException.cpp.

References clang::ObjCRuntime::FragileMacOSX, clang::ObjCRuntime::GCC, getCXXPersonality(), clang::ObjCRuntime::getKind(), getObjCPersonality(), clang::TargetInfo::getTriple(), clang::CodeGen::EHPersonality::GNU_ObjCXX, clang::ObjCRuntime::GNUstep, clang::ObjCRuntime::iOS, clang::ObjCRuntime::MacOSX, clang::LangOptions::ObjCRuntime, clang::ObjCRuntime::ObjFW, and clang::ObjCRuntime::WatchOS.

Referenced by clang::CodeGen::EHPersonality::get().

## ◆ getOpaquePersonalityFn()

static llvm::Constant* getOpaquePersonalityFn | ( | CodeGenModule & | CGM,
|  | const EHPersonality & | Personality
| ) |  |
| static

Definition at line 250 of file CGException.cpp.

References clang::CodeGen::CodeGenModule::getDataLayout(), clang::CodeGen::CodeGenModule::getLLVMContext(), getPersonalityFn(), and clang::CodeGen::CodeGenTypeCache::Int8PtrTy.

Referenced by clang::CodeGen::CodeGenFunction::getInvokeDestImpl().

## ◆ getPersonalityFn()

static llvm::Constant* getPersonalityFn | ( | CodeGenModule & | CGM,
|  | const EHPersonality & | Personality
| ) |  |
| static

Definition at line 243 of file CGException.cpp.

References clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenTypeCache::Int32Ty, and clang::CodeGen::EHPersonality::PersonalityFn.

Referenced by getOpaquePersonalityFn(), and PersonalityHasOnlyCXXUses().

## ◆ getSEHPersonalityMSVC()

static const EHPersonality& getSEHPersonalityMSVC | ( | const llvm::Triple & | T | ) |
| static

Definition at line 211 of file CGException.cpp.

References clang::CodeGen::EHPersonality::MSVC_C_specific_handler.

Referenced by clang::CodeGen::EHPersonality::get().

## ◆ getUnexpectedFn()

static llvm::Constant* getUnexpectedFn | ( | CodeGenModule & | CGM | ) |
| static

Definition at line 42 of file CGException.cpp.

References clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, and clang::CodeGen::CodeGenTypeCache::VoidTy.

Referenced by emitFilterDispatchBlock().

## ◆ isNonEHScope()

static bool isNonEHScope | ( | const EHScope & | S | ) |
| static

Check whether this is a non-EH scope, i.e.

a scope which doesn't affect exception handling. Currently, the only non-EH scopes are normal-only cleanup scopes.

Definition at line 690 of file CGException.cpp.

Referenced by clang::CodeGen::CodeGenFunction::getInvokeDestImpl().

## ◆ LandingPadHasOnlyCXXUses()

static bool LandingPadHasOnlyCXXUses | ( | llvm::LandingPadInst * | LPI | ) |
| static

Check whether a landingpad instruction only uses C++ features.

Definition at line 261 of file CGException.cpp.

Referenced by PersonalityHasOnlyCXXUses().

## ◆ PersonalityHasOnlyCXXUses()

static bool PersonalityHasOnlyCXXUses | ( | llvm::Constant * | Fn | ) |
| static

Check whether a personality function could reasonably be swapped for a C++ personality function.

Definition at line 292 of file CGException.cpp.

References clang::CXX, clang::CodeGen::EHPersonality::get(), getCXXPersonality(), clang::CodeGen::CodeGenModule::getModule(), getPersonalityFn(), clang::CodeGen::CodeGenModule::getTarget(), clang::ObjCRuntime::isNeXTFamily(), LandingPadHasOnlyCXXUses(), clang::LangOptions::ObjCRuntime, and clang::CodeGen::EHPersonality::PersonalityFn.