clang 22.0.0git
|
#include "CGCUDARuntime.h"
#include "CGCXXABI.h"
#include "CGDebugInfo.h"
#include "CGObjCRuntime.h"
#include "CodeGenFunction.h"
#include "ConstantEmitter.h"
#include "TargetInfo.h"
#include "clang/Basic/CodeGenOptions.h"
#include "clang/CodeGen/CGFunctionInfo.h"
#include "llvm/IR/Intrinsics.h"
Go to the source code of this file.
Functions | |
static MemberCallInfo | commonEmitCXXMemberOrOperatorCall (CodeGenFunction &CGF, GlobalDecl GD, llvm::Value *This, llvm::Value *ImplicitParam, QualType ImplicitParamTy, const CallExpr *CE, CallArgList &Args, CallArgList *RtlArgs) |
static CXXRecordDecl * | getCXXRecord (const Expr *E) |
static void | EmitNullBaseClassInitialization (CodeGenFunction &CGF, Address DestPtr, const CXXRecordDecl *Base) |
static CharUnits | CalculateCookiePadding (CodeGenFunction &CGF, const CXXNewExpr *E) |
static llvm::Value * | EmitCXXNewAllocSize (CodeGenFunction &CGF, const CXXNewExpr *e, unsigned minElements, llvm::Value *&numElements, llvm::Value *&sizeWithoutCookie) |
static void | StoreAnyExprIntoOneUnit (CodeGenFunction &CGF, const Expr *Init, QualType AllocType, Address NewPtr, AggValueSlot::Overlap_t MayOverlap) |
static void | EmitNewInitializer (CodeGenFunction &CGF, const CXXNewExpr *E, QualType ElementType, llvm::Type *ElementTy, Address NewPtr, llvm::Value *NumElements, llvm::Value *AllocSizeWithoutCookie) |
static RValue | EmitNewDeleteCall (CodeGenFunction &CGF, const FunctionDecl *CalleeDecl, const FunctionProtoType *CalleeType, const CallArgList &Args) |
Emit a call to an operator new or operator delete function, as implicitly created by new-expressions and delete-expressions. | |
static UsualDeleteParams | getUsualDeleteParams (const FunctionDecl *FD) |
static void | EnterNewDeleteCleanup (CodeGenFunction &CGF, const CXXNewExpr *E, RValue TypeIdentity, Address NewPtr, llvm::Value *AllocSize, CharUnits AllocAlign, const CallArgList &NewArgs) |
Enter a cleanup to call 'operator delete' if the initializer in a new-expression throws. | |
static void | EmitDestroyingObjectDelete (CodeGenFunction &CGF, const CXXDeleteExpr *DE, Address Ptr, QualType ElementType) |
Emit the code for deleting a single object with a destroying operator delete. | |
static bool | EmitObjectDelete (CodeGenFunction &CGF, const CXXDeleteExpr *DE, Address Ptr, QualType ElementType, llvm::BasicBlock *UnconditionalDeleteBlock) |
Emit the code for deleting a single object. | |
static void | EmitArrayDelete (CodeGenFunction &CGF, const CXXDeleteExpr *E, Address deletedPtr, QualType elementType) |
Emit the code for deleting an array of objects. | |
static llvm::Value * | EmitTypeidFromVTable (CodeGenFunction &CGF, const Expr *E, llvm::Type *StdTypeInfoPtrTy, bool HasNullCheck) |
static llvm::Value * | EmitDynamicCastToNull (CodeGenFunction &CGF, QualType DestTy) |
|
static |
Definition at line 695 of file CGExprCXX.cpp.
References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CGCXXABI::GetArrayCookieSize(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::CXXNewExpr::getOperatorNew(), clang::CXXNewExpr::isArray(), clang::FunctionDecl::isReservedGlobalPlacementOperator(), and clang::CharUnits::Zero().
Referenced by EmitCXXNewAllocSize(), and clang::CodeGen::CodeGenFunction::EmitCXXNewExpr().
|
static |
Definition at line 36 of file CGExprCXX.cpp.
References clang::CodeGen::CallArgList::add(), clang::CodeGen::CallArgList::addFrom(), clang::CallExpr::arguments(), clang::cast(), clang::Type::castAs(), clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenTypes::DeriveThisType(), clang::CodeGen::CodeGenFunction::EmitCallArgs(), clang::CodeGen::RequiredArgs::forPrototypePlus(), clang::CodeGen::RValue::get(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::GlobalDecl::getDecl(), clang::CallExpr::getDirectCallee(), clang::FunctionProtoType::getNumParams(), clang::CodeGen::CGCXXABI::getThisArgumentTypeForMethod(), clang::CodeGen::CodeGenFunction::getTypes(), and clang::isa().
Referenced by clang::CodeGen::CodeGenFunction::EmitCXXDestructorCall(), clang::CodeGen::CodeGenFunction::EmitCXXMemberOrOperatorCall(), and clang::CodeGen::CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr().
|
static |
Emit the code for deleting an array of objects.
Definition at line 2073 of file CGExprCXX.cpp.
References clang::CharUnits::alignmentOfArrayElement(), clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CGBuilderTy::CreateInBoundsGEP(), clang::CodeGen::CodeGenFunction::EHStack, clang::CodeGen::CodeGenFunction::emitArrayDestroy(), clang::CodeGen::Address::emitRawPointer(), clang::CodeGen::Address::getAlignment(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::CodeGen::CodeGenFunction::getDestroyer(), clang::CodeGen::Address::getElementType(), clang::CXXDeleteExpr::getOperatorDelete(), clang::ASTContext::getTypeSizeInChars(), clang::QualType::isDestructedType(), clang::CodeGen::CodeGenFunction::needsEHCleanup(), clang::CodeGen::NormalAndEHCleanup, clang::CodeGen::CodeGenFunction::PopCleanupBlock(), and clang::CodeGen::CGCXXABI::ReadArrayCookie().
Referenced by clang::CodeGen::CodeGenFunction::EmitCXXDeleteExpr().
|
static |
Definition at line 708 of file CGExprCXX.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CalculateCookiePadding(), clang::cast(), clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CXXNewExpr::getAllocatedType(), clang::CXXNewExpr::getArraySize(), clang::ASTContext::getAsConstantArrayType(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenModule::getIntrinsic(), clang::CharUnits::getQuantity(), clang::ASTContext::getTypeSizeInChars(), clang::isa(), clang::CXXNewExpr::isArray(), clang::CharUnits::isOne(), clang::CodeGen::CodeGenTypeCache::SizeTy, clang::CodeGen::ConstantEmitter::tryEmitAbstract(), and clang::ast_matchers::type.
Referenced by clang::CodeGen::CodeGenFunction::EmitCXXNewExpr().
|
static |
Emit the code for deleting a single object with a destroying operator delete.
If the element type has a non-virtual destructor, Ptr has already been converted to the type of the parameter of 'operator delete'. Otherwise Ptr points to an object of the static type.
Definition at line 1939 of file CGExprCXX.cpp.
References clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitDeleteCall(), clang::CodeGen::Address::emitRawPointer(), clang::CodeGen::CGCXXABI::emitVirtualObjectDelete(), clang::Type::getAsCXXRecordDecl(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::CXXRecordDecl::getDestructor(), and clang::CXXDeleteExpr::getOperatorDelete().
Referenced by clang::CodeGen::CodeGenFunction::EmitCXXDeleteExpr().
|
static |
C++ [expr.dynamic.cast]p9: A failed cast to reference type throws std::bad_cast
Definition at line 2231 of file CGExprCXX.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::ConvertType(), clang::CodeGen::CGCXXABI::EmitBadCastCall(), clang::CodeGen::CodeGenModule::getCXXABI(), and clang::Type::isPointerType().
Referenced by clang::CodeGen::CodeGenFunction::EmitDynamicCast().
|
static |
Emit a call to an operator new or operator delete function, as implicitly created by new-expressions and delete-expressions.
C++1y [expr.new]p10: [In a new-expression,] an implementation is allowed to omit a call to a replaceable global allocation function.
We model such elidable calls with the 'builtin' attribute.
Definition at line 1336 of file CGExprCXX.cpp.
References clang::CodeGen::CodeGenTypes::arrangeFreeFunctionCall(), clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitCall(), clang::CodeGen::CGCallee::forDirect(), clang::CodeGen::CodeGenModule::GetAddrOfFunction(), clang::CodeGen::CodeGenModule::getTypes(), and clang::FunctionDecl::isReplaceableGlobalAllocationFunction().
Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinNewDeleteCall(), clang::CodeGen::CodeGenFunction::EmitCXXNewExpr(), and clang::CodeGen::CodeGenFunction::EmitDeleteCall().
|
static |
Definition at line 1321 of file CGExprCXX.cpp.
References clang::CodeGen::AggValueSlot::DoesNotOverlap, clang::CodeGen::CodeGenFunction::EmitNewArrayInitializer(), clang::CXXNewExpr::getAllocatedType(), clang::CXXNewExpr::getInitializer(), clang::Init, clang::CXXNewExpr::isArray(), and StoreAnyExprIntoOneUnit().
Referenced by clang::CodeGen::CodeGenFunction::EmitCXXNewExpr().
|
static |
Definition at line 510 of file CGExprCXX.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CGBuilderTy::CreateConstInBoundsByteGEP(), clang::CodeGen::CGBuilderTy::CreateMemCpy(), clang::CodeGen::CGBuilderTy::CreateMemSet(), clang::CodeGen::CodeGenModule::EmitNullConstantForBase(), clang::CodeGen::Address::getAlignment(), clang::CharUnits::getAsAlign(), clang::ASTContext::getASTRecordLayout(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::CodeGen::CodeGenModule::getModule(), clang::ASTRecordLayout::getNonVirtualAlignment(), clang::ASTRecordLayout::getNonVirtualSize(), clang::CodeGen::CodeGenTypeCache::getPointerSize(), clang::CodeGen::CodeGenModule::getSize(), clang::CodeGen::CGCXXABI::getVBPtrOffsets(), clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::CharUnits::isNegative(), clang::CharUnits::isZero(), clang::CodeGen::Address::withElementType(), and clang::CharUnits::Zero().
Referenced by clang::CodeGen::CodeGenFunction::EmitCXXConstructExpr().
|
static |
Emit the code for deleting a single object.
true
if we started emitting UnconditionalDeleteBlock, false
if not. Definition at line 1954 of file CGExprCXX.cpp.
References clang::CodeGen::ARCPreciseLifetime, clang::CodeGen::CodeGenFunction::CGM, clang::declaresSameEntity(), clang::Dtor_Complete, clang::CodeGen::CodeGenFunction::EHStack, clang::CodeGen::CodeGenFunction::EmitARCDestroyStrong(), clang::CodeGen::CodeGenFunction::EmitARCDestroyWeak(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitCXXDestructorCall(), clang::CodeGen::Address::emitRawPointer(), clang::CodeGen::CodeGenFunction::EmitTypeCheck(), clang::CodeGen::CGCXXABI::emitVirtualObjectDelete(), clang::CXXDeleteExpr::getArgument(), clang::Type::getAsCXXRecordDecl(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getCXXABI(), getCXXRecord(), clang::CXXMethodDecl::getDevirtualizedMethod(), clang::Expr::getExprLoc(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::QualType::getObjCLifetime(), clang::CXXDeleteExpr::getOperatorDelete(), clang::DeclContext::getParent(), clang::CXXMethodDecl::isVirtual(), clang::CodeGen::NormalAndEHCleanup, clang::Qualifiers::OCL_Autoreleasing, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, clang::Qualifiers::OCL_Weak, clang::CodeGen::CodeGenFunction::PopCleanupBlock(), and clang::CodeGen::CodeGenFunction::TCK_MemberCall.
Referenced by clang::CodeGen::CodeGenFunction::EmitCXXDeleteExpr().
|
static |
Definition at line 2160 of file CGExprCXX.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CGBuilderTy::CreateIsNull(), clang::CodeGen::CGCXXABI::EmitBadTypeidCall(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitLValue(), clang::CodeGen::CodeGenFunction::EmitTypeCheck(), clang::CodeGen::CGCXXABI::EmitTypeid(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::Expr::getExprLoc(), clang::Expr::getType(), IsNull, clang::CodeGen::CGCXXABI::shouldTypeidBeNullChecked(), and clang::CodeGen::CodeGenFunction::TCK_DynamicOperation.
Referenced by clang::CodeGen::CodeGenFunction::EmitCXXTypeidExpr().
|
static |
Enter a cleanup to call 'operator delete' if the initializer in a new-expression throws.
Definition at line 1542 of file CGExprCXX.cpp.
References clang::CodeGen::EHCleanup, clang::CodeGen::CodeGenFunction::EHStack, clang::CodeGen::Address::emitRawPointer(), clang::CodeGen::RValue::get(), clang::CXXNewExpr::getNumImplicitArgs(), clang::CXXNewExpr::getNumPlacementArgs(), clang::CXXNewExpr::getOperatorDelete(), clang::CXXNewExpr::implicitAllocationParameters(), clang::CodeGen::CodeGenFunction::initFullExprCleanup(), clang::CodeGen::CodeGenFunction::isInConditionalBranch(), clang::CodeGen::EHScopeStack::pushCleanupWithExtra(), clang::CodeGen::InvariantValue< T >::save(), and V.
Referenced by clang::CodeGen::CodeGenFunction::EmitCXXNewExpr().
|
static |
Definition at line 179 of file CGExprCXX.cpp.
References clang::Expr::getType(), and clang::T.
Referenced by clang::CodeGen::CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr(), and EmitObjectDelete().
|
static |
Definition at line 1389 of file CGExprCXX.cpp.
References clang::Type::castAs(), clang::ValueDecl::getType(), clang::Type::isAlignValT(), clang::FunctionDecl::isDestroyingOperatorDelete(), clang::Type::isIntegerType(), clang::isTypeAwareAllocation(), clang::FunctionDecl::isTypeAwareOperatorNewOrDelete(), clang::FunctionProtoType::param_type_begin(), clang::FunctionProtoType::param_type_end(), and clang::Yes.
Referenced by clang::CodeGen::CodeGenFunction::EmitDeleteCall().
|
static |
Definition at line 970 of file CGExprCXX.cpp.
References clang::CodeGen::AggValueSlot::DoesNotNeedGCBarriers, clang::CodeGen::CodeGenFunction::EmitAggExpr(), clang::CodeGen::CodeGenFunction::EmitComplexExprIntoLValue(), clang::CodeGen::CodeGenFunction::EmitScalarInit(), clang::CodeGen::AggValueSlot::forAddr(), clang::CodeGen::CodeGenFunction::getEvaluationKind(), clang::QualType::getQualifiers(), clang::Init, clang::CodeGen::AggValueSlot::IsDestructed, clang::CodeGen::AggValueSlot::IsNotAliased, clang::CodeGen::AggValueSlot::IsNotZeroed, clang::CodeGen::AggValueSlot::IsSanitizerChecked, clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::CodeGen::TEK_Aggregate, clang::CodeGen::TEK_Complex, and clang::CodeGen::TEK_Scalar.
Referenced by clang::CodeGen::CodeGenFunction::EmitNewArrayInitializer(), and EmitNewInitializer().