clang API Documentation

Functions
CGException.cpp File Reference
#include "CodeGenFunction.h"
#include "CGCleanup.h"
#include "CGObjCRuntime.h"
#include "TargetInfo.h"
#include "clang/AST/StmtCXX.h"
#include "clang/AST/StmtObjC.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Intrinsics.h"
Include dependency graph for CGException.cpp:

Go to the source code of this file.

Functions

static llvm::Constant * getAllocateExceptionFn (CodeGenModule &CGM)
static llvm::Constant * getFreeExceptionFn (CodeGenModule &CGM)
static llvm::Constant * getThrowFn (CodeGenModule &CGM)
static llvm::Constant * getReThrowFn (CodeGenModule &CGM)
static llvm::Constant * getGetExceptionPtrFn (CodeGenModule &CGM)
static llvm::Constant * getBeginCatchFn (CodeGenModule &CGM)
static llvm::Constant * getEndCatchFn (CodeGenModule &CGM)
static llvm::Constant * getUnexpectedFn (CodeGenModule &CGM)
static llvm::Constant * getTerminateFn (CodeGenModule &CGM)
static llvm::Constant * getCatchallRethrowFn (CodeGenModule &CGM, StringRef Name)
static bool useLibGCCSEHPersonality (const llvm::Triple &T)
static const EHPersonality & getCPersonality (const llvm::Triple &T, const LangOptions &L)
static const EHPersonality & getObjCPersonality (const llvm::Triple &T, const LangOptions &L)
static const EHPersonality & getCXXPersonality (const llvm::Triple &T, const LangOptions &L)
static const EHPersonality & getObjCXXPersonality (const llvm::Triple &T, const LangOptions &L)
static llvm::Constant * getPersonalityFn (CodeGenModule &CGM, const EHPersonality &Personality)
static llvm::Constant * getOpaquePersonalityFn (CodeGenModule &CGM, const EHPersonality &Personality)
static bool PersonalityHasOnlyCXXUses (llvm::Constant *Fn)
static llvm::Constant * getCatchAllValue (CodeGenFunction &CGF)
static void EmitAnyExprToExn (CodeGenFunction &CGF, const Expr *e, llvm::Value *addr)
static void emitFilterDispatchBlock (CodeGenFunction &CGF, EHFilterScope &filterScope)
 Emit the dispatch block for a filter scope if necessary.
static bool isNonEHScope (const EHScope &S)
static llvm::ValueCallBeginCatch (CodeGenFunction &CGF, llvm::Value *Exn, bool EndMightThrow)
static void InitCatchParam (CodeGenFunction &CGF, const VarDecl &CatchParam, llvm::Value *ParamAddr, SourceLocation Loc)
static void BeginCatch (CodeGenFunction &CGF, const CXXCatchStmt *S)
static void emitCatchDispatchBlock (CodeGenFunction &CGF, EHCatchScope &catchScope)
static bool useClangCallTerminate (CodeGenModule &CGM)
static llvm::Constant * getClangCallTerminateFn (CodeGenModule &CGM)

Function Documentation

static void BeginCatch ( CodeGenFunction CGF,
const CXXCatchStmt S 
) [static]
static llvm::Value* CallBeginCatch ( CodeGenFunction CGF,
llvm::Value Exn,
bool  EndMightThrow 
) [static]

Emits a call to __cxa_begin_catch and enters a cleanup to call __cxa_end_catch.

Parameters:
EndMightThrow- true if __cxa_end_catch might throw

Definition at line 902 of file CGException.cpp.

References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EHStack, clang::CodeGen::CodeGenFunction::EmitNounwindRuntimeCall(), getBeginCatchFn(), and clang::CodeGen::NormalAndEHCleanup.

Referenced by BeginCatch(), and InitCatchParam().

static void EmitAnyExprToExn ( CodeGenFunction CGF,
const Expr e,
llvm::Value addr 
) [static]
static void emitCatchDispatchBlock ( CodeGenFunction CGF,
EHCatchScope catchScope 
) [static]
static void emitFilterDispatchBlock ( CodeGenFunction CGF,
EHFilterScope filterScope 
) [static]
static llvm::Constant* getAllocateExceptionFn ( CodeGenModule CGM) [static]
static llvm::Constant* getBeginCatchFn ( CodeGenModule CGM) [static]
static llvm::Constant* getCatchallRethrowFn ( CodeGenModule CGM,
StringRef  Name 
) [static]
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::CodeGenTypeCache::Int8PtrTy.

Referenced by clang::CodeGen::CodeGenFunction::EmitLandingPad(), and clang::CodeGen::CodeGenFunction::getTerminateLandingPad().

static llvm::Constant* getClangCallTerminateFn ( CodeGenModule CGM) [static]
static const EHPersonality& getCPersonality ( const llvm::Triple &  T,
const LangOptions L 
) [static]

Definition at line 177 of file CGException.cpp.

References useLibGCCSEHPersonality().

Referenced by getObjCPersonality().

static const EHPersonality& getCXXPersonality ( const llvm::Triple &  T,
const LangOptions L 
) [static]

Definition at line 205 of file CGException.cpp.

References useLibGCCSEHPersonality().

Referenced by getObjCXXPersonality().

static llvm::Constant* getEndCatchFn ( CodeGenModule CGM) [static]
static llvm::Constant* getFreeExceptionFn ( CodeGenModule CGM) [static]
static llvm::Constant* getGetExceptionPtrFn ( CodeGenModule CGM) [static]
static const EHPersonality& getObjCPersonality ( const llvm::Triple &  T,
const LangOptions L 
) [static]
static const EHPersonality& getObjCXXPersonality ( const llvm::Triple &  T,
const LangOptions L 
) [static]
static llvm::Constant* getOpaquePersonalityFn ( CodeGenModule CGM,
const EHPersonality &  Personality 
) [static]
static llvm::Constant* getPersonalityFn ( CodeGenModule CGM,
const EHPersonality &  Personality 
) [static]
static llvm::Constant* getReThrowFn ( CodeGenModule CGM) [static]
static llvm::Constant* getTerminateFn ( CodeGenModule CGM) [static]
static llvm::Constant* getThrowFn ( CodeGenModule CGM) [static]
static llvm::Constant* getUnexpectedFn ( CodeGenModule CGM) [static]
static void InitCatchParam ( CodeGenFunction CGF,
const VarDecl CatchParam,
llvm::Value ParamAddr,
SourceLocation  Loc 
) [static]

A "special initializer" callback for initializing a catch parameter during catch initialization.

Definition at line 915 of file CGException.cpp.

References clang::CodeGen::CodeGenFunction::Builder, CallBeginCatch(), clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::CodeGenFunction::CreateTempAlloca(), clang::CodeGen::AggValueSlot::DoesNotNeedGCBarriers, clang::CodeGen::CodeGenFunction::EHStack, clang::CodeGen::CodeGenFunction::EmitAggExpr(), clang::CodeGen::CodeGenFunction::EmitAggregateCopy(), clang::CodeGen::CodeGenFunction::EmitARCInitWeak(), clang::CodeGen::CodeGenFunction::EmitARCRetainNonBlock(), clang::CodeGen::CodeGenFunction::EmitLoadOfComplex(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::EmitNounwindRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitStoreOfComplex(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::OpaqueValueExpr::findInCopyConstruct(), clang::CodeGen::AggValueSlot::forAddr(), clang::ASTContext::getCanonicalType(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenFunction::getContext(), clang::ASTContext::getDeclAlign(), getElementType(), clang::CodeGen::CodeGenFunction::getEvaluationKind(), clang::CodeGen::CodeGenFunction::getExceptionFromSlot(), getGetExceptionPtrFn(), clang::VarDecl::getInit(), clang::Qualifiers::getObjCLifetime(), clang::Type::getPointeeType(), clang::CanQual< T >::getQualifiers(), clang::TargetCodeGenInfo::getSizeOfUnwindException(), clang::CodeGen::CodeGenModule::getTargetCodeGenInfo(), clang::ValueDecl::getType(), clang::CodeGen::AggValueSlot::IsNotAliased, clang::CodeGen::AggValueSlot::IsNotDestructed, clang::Type::isRecordType(), clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::CodeGen::CodeGenFunction::MakeNaturalAlignAddrLValue(), clang::Qualifiers::OCL_Autoreleasing, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, clang::Qualifiers::OCL_Weak, clang::CodeGen::CodeGenFunction::OpaqueValueMapping::pop(), clang::CodeGen::EHScopeStack::popTerminate(), clang::CodeGen::EHScopeStack::pushTerminate(), clang::CodeGen::TEK_Aggregate, clang::CodeGen::TEK_Complex, and clang::CodeGen::TEK_Scalar.

Referenced by BeginCatch().

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 689 of file CGException.cpp.

References clang::CodeGen::EHScope::Catch, clang::CodeGen::EHScope::Cleanup, clang::CodeGen::EHScope::Filter, clang::CodeGen::EHScope::getKind(), S, and clang::CodeGen::EHScope::Terminate.

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

static bool PersonalityHasOnlyCXXUses ( llvm::Constant *  Fn) [static]

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

Definition at line 271 of file CGException.cpp.

static bool useClangCallTerminate ( CodeGenModule CGM) [static]

In a terminate landing pad, should we use __clang__call_terminate or just a naked call to std::terminate?

__clang_call_terminate calls __cxa_begin_catch, which then allows std::terminate to usefully report something about the violating exception.

Definition at line 1499 of file CGException.cpp.

References clang::TargetInfo::getCXXABI(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getTarget(), and clang::TargetCXXABI::isItaniumFamily().

Referenced by clang::CodeGen::CodeGenFunction::getTerminateHandler(), and clang::CodeGen::CodeGenFunction::getTerminateLandingPad().

static bool useLibGCCSEHPersonality ( const llvm::Triple &  T) [static]

On Win64, use libgcc's SEH personality function. We fall back to dwarf on other platforms, unless the user asked for SjLj exceptions.

Definition at line 173 of file CGException.cpp.

Referenced by getCPersonality(), and getCXXPersonality().