27 #include "llvm/IR/Intrinsics.h"
29 using namespace clang;
30 using namespace CodeGen;
42 assert(!Base->
isVirtual() &&
"Should not see virtual bases here!");
51 Offset += Layout.getBaseClassOffset(BaseDecl);
63 assert(PathBegin != PathEnd &&
"Base path should not be empty!");
73 return llvm::ConstantInt::get(PtrDiffTy, Offset.
getQuantity());
87 assert(This->getType()->isPointerTy() &&
102 if (Offset.isPositive()) {
104 V =
Builder.CreateConstInBoundsGEP1_64(V, Offset.getQuantity());
116 assert(!nonVirtualOffset.
isZero() || virtualOffset !=
nullptr);
120 if (!nonVirtualOffset.
isZero()) {
121 baseOffset = llvm::ConstantInt::get(CGF.
PtrDiffTy,
124 baseOffset = CGF.
Builder.CreateAdd(virtualOffset, baseOffset);
127 baseOffset = virtualOffset;
132 ptr = CGF.
Builder.CreateInBoundsGEP(ptr, baseOffset,
"add.ptr");
141 assert(PathBegin != PathEnd &&
"Base path should not be empty!");
150 if ((*Start)->isVirtual()) {
152 cast<CXXRecordDecl>((*Start)->getType()->getAs<
RecordType>()->getDecl());
160 VBase ? VBase : Derived, Start, PathEnd);
165 if (VBase && Derived->
hasAttr<FinalAttr>()) {
168 NonVirtualOffset += vBaseOffset;
173 llvm::Type *BasePtrTy =
174 ConvertType((PathEnd[-1])->getType())->getPointerTo();
181 if (NonVirtualOffset.
isZero() && !VBase) {
186 return Builder.CreateBitCast(Value, BasePtrTy);
189 llvm::BasicBlock *origBB =
nullptr;
190 llvm::BasicBlock *endBB =
nullptr;
194 if (NullCheckValue) {
195 origBB =
Builder.GetInsertBlock();
200 Builder.CreateCondBr(isNull, endBB, notNullBB);
206 DerivedTy, DerivedAlign,
true);
222 Value =
Builder.CreateBitCast(Value, BasePtrTy);
225 if (NullCheckValue) {
226 llvm::BasicBlock *notNullBB =
Builder.GetInsertBlock();
230 llvm::PHINode *PHI =
Builder.CreatePHI(BasePtrTy, 2,
"cast.result");
231 PHI->addIncoming(Value, notNullBB);
232 PHI->addIncoming(llvm::Constant::getNullValue(BasePtrTy), origBB);
244 bool NullCheckValue) {
245 assert(PathBegin != PathEnd &&
"Base path should not be empty!");
249 llvm::Type *DerivedPtrTy =
ConvertType(DerivedTy)->getPointerTo();
254 if (!NonVirtualOffset) {
256 return Builder.CreateBitCast(Value, DerivedPtrTy);
259 llvm::BasicBlock *CastNull =
nullptr;
260 llvm::BasicBlock *CastNotNull =
nullptr;
261 llvm::BasicBlock *CastEnd =
nullptr;
263 if (NullCheckValue) {
269 Builder.CreateCondBr(IsNull, CastNull, CastNotNull);
275 Value =
Builder.CreateGEP(Value,
Builder.CreateNeg(NonVirtualOffset),
279 Value =
Builder.CreateBitCast(Value, DerivedPtrTy);
281 if (NullCheckValue) {
287 llvm::PHINode *PHI =
Builder.CreatePHI(Value->getType(), 2);
288 PHI->addIncoming(Value, CastNotNull);
289 PHI->addIncoming(llvm::Constant::getNullValue(Value->getType()),
310 uint64_t SubVTTIndex;
315 }
else if (RD == Base) {
319 "doing no-op VTT offset in base dtor/ctor?");
320 assert(!ForVirtualBase &&
"Can't have same class as virtual base!");
330 assert(SubVTTIndex != 0 &&
"Sub-VTT index must be greater than zero!");
336 VTT =
Builder.CreateConstInBoundsGEP1_64(VTT, SubVTTIndex);
340 VTT =
Builder.CreateConstInBoundsGEP2_64(VTT, 0, SubVTTIndex);
352 : BaseClass(Base), BaseIsVirtual(BaseIsVirtual) {}
361 DerivedClass, BaseClass,
382 void VisitCXXThisExpr(
const CXXThisExpr *E) { UsesThis =
true; }
387 DynamicThisUseChecker Checker(C);
389 return Checker.UsesThis;
397 "Must have base initializer!");
408 if (CtorType ==
Ctor_Base && isBaseVirtual)
445 if (Index == ArrayIndexes.size()) {
453 Dest = CGF.
Builder.CreateInBoundsGEP(Dest, ArrayIndex,
"destaddress");
455 Next = CGF.
Builder.CreateAdd(ArrayIndex, Next,
"inc");
456 CGF.
Builder.CreateStore(Next, ArrayIndexVar);
487 assert(Array &&
"Array initialization without the array type?");
490 assert(IndexVar &&
"Array index variable not loaded");
494 = llvm::Constant::getNullValue(
496 CGF.
Builder.CreateStore(Zero, IndexVar);
507 uint64_t NumElements = Array->
getSize().getZExtValue();
510 llvm::ConstantInt::get(Counter->getType(), NumElements);
515 CGF.
Builder.CreateCondBr(IsLess, ForBody, AfterFor);
528 llvm::Value *NextVal = llvm::ConstantInt::get(Counter->getType(), 1);
529 Counter = CGF.
Builder.CreateLoad(IndexVar);
530 NextVal = CGF.
Builder.CreateAdd(Counter, NextVal,
"inc");
531 CGF.
Builder.CreateStore(NextVal, IndexVar);
542 if (!(CD && CD->isCopyOrMoveConstructor()) &&
564 for (
const auto *I : IndirectField->
chain())
578 "Must have member initializer!");
579 assert(MemberInit->
getInit() &&
"Must have initializer!");
583 QualType FieldType = Field->getType();
604 unsigned SrcArgIndex =
647 if (ArrayIndexes.size()) {
654 BasePtr = llvm::PointerType::getUnqual(BasePtr);
662 llvm::Value *Zero = llvm::Constant::getNullValue(SizeTy);
663 Builder.CreateStore(Zero, ArrayIndexVar);
667 for (
unsigned I = 0, N = ArrayIndexes.size(); I != N; ++I)
737 Prologue ? cast<CXXConstructorDecl>(
CurGD.
getDecl())->getParent()
738 : cast<CXXDestructorDecl>(
CurGD.
getDecl())->getParent();
741 struct SizeAndOffset {
755 size_t NumFields = 0;
756 for (
const auto *Field : ClassDecl->
fields()) {
758 std::pair<CharUnits, CharUnits> FieldInfo =
761 assert(NumFields < SSV.size());
765 assert(NumFields == SSV.size());
766 if (SSV.size() <= 1)
return;
771 llvm::FunctionType *FTy =
772 llvm::FunctionType::get(
CGM.
VoidTy, Args,
false);
774 FTy, Prologue ?
"__asan_poison_intra_object_redzone"
775 :
"__asan_unpoison_intra_object_redzone");
782 for (
size_t i = 0; i < SSV.size(); i++) {
783 uint64_t AsanAlignment = 8;
784 uint64_t NextField = i == SSV.size() - 1 ? TypeSize : SSV[i + 1].Offset;
785 uint64_t PoisonSize = NextField - SSV[i].Offset - SSV[i].Size;
786 uint64_t EndOffset = SSV[i].Offset + SSV[i].Size;
787 if (PoisonSize < AsanAlignment || !SSV[i].Size ||
788 (NextField % AsanAlignment) != 0)
791 F, {
Builder.CreateAdd(ThisPtr,
Builder.getIntN(PtrSize, EndOffset)),
792 Builder.getIntN(PtrSize, PoisonSize)});
804 "can only generate complete ctor for this ABI");
816 assert(Definition == Ctor &&
"emitting wrong constructor body");
820 bool IsTryBody = (Body && isa<CXXTryStmt>(Body));
837 EmitStmt(cast<CXXTryStmt>(Body)->getTryBlock());
856 class CopyingValueRepresentation {
859 : CGF(CGF), OldSanOpts(CGF.SanOpts) {
863 ~CopyingValueRepresentation() {
873 class FieldMemcpyizer {
877 : CGF(CGF), ClassDecl(ClassDecl), SrcRec(SrcRec),
878 RecLayout(CGF.getContext().getASTRecordLayout(ClassDecl)),
879 FirstField(nullptr), LastField(nullptr), FirstFieldOffset(0),
880 LastFieldOffset(0), LastAddedFieldIndex(0) {}
882 bool isMemcpyableField(
FieldDecl *F)
const {
899 CharUnits getMemcpySize(uint64_t FirstByteOffset)
const {
900 unsigned LastFieldSize =
901 LastField->isBitField() ?
902 LastField->getBitWidthValue(CGF.
getContext()) :
904 uint64_t MemcpySizeBits =
905 LastFieldOffset + LastFieldSize - FirstByteOffset +
919 uint64_t FirstByteOffset;
920 if (FirstField->isBitField()) {
928 FirstByteOffset = FirstFieldOffset;
931 CharUnits MemcpySize = getMemcpySize(FirstByteOffset);
945 MemcpySize, Alignment);
950 FirstField =
nullptr;
961 llvm::PointerType *DPT = cast<llvm::PointerType>(DestPtr->getType());
963 llvm::Type::getInt8PtrTy(CGF.
getLLVMContext(), DPT->getAddressSpace());
964 DestPtr = CGF.
Builder.CreateBitCast(DestPtr, DBP);
966 llvm::PointerType *SPT = cast<llvm::PointerType>(SrcPtr->getType());
968 llvm::Type::getInt8PtrTy(CGF.
getLLVMContext(), SPT->getAddressSpace());
969 SrcPtr = CGF.
Builder.CreateBitCast(SrcPtr, SBP);
978 FirstFieldOffset = RecLayout.getFieldOffset(F->
getFieldIndex());
979 LastFieldOffset = FirstFieldOffset;
990 "Cannot aggregate fields out of order.");
996 uint64_t FOffset = RecLayout.getFieldOffset(F->
getFieldIndex());
997 if (FOffset < FirstFieldOffset) {
999 FirstFieldOffset = FOffset;
1000 }
else if (FOffset > LastFieldOffset) {
1002 LastFieldOffset = FOffset;
1010 uint64_t FirstFieldOffset, LastFieldOffset;
1011 unsigned LastAddedFieldIndex;
1014 class ConstructorMemcpyizer :
public FieldMemcpyizer {
1030 if (!MemcpyableCtor)
1033 assert(Field &&
"No field for member init.");
1044 if (!isMemcpyableField(Field))
1054 : FieldMemcpyizer(CGF, CD->getParent(), getTrivialCopySource(CGF, CD, Args)),
1055 ConstructorDecl(CD),
1056 MemcpyableCtor(CD->isDefaulted() &&
1057 CD->isCopyOrMoveConstructor() &&
1062 if (isMemberInitMemcpyable(MemberInit)) {
1063 AggregatedInits.push_back(MemberInit);
1064 addMemcpyableField(MemberInit->
getMember());
1066 emitAggregatedInits();
1068 ConstructorDecl, Args);
1072 void emitAggregatedInits() {
1073 if (AggregatedInits.size() <= 1) {
1076 if (!AggregatedInits.empty()) {
1077 CopyingValueRepresentation CVR(CGF);
1079 AggregatedInits[0], ConstructorDecl, Args);
1080 AggregatedInits.clear();
1086 pushEHDestructors();
1088 AggregatedInits.clear();
1091 void pushEHDestructors() {
1096 for (
unsigned i = 0; i < AggregatedInits.size(); ++i) {
1109 emitAggregatedInits();
1114 bool MemcpyableCtor;
1119 class AssignmentMemcpyizer :
public FieldMemcpyizer {
1125 if (!AssignmentsMemcpyable)
1135 if (!Field || !isMemcpyableField(Field))
1137 Stmt *RHS = BO->getRHS();
1139 RHS = EC->getSubExpr();
1154 if (!Field || !isMemcpyableField(Field))
1157 if (!Arg0 || Field != dyn_cast<FieldDecl>(Arg0->
getMemberDecl()))
1160 }
else if (
CallExpr *CE = dyn_cast<CallExpr>(S)) {
1162 if (!FD || FD->
getBuiltinID() != Builtin::BI__builtin_memcpy)
1166 DstPtr = DC->getSubExpr();
1174 if (!Field || !isMemcpyableField(Field))
1178 SrcPtr = SC->getSubExpr();
1183 if (!ME2 || Field != dyn_cast<FieldDecl>(ME2->
getMemberDecl()))
1191 bool AssignmentsMemcpyable;
1198 : FieldMemcpyizer(CGF, AD->getParent(), Args[Args.size() - 1]),
1199 AssignmentsMemcpyable(CGF.getLangOpts().getGC() ==
LangOptions::NonGC) {
1200 assert(Args.size() == 2);
1203 void emitAssignment(
Stmt *S) {
1206 addMemcpyableField(F);
1207 AggregatedStmts.push_back(S);
1209 emitAggregatedStmts();
1214 void emitAggregatedStmts() {
1215 if (AggregatedStmts.size() <= 1) {
1216 if (!AggregatedStmts.empty()) {
1217 CopyingValueRepresentation CVR(CGF);
1224 AggregatedStmts.clear();
1228 emitAggregatedStmts();
1247 llvm::BasicBlock *BaseCtorContinueBB =
nullptr;
1252 BaseCtorContinueBB =
1254 assert(BaseCtorContinueBB);
1258 for (; B != E && (*B)->isBaseInitializer() && (*B)->isBaseVirtual(); B++) {
1262 if (BaseCtorContinueBB) {
1264 Builder.CreateBr(BaseCtorContinueBB);
1269 for (; B != E && (*B)->isBaseInitializer(); B++) {
1270 assert(!(*B)->isBaseVirtual());
1278 ConstructorMemcpyizer CM(*
this, CD, Args);
1279 for (; B != E; B++) {
1283 "Delegating initializer on non-delegating constructor");
1284 CM.addMemberInitializer(Member);
1305 for (
const auto *Field : BaseClassDecl->
fields())
1310 for (
const auto &I : BaseClassDecl->
bases()) {
1315 cast<CXXRecordDecl>(I.getType()->castAs<
RecordType>()->getDecl());
1317 MostDerivedClassDecl))
1321 if (BaseClassDecl == MostDerivedClassDecl) {
1323 for (
const auto &I : BaseClassDecl->
vbases()) {
1325 cast<CXXRecordDecl>(I.getType()->castAs<
RecordType>()->getDecl());
1327 MostDerivedClassDecl))
1363 for (
const auto *Field : ClassDecl->
fields())
1382 llvm::FunctionType *FnType =
1383 llvm::FunctionType::get(CGF.
VoidTy, ArgTypes,
false);
1412 bool isTryBody = (Body && isa<CXXTryStmt>(Body));
1427 llvm_unreachable(
"not expecting a COMDAT");
1429 case Dtor_Deleting: llvm_unreachable(
"already handled deleting case");
1432 assert((Body ||
getTarget().getCXXABI().isMicrosoft()) &&
1433 "can't emit a dtor without a body for non-Microsoft ABIs");
1456 EmitStmt(cast<CXXTryStmt>(Body)->getTryBlock());
1460 assert(Dtor->
isImplicit() &&
"bodyless dtor not implicit");
1466 CurFn->addFnAttr(llvm::Attribute::AlwaysInline);
1485 assert(isa<CompoundStmt>(RootS) &&
1486 "Body of an implicit assignment operator should be compound stmt.");
1487 const CompoundStmt *RootCS = cast<CompoundStmt>(RootS);
1491 AssignmentMemcpyizer AM(*
this, AssignOp, Args);
1492 for (
auto *I : RootCS->
body())
1493 AM.emitAssignment(I);
1513 CallDtorDeleteConditional(
llvm::Value *ShouldDeleteCondition)
1514 : ShouldDeleteCondition(ShouldDeleteCondition) {
1515 assert(ShouldDeleteCondition !=
nullptr);
1522 = CGF.
Builder.CreateIsNull(ShouldDeleteCondition);
1523 CGF.
Builder.CreateCondBr(ShouldCallDelete, continueBB, callDeleteBB);
1530 CGF.
Builder.CreateBr(continueBB);
1539 bool useEHCleanupForArray;
1543 bool useEHCleanupForArray)
1544 : field(field), destroyer(destroyer),
1545 useEHCleanupForArray(useEHCleanupForArray) {}
1556 flags.isForNormalCleanup() && useEHCleanupForArray);
1567 "Should not emit dtor epilogue for non-exported trivial dtor!");
1573 "operator delete missing - EnterDtorCleanups");
1574 if (CXXStructorImplicitParamValue) {
1577 EHStack.pushCleanup<CallDtorDeleteConditional>(
1596 for (
const auto &
Base : ClassDecl->
vbases()) {
1598 = cast<CXXRecordDecl>(
Base.getType()->getAs<
RecordType>()->getDecl());
1615 for (
const auto &
Base : ClassDecl->
bases()) {
1617 if (
Base.isVirtual())
1632 for (
const auto *Field : ClassDecl->
fields()) {
1635 if (!dtorKind)
continue;
1642 EHStack.pushCleanup<DestroyField>(cleanupKind, Field,
1679 bool zeroInitialize) {
1686 llvm::BranchInst *zeroCheckBranch =
nullptr;
1689 llvm::ConstantInt *constantCount
1690 = dyn_cast<llvm::ConstantInt>(numElements);
1691 if (constantCount) {
1693 if (constantCount->isZero())
return;
1699 zeroCheckBranch =
Builder.CreateCondBr(iszero, loopBB, loopBB);
1708 llvm::BasicBlock *entryBB =
Builder.GetInsertBlock();
1711 llvm::PHINode *cur =
Builder.CreatePHI(arrayBegin->getType(), 2,
1713 cur->addIncoming(arrayBegin, entryBB);
1748 Builder.CreateInBoundsGEP(cur, llvm::ConstantInt::get(
SizeTy, 1),
1750 cur->addIncoming(next,
Builder.GetInsertBlock());
1755 Builder.CreateCondBr(done, contBB, loopBB);
1758 if (zeroCheckBranch) zeroCheckBranch->setSuccessor(0, contBB);
1769 assert(!dtor->isTrivial());
1776 bool ForVirtualBase,
1787 assert(E->
getNumArgs() == 0 &&
"trivial default ctor with args");
1795 assert(E->
getNumArgs() == 1 &&
"unexpected argcount for trivial ctor");
1816 *
this, D, Type, ForVirtualBase, Delegating, Args);
1830 assert(E->
getNumArgs() == 1 &&
"unexpected argcount for trivial ctor");
1832 "trivial 1-arg ctor not a copy/move ctor");
1840 "Trying to emit a member call expr on a static method!");
1850 QualType QT = *(FPT->param_type_begin());
1852 Src =
Builder.CreateBitCast(Src, t);
1870 FunctionArgList::const_iterator I = Args.begin(), E = Args.end();
1871 assert(I != E &&
"no parameters to constructor");
1885 assert(I != E &&
"cannot skip vtt parameter, already done with args");
1886 assert((*I)->getType() == VoidPP &&
"skipping parameter not of vtt type");
1892 for (; I != E; ++I) {
1913 : Dtor(D), Addr(Addr), Type(Type) {}
1940 if (
CGM.
getLangOpts().Exceptions && !ClassDecl->hasTrivialDestructor()) {
1945 ClassDecl->getDestructor(),
1952 bool ForVirtualBase,
1965 : Dtor(D), Addr(Addr) {}
1982 if (!ClassDecl)
return;
1986 assert(D && D->
isUsed() &&
"destructor not marked as used!");
1999 if ((RD == VTableClass || RD == NearestVBase) &&
2000 VTableClass->
hasAttr<MSNoVTableAttr>())
2004 bool NeedsVirtualOffset;
2007 *
this, VTableClass, Base, NearestVBase, NeedsVirtualOffset);
2008 if (!VTableAddressPoint)
2015 if (NeedsVirtualOffset) {
2022 NonVirtualOffset = OffsetFromNearestVBase;
2031 if (!NonVirtualOffset.
isZero() || VirtualOffset)
2038 llvm::Type *VTablePtrTy =
2042 VTableField =
Builder.CreateBitCast(VTableField, VTablePtrTy->getPointerTo());
2043 VTableAddressPoint =
Builder.CreateBitCast(VTableAddressPoint, VTablePtrTy);
2044 llvm::StoreInst *
Store =
Builder.CreateStore(VTableAddressPoint, VTableField);
2052 bool BaseIsNonVirtualPrimaryBase,
2057 if (!BaseIsNonVirtualPrimaryBase) {
2066 for (
const auto &I : RD->
bases()) {
2068 = cast<CXXRecordDecl>(I.getType()->getAs<
RecordType>()->getDecl());
2076 bool BaseDeclIsNonVirtualPrimaryBase;
2078 if (I.isVirtual()) {
2080 if (!VBases.insert(BaseDecl).second)
2088 BaseDeclIsNonVirtualPrimaryBase =
false;
2093 BaseOffsetFromNearestVBase =
2095 BaseDeclIsNonVirtualPrimaryBase = Layout.
getPrimaryBase() == BaseDecl;
2099 I.isVirtual() ? BaseDecl : NearestVBase,
2100 BaseOffsetFromNearestVBase,
2101 BaseDeclIsNonVirtualPrimaryBase,
2102 VTableClass, VBases);
2125 llvm::Instruction *VTable =
Builder.CreateLoad(VTablePtrSrc,
"vtable");
2155 if (isa<CXXDestructorDecl>(MD) && MD->
isImplicit())
2170 if (!
SanOpts.
has(SanitizerKind::CFICastStrict))
2188 const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(ClassTy->getDecl());
2194 llvm::raw_svector_ostream Out(MangledName);
2202 if (!
SanOpts.
has(SanitizerKind::CFICastStrict))
2205 llvm::BasicBlock *ContBlock = 0;
2209 Builder.CreateIsNotNull(Derived,
"cast.nonnull");
2214 Builder.CreateCondBr(DerivedNotNull, CheckBlock, ContBlock);
2237 std::string OutName;
2238 llvm::raw_string_ostream Out(OutName);
2241 llvm::Value *BitSetName = llvm::MetadataAsValue::get(
2247 {CastedVTable, BitSetName});
2252 M = SanitizerKind::CFIVCall;
2255 M = SanitizerKind::CFINVCall;
2258 M = SanitizerKind::CFIDerivedCast;
2261 M = SanitizerKind::CFIUnrelatedCast;
2265 llvm::Constant *StaticData[] = {
2268 llvm::ConstantInt::get(
Int8Ty, TCK),
2270 EmitCheck(std::make_pair(BitSetTest, M),
"cfi_bad_type", StaticData,
2278 if (
const ParenExpr *PE = dyn_cast<ParenExpr>(E)) {
2279 E = PE->getSubExpr();
2283 if (
const CastExpr *CE = dyn_cast<CastExpr>(E)) {
2284 if (CE->getCastKind() ==
CK_NoOp) {
2285 E = CE->getSubExpr();
2291 E = UO->getSubExpr();
2318 if (MostDerivedClassDecl->
hasAttr<FinalAttr>())
2332 if (
const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Base)) {
2333 if (
const VarDecl *VD = dyn_cast<VarDecl>(DRE->getDecl())) {
2335 return VD->getType()->isRecordType();
2344 if (
const MemberExpr *ME = dyn_cast<MemberExpr>(Base))
2346 return VD->getType()->isRecordType();
2349 if (isa<CXXConstructExpr>(Base))
2353 if (isa<CXXBindTemporaryExpr>(Base))
2357 if (
const CallExpr *CE = dyn_cast<CallExpr>(Base))
2358 return CE->getCallReturnType(
getContext())->isRecordType();
2379 if (!resultType->isVoidType() &&
2390 callArgs, callOperator);
2393 if (!resultType->isVoidType() && returnSlot.
isNull())
2394 EmitReturnOfRValue(RV, resultType);
2412 for (
auto param : BD->
params())
2416 "generic lambda interconversion to block not implemented");
2421 if (cast<CXXMethodDecl>(
CurCodeDecl)->isVariadic()) {
2442 for (
auto Param : MD->
params())
2452 void *InsertPos =
nullptr;
2455 assert(CorrespondingCallOpSpecialization);
2456 CallOp = cast<CXXMethodDecl>(CorrespondingCallOpSpecialization);
void EmitInitializerForField(FieldDecl *Field, LValue LHS, Expr *Init, ArrayRef< VarDecl * > ArrayIndexes)
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
void EnterDtorCleanups(const CXXDestructorDecl *Dtor, CXXDtorType Type)
Emit all code that comes at the end of class's destructor. This is to call destructors on members and...
unsigned getNumArrayIndices() const
Determine the number of implicit array indices used while described an array member initialization...
llvm::Value * GetAddrOfBlockDecl(const VarDecl *var, bool ByRef)
void EmitDelegateCXXConstructorCall(const CXXConstructorDecl *Ctor, CXXCtorType CtorType, const FunctionArgList &Args, SourceLocation Loc)
Destroyer * getDestroyer(QualType::DestructionKind destructionKind)
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
void EmitVTablePtrCheckForCall(const CXXMethodDecl *MD, llvm::Value *VTable, CFITypeCheckKind TCK, SourceLocation Loc)
void EmitCtorPrologue(const CXXConstructorDecl *CD, CXXCtorType Type, FunctionArgList &Args)
CodeGenTypes & getTypes()
unsigned getFieldCount() const
getFieldCount - Get the number of fields in the layout.
CanQualType getReturnType() const
bool isBitField() const
Determines whether this field is a bitfield.
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
DestructionKind isDestructedType() const
QualType getType() const
Retrieves the type of the base class.
CXXCtorType getCtorType() const
llvm::Constant * EmitCheckTypeDescriptor(QualType T)
Emit a description of a type in a format suitable for passing to a runtime sanitizer handler...
void InitializeVTablePointers(BaseSubobject Base, const CXXRecordDecl *NearestVBase, CharUnits OffsetFromNearestVBase, bool BaseIsNonVirtualPrimaryBase, const CXXRecordDecl *VTableClass, VisitedVirtualBasesSetTy &VBases)
FunctionDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
method_range methods() const
static AggValueSlot forLValue(const LValue &LV, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, IsZeroed_t isZeroed=IsNotZeroed)
void setAlignment(CharUnits A)
const TargetInfo & getTarget() const
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
llvm::AllocaInst * CreateTempAlloca(llvm::Type *Ty, const Twine &Name="tmp")
Checking the 'this' pointer for a constructor call.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
static void EmitAggMemberInitializer(CodeGenFunction &CGF, LValue LHS, Expr *Init, llvm::Value *ArrayIndexVar, QualType T, ArrayRef< VarDecl * > ArrayIndexes, unsigned Index)
chain_range chain() const
const Decl * CurCodeDecl
CurCodeDecl - This is the inner-most code context, which includes blocks.
Defines the C++ template declaration subclasses.
void EmitAutoVarDecl(const VarDecl &D)
const llvm::DataLayout & getDataLayout() const
llvm::Value * LoadCXXThis()
static bool isMemcpyEquivalentSpecialMember(const CXXMethodDecl *D)
void EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit=false)
void EmitComplexExprIntoLValue(const Expr *E, LValue dest, bool isInit)
QualType getRecordType(const RecordDecl *Decl) const
bool sanitizePerformTypeCheck() const
Whether any type-checking sanitizers are enabled. If false, calls to EmitTypeCheck can be skipped...
CharUnits getVBaseClassOffset(const CXXRecordDecl *VBase) const
getVBaseClassOffset - Get the offset, in chars, for the given base class.
Represents a call to a C++ constructor.
const LangOptions & getLangOpts() const
LValue EmitLValueForFieldInitialization(LValue Base, const FieldDecl *Field)
SourceLocation getLocEnd() const LLVM_READONLY
void EmitCXXDestructorCall(const CXXDestructorDecl *D, CXXDtorType Type, bool ForVirtualBase, bool Delegating, llvm::Value *This)
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
Represents a C++ constructor within a class.
llvm::Value * getAddress() const
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
const llvm::APInt & getSize() const
virtual llvm::BasicBlock * EmitCtorCompleteObjectHandler(CodeGenFunction &CGF, const CXXRecordDecl *RD)
const CXXBaseSpecifier *const * path_const_iterator
Expr * getInit() const
Get the initializer.
RAII object to set/unset CodeGenFunction::IsSanitizerScope.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
llvm::Value * GetVTTParameter(GlobalDecl GD, bool ForVirtualBase, bool Delegating)
QualType getThisType(ASTContext &C) const
Returns the type of the this pointer.
const CGBitFieldInfo & getBitFieldInfo(const FieldDecl *FD) const
Return the BitFieldInfo that corresponds to the field FD.
void DecorateInstruction(llvm::Instruction *Inst, llvm::MDNode *TBAAInfo, bool ConvertTypeToTag=true)
bool isCopyOrMoveConstructor(unsigned &TypeQuals) const
Determine whether this is a copy or move constructor.
const CGFunctionInfo & arrangeCXXStructorDeclaration(const CXXMethodDecl *MD, StructorType Type)
llvm::Value * ReturnValue
capture_iterator capture_begin()
void setAddress(llvm::Value *address)
void EmitAggregateCopyCtor(llvm::Value *DestPtr, llvm::Value *SrcPtr, QualType DestTy, QualType SrcTy)
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
void emitImplicitAssignmentOperatorBody(FunctionArgList &Args)
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
static const CXXRecordDecl * LeastDerivedClassWithSameLayout(const CXXRecordDecl *RD)
bool isFunctionTemplateSpecialization() const
Determine whether this function is a function template specialization.
void EmitCallArgs(CallArgList &Args, const T *CallArgTypeInfo, CallExpr::const_arg_iterator ArgBeg, CallExpr::const_arg_iterator ArgEnd, const FunctionDecl *CalleeDecl=nullptr, unsigned ParamsToSkip=0)
EmitCallArgs - Emit call arguments for a function.
bool isVolatileQualified() const
llvm::Type * ConvertType(QualType T)
ConvertType - Convert type T into a llvm::Type.
const TemplateArgumentList * getTemplateSpecializationArgs() const
Retrieve the template arguments used to produce this function template specialization from the primar...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
void EmitExprAsInit(const Expr *init, const ValueDecl *D, LValue lvalue, bool capturedByInit)
bool isDelegatingConstructor() const
Determine whether this constructor is a delegating constructor.
virtual void mangleCXXVTableBitSet(const CXXRecordDecl *RD, raw_ostream &)=0
llvm::SmallPtrSet< const CXXRecordDecl *, 4 > VisitedVirtualBasesSetTy
bool isReferenceType() const
bool isCompleteDefinition() const
llvm::IntegerType * SizeTy
static bool CanSkipVTablePointerInitialization(ASTContext &Context, const CXXDestructorDecl *Dtor)
virtual llvm::Value * getVTableAddressPointInStructor(CodeGenFunction &CGF, const CXXRecordDecl *RD, BaseSubobject Base, const CXXRecordDecl *NearestVBase, bool &NeedsVirtualOffset)=0
uint64_t getSubVTTIndex(const CXXRecordDecl *RD, BaseSubobject Base)
void EmitVTablePtrCheck(const CXXRecordDecl *RD, llvm::Value *VTable, CFITypeCheckKind TCK, SourceLocation Loc)
ArrayRef< VarDecl * > getArrayIndexes()
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
CleanupKind getCleanupKind(QualType::DestructionKind kind)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
const Decl * getDecl() const
void EmitLambdaDelegatingInvokeBody(const CXXMethodDecl *MD)
LValue MakeAddrLValue(llvm::Value *V, QualType T, CharUnits Alignment=CharUnits())
static bool hasScalarEvaluationKind(QualType T)
void Destroyer(CodeGenFunction &CGF, llvm::Value *addr, QualType ty)
RValue EmitCall(const CGFunctionInfo &FnInfo, llvm::Value *Callee, ReturnValueSlot ReturnValue, const CallArgList &Args, const Decl *TargetDecl=nullptr, llvm::Instruction **callOrInvoke=nullptr)
CharUnits getAlignment() const
llvm::Value * GetVTablePtr(llvm::Value *This, llvm::Type *Ty)
const LangOptions & getLangOpts() const
IndirectFieldDecl * getIndirectMember() const
void pushRegularPartialArrayCleanup(llvm::Value *arrayBegin, llvm::Value *arrayEnd, QualType elementType, Destroyer *destroyer)
QualType getReturnType() const
const CXXRecordDecl * getParent() const
CharUnits StorageOffset
The offset of the bitfield storage from the start of the struct.
field_range fields() const
llvm::PointerType * VoidPtrTy
A builtin binary operation expression such as "x + y" or "x <= y".
bool needsEHCleanup(QualType::DestructionKind kind)
RecordDecl * getDecl() const
llvm::Value * GetAddressOfBaseClass(llvm::Value *Value, const CXXRecordDecl *Derived, CastExpr::path_const_iterator PathBegin, CastExpr::path_const_iterator PathEnd, bool NullCheckValue, SourceLocation Loc)
const SanitizerBlacklist & getSanitizerBlacklist() const
bool isVariadic() const
Whether this function is variadic.
void incrementProfileCounter(const Stmt *S)
Increment the profiler's counter for the given statement.
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D...
const Type * getBaseClass() const
static void EmitDtorSanitizerCallback(CodeGenFunction &CGF, const CXXDestructorDecl *Dtor)
void EmitStmt(const Stmt *S)
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
uint64_t getFieldOffset(unsigned FieldNo) const
void EmitDeleteCall(const FunctionDecl *DeleteFD, llvm::Value *Ptr, QualType DeleteTy)
base_class_iterator bases_begin()
const CGFunctionInfo & arrangeCXXMethodDeclaration(const CXXMethodDecl *MD)
GlobalDecl CurGD
CurGD - The GlobalDecl for the current function being compiled.
static const Expr * skipNoOpCastsAndParens(const Expr *E)
static bool BaseInitializerUsesThis(ASTContext &C, const Expr *Init)
std::pair< CharUnits, CharUnits > getTypeInfoInChars(const Type *T) const
init_iterator init_begin()
Retrieve an iterator to the first initializer.
virtual void mangleCXXRTTI(QualType T, raw_ostream &)=0
Represents the this expression in C++.
static llvm::Value * ApplyNonVirtualAndVirtualOffset(CodeGenFunction &CGF, llvm::Value *ptr, CharUnits nonVirtualOffset, llvm::Value *virtualOffset)
LValue EmitLValueForField(LValue Base, const FieldDecl *Field)
llvm::GlobalValue * getAddrOfCXXStructor(const CXXMethodDecl *MD, StructorType Type, const CGFunctionInfo *FnInfo=nullptr, llvm::FunctionType *FnType=nullptr, bool DontDefer=false)
Return the address of the constructor/destructor of the given type.
void EmitCheck(ArrayRef< std::pair< llvm::Value *, SanitizerMask >> Checked, StringRef CheckName, ArrayRef< llvm::Constant * > StaticArgs, ArrayRef< llvm::Value * > DynamicArgs)
Create a basic block that will call a handler function in a sanitizer runtime with the provided argum...
llvm::CallInst * EmitNounwindRuntimeCall(llvm::Value *callee, const Twine &name="")
void emitDestroy(llvm::Value *addr, QualType type, Destroyer *destroyer, bool useEHCleanupForArray)
const CodeGen::CGBlockInfo * BlockInfo
void PushDestructorCleanup(QualType T, llvm::Value *Addr)
const TargetInfo & getTarget() const
bool hasConstructorVariants() const
Does this ABI have different entrypoints for complete-object and base-subobject constructors?
bool isGenericLambda() const
Determine whether this class describes a generic lambda function object (i.e. function call operator ...
void EmitDelegateCallArg(CallArgList &args, const VarDecl *param, SourceLocation loc)
static void EmitLValueForAnyFieldInitialization(CodeGenFunction &CGF, CXXCtorInitializer *MemberInit, LValue &LHS)
const CXXRecordDecl * getBase() const
getBase - Returns the base class declaration.
static TypeEvaluationKind getEvaluationKind(QualType T)
CXXDtorType
C++ destructor types.
llvm::Value * getBitFieldAddr() const
const Type * getTypeForDecl() const
CXXDtorType getDtorType() const
bool CanDevirtualizeMemberFunctionCall(const Expr *Base, const CXXMethodDecl *MD)
CGCXXABI & getCXXABI() const
VarDecl * getVariable() const
The variable being captured.
Enters a new scope for capturing cleanups, all of which will be executed once the scope is exited...
llvm::Value * GetAddrOfLocalVar(const VarDecl *VD)
GetAddrOfLocalVar - Return the address of a local variable.
Represents a C++ destructor within a class.
llvm::Value * emitArrayLength(const ArrayType *arrayType, QualType &baseType, llvm::Value *&addr)
void EmitLambdaBlockInvokeBody()
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
ASTContext & getContext() const
void add(RValue rvalue, QualType type, bool needscopy=false)
void EmitAsanPrologueOrEpilogue(bool Prologue)
llvm::LLVMContext & getLLVMContext()
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
llvm::IntegerType * Int32Ty
Expr * getSubExpr() const
bool isIndirectMemberInitializer() const
void EmitConstructorBody(FunctionArgList &Args)
EmitConstructorBody - Emits the body of the current constructor.
LValue MakeNaturalAlignAddrLValue(llvm::Value *V, QualType T)
void EmitForwardingCallToLambda(const CXXMethodDecl *LambdaCallOperator, CallArgList &CallArgs)
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
void EmitLambdaToBlockPointerBody(FunctionArgList &Args)
llvm::Function * getIntrinsic(unsigned IID, ArrayRef< llvm::Type * > Tys=None)
unsigned getNumBases() const
Retrieves the number of base classes of this class.
The COMDAT used for dtors.
bool hasObjCLifetime() const
static const RecordType * getRecordType(QualType QT)
Checks that the passed in QualType either is of RecordType or points to RecordType. Returns the relevant RecordType, null if it does not exit.
Stmt * getBody(const FunctionDecl *&Definition) const
void set(SanitizerMask K, bool Value)
Enable or disable a certain (single) sanitizer.
Enumerates target-specific builtins in their own namespaces within namespace clang.
virtual unsigned addImplicitConstructorArgs(CodeGenFunction &CGF, const CXXConstructorDecl *D, CXXCtorType Type, bool ForVirtualBase, bool Delegating, CallArgList &Args)=0
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
llvm::Constant * CreateRuntimeFunction(llvm::FunctionType *Ty, StringRef Name, llvm::AttributeSet ExtraAttrs=llvm::AttributeSet())
Create a new runtime function with the specified type and name.
void EmitCXXConstructorCall(const CXXConstructorDecl *D, CXXCtorType Type, bool ForVirtualBase, bool Delegating, llvm::Value *This, const CXXConstructExpr *E)
bool mayInsertExtraPadding(bool EmitRemark=false) const
Whether we are allowed to insert extra padding between fields. These padding are added to help Addres...
virtual bool NeedsVTTParameter(GlobalDecl GD)
Return whether the given global decl needs a VTT parameter.
ASTContext & getContext() const
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
bool isBlacklistedType(StringRef MangledTypeName, StringRef Category=StringRef()) const
CharUnits getSize() const
getSize - Get the record size in characters.
void EmitAggregateCopy(llvm::Value *DestPtr, llvm::Value *SrcPtr, QualType EltTy, bool isVolatile=false, CharUnits Alignment=CharUnits::Zero(), bool isAssignment=false)
const CXXRecordDecl * getPrimaryBase() const
getPrimaryBase - Get the primary base for this record.
FieldDecl * getAnyMember() const
init_iterator init_end()
Retrieve an iterator past the last initializer.
llvm::GlobalVariable * GetAddrOfVTT(const CXXRecordDecl *RD)
GetAddrOfVTT - Get the address of the VTT for the given record decl.
Represents a static or instance method of a struct/union/class.
virtual size_t getSrcArgforCopyCtor(const CXXConstructorDecl *, FunctionArgList &Args) const =0
SourceLocation getSourceLocation() const
Determine the source location of the initializer.
const CXXRecordDecl * getBestDynamicClassType() const
For an expression of class type or pointer to class type, return the most derived class decl the expr...
void EmitNullInitialization(llvm::Value *DestPtr, QualType Ty)
bool isBaseVirtual() const
Returns whether the base is virtual or not.
SanitizerSet SanOpts
Sanitizers enabled for this function.
const ConstantArrayType * getAsConstantArrayType(QualType T) const
virtual llvm::Value * GetVirtualBaseClassOffset(CodeGenFunction &CGF, llvm::Value *This, const CXXRecordDecl *ClassDecl, const CXXRecordDecl *BaseClassDecl)=0
void pushEHDestroy(QualType::DestructionKind dtorKind, llvm::Value *addr, QualType type)
const CodeGenOptions & getCodeGenOpts() const
const LangOptions & getLangOpts() const
MangleContext & getMangleContext()
Gets the mangle context.
unsigned getBuiltinID() const
Returns a value indicating whether this function corresponds to a builtin function.
const CGFunctionInfo & arrangeCXXMethodCall(const CallArgList &args, const FunctionProtoType *type, RequiredArgs required)
Arrange a call to a C++ method, passing the given arguments.
static void EmitBaseInitializer(CodeGenFunction &CGF, const CXXRecordDecl *ClassDecl, CXXCtorInitializer *BaseInit, CXXCtorType CtorType)
bool isDynamicClass() const
CXXCtorType
C++ constructor types.
llvm::Value * EmitScalarExpr(const Expr *E, bool IgnoreResultAssign=false)
bool isAnonymousStructOrUnion() const
void ErrorUnsupported(const Stmt *S, const char *Type)
Print out an error that codegen doesn't support the specified stmt yet.
static const Type * getElementType(const Expr *BaseExpr)
void EmitVTablePtrCheckForCast(QualType T, llvm::Value *Derived, bool MayBeNull, CFITypeCheckKind TCK, SourceLocation Loc)
Derived is the presumed address of an object of type T after a cast. If T is a polymorphic class type...
llvm::Constant * GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty=0, bool ForVTable=false, bool DontDefer=false)
bool isZero() const
isZero - Test whether the quantity equals zero.
llvm::Value * GetAddressOfDirectBaseInCompleteClass(llvm::Value *Value, const CXXRecordDecl *Derived, const CXXRecordDecl *Base, bool BaseIsVirtual)
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
llvm::IntegerType * IntPtrTy
void EmitDelegatingCXXConstructorCall(const CXXConstructorDecl *Ctor, const FunctionArgList &Args)
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
static bool IsConstructorDelegationValid(const CXXConstructorDecl *Ctor)
bool isUsed(bool CheckUsedAttr=true) const
Whether this declaration was used, meaning that a definition is required.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
FieldDecl * getMember() const
If this is a member initializer, returns the declaration of the non-static data member being initiali...
ConstEvaluatedExprVisitor - This class visits 'const Expr *'s.
unsigned getNumArgs() const
void EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc, llvm::Value *V, QualType Type, CharUnits Alignment=CharUnits::Zero(), bool SkipNullCheck=false)
Emit a check that V is the address of storage of the appropriate size and alignment for an object of ...
void EmitAggExpr(const Expr *E, AggValueSlot AS)
JumpDest ReturnBlock
ReturnBlock - Unified return block.
virtual void initializeHiddenVirtualInheritanceMembers(CodeGenFunction &CGF, const CXXRecordDecl *RD)
void EmitSynthesizedCXXCopyCtorCall(const CXXConstructorDecl *D, llvm::Value *This, llvm::Value *Src, const CXXConstructExpr *E)
bool isTriviallyCopyableType(ASTContext &Context) const
StructorType getFromCtorType(CXXCtorType T)
Represents a C++ base or member initializer.
llvm::PointerType * Int8PtrTy
void EmitLambdaStaticInvokeFunction(const CXXMethodDecl *MD)
bool has(SanitizerMask K) const
Check if a certain (single) sanitizer is enabled.
llvm::Constant * GetNonVirtualBaseClassOffset(const CXXRecordDecl *ClassDecl, CastExpr::path_const_iterator PathBegin, CastExpr::path_const_iterator PathEnd)
void EmitScalarInit(const Expr *init, const ValueDecl *D, LValue lvalue, bool capturedByInit)
Expr * getArg(unsigned Arg)
Return the specified argument.
CXXConstructorDecl * getConstructor() const
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
uint64_t getCharWidth() const
Return the size of the character type, in bits.
virtual void EmitDestructorCall(CodeGenFunction &CGF, const CXXDestructorDecl *DD, CXXDtorType Type, bool ForVirtualBase, bool Delegating, llvm::Value *This)=0
Emit the destructor call.
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
void EnterCXXTryStmt(const CXXTryStmt &S, bool IsFnTryBlock=false)
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
ABIArgInfo & getReturnInfo()
Represents a base class of a C++ class.
CharUnits getNonVirtualSize() const
llvm::Value * LoadCXXVTT()
unsigned getFieldIndex() const
bool isAnyMemberInitializer() const
void EmitFunctionBody(FunctionArgList &Args, const Stmt *Body)
bool isDefaultConstructor() const
void InitializeVTablePointer(BaseSubobject Base, const CXXRecordDecl *NearestVBase, CharUnits OffsetFromNearestVBase, const CXXRecordDecl *VTableClass)
A template argument list.
llvm::IntegerType * PtrDiffTy
bool isPODType(ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
void EmitCXXAggrConstructorCall(const CXXConstructorDecl *D, const ConstantArrayType *ArrayTy, llvm::Value *ArrayPtr, const CXXConstructExpr *E, bool ZeroInitialization=false)
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
static void EmitMemberInitializer(CodeGenFunction &CGF, const CXXRecordDecl *ClassDecl, CXXCtorInitializer *MemberInit, const CXXConstructorDecl *Constructor, FunctionArgList &Args)
Represents a C++ struct/union/class.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
void EmitBranch(llvm::BasicBlock *Block)
bool IsCFIBlacklistedRecord(const CXXRecordDecl *RD)
llvm::Type * ConvertType(QualType T)
static Destroyer destroyCXXObject
LValue EmitLValue(const Expr *E)
const BlockDecl * getBlockDecl() const
void ForceCleanup()
Force the emission of cleanups now, instead of waiting until this object is destroyed.
CharUnits computeNonVirtualBaseClassOffset(const CXXRecordDecl *DerivedClass, CastExpr::path_const_iterator Start, CastExpr::path_const_iterator End)
const FunctionDecl * getOperatorDelete() const
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].
static RValue get(llvm::Value *V)
void EmitDestructorBody(FunctionArgList &Args)
EmitDestructorBody - Emits the body of the current destructor.
void ExitCXXTryStmt(const CXXTryStmt &S, bool IsFnTryBlock=false)
QualType getElementType() const
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
void EmitBranchThroughCleanup(JumpDest Dest)
static AggValueSlot forAddr(llvm::Value *addr, CharUnits align, Qualifiers quals, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, IsZeroed_t isZeroed=IsNotZeroed)
llvm::Constant * EmitCheckSourceLocation(SourceLocation Loc)
Emit a description of a source location in a format suitable for passing to a runtime sanitizer handl...
llvm::Value * GetAddressOfDerivedClass(llvm::Value *Value, const CXXRecordDecl *Derived, CastExpr::path_const_iterator PathBegin, CastExpr::path_const_iterator PathEnd, bool NullCheckValue)
CodeGenVTables & getVTables()
CharUnits getBaseOffset() const
getBaseOffset - Returns the base class offset.
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
CodeGenTypes & getTypes() const
CharUnits alignmentAtOffset(CharUnits offset)
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
static bool HasTrivialDestructorBody(ASTContext &Context, const CXXRecordDecl *BaseClassDecl, const CXXRecordDecl *MostDerivedClassDecl)
bool hasTrivialBody() const
const CGRecordLayout & getCGRecordLayout(const RecordDecl *)
getCGRecordLayout - Return record layout info for the given record decl.
void PopCleanupBlock(bool FallThroughIsBranchThrough=false)
base_class_range vbases()
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
Declaration of a template function.
static bool FieldHasTrivialDestructorBody(ASTContext &Context, const FieldDecl *Field)
Structure with information about how a bitfield should be accessed.
llvm::MDNode * getTBAAInfoForVTablePtr()
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
const CGFunctionInfo & arrangeCXXConstructorCall(const CallArgList &Args, const CXXConstructorDecl *D, CXXCtorType CtorKind, unsigned ExtraArgs)
Arrange a call to a C++ method, passing the given arguments.
llvm::FunctionType * GetFunctionType(const CGFunctionInfo &Info)
GetFunctionType - Get the LLVM function type for.