clang API Documentation
Implements runtime-specific code generation functions. More...
#include <CGObjCRuntime.h>
Implements runtime-specific code generation functions.
Definition at line 63 of file CGObjCRuntime.h.
clang::CodeGen::CGObjCRuntime::CGObjCRuntime | ( | CodeGen::CodeGenModule & | CGM | ) | [inline, protected] |
Definition at line 66 of file CGObjCRuntime.h.
CGObjCRuntime::~CGObjCRuntime | ( | ) | [virtual] |
Definition at line 3073 of file CGObjC.cpp.
virtual llvm::Constant* clang::CodeGen::CGObjCRuntime::BuildByrefLayout | ( | CodeGen::CodeGenModule & | CGM, |
QualType | T | ||
) | [pure virtual] |
virtual llvm::Constant* clang::CodeGen::CGObjCRuntime::BuildGCBlockLayout | ( | CodeGen::CodeGenModule & | CGM, |
const CodeGen::CGBlockInfo & | blockInfo | ||
) | [pure virtual] |
Referenced by buildBlockDescriptor().
virtual llvm::Constant* clang::CodeGen::CGObjCRuntime::BuildRCBlockLayout | ( | CodeGen::CodeGenModule & | CGM, |
const CodeGen::CGBlockInfo & | blockInfo | ||
) | [pure virtual] |
Referenced by buildBlockDescriptor().
unsigned CGObjCRuntime::ComputeBitfieldBitOffset | ( | CodeGen::CodeGenModule & | CGM, |
const ObjCInterfaceDecl * | ID, | ||
const ObjCIvarDecl * | Ivar | ||
) |
Definition at line 79 of file CGObjCRuntime.cpp.
References clang::ObjCInterfaceDecl::getImplementation(), and LookupFieldBitOffset().
uint64_t CGObjCRuntime::ComputeIvarBaseOffset | ( | CodeGen::CodeGenModule & | CGM, |
const ObjCInterfaceDecl * | OID, | ||
const ObjCIvarDecl * | Ivar | ||
) | [protected] |
Compute an offset to the given ivar, suitable for passing to EmitValueForIvarAtOffset. Note that the correct handling of bit-fields is carefully coordinated by these two, use caution!
The latter overload is suitable for computing the offset of a sythesized ivar.
Definition at line 65 of file CGObjCRuntime.cpp.
References clang::ASTContext::getCharWidth(), clang::CodeGen::CodeGenModule::getContext(), and LookupFieldBitOffset().
uint64_t CGObjCRuntime::ComputeIvarBaseOffset | ( | CodeGen::CodeGenModule & | CGM, |
const ObjCImplementationDecl * | OID, | ||
const ObjCIvarDecl * | Ivar | ||
) | [protected] |
Definition at line 72 of file CGObjCRuntime.cpp.
References clang::ASTContext::getCharWidth(), clang::ObjCImplDecl::getClassInterface(), clang::CodeGen::CodeGenModule::getContext(), and LookupFieldBitOffset().
void CGObjCRuntime::EmitAtSynchronizedStmt | ( | CodeGenFunction & | CGF, |
const ObjCAtSynchronizedStmt & | S, | ||
llvm::Function * | syncEnterFn, | ||
llvm::Function * | syncExitFn | ||
) | [protected] |
Emits an @synchronize() statement, using the syncEnterFn
and syncExitFn
arguments as the functions called to lock and unlock the object. This function can be called by subclasses that use zero-cost exception handling.
Definition at line 312 of file CGObjCRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::EHStack, clang::CodeGen::CodeGenFunction::EmitARCRetainScalarExpr(), clang::CodeGen::CodeGenFunction::EmitObjCConsumeObject(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitStmt(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::ObjCAtSynchronizedStmt::getSynchBody(), clang::ObjCAtSynchronizedStmt::getSynchExpr(), clang::Expr::getType(), clang::CodeGen::NormalAndEHCleanup, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.
virtual void clang::CodeGen::CGObjCRuntime::EmitGCMemmoveCollectable | ( | CodeGen::CodeGenFunction & | CGF, |
llvm::Value * | DestPtr, | ||
llvm::Value * | SrcPtr, | ||
llvm::Value * | Size | ||
) | [pure virtual] |
Referenced by clang::CodeGen::CodeGenFunction::EmitAggregateCopy().
virtual llvm::Value* clang::CodeGen::CGObjCRuntime::EmitIvarOffset | ( | CodeGen::CodeGenFunction & | CGF, |
const ObjCInterfaceDecl * | Interface, | ||
const ObjCIvarDecl * | Ivar | ||
) | [pure virtual] |
Referenced by clang::CodeGen::CodeGenFunction::EmitIvarOffset().
virtual llvm::Value* clang::CodeGen::CGObjCRuntime::EmitNSAutoreleasePoolClassRef | ( | CodeGenFunction & | CGF | ) | [inline, virtual] |
Definition at line 225 of file CGObjCRuntime.h.
Referenced by clang::CodeGen::CodeGenFunction::EmitObjCMRRAutoreleasePoolPush().
virtual void clang::CodeGen::CGObjCRuntime::EmitObjCGlobalAssign | ( | CodeGen::CodeGenFunction & | CGF, |
llvm::Value * | src, | ||
llvm::Value * | dest, | ||
bool | threadlocal = false |
||
) | [pure virtual] |
Referenced by EmitDeclInit(), and clang::CodeGen::CodeGenFunction::EmitStoreThroughLValue().
virtual void clang::CodeGen::CGObjCRuntime::EmitObjCIvarAssign | ( | CodeGen::CodeGenFunction & | CGF, |
llvm::Value * | src, | ||
llvm::Value * | dest, | ||
llvm::Value * | ivarOffset | ||
) | [pure virtual] |
Referenced by clang::CodeGen::CodeGenFunction::EmitStoreThroughLValue().
virtual void clang::CodeGen::CGObjCRuntime::EmitObjCStrongCastAssign | ( | CodeGen::CodeGenFunction & | CGF, |
llvm::Value * | src, | ||
llvm::Value * | dest | ||
) | [pure virtual] |
Referenced by clang::CodeGen::CodeGenFunction::EmitStoreThroughLValue().
virtual LValue clang::CodeGen::CGObjCRuntime::EmitObjCValueForIvar | ( | CodeGen::CodeGenFunction & | CGF, |
QualType | ObjectTy, | ||
llvm::Value * | BaseValue, | ||
const ObjCIvarDecl * | Ivar, | ||
unsigned | CVRQualifiers | ||
) | [pure virtual] |
Referenced by clang::CodeGen::CodeGenFunction::EmitLValueForIvar().
virtual void clang::CodeGen::CGObjCRuntime::EmitObjCWeakAssign | ( | CodeGen::CodeGenFunction & | CGF, |
llvm::Value * | src, | ||
llvm::Value * | dest | ||
) | [pure virtual] |
Referenced by EmitDeclInit(), and clang::CodeGen::CodeGenFunction::EmitStoreThroughLValue().
virtual llvm::Value* clang::CodeGen::CGObjCRuntime::EmitObjCWeakRead | ( | CodeGen::CodeGenFunction & | CGF, |
llvm::Value * | AddrWeakObj | ||
) | [pure virtual] |
Referenced by clang::CodeGen::CodeGenFunction::EmitLoadOfLValue().
virtual void clang::CodeGen::CGObjCRuntime::EmitSynchronizedStmt | ( | CodeGen::CodeGenFunction & | CGF, |
const ObjCAtSynchronizedStmt & | S | ||
) | [pure virtual] |
virtual void clang::CodeGen::CGObjCRuntime::EmitThrowStmt | ( | CodeGen::CodeGenFunction & | CGF, |
const ObjCAtThrowStmt & | S, | ||
bool | ClearInsertionPoint = true |
||
) | [pure virtual] |
void CGObjCRuntime::EmitTryCatchStmt | ( | CodeGenFunction & | CGF, |
const ObjCAtTryStmt & | S, | ||
llvm::Constant * | beginCatchFn, | ||
llvm::Constant * | endCatchFn, | ||
llvm::Constant * | exceptionRethrowFn | ||
) | [protected] |
Emits a try / catch statement. This function is intended to be called by subclasses, and provides a generic mechanism for generating these, which should be usable by all runtimes. The caller must provide the functions to call when entering and exiting a @catch() block, and the function used to rethrow exceptions. If the begin and end catch functions are NULL, then the function assumes that the EH personality function provides the thrown object directly.
Definition at line 173 of file CGObjCRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CodeGenFunction::EHStack, clang::CodeGen::CodeGenFunction::EmitARCInitWeak(), clang::CodeGen::CodeGenFunction::EmitARCRetainNonBlock(), clang::CodeGen::CodeGenFunction::EmitAutoVarDecl(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitBranchThroughCleanup(), clang::CodeGen::CodeGenFunction::EmitStmt(), clang::CodeGen::CodeGenFunction::FinallyInfo::enter(), clang::CodeGen::CodeGenFunction::FinallyInfo::exit(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CodeGen::CodeGenFunction::JumpDest::getBlock(), clang::ObjCAtCatchStmt::getCatchBody(), clang::ObjCAtCatchStmt::getCatchParamDecl(), clang::ObjCAtTryStmt::getCatchStmt(), GetEHType(), clang::CodeGen::CodeGenFunction::getExceptionFromSlot(), clang::ObjCAtTryStmt::getFinallyStmt(), clang::CodeGen::CodeGenFunction::getJumpDestInCurrentScope(), clang::ObjCAtTryStmt::getNumCatchStmts(), clang::ObjCAtTryStmt::getTryBody(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenFunction::JumpDest::isValid(), clang::CodeGen::NormalAndEHCleanup, clang::CodeGen::CodeGenFunction::ObjCEHValueStack, clang::Qualifiers::OCL_Autoreleasing, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, clang::Qualifiers::OCL_Weak, clang::CodeGen::CodeGenFunction::popCatchScope(), clang::CodeGen::EHScopeStack::pushCatch(), and clang::CodeGen::EHCatchScope::setHandler().
virtual void clang::CodeGen::CGObjCRuntime::EmitTryStmt | ( | CodeGen::CodeGenFunction & | CGF, |
const ObjCAtTryStmt & | S | ||
) | [pure virtual] |
Referenced by clang::CodeGen::CodeGenFunction::EmitObjCAtTryStmt().
LValue CGObjCRuntime::EmitValueForIvarAtOffset | ( | CodeGen::CodeGenFunction & | CGF, |
const ObjCInterfaceDecl * | OID, | ||
llvm::Value * | BaseValue, | ||
const ObjCIvarDecl * | Ivar, | ||
unsigned | CVRQualifiers, | ||
llvm::Value * | Offset | ||
) | [protected] |
Definition at line 86 of file CGObjCRuntime.cpp.
References clang::Qualifiers::addCVRQualifiers(), clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenTypes::ConvertTypeForMem(), clang::FieldDecl::getBitWidthValue(), clang::TargetInfo::getCharAlign(), clang::ASTContext::getCharWidth(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::CodeGen::LValue::getQuals(), clang::CharUnits::getQuantity(), clang::CodeGen::CodeGenModule::getTarget(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenModule::getTypes(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::FieldDecl::isBitField(), LookupFieldBitOffset(), clang::CodeGen::LValue::MakeBitfield(), clang::CodeGen::CGBitFieldInfo::MakeInfo(), clang::CodeGen::CodeGenFunction::MakeNaturalAlignAddrLValue(), clang::CodeGen::CGBitFieldInfo::StorageSize, clang::ASTContext::toBits(), clang::ASTContext::toCharUnitsFromBits(), and clang::QualType::withCVRQualifiers().
virtual llvm::Constant* clang::CodeGen::CGObjCRuntime::EnumerationMutationFunction | ( | ) | [pure virtual] |
EnumerationMutationFunction - Return the function that's called by the compiler when a mutation is detected during foreach iteration.
Referenced by clang::CodeGen::CodeGenFunction::EmitObjCForCollectionStmt().
virtual void clang::CodeGen::CGObjCRuntime::GenerateCategory | ( | const ObjCCategoryImplDecl * | OCD | ) | [pure virtual] |
Generate a category. A category contains a list of methods (and accompanying metadata) and a list of protocols.
virtual void clang::CodeGen::CGObjCRuntime::GenerateClass | ( | const ObjCImplementationDecl * | OID | ) | [pure virtual] |
Generate a class structure for this class.
virtual llvm::Constant* clang::CodeGen::CGObjCRuntime::GenerateConstantString | ( | const StringLiteral * | ) | [pure virtual] |
Generate a constant string object.
Referenced by clang::CodeGen::CodeGenFunction::EmitObjCStringLiteral().
virtual CodeGen::RValue clang::CodeGen::CGObjCRuntime::GenerateMessageSend | ( | CodeGen::CodeGenFunction & | CGF, |
ReturnValueSlot | ReturnSlot, | ||
QualType | ResultType, | ||
Selector | Sel, | ||
llvm::Value * | Receiver, | ||
const CallArgList & | CallArgs, | ||
const ObjCInterfaceDecl * | Class = nullptr , |
||
const ObjCMethodDecl * | Method = nullptr |
||
) | [pure virtual] |
Generate an Objective-C message send operation.
Method | - The method being called, this may be null if synthesizing a property setter or getter. |
Referenced by clang::CodeGen::CodeGenFunction::EmitBlockCopyAndAutorelease(), clang::CodeGen::CodeGenFunction::EmitObjCBoxedExpr(), clang::CodeGen::CodeGenFunction::EmitObjCCollectionLiteral(), clang::CodeGen::CodeGenFunction::EmitObjCForCollectionStmt(), clang::CodeGen::CodeGenFunction::EmitObjCMessageExpr(), clang::CodeGen::CodeGenFunction::EmitObjCMRRAutoreleasePoolPop(), and clang::CodeGen::CodeGenFunction::EmitObjCMRRAutoreleasePoolPush().
virtual CodeGen::RValue clang::CodeGen::CGObjCRuntime::GenerateMessageSendSuper | ( | CodeGen::CodeGenFunction & | CGF, |
ReturnValueSlot | ReturnSlot, | ||
QualType | ResultType, | ||
Selector | Sel, | ||
const ObjCInterfaceDecl * | Class, | ||
bool | isCategoryImpl, | ||
llvm::Value * | Self, | ||
bool | IsClassMessage, | ||
const CallArgList & | CallArgs, | ||
const ObjCMethodDecl * | Method = nullptr |
||
) | [pure virtual] |
Generate an Objective-C message send operation to the super class initiated in a method for Class and with the given Self object.
Method | - The method being called, this may be null if synthesizing a property setter or getter. |
Referenced by clang::CodeGen::CodeGenFunction::EmitObjCMessageExpr().
virtual llvm::Function* clang::CodeGen::CGObjCRuntime::GenerateMethod | ( | const ObjCMethodDecl * | OMD, |
const ObjCContainerDecl * | CD | ||
) | [pure virtual] |
Generate a function preamble for a method with the specified types.
Referenced by clang::CodeGen::CodeGenFunction::StartObjCMethod().
virtual void clang::CodeGen::CGObjCRuntime::GenerateProtocol | ( | const ObjCProtocolDecl * | OPD | ) | [pure virtual] |
Generate the named protocol. Protocols contain method metadata but no implementations.
virtual llvm::Value* clang::CodeGen::CGObjCRuntime::GenerateProtocolRef | ( | CodeGenFunction & | CGF, |
const ObjCProtocolDecl * | OPD | ||
) | [pure virtual] |
Emit the code to return the named protocol as an object, as in a @protocol expression.
Referenced by clang::CodeGen::CodeGenFunction::EmitObjCProtocolExpr().
virtual llvm::Value* clang::CodeGen::CGObjCRuntime::GetClass | ( | CodeGenFunction & | CGF, |
const ObjCInterfaceDecl * | OID | ||
) | [pure virtual] |
GetClass - Return a reference to the class for the given interface decl.
Referenced by clang::CodeGen::CodeGenFunction::EmitObjCBoxedExpr(), clang::CodeGen::CodeGenFunction::EmitObjCCollectionLiteral(), and clang::CodeGen::CodeGenFunction::EmitObjCMessageExpr().
virtual llvm::GlobalVariable* clang::CodeGen::CGObjCRuntime::GetClassGlobal | ( | const std::string & | Name, |
bool | Weak = false |
||
) | [pure virtual] |
Referenced by clang::CodeGen::CodeGenModule::GetAddrOfConstantString().
virtual llvm::Constant* clang::CodeGen::CGObjCRuntime::GetCppAtomicObjectGetFunction | ( | ) | [pure virtual] |
API for atomic copying of qualified aggregates with non-trivial copy assignment (c++) in getter.
Referenced by emitCPPObjectAtomicGetterCall().
virtual llvm::Constant* clang::CodeGen::CGObjCRuntime::GetCppAtomicObjectSetFunction | ( | ) | [pure virtual] |
API for atomic copying of qualified aggregates with non-trivial copy assignment (c++) in setter.
Referenced by emitCPPObjectAtomicSetterCall().
virtual llvm::Constant* clang::CodeGen::CGObjCRuntime::GetEHType | ( | QualType | T | ) | [pure virtual] |
Get the type constant to catch for the given ObjC pointer type. This is used externally to implement catching ObjC types in C++. Runtimes which don't support this should add the appropriate error to Sema.
Referenced by EmitTryCatchStmt(), and clang::CodeGen::CodeGenFunction::EnterCXXTryStmt().
virtual llvm::Constant* clang::CodeGen::CGObjCRuntime::GetGetStructFunction | ( | ) | [pure virtual] |
Referenced by emitStructGetterCall().
CGObjCRuntime::MessageSendInfo CGObjCRuntime::getMessageSendInfo | ( | const ObjCMethodDecl * | method, |
QualType | resultType, | ||
CallArgList & | callArgs | ||
) |
Compute the pointer-to-function type to which a message send should be casted in order to correctly call the given method with the given arguments.
method | - may be null |
resultType | - the result type to use if there's no method |
callArgs | - the actual arguments, including implicit ones |
Definition at line 348 of file CGObjCRuntime.cpp.
References clang::CodeGen::RequiredArgs::All, clang::CodeGen::CodeGenTypes::arrangeFreeFunctionCall(), clang::CodeGen::CodeGenTypes::arrangeObjCMessageSendSignature(), CGM, clang::CodeGen::CGFunctionInfo::getExtInfo(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CGFunctionInfo::getRequiredArgs(), clang::CodeGen::CodeGenModule::getTypes(), and clang::CodeGen::CGFunctionInfo::isVariadic().
virtual llvm::Constant* clang::CodeGen::CGObjCRuntime::GetOptimizedPropertySetFunction | ( | bool | atomic, |
bool | copy | ||
) | [pure virtual] |
Return the runtime function for optimized setting properties.
Referenced by clang::CodeGen::CodeGenFunction::generateObjCSetterBody().
virtual llvm::Constant* clang::CodeGen::CGObjCRuntime::GetPropertyGetFunction | ( | ) | [pure virtual] |
Return the runtime function for getting properties.
Referenced by clang::CodeGen::CodeGenFunction::generateObjCGetterBody().
virtual llvm::Constant* clang::CodeGen::CGObjCRuntime::GetPropertySetFunction | ( | ) | [pure virtual] |
Return the runtime function for setting properties.
Referenced by clang::CodeGen::CodeGenFunction::generateObjCSetterBody().
virtual llvm::Value* clang::CodeGen::CGObjCRuntime::GetSelector | ( | CodeGenFunction & | CGF, |
Selector | Sel, | ||
bool | lval = false |
||
) | [pure virtual] |
Get a selector for the specified name and type values. The return value should have the LLVM type for pointer-to ASTContext::getObjCSelType().
Referenced by clang::CodeGen::CodeGenFunction::EmitObjCSelectorExpr(), and clang::CodeGen::CodeGenFunction::EmitObjCSelectorLValue().
virtual llvm::Value* clang::CodeGen::CGObjCRuntime::GetSelector | ( | CodeGenFunction & | CGF, |
const ObjCMethodDecl * | Method | ||
) | [pure virtual] |
Get a typed selector.
virtual llvm::Constant* clang::CodeGen::CGObjCRuntime::GetSetStructFunction | ( | ) | [pure virtual] |
Referenced by emitStructSetterCall().
virtual llvm::Function* clang::CodeGen::CGObjCRuntime::ModuleInitFunction | ( | ) | [pure virtual] |
Generate the function required to register all Objective-C components in this compilation unit with the runtime library.
virtual void clang::CodeGen::CGObjCRuntime::RegisterAlias | ( | const ObjCCompatibleAliasDecl * | OAD | ) | [pure virtual] |
Register an class alias.
CodeGen::CodeGenModule& clang::CodeGen::CGObjCRuntime::CGM [protected] |
Definition at line 65 of file CGObjCRuntime.h.
Referenced by getMessageSendInfo().