21 #include "llvm/IR/Constants.h"
22 #include "llvm/IR/Function.h"
23 #include "llvm/IR/GlobalVariable.h"
24 #include "llvm/IR/Intrinsics.h"
25 using namespace clang;
26 using namespace CodeGen;
33 class AggExprEmitter :
public StmtVisitor<AggExprEmitter> {
44 bool shouldUseDestForReturnSlot()
const {
45 return !(Dest.requiresGCollection() || Dest.isPotentiallyAliased());
49 if (!shouldUseDestForReturnSlot())
52 return ReturnValueSlot(Dest.getAddr(), Dest.isVolatile(), IsResultUnused);
56 if (!Dest.isIgnored())
return Dest;
57 return CGF.CreateAggTemp(T,
"agg.tmp.ensured");
60 if (!Dest.isIgnored())
return;
61 Dest = CGF.CreateAggTemp(T,
"agg.tmp.ensured");
67 IsResultUnused(IsResultUnused) { }
76 void EmitAggLoadOfLValue(
const Expr *E);
85 void EmitMoveFromReturnSlot(
const Expr *E,
RValue Src);
87 void EmitArrayInit(
llvm::Value *DestPtr, llvm::ArrayType *AType,
91 if (CGF.getLangOpts().getGC() && TypeRequiresGCollection(T))
96 bool TypeRequiresGCollection(
QualType T);
102 void Visit(
Expr *E) {
107 void VisitStmt(
Stmt *
S) {
108 CGF.ErrorUnsupported(S,
"aggregate expression");
129 = CGF.tryEmitAsConstant(E)) {
130 EmitFinalDestCopy(E->
getType(), result.getReferenceLValue(CGF, E));
135 EmitAggLoadOfLValue(E);
138 void VisitMemberExpr(
MemberExpr *ME) { EmitAggLoadOfLValue(ME); }
139 void VisitUnaryDeref(
UnaryOperator *E) { EmitAggLoadOfLValue(E); }
140 void VisitStringLiteral(
StringLiteral *E) { EmitAggLoadOfLValue(E); }
143 EmitAggLoadOfLValue(E);
146 EmitAggLoadOfLValue(E);
151 void VisitCallExpr(
const CallExpr *E);
152 void VisitStmtExpr(
const StmtExpr *E);
154 void VisitPointerToDataMemberBinaryOperator(
const BinaryOperator *BO);
160 EmitAggLoadOfLValue(E);
182 void VisitCXXTypeidExpr(
CXXTypeidExpr *E) { EmitAggLoadOfLValue(E); }
188 LValue LV = CGF.EmitPseudoObjectLValue(E);
189 return EmitFinalDestCopy(E->
getType(), LV);
192 CGF.EmitPseudoObjectRValue(E, EnsureSlot(E->
getType()));
197 void EmitInitializationToLValue(
Expr *E,
LValue Address);
198 void EmitNullInitializationToLValue(
LValue Address);
200 void VisitCXXThrowExpr(
const CXXThrowExpr *E) { CGF.EmitCXXThrowExpr(E); }
202 CGF.EmitAtomicExpr(E, EnsureSlot(E->
getType()).getAddr());
214 void AggExprEmitter::EmitAggLoadOfLValue(
const Expr *E) {
215 LValue LV = CGF.EmitLValue(E);
219 CGF.EmitAtomicLoad(LV, E->
getExprLoc(), Dest);
223 EmitFinalDestCopy(E->
getType(), LV);
227 bool AggExprEmitter::TypeRequiresGCollection(
QualType T) {
230 if (!RecordTy)
return false;
234 if (isa<CXXRecordDecl>(Record) &&
235 (cast<CXXRecordDecl>(Record)->hasNonTrivialCopyConstructor() ||
236 !cast<CXXRecordDecl>(Record)->hasTrivialDestructor()))
253 void AggExprEmitter::EmitMoveFromReturnSlot(
const Expr *E,
RValue src) {
254 if (shouldUseDestForReturnSlot()) {
263 std::pair<CharUnits, CharUnits> typeInfo =
264 CGF.getContext().getTypeInfoInChars(E->
getType());
265 EmitFinalDestCopy(E->
getType(), src, typeInfo.second);
271 assert(src.
isAggregate() &&
"value must be aggregate value!");
273 EmitFinalDestCopy(type, srcLV);
277 void AggExprEmitter::EmitFinalDestCopy(
QualType type,
const LValue &src) {
282 if (Dest.isIgnored())
288 EmitCopy(type, Dest, srcAgg);
298 CharUnits sz = CGF.getContext().getTypeSizeInChars(type);
300 CGF.CGM.getObjCRuntime().EmitGCMemmoveCollectable(CGF,
323 assert(Array.
isSimple() &&
"initializer_list array not a simple lvalue");
328 assert(ArrayType &&
"std::initializer_list constructed from non-array");
334 CGF.ErrorUnsupported(E,
"weird std::initializer_list");
339 if (!Field->getType()->isPointerType() ||
340 !Ctx.
hasSameType(Field->getType()->getPointeeType(),
342 CGF.ErrorUnsupported(E,
"weird std::initializer_list");
349 LValue Start = CGF.EmitLValueForFieldInitialization(DestLV, *Field);
350 llvm::Value *Zero = llvm::ConstantInt::get(CGF.PtrDiffTy, 0);
353 Builder.CreateInBoundsGEP(ArrayPtr, IdxStart,
"arraystart");
354 CGF.EmitStoreThroughLValue(
RValue::get(ArrayStart), Start);
358 CGF.ErrorUnsupported(E,
"weird std::initializer_list");
363 LValue EndOrLength = CGF.EmitLValueForFieldInitialization(DestLV, *Field);
364 if (Field->getType()->isPointerType() &&
365 Ctx.
hasSameType(Field->getType()->getPointeeType(),
370 Builder.CreateInBoundsGEP(ArrayPtr, IdxEnd,
"arrayend");
371 CGF.EmitStoreThroughLValue(
RValue::get(ArrayEnd), EndOrLength);
374 CGF.EmitStoreThroughLValue(
RValue::get(Size), EndOrLength);
376 CGF.ErrorUnsupported(E,
"weird std::initializer_list");
387 if (isa<ImplicitValueInitExpr>(E))
390 if (
auto *ILE = dyn_cast<InitListExpr>(E)) {
391 if (ILE->getNumInits())
396 if (
auto *Cons = dyn_cast_or_null<CXXConstructExpr>(E))
397 return Cons->getConstructor()->isDefaultConstructor() &&
398 Cons->getConstructor()->isTrivial();
405 void AggExprEmitter::EmitArrayInit(
llvm::Value *DestPtr, llvm::ArrayType *AType,
409 uint64_t NumArrayElements = AType->getNumElements();
410 assert(NumInitElements <= NumArrayElements);
414 llvm::Value *zero = llvm::ConstantInt::get(CGF.SizeTy, 0);
417 Builder.CreateInBoundsGEP(DestPtr, indices,
"arrayinit.begin");
423 llvm::AllocaInst *endOfInit =
nullptr;
425 llvm::Instruction *cleanupDominator =
nullptr;
426 if (CGF.needsEHCleanup(dtorKind)) {
431 endOfInit = CGF.CreateTempAlloca(begin->getType(),
432 "arrayinit.endOfInit");
433 cleanupDominator =
Builder.CreateStore(begin, endOfInit);
434 CGF.pushIrregularPartialArrayCleanup(begin, endOfInit, elementType,
435 CGF.getDestroyer(dtorKind));
436 cleanup = CGF.EHStack.stable_begin();
443 llvm::Value *one = llvm::ConstantInt::get(CGF.SizeTy, 1);
453 for (uint64_t i = 0; i != NumInitElements; ++i) {
456 element =
Builder.CreateInBoundsGEP(element, one,
"arrayinit.element");
461 if (endOfInit)
Builder.CreateStore(element, endOfInit);
464 LValue elementLV = CGF.MakeAddrLValue(element, elementType);
465 EmitInitializationToLValue(E->
getInit(i), elementLV);
475 if (NumInitElements != NumArrayElements &&
476 !(Dest.
isZeroed() && hasTrivialFiller &&
477 CGF.getTypes().isZeroInitializable(elementType))) {
483 if (NumInitElements) {
484 element =
Builder.CreateInBoundsGEP(element, one,
"arrayinit.start");
485 if (endOfInit)
Builder.CreateStore(element, endOfInit);
490 llvm::ConstantInt::get(CGF.SizeTy, NumArrayElements),
493 llvm::BasicBlock *entryBB =
Builder.GetInsertBlock();
494 llvm::BasicBlock *bodyBB = CGF.createBasicBlock(
"arrayinit.body");
497 CGF.EmitBlock(bodyBB);
498 llvm::PHINode *currentElement =
499 Builder.CreatePHI(element->getType(), 2,
"arrayinit.cur");
500 currentElement->addIncoming(element, entryBB);
503 LValue elementLV = CGF.MakeAddrLValue(currentElement, elementType);
505 EmitInitializationToLValue(filler, elementLV);
507 EmitNullInitializationToLValue(elementLV);
511 Builder.CreateInBoundsGEP(currentElement, one,
"arrayinit.next");
514 if (endOfInit)
Builder.CreateStore(nextElement, endOfInit);
519 llvm::BasicBlock *endBB = CGF.createBasicBlock(
"arrayinit.end");
520 Builder.CreateCondBr(done, endBB, bodyBB);
521 currentElement->addIncoming(nextElement,
Builder.GetInsertBlock());
523 CGF.EmitBlock(endBB);
527 if (dtorKind) CGF.DeactivateCleanupBlock(cleanup, cleanupDominator);
539 EmitFinalDestCopy(e->
getType(), CGF.getOpaqueLValueMapping(e));
548 EmitAggLoadOfLValue(E);
561 if (
CastExpr *castE = dyn_cast<CastExpr>(op)) {
562 if (castE->getCastKind() ==
kind)
563 return castE->getSubExpr();
564 if (castE->getCastKind() ==
CK_NoOp)
571 void AggExprEmitter::VisitCastExpr(
CastExpr *E) {
575 assert(isa<CXXDynamicCastExpr>(E) &&
"CK_Dynamic without a dynamic_cast?");
580 CGF.EmitDynamicCast(LV.
getAddress(), cast<CXXDynamicCastExpr>(E));
582 CGF.CGM.ErrorUnsupported(E,
"non-simple lvalue dynamic_cast");
585 CGF.CGM.ErrorUnsupported(E,
"lvalue dynamic_cast with a destination");
599 QualType PtrTy = CGF.getContext().getPointerType(Ty);
601 CGF.ConvertType(PtrTy));
603 CGF.MakeAddrLValue(CastPtr, Ty));
610 llvm_unreachable(
"cannot perform hierarchy conversion in EmitAggExpr: "
611 "should have been unpacked before we got here");
621 if (isToAtomic) std::swap(atomicType, valueType);
624 assert(CGF.getContext().hasSameUnqualifiedType(valueType,
629 if (Dest.
isIgnored() || !CGF.CGM.isPaddedAtomicType(atomicType)) {
638 assert(CGF.getContext().hasSameUnqualifiedType(op->getType(),
640 "peephole significantly changed types?");
648 if (!valueDest.
isIgnored() && CGF.CGM.isPaddedAtomicType(atomicType)) {
652 CGF.EmitNullInitialization(Dest.
getAddr(), atomicType);
656 CGF.Builder.CreateStructGEP(
nullptr, valueDest.
getAddr(), 0);
673 CGF.CreateAggTemp(atomicType,
"atomic-to-nonatomic.temp");
679 return EmitFinalDestCopy(valueType, rvalue);
697 "Implicit cast types must be compatible");
702 llvm_unreachable(
"should not be emitting lvalue bitcast as rvalue");
747 llvm_unreachable(
"cast kind invalid for aggregate types");
751 void AggExprEmitter::VisitCallExpr(
const CallExpr *E) {
753 EmitAggLoadOfLValue(E);
757 RValue RV = CGF.EmitCallExpr(E, getReturnValueSlot());
758 EmitMoveFromReturnSlot(E, RV);
762 RValue RV = CGF.EmitObjCMessageExpr(E, getReturnValueSlot());
763 EmitMoveFromReturnSlot(E, RV);
767 CGF.EmitIgnoredExpr(E->
getLHS());
771 void AggExprEmitter::VisitStmtExpr(
const StmtExpr *E) {
773 CGF.EmitCompoundStmt(*E->
getSubStmt(),
true, Dest);
776 void AggExprEmitter::VisitBinaryOperator(
const BinaryOperator *E) {
778 VisitPointerToDataMemberBinaryOperator(E);
780 CGF.ErrorUnsupported(E,
"aggregate binary expression");
783 void AggExprEmitter::VisitPointerToDataMemberBinaryOperator(
785 LValue LV = CGF.EmitPointerToDataMemberBinaryExpr(E);
786 EmitFinalDestCopy(E->
getType(), LV);
796 if (
const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) {
798 return (var && var->
hasAttr<BlocksAttr>());
807 if (op->isAssignmentOp() || op->isPtrMemOp())
819 = dyn_cast<AbstractConditionalOperator>(E)) {
825 = dyn_cast<OpaqueValueExpr>(E)) {
826 if (
const Expr *src = op->getSourceExpr())
833 }
else if (
const CastExpr *cast = dyn_cast<CastExpr>(E)) {
840 }
else if (
const UnaryOperator *uop = dyn_cast<UnaryOperator>(E)) {
844 }
else if (
const MemberExpr *mem = dyn_cast<MemberExpr>(E)) {
858 assert(CGF.getContext().hasSameUnqualifiedType(E->
getLHS()->
getType(),
860 &&
"Invalid assignment");
876 if (LHS.getType()->isAtomicType() ||
877 CGF.LValueIsSuitableForInlineAtomic(LHS)) {
878 CGF.EmitAtomicStore(Dest.
asRValue(), LHS,
false);
895 CGF.LValueIsSuitableForInlineAtomic(LHS)) {
898 CGF.EmitAtomicStore(Dest.
asRValue(), LHS,
false);
912 CGF.EmitAggExpr(E->
getRHS(), LHSSlot);
915 EmitFinalDestCopy(E->
getType(), LHS);
918 void AggExprEmitter::
920 llvm::BasicBlock *LHSBlock = CGF.createBasicBlock(
"cond.true");
921 llvm::BasicBlock *RHSBlock = CGF.createBasicBlock(
"cond.false");
922 llvm::BasicBlock *ContBlock = CGF.createBasicBlock(
"cond.end");
928 CGF.EmitBranchOnBoolExpr(E->
getCond(), LHSBlock, RHSBlock,
929 CGF.getProfileCount(E));
935 CGF.EmitBlock(LHSBlock);
936 CGF.incrementProfileCounter(E);
940 assert(CGF.HaveInsertPoint() &&
"expression evaluation ended with no IP!");
941 CGF.Builder.CreateBr(ContBlock);
950 CGF.EmitBlock(RHSBlock);
954 CGF.EmitBlock(ContBlock);
957 void AggExprEmitter::VisitChooseExpr(
const ChooseExpr *CE) {
961 void AggExprEmitter::VisitVAArgExpr(
VAArgExpr *VE) {
974 EmitFinalDestCopy(VE->
getType(), CGF.MakeAddrLValue(ArgPtr, VE->
getType()));
989 if (!wasExternallyDestructed)
996 CGF.EmitCXXConstructExpr(E, Slot);
1000 AggExprEmitter::VisitLambdaExpr(
LambdaExpr *E) {
1002 CGF.EmitLambdaExpr(E, Slot);
1006 CGF.enterFullExpression(E);
1014 EmitNullInitializationToLValue(CGF.MakeAddrLValue(Slot.
getAddr(), T));
1020 EmitNullInitializationToLValue(CGF.MakeAddrLValue(Slot.
getAddr(), T));
1031 return IL->getValue() == 0;
1034 return FL->getValue().isPosZero();
1036 if ((isa<ImplicitValueInitExpr>(E) || isa<CXXScalarValueInitExpr>(E)) &&
1040 if (
const CastExpr *ICE = dyn_cast<CastExpr>(E))
1044 return CL->getValue() == 0;
1052 AggExprEmitter::EmitInitializationToLValue(
Expr *E,
LValue LV) {
1059 }
else if (isa<ImplicitValueInitExpr>(E) || isa<CXXScalarValueInitExpr>(E)) {
1060 return EmitNullInitializationToLValue(LV);
1061 }
else if (isa<NoInitExpr>(E)) {
1065 RValue RV = CGF.EmitReferenceBindingToExpr(E);
1066 return CGF.EmitStoreThroughLValue(RV, LV);
1069 switch (CGF.getEvaluationKind(type)) {
1071 CGF.EmitComplexExprIntoLValue(E, LV,
true);
1082 CGF.EmitScalarInit(E,
nullptr, LV,
false);
1084 CGF.EmitStoreThroughLValue(
RValue::get(CGF.EmitScalarExpr(E)), LV);
1088 llvm_unreachable(
"bad evaluation kind");
1091 void AggExprEmitter::EmitNullInitializationToLValue(
LValue lv) {
1096 if (Dest.
isZeroed() && CGF.getTypes().isZeroInitializable(type))
1099 if (CGF.hasScalarEvaluationKind(type)) {
1101 llvm::Value *null = CGF.CGM.EmitNullConstant(type);
1105 CGF.EmitStoreThroughBitfieldLValue(
RValue::get(null), lv);
1108 CGF.EmitStoreOfScalar(null, lv,
true);
1118 void AggExprEmitter::VisitInitListExpr(
InitListExpr *E) {
1125 if (llvm::Constant*
C = CGF.CGM.EmitConstantExpr(E, E->
getType(), &CGF)) {
1126 llvm::GlobalVariable* GV =
1127 new llvm::GlobalVariable(CGF.CGM.getModule(),
C->getType(),
true,
1129 EmitFinalDestCopy(E->
getType(), CGF.MakeAddrLValue(GV, E->
getType()));
1134 CGF.ErrorUnsupported(E,
"GNU array range designator extension");
1149 llvm::PointerType *APType =
1150 cast<llvm::PointerType>(Dest.
getAddr()->getType());
1151 llvm::ArrayType *AType =
1152 cast<llvm::ArrayType>(APType->getElementType());
1154 EmitArrayInit(Dest.
getAddr(), AType, elementType, E);
1162 CGF.getContext().hasSameUnqualifiedType(E->
getInit(0)->
getType(),
1164 "unexpected list initialization for atomic object");
1189 for (
const auto *Field : record->
fields())
1190 assert(Field->isUnnamedBitfield() &&
"Only unnamed bitfields allowed");
1198 LValue FieldLoc = CGF.EmitLValueForFieldInitialization(DestLV, Field);
1199 if (NumInitElements) {
1201 EmitInitializationToLValue(E->
getInit(0), FieldLoc);
1204 EmitNullInitializationToLValue(FieldLoc);
1213 llvm::Instruction *cleanupDominator =
nullptr;
1217 unsigned curInitIndex = 0;
1218 for (
const auto *field : record->
fields()) {
1220 if (field->getType()->isIncompleteArrayType())
1224 if (field->isUnnamedBitfield())
1230 if (curInitIndex == NumInitElements && Dest.
isZeroed() &&
1231 CGF.getTypes().isZeroInitializable(E->
getType()))
1235 LValue LV = CGF.EmitLValueForFieldInitialization(DestLV, field);
1239 if (curInitIndex < NumInitElements) {
1241 EmitInitializationToLValue(E->
getInit(curInitIndex++), LV);
1244 EmitNullInitializationToLValue(LV);
1250 bool pushedCleanup =
false;
1252 = field->getType().isDestructedType()) {
1254 if (CGF.needsEHCleanup(dtorKind)) {
1255 if (!cleanupDominator)
1256 cleanupDominator = CGF.Builder.CreateUnreachable();
1259 CGF.getDestroyer(dtorKind),
false);
1260 cleanups.push_back(CGF.EHStack.stable_begin());
1261 pushedCleanup =
true;
1267 if (!pushedCleanup && LV.
isSimple())
1268 if (llvm::GetElementPtrInst *GEP =
1269 dyn_cast<llvm::GetElementPtrInst>(LV.
getAddress()))
1270 if (GEP->use_empty())
1271 GEP->eraseFromParent();
1276 for (
unsigned i = cleanups.size(); i != 0; --i)
1277 CGF.DeactivateCleanupBlock(cleanups[i-1], cleanupDominator);
1280 if (cleanupDominator)
1281 cleanupDominator->eraseFromParent();
1289 EmitInitializationToLValue(E->
getBase(), DestLV);
1316 if (!RT->isUnionType()) {
1320 unsigned ILEElement = 0;
1321 for (
const auto *Field : SD->
fields()) {
1340 return NumNonZeroBytes;
1346 for (
unsigned i = 0, e = ILE->
getNumInits(); i != e; ++i)
1348 return NumNonZeroBytes;
1365 const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
1371 std::pair<CharUnits, CharUnits>
TypeInfo =
1379 if (NumNonZeroBytes*4 > TypeInfo.first)
1383 llvm::Constant *SizeVal = CGF.
Builder.getInt64(TypeInfo.first.getQuantity());
1405 "Invalid aggregate expression to emit");
1407 "slot has bits but no address");
1412 AggExprEmitter(*
this, Slot, Slot.
isIgnored()).Visit(const_cast<Expr*>(E));
1429 bool isAssignment) {
1440 "Trying to aggregate-copy a type without a trivial copy/move "
1441 "constructor or assignment operator");
1461 std::pair<CharUnits, CharUnits>
TypeInfo;
1468 alignment = TypeInfo.second;
1471 if (TypeInfo.first.isZero()) {
1473 if (
auto *VAT = dyn_cast_or_null<VariableArrayType>(
1478 std::pair<CharUnits, CharUnits> LastElementTypeInfo;
1481 assert(!TypeInfo.first.isZero());
1482 SizeVal =
Builder.CreateNUWMul(
1484 llvm::ConstantInt::get(
SizeTy, TypeInfo.first.getQuantity()));
1485 if (!isAssignment) {
1486 SizeVal =
Builder.CreateNUWSub(
1488 llvm::ConstantInt::get(
SizeTy, TypeInfo.first.getQuantity()));
1489 SizeVal =
Builder.CreateNUWAdd(
1490 SizeVal, llvm::ConstantInt::get(
1491 SizeTy, LastElementTypeInfo.first.getQuantity()));
1496 SizeVal = llvm::ConstantInt::get(
SizeTy, TypeInfo.first.getQuantity());
1512 llvm::PointerType *DPT = cast<llvm::PointerType>(DestPtr->getType());
1514 llvm::Type::getInt8PtrTy(
getLLVMContext(), DPT->getAddressSpace());
1515 DestPtr =
Builder.CreateBitCast(DestPtr, DBP);
1517 llvm::PointerType *SPT = cast<llvm::PointerType>(SrcPtr->getType());
1519 llvm::Type::getInt8PtrTy(
getLLVMContext(), SPT->getAddressSpace());
1520 SrcPtr =
Builder.CreateBitCast(SrcPtr, SBP);
1549 isVolatile,
nullptr, TBAAStructTag);
Defines the clang::ASTContext interface.
unsigned getNumInits() const
CastKind getCastKind() const
DestructionKind isDestructedType() const
CompoundStmt * getSubStmt()
static AggValueSlot forLValue(const LValue &LV, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, IsZeroed_t isZeroed=IsNotZeroed)
const TargetInfo & getTarget() const
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
Expr * GetTemporaryExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue...
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
bool isRecordType() const
llvm::MDNode * getTBAAStructInfo(QualType QTy)
Defines the C++ template declaration subclasses.
const Expr * getResultExpr() const
Represents a call to a C++ constructor.
void setZeroed(bool V=true)
const LangOptions & getLangOpts() const
[ARC] Consumes a retainable object pointer that has just been produced, e.g. as the return value of a...
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
llvm::Value * getAddress() const
const llvm::APInt & getSize() const
bool hadArrayRangeDesignator() const
static bool isBlockVarRef(const Expr *E)
CharUnits getAlignment() const
static Expr * findPeephole(Expr *op, CastKind kind)
static bool isSimpleZero(const Expr *E, CodeGenFunction &CGF)
field_iterator field_begin() const
CK_Dynamic - A C++ dynamic_cast.
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
IsZeroed_t isZeroed() const
A C++ throw-expression (C++ [except.throw]).
bool hasTrivialCopyConstructor() const
Determine whether this class has a trivial copy constructor (C++ [class.copy]p6, C++11 [class...
static CharUnits GetNumNonZeroBytesInInit(const Expr *E, CodeGenFunction &CGF)
An object to manage conditionally-evaluated expressions.
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Converts between different integral complex types. _Complex char -> _Complex long long _Complex unsig...
bool isReferenceType() const
llvm::IntegerType * SizeTy
Represents a place-holder for an object not to be initialized by anything.
An RAII object to set (and then clear) a mapping for an OpaqueValueExpr.
Converting between two Objective-C object types, which can occur when performing reference binding to...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
[ARC] Causes a value of block type to be copied to the heap, if it is not already there...
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
static bool isTrivialFiller(Expr *E)
Determine if E is a trivial array filler, that is, one that is equivalent to zero-initialization.
void setNonGC(bool Value)
Converts a floating point complex to bool by comparing against 0+0i.
LValue MakeAddrLValue(llvm::Value *V, QualType T, CharUnits Alignment=CharUnits())
Describes an C or C++ initializer list.
Expr * getChosenSubExpr() const
Expr * getTrueExpr() const
field_range fields() const
const Expr * getSubExpr() const
A builtin binary operation expression such as "x + y" or "x <= y".
RecordDecl * getDecl() const
llvm::Value * getAggregateAddr() const
getAggregateAddr() - Return the Value* of the address of the aggregate.
virtual void EmitGCMemmoveCollectable(CodeGen::CodeGenFunction &CGF, llvm::Value *DestPtr, llvm::Value *SrcPtr, llvm::Value *Size)=0
Represents binding an expression to a temporary.
CXXTemporary * getTemporary()
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
std::pair< CharUnits, CharUnits > getTypeInfoInChars(const Type *T) const
A default argument (C++ [dcl.fct.default]).
bool isUnnamedBitfield() const
Determines whether this is an unnamed bitfield.
Checking the operand of a load. Must be suitably sized and aligned.
field_iterator field_end() const
QualType getValueType() const
Causes a block literal to by copied to the heap and then autoreleased.
CastKind
CastKind - The kind of operation required for a conversion.
const Expr * getExpr() const
Get the initialization expression that will be used.
VAArgExpr, used for the builtin function __builtin_va_arg.
Converts between different floating point complex types. _Complex float -> _Complex double...
std::pair< CharUnits, CharUnits > getTypeInfoDataSizeInChars(QualType T) const
CGObjCRuntime & getObjCRuntime()
Return a reference to the configured Objective-C runtime.
Converts an integral complex to an integral real of the source's element type by discarding the imagi...
bool isAnyComplexType() const
Enters a new scope for capturing cleanups, all of which will be executed once the scope is exited...
bool isAtomicType() const
llvm::Value * emitArrayLength(const ArrayType *arrayType, QualType &baseType, llvm::Value *&addr)
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
llvm::LLVMContext & getLLVMContext()
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
Expr * getSubExpr() const
An expression that sends a message to the given Objective-C object or class.
Converts from an integral complex to a floating complex. _Complex unsigned -> _Complex float...
Represents a reference to a non-type template parameter that has been substituted with a template arg...
llvm::IRBuilder< PreserveNames, llvm::ConstantFolder, CGBuilderInserterTy > CGBuilderTy
InitListExpr * getUpdater() const
ASTContext & getContext() const
void EmitAggregateCopy(llvm::Value *DestPtr, llvm::Value *SrcPtr, QualType EltTy, bool isVolatile=false, CharUnits Alignment=CharUnits::Zero(), bool isAssignment=false)
LValue EmitAggExprToLValue(const Expr *E)
static RValue getAggregate(llvm::Value *V, bool Volatile=false)
const ConstantArrayType * getAsConstantArrayType(QualType T) const
static void CheckAggExprForMemSetUse(AggValueSlot &Slot, const Expr *E, CodeGenFunction &CGF)
Converts from an integral real to an integral complex whose element type matches the source...
const LangOptions & getLangOpts() const
llvm::AllocaInst * CreateMemTemp(QualType T, const Twine &Name="tmp")
bool hasObjectMember() const
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
SourceLocation getExprLoc() const LLVM_READONLY
bool hasTrivialCopyAssignment() const
Determine whether this class has a trivial copy assignment operator (C++ [class.copy]p11, C++11 [class.copy]p25)
void setExternallyDestructed(bool destructed=true)
Represents a C11 generic selection.
QualType getCallReturnType(const ASTContext &Ctx) const
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T-> getSizeExpr()))
Converts a floating point complex to floating point real of the source's element type. Just discards the imaginary component. _Complex long double -> long double.
Expr * getReplacement() const
static const Type * getElementType(const Expr *BaseExpr)
void setVolatile(bool flag)
const Expr * getExpr() const
[C99 6.4.2.2] - A predefined identifier such as func.
Converts an integral complex to bool by comparing against 0+0i.
bool isZero() const
isZero - Test whether the quantity equals zero.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
static AggValueSlot ignored()
IsAliased_t isPotentiallyAliased() const
bool hasTrivialMoveConstructor() const
Determine whether this class has a trivial move constructor (C++11 [class.copy]p12) ...
Checking the destination of a store. Must be suitably sized and aligned.
IsDestructed_t isExternallyDestructed() const
A conversion of a floating point real to a floating point complex of the original type...
void EmitAggExpr(const Expr *E, AggValueSlot AS)
[ARC] Reclaim a retainable object pointer object that may have been produced and autoreleased as part...
static bool hasAggregateEvaluationKind(QualType T)
bool hasTrivialMoveAssignment() const
Determine whether this class has a trivial move assignment operator (C++11 [class.copy]p25)
Expr * getFalseExpr() const
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
NeedsGCBarriers_t requiresGCollection() const
[ARC] Produces a retainable object pointer so that it may be consumed, e.g. by being passed to a cons...
llvm::PointerType * Int8PtrTy
Converts from T to _Atomic(T).
Converts from a floating complex to an integral complex. _Complex float -> _Complex int...
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
const Expr * getInitializer() const
ObjCIvarRefExpr - A reference to an ObjC instance variable.
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
A use of a default initializer in a constructor or in aggregate initialization.
llvm::Value * getAddr() const
bool isPODType(ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
const Expr * getSubExpr() const
Represents a C++ struct/union/class.
BoundNodesTreeBuilder *const Builder
unsigned kind
All of the diagnostics that can be emitted by the frontend.
Converts from _Atomic(T) to T.
bool isIncompleteArrayType() const
bool isStringLiteralInit() const
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].
static RValue get(llvm::Value *V)
QualType getElementType() const
static AggValueSlot forAddr(llvm::Value *addr, CharUnits align, Qualifiers quals, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, IsZeroed_t isZeroed=IsNotZeroed)
const Expr * getInit(unsigned Init) const
const Expr * getSubExpr() const
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
CodeGenTypes & getTypes() const
Qualifiers getQualifiers() const
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
bool isZeroInitializable(QualType T)
Represents an implicitly-generated value initialization of an object of a given type.
bool hasUserDeclaredConstructor() const
Determine whether this class has any user-declared constructors.
Expr * IgnoreParens() LLVM_READONLY