Lines Matching +full:de +full:- +full:asserting
1 //===--- CGDecl.cpp - Emit LLVM Code for declarations ---------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
113 DI->EmitAndRetainType(getContext().getRecordType(cast<RecordDecl>(&D))); in EmitDecl()
118 DI->EmitAndRetainType(getContext().getEnumType(cast<EnumDecl>(&D))); in EmitDecl()
142 DI->EmitNamespaceAlias(cast<NamespaceAliasDecl>(D)); in EmitDecl()
146 DI->EmitUsingDecl(cast<UsingDecl>(D)); in EmitDecl()
150 DI->EmitUsingEnumDecl(cast<UsingEnumDecl>(D)); in EmitDecl()
158 DI->EmitUsingDirective(cast<UsingDirectiveDecl>(D)); in EmitDecl()
164 "Should not see file-scope variables inside a function!"); in EmitDecl()
167 for (auto *B : DD->bindings()) in EmitDecl()
168 if (auto *HD = B->getHoldingVar()) in EmitDecl()
183 DI->EmitAndRetainType(Ty); in EmitDecl()
184 if (Ty->isVariablyModifiedType()) in EmitDecl()
191 /// EmitVarDecl - This method handles emission of any variable declaration
198 // Some function-scope variable does not have static storage but still in EmitVarDecl()
199 // needs to be emitted like a static variable, e.g. a function-scope in EmitVarDecl()
203 if (D.getType()->isSamplerT()) in EmitVarDecl()
210 // some variables even if we can constant-evaluate them because in EmitVarDecl()
211 // we can't guarantee every translation unit will constant-evaluate them. in EmitVarDecl()
232 DC = cast<DeclContext>(CD->getNonClosureContext()); in getStaticDeclName()
238 ContextName = OMD->getSelector().getAsString(); in getStaticDeclName()
256 assert(Ty->isConstantSizeType() && "VLAs can't be static"); in getOrCreateStaticVarDecl()
258 // Use the label if the variable is renamed with the asm-label extension. in getOrCreateStaticVarDecl()
281 GV->setAlignment(getContext().getDeclAlign(&D).getAsAlign()); in getOrCreateStaticVarDecl()
283 if (supportsCOMDAT() && GV->isWeakForLinker()) in getOrCreateStaticVarDecl()
284 GV->setComdat(TheModule.getOrInsertComdat(GV->getName())); in getOrCreateStaticVarDecl()
311 DC = DC->getNonClosureContext(); in getOrCreateStaticVarDecl()
325 // Don't do anything for Obj-C method decls or global closures. We should in getOrCreateStaticVarDecl()
338 /// AddInitializerToStaticVarDecl - Add the initializer for 'D' to the
352 CGM.ErrorUnsupported(D.getInit(), "constant l-value expression"); in AddInitializerToStaticVarDecl()
358 GV->setConstant(false); in AddInitializerToStaticVarDecl()
369 CGM.getDataLayout().getTypeAllocSize(Init->getType())); in AddInitializerToStaticVarDecl()
377 if (GV->getValueType() != Init->getType()) { in AddInitializerToStaticVarDecl()
381 CGM.getModule(), Init->getType(), OldGV->isConstant(), in AddInitializerToStaticVarDecl()
382 OldGV->getLinkage(), Init, "", in AddInitializerToStaticVarDecl()
383 /*InsertBefore*/ OldGV, OldGV->getThreadLocalMode(), in AddInitializerToStaticVarDecl()
384 OldGV->getType()->getPointerAddressSpace()); in AddInitializerToStaticVarDecl()
385 GV->setVisibility(OldGV->getVisibility()); in AddInitializerToStaticVarDecl()
386 GV->setDSOLocal(OldGV->isDSOLocal()); in AddInitializerToStaticVarDecl()
387 GV->setComdat(OldGV->getComdat()); in AddInitializerToStaticVarDecl()
390 GV->takeName(OldGV); in AddInitializerToStaticVarDecl()
393 OldGV->replaceAllUsesWith(GV); in AddInitializerToStaticVarDecl()
396 OldGV->eraseFromParent(); in AddInitializerToStaticVarDecl()
402 GV->setConstant( in AddInitializerToStaticVarDecl()
404 GV->setInitializer(Init); in AddInitializerToStaticVarDecl()
421 // declaration. This can happen when double-emitting function in EmitStaticVarDecl()
434 if (D.getType()->isVariablyModifiedType()) in EmitStaticVarDecl()
438 llvm::Type *expectedType = addr->getType(); in EmitStaticVarDecl()
441 cast<llvm::GlobalVariable>(addr->stripPointerCasts()); in EmitStaticVarDecl()
444 // have any non-empty initializers. This is ensured by Sema. in EmitStaticVarDecl()
446 // a no-op and should not be emitted. in EmitStaticVarDecl()
453 var->setAlignment(alignment.getAsAlign()); in EmitStaticVarDecl()
459 var->addAttribute("bss-section", SA->getName()); in EmitStaticVarDecl()
461 var->addAttribute("data-section", SA->getName()); in EmitStaticVarDecl()
463 var->addAttribute("rodata-section", SA->getName()); in EmitStaticVarDecl()
465 var->addAttribute("relro-section", SA->getName()); in EmitStaticVarDecl()
468 var->setSection(SA->getName()); in EmitStaticVarDecl()
485 LocalDeclMap.find(&D)->second = Address(castedAddr, elemTy, alignment); in EmitStaticVarDecl()
488 CGM.getSanitizerMetadata()->reportGlobal(var, D); in EmitStaticVarDecl()
493 DI->setLocation(D.getLocation()); in EmitStaticVarDecl()
494 DI->EmitGlobalVariable(var, &D); in EmitStaticVarDecl()
514 flags.isForNormalCleanup() && this->useEHCleanupForArray; in Emit()
544 static_cast<Derived *>(this)->emitDestructorCall(CGF); in Emit()
635 QualType ArgTy = FnInfo.arg_begin()->type; in Emit()
648 /// EmitAutoVarWithLifetime - Does the setup required for an automatic
689 // hierarchy-walking expensive. in isAccessedBy()
690 s = e = e->IgnoreParenCasts(); in isAccessedBy()
693 return (ref->getDecl() == &var); in isAccessedBy()
695 const BlockDecl *block = be->getBlockDecl(); in isAccessedBy()
696 for (const auto &I : block->captures()) { in isAccessedBy()
703 for (const Stmt *SubStmt : s->children()) in isAccessedBy()
704 // SubStmt might be null; as in missing decl or conditional of an if-stmt. in isAccessedBy()
722 while (auto castExpr = dyn_cast<CastExpr>(init->IgnoreParens())) { in tryEmitARCCopyWeakInit()
723 switch (castExpr->getCastKind()) { in tryEmitARCCopyWeakInit()
731 // If we find an l-value to r-value cast from a __weak variable, in tryEmitARCCopyWeakInit()
734 const Expr *srcExpr = castExpr->getSubExpr(); in tryEmitARCCopyWeakInit()
735 if (srcExpr->getType().getObjCLifetime() != Qualifiers::OCL_Weak) in tryEmitARCCopyWeakInit()
738 // Emit the source l-value. in tryEmitARCCopyWeakInit()
741 // Handle a formal type change to avoid asserting. in tryEmitARCCopyWeakInit()
747 // If it was an l-value, use objc_copyWeak. in tryEmitARCCopyWeakInit()
748 if (srcExpr->isLValue()) { in tryEmitARCCopyWeakInit()
751 assert(srcExpr->isXValue()); in tryEmitARCCopyWeakInit()
762 init = castExpr->getSubExpr(); in tryEmitARCCopyWeakInit()
778 auto Nullability = LHS.getType()->getNullability(); in EmitNullabilityCheck()
801 EmitNullabilityCheck(lvalue, value, init->getExprLoc()); in EmitScalarInit()
807 init = DIE->getExpr(); in EmitScalarInit()
813 return EmitScalarInit(EWC->getSubExpr(), D, lvalue, capturedByInit); in EmitScalarInit()
817 // zero-initialized. If the variable might be accessed in its in EmitScalarInit()
818 // initializer, zero-initialize before running the initializer, then in EmitScalarInit()
854 if (!D || !isa<VarDecl>(D) || !cast<VarDecl>(D)->isARCPseudoStrong()) { in EmitScalarInit()
858 // If D is pseudo-strong, treat it like __unsafe_unretained here. This means in EmitScalarInit()
859 // that we omit the retain, and causes non-autoreleased return values to be in EmitScalarInit()
895 EmitNullabilityCheck(lvalue, value, init->getExprLoc()); in EmitScalarInit()
901 llvm::Value *oldValue = EmitLoadOfScalar(lvalue, init->getExprLoc()); in EmitScalarInit()
910 /// Decide whether we can emit the non-zero parts of the specified initializer
922 return Init->isNullValue() || NumStores--; in canEmitInitWithFewStoresAfterBZero()
926 for (unsigned i = 0, e = Init->getNumOperands(); i != e; ++i) { in canEmitInitWithFewStoresAfterBZero()
927 llvm::Constant *Elt = cast<llvm::Constant>(Init->getOperand(i)); in canEmitInitWithFewStoresAfterBZero()
936 for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) { in canEmitInitWithFewStoresAfterBZero()
937 llvm::Constant *Elt = CDS->getElementAsConstant(i); in canEmitInitWithFewStoresAfterBZero()
954 assert(!Init->isNullValue() && !isa<llvm::UndefValue>(Init) && in emitStoresForInitAfterBZero()
962 I->addAnnotationMetadata("auto-init"); in emitStoresForInitAfterBZero()
968 for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) { in emitStoresForInitAfterBZero()
969 llvm::Constant *Elt = CDS->getElementAsConstant(i); in emitStoresForInitAfterBZero()
972 if (!Elt->isNullValue() && !isa<llvm::UndefValue>(Elt)) in emitStoresForInitAfterBZero()
983 for (unsigned i = 0, e = Init->getNumOperands(); i != e; ++i) { in emitStoresForInitAfterBZero()
984 llvm::Constant *Elt = cast<llvm::Constant>(Init->getOperand(i)); in emitStoresForInitAfterBZero()
987 if (!Elt->isNullValue() && !isa<llvm::UndefValue>(Elt)) in emitStoresForInitAfterBZero()
1002 // If a non-zero global is <= 32 bytes, always use a memcpy. If it is large, in shouldUseBZeroPlusStoresToInitialize()
1066 for (unsigned i = 0, e = STy->getNumElements(); i != e; i++) { in constStructWithPadding()
1067 unsigned CurOff = Layout->getElementOffset(i); in constStructWithPadding()
1069 assert(!STy->isPacked()); in constStructWithPadding()
1070 auto *PadTy = llvm::ArrayType::get(Int8Ty, CurOff - SizeSoFar); in constStructWithPadding()
1074 if (constant->isZeroValue()) in constStructWithPadding()
1075 CurOp = llvm::Constant::getNullValue(STy->getElementType(i)); in constStructWithPadding()
1077 CurOp = cast<llvm::Constant>(constant->getAggregateElement(i)); in constStructWithPadding()
1082 SizeSoFar = CurOff + DL.getTypeAllocSize(CurOp->getType()); in constStructWithPadding()
1084 unsigned TotalSize = Layout->getSizeInBytes(); in constStructWithPadding()
1086 auto *PadTy = llvm::ArrayType::get(Int8Ty, TotalSize - SizeSoFar); in constStructWithPadding()
1089 if (NestedIntact && Values.size() == STy->getNumElements()) in constStructWithPadding()
1091 return llvm::ConstantStruct::getAnon(Values, STy->isPacked()); in constStructWithPadding()
1098 llvm::Type *OrigTy = constant->getType(); in constWithPadding()
1103 uint64_t Size = ArrayTy->getNumElements(); in constWithPadding()
1106 llvm::Type *ElemTy = ArrayTy->getElementType(); in constWithPadding()
1107 bool ZeroInitializer = constant->isNullValue(); in constWithPadding()
1115 OpValue = constant->getAggregateElement(Op); in constWithPadding()
1120 auto *NewElemTy = Values[0]->getType(); in constWithPadding()
1135 auto FunctionName = [&](const DeclContext *DC) -> std::string { in createUnnamedGlobalFrom()
1138 return CC->getNameAsString(); in createUnnamedGlobalFrom()
1140 return CD->getNameAsString(); in createUnnamedGlobalFrom()
1143 return OM->getNameAsString(); in createUnnamedGlobalFrom()
1153 // Form a simple per-variable cache of these values in case we find we in createUnnamedGlobalFrom()
1156 if (!CacheEntry || CacheEntry->getInitializer() != Constant) { in createUnnamedGlobalFrom()
1157 auto *Ty = Constant->getType(); in createUnnamedGlobalFrom()
1172 GV->setAlignment(Align.getAsAlign()); in createUnnamedGlobalFrom()
1173 GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global); in createUnnamedGlobalFrom()
1175 } else if (CacheEntry->getAlignment() < uint64_t(Align.getQuantity())) { in createUnnamedGlobalFrom()
1176 CacheEntry->setAlignment(Align.getAsAlign()); in createUnnamedGlobalFrom()
1179 return Address(CacheEntry, CacheEntry->getValueType(), Align); in createUnnamedGlobalFrom()
1195 auto *Ty = constant->getType(); in emitStoresForConstant()
1200 bool canDoSingleStore = Ty->isIntOrIntVectorTy() || in emitStoresForConstant()
1201 Ty->isPtrOrPtrVectorTy() || Ty->isFPOrFPVectorTy(); in emitStoresForConstant()
1205 I->addAnnotationMetadata("auto-init"); in emitStoresForConstant()
1217 I->addAnnotationMetadata("auto-init"); in emitStoresForConstant()
1220 constant->isNullValue() || isa<llvm::UndefValue>(constant); in emitStoresForConstant()
1235 const llvm::APInt &AP = cast<llvm::ConstantInt>(Pattern)->getValue(); in emitStoresForConstant()
1242 I->addAnnotationMetadata("auto-init"); in emitStoresForConstant()
1257 for (unsigned i = 0; i != constant->getNumOperands(); i++) { in emitStoresForConstant()
1259 CharUnits::fromQuantity(Layout->getElementOffset(i)); in emitStoresForConstant()
1263 constant->getAggregateElement(i), IsAutoInit); in emitStoresForConstant()
1270 for (unsigned i = 0; i != ATy->getNumElements(); i++) { in emitStoresForConstant()
1272 Loc.withElementType(ATy->getElementType()), i); in emitStoresForConstant()
1274 constant->getAggregateElement(i), IsAutoInit); in emitStoresForConstant()
1288 I->addAnnotationMetadata("auto-init"); in emitStoresForConstant()
1313 auto *Ty = constant->getType(); in containsUndef()
1316 if (Ty->isStructTy() || Ty->isArrayTy() || Ty->isVectorTy()) in containsUndef()
1317 for (llvm::Use &Op : constant->operands()) in containsUndef()
1325 auto *Ty = constant->getType(); in replaceUndef()
1328 if (!(Ty->isStructTy() || Ty->isArrayTy() || Ty->isVectorTy())) in replaceUndef()
1332 llvm::SmallVector<llvm::Constant *, 8> Values(constant->getNumOperands()); in replaceUndef()
1333 for (unsigned Op = 0, NumOp = constant->getNumOperands(); Op != NumOp; ++Op) { in replaceUndef()
1334 auto *OpValue = cast<llvm::Constant>(constant->getOperand(Op)); in replaceUndef()
1337 if (Ty->isStructTy()) in replaceUndef()
1339 if (Ty->isArrayTy()) in replaceUndef()
1341 assert(Ty->isVectorTy()); in replaceUndef()
1345 /// EmitAutoVarDecl - Emit code and set up an entry in LocalDeclMap for a
1362 assert(Addr->getType()->getPointerAddressSpace() == in EmitLifetimeStart()
1366 Int64Ty, Size.isScalable() ? -1 : Size.getFixedValue()); in EmitLifetimeStart()
1369 C->setDoesNotThrow(); in EmitLifetimeStart()
1374 assert(Addr->getType()->getPointerAddressSpace() == in EmitLifetimeEnd()
1379 C->setDoesNotThrow(); in EmitLifetimeEnd()
1385 // size-expression Value. in EmitAndRegisterVariableArrayDimensions()
1403 CreateDefaultAlignTempAlloca(VlaSize.NumElts->getType(), NameRef); in EmitAndRegisterVariableArrayDimensions()
1414 // Register each dimension's size-expression with a DILocalVariable, in EmitAndRegisterVariableArrayDimensions()
1426 SizeTy->getScalarSizeInBits(), false); in EmitAndRegisterVariableArrayDimensions()
1431 ArtificialDecl->setImplicit(); in EmitAndRegisterVariableArrayDimensions()
1433 MD = DI->EmitDeclareOfAutoVariable(ArtificialDecl, VlaSize.NumElts, in EmitAndRegisterVariableArrayDimensions()
1437 DI->registerVLASizeExpression(VlaSize.Type, MD); in EmitAndRegisterVariableArrayDimensions()
1441 /// EmitAutoVarAlloca - Emit the alloca and debug information for a
1457 // If the type is variably-modified, emit all the VLA sizes for it. in EmitAutoVarAlloca()
1458 if (Ty->isVariablyModifiedType()) in EmitAutoVarAlloca()
1480 } else if (Ty->isConstantSizeType()) { in EmitAutoVarAlloca()
1484 // TODO: We should constant-evaluate the initializer of any variable, in EmitAutoVarAlloca()
1488 // for POD-ness protects us from some of these. in EmitAutoVarAlloca()
1489 if (D.getInit() && (Ty->isArrayType() || Ty->isRecordType()) && in EmitAutoVarAlloca()
1492 getContext().getBaseElementType(Ty)->isObjCObjectPointerType()) && in EmitAutoVarAlloca()
1493 D.getInit()->isConstantInitializer(getContext(), false)))) { in EmitAutoVarAlloca()
1498 // Exception is if a variable is located in non-constant address space in EmitAutoVarAlloca()
1521 // - it's an NRVO variable. in EmitAutoVarAlloca()
1522 // - we are compiling OpenMP and it's an OpenMP local variable. in EmitAutoVarAlloca()
1533 if (const RecordType *RecordTy = Ty->getAs<RecordType>()) { in EmitAutoVarAlloca()
1534 const auto *RD = RecordTy->getDecl(); in EmitAutoVarAlloca()
1536 if ((CXXRD && !CXXRD->hasTrivialDestructor()) || in EmitAutoVarAlloca()
1537 RD->isNonTrivialToPrimitiveDestroy()) { in EmitAutoVarAlloca()
1543 CreateTempAlloca(Zero->getType(), CharUnits::One(), "nrvo"); in EmitAutoVarAlloca()
1565 // building the instruction so that it's there even in no-asserts in EmitAutoVarAlloca()
1587 // earlier point in the current block because non-VLA lifetimes begin as in EmitAutoVarAlloca()
1641 assert(V->getType() == AllocaInt8PtrTy); in EmitAutoVarAlloca()
1673 DI->setLocation(D.getLocation()); in EmitAutoVarAlloca()
1680 (void)DI->EmitDeclareOfAutoVariable(&D, AllocaAddr.getPointer(), Builder, in EmitAutoVarAlloca()
1703 for (const Stmt *SubStmt : S->children()) in isCapturedBy()
1713 // hierarchy-walking expensive. in isCapturedBy()
1714 E = E->IgnoreParenCasts(); in isCapturedBy()
1717 const BlockDecl *Block = BE->getBlockDecl(); in isCapturedBy()
1718 for (const auto &I : Block->captures()) { in isCapturedBy()
1728 const CompoundStmt *CS = SE->getSubStmt(); in isCapturedBy()
1729 for (const auto *BI : CS->body()) in isCapturedBy()
1736 for (const auto *I : DS->decls()) { in isCapturedBy()
1738 const Expr *Init = VD->getInit(); in isCapturedBy()
1751 for (const Stmt *SubStmt : E->children()) in isCapturedBy()
1765 if (CXXConstructorDecl *Constructor = Construct->getConstructor()) in isTrivialInitializer()
1766 if (Constructor->isTrivial() && in isTrivialInitializer()
1767 Constructor->isDefaultConstructor() && in isTrivialInitializer()
1768 !Construct->requiresZeroInitialization()) in isTrivialInitializer()
1783 // We skip auto-init variables by their alloc size. Take this as an example: in emitZeroOrPatternForAutoVarInit()
1784 // "struct Foo {int x; char buff[1024];}" Assume the max-size flag is 1023. in emitZeroOrPatternForAutoVarInit()
1786 // array and still auto-init X in this example. in emitZeroOrPatternForAutoVarInit()
1812 // VLAs look zero-sized to getTypeInfo. We can't emit constant stores to in emitZeroOrPatternForAutoVarInit()
1814 // Technically zero-sized or negative-sized VLAs are undefined, and UBSan in emitZeroOrPatternForAutoVarInit()
1815 // will catch that code, but there exists code which generates zero-sized in emitZeroOrPatternForAutoVarInit()
1834 I->addAnnotationMetadata("auto-init"); in emitZeroOrPatternForAutoVarInit()
1845 llvm::BasicBlock *SetupBB = createBasicBlock("vla-setup.loop"); in emitZeroOrPatternForAutoVarInit()
1846 llvm::BasicBlock *LoopBB = createBasicBlock("vla-init.loop"); in emitZeroOrPatternForAutoVarInit()
1847 llvm::BasicBlock *ContBB = createBasicBlock("vla-init.cont"); in emitZeroOrPatternForAutoVarInit()
1849 SizeVal, llvm::ConstantInt::get(SizeVal->getType(), 0), in emitZeroOrPatternForAutoVarInit()
1864 Cur->addIncoming(Begin.emitRawPointer(*this), OriginBB); in emitZeroOrPatternForAutoVarInit()
1871 I->addAnnotationMetadata("auto-init"); in emitZeroOrPatternForAutoVarInit()
1874 llvm::Value *Done = Builder.CreateICmpEQ(Next, End, "vla-init.isdone"); in emitZeroOrPatternForAutoVarInit()
1876 Cur->addIncoming(Next, LoopBB); in emitZeroOrPatternForAutoVarInit()
1907 // C struct that is non-trivial to initialize or an array containing such a in EmitAutoVarInit()
1957 if (constant && !constant->isZeroValue() && in EmitAutoVarInit()
1964 // C guarantees that brace-init with fewer initializers than members in in EmitAutoVarInit()
1965 // the aggregate will initialize the rest of the aggregate as-if it were in EmitAutoVarInit()
1967 // padding is initialized to zero bits. We could instead pattern-init if D in EmitAutoVarInit()
1974 if (D.getType()->isBitIntType() && in EmitAutoVarInit()
1980 D.getType(), constant->getType()); in EmitAutoVarInit()
1990 // - If D is not a scalar, auto-var-init conservatively (members may be in EmitAutoVarInit()
1992 // - If D is a scalar, we only need to auto-var-init if there is a in EmitAutoVarInit()
1993 // self-reference. Otherwise, the Init expression should be sufficient. in EmitAutoVarInit()
1995 // but auto-var-init here would not help, as auto-init would get in EmitAutoVarInit()
1997 if (!D.getType()->isScalarType() || capturedByInit || in EmitAutoVarInit()
2031 QualType type = D->getType(); in EmitExprAsInit()
2033 if (type->isReferenceType()) { in EmitExprAsInit()
2052 if (type->isAtomicType()) { in EmitExprAsInit()
2082 QualType type = var->getType(); in emitAutoVarTypeCleanup()
2089 llvm_unreachable("no cleanup for trivially-destructible variable"); in emitAutoVarTypeCleanup()
2095 assert(!type->isArrayType()); in emitAutoVarTypeCleanup()
2096 CXXDestructorDecl *dtor = type->getAsCXXRecordDecl()->getDestructor(); in emitAutoVarTypeCleanup()
2104 // Suppress cleanups for pseudo-strong variables. in emitAutoVarTypeCleanup()
2105 if (var->isARCPseudoStrong()) return; in emitAutoVarTypeCleanup()
2111 if (!var->hasAttr<ObjCPreciseLifetimeAttr>()) in emitAutoVarTypeCleanup()
2121 assert(!type->isArrayType()); in emitAutoVarTypeCleanup()
2163 const FunctionDecl *FD = CA->getFunctionDecl(); in EmitAutoVarCleanups()
2173 // (on the unforwarded address). Don't enter this cleanup if we're in pure-GC in EmitAutoVarCleanups()
2178 if (emission.Variable->getType().isObjCGCWeak()) in EmitAutoVarCleanups()
2182 cxxDestructorCanThrow(emission.Variable->getType())); in EmitAutoVarCleanups()
2202 /// pushEHDestroy - Push the standard destructor for the given type as
2203 /// an EH-only cleanup.
2212 /// pushDestroy - Push the standard destructor for the given type as
2270 // Add the cleanup to the EHStack. After the full-expr, this would be in pushLifetimeExtendedDestroy()
2275 // Since this is lifetime-extended, push it once again to the EHStack after in pushLifetimeExtendedDestroy()
2289 // Remember to emit cleanup if we branch-out before end of full-expression in pushLifetimeExtendedDestroy()
2290 // (eg: through stmt-expr or coro suspensions). in pushLifetimeExtendedDestroy()
2301 // Since this is lifetime-extended, push it once again to the EHStack after in pushLifetimeExtendedDestroy()
2304 // deactivation. Use a separate flag for lifetime-extension to correctly in pushLifetimeExtendedDestroy()
2312 /// emitDestroy - Immediately perform the destruction of the given
2315 /// \param addr - the address of the object; a type*
2316 /// \param type - the type of the object; if an array type, all
2318 /// \param destroyer - the function to call to destroy individual
2320 /// \param useEHCleanupForArray - whether an EH cleanup should be
2336 // Normally we have to check whether the array is zero-length. in emitDestroy()
2342 if (constLength->isZero()) return; in emitDestroy()
2353 /// emitArrayDestroy - Destroys all the elements of the given array,
2354 /// beginning from last to first. The array cannot be zero-length.
2356 /// \param begin - a type* denoting the first element of the array
2357 /// \param end - a type* denoting one past the end of the array
2358 /// \param elementType - the element type of the array
2359 /// \param destroyer - the function to call to destroy elements
2360 /// \param useEHCleanup - whether to push an EH cleanup to destroy
2370 assert(!elementType->isArrayType()); in emitArrayDestroy()
2372 // The basic structure here is a do-while loop, because we don't in emitArrayDestroy()
2373 // need to check for the zero-element case. in emitArrayDestroy()
2387 Builder.CreatePHI(begin->getType(), 2, "arraydestroy.elementPast"); in emitArrayDestroy()
2388 elementPast->addIncoming(end, entryBB); in emitArrayDestroy()
2391 llvm::Value *negativeOne = llvm::ConstantInt::get(SizeTy, -1, true); in emitArrayDestroy()
2410 elementPast->addIncoming(element, Builder.GetInsertBlock()); in emitArrayDestroy()
2430 type = arrayType->getElementType(); in emitPartialArrayDestroy()
2451 /// RegularPartialArrayDestroy - a cleanup which performs a partial
2474 /// IrregularPartialArrayDestroy - a cleanup which performs a
2501 /// pushIrregularPartialArrayCleanup - Push a NormalAndEHCleanup to
2502 /// destroy already-constructed elements of the given array. The cleanup may be
2505 /// \param elementType - the immediate element type of the array;
2517 /// pushRegularPartialArrayCleanup - Push an EH cleanup to destroy
2518 /// already-constructed elements of the given array. The cleanup
2521 /// \param elementType - the immediate element type of the array;
2583 Arg.getAnyValue()->setName(D.getName()); in EmitParmDecl()
2601 (IPD->getParameterKind() == ImplicitParamKind::ThreadPrivateVar); in EmitParmDecl()
2620 // For truly ABI indirect arguments -- those that are not `byval` -- store in EmitParmDecl()
2622 ABIArgInfo ArgInfo = CurFnInfo->arguments()[ArgNo - 1].info; in EmitParmDecl()
2649 if (Ty->isRecordType() && !CurFuncIsThunk && in EmitParmDecl()
2650 Ty->castAs<RecordType>()->getDecl()->isParamDestroyedInCallee()) { in EmitParmDecl()
2690 // If a parameter is pseudo-strong then we can omit the implicit retain. in EmitParmDecl()
2693 "pseudo-strong variable isn't strong?"); in EmitParmDecl()
2694 assert(qs.hasConst() && "pseudo-strong variable should be const!"); in EmitParmDecl()
2745 // Emit debug info for param declarations in non-thunk functions. in EmitParmDecl()
2749 llvm::DILocalVariable *DILocalVar = DI->EmitDeclareOfArgVariable( in EmitParmDecl()
2752 DI->getParamDbgMappings().insert({Var, DILocalVar}); in EmitParmDecl()
2763 auto Nullability = Ty->getNullability(); in EmitParmDecl()
2775 if (!LangOpts.OpenMP || (!LangOpts.EmitAllDecls && !D->isUsed())) in EmitOMPDeclareReduction()
2783 (!LangOpts.EmitAllDecls && !D->isUsed())) in EmitOMPDeclareMapper()
2793 for (const Expr *E : D->varlists()) { in EmitOMPAllocateDecl()
2794 const auto *DE = cast<DeclRefExpr>(E); in EmitOMPAllocateDecl() local
2795 const auto *VD = cast<VarDecl>(DE->getDecl()); in EmitOMPAllocateDecl()
2798 if (!VD->hasGlobalStorage()) in EmitOMPAllocateDecl()
2815 QualType ASTTy = VD->getType(); in EmitOMPAllocateDecl()
2818 if (Entry->getType()->getAddressSpace() == TargetAS) in EmitOMPAllocateDecl()
2829 getModule(), Entry->getValueType(), false, in EmitOMPAllocateDecl()
2831 llvm::GlobalVariable::NotThreadLocal, Entry->getAddressSpace()); in EmitOMPAllocateDecl()
2832 Entry->replaceAllUsesWith(DummyGV); in EmitOMPAllocateDecl()
2834 Entry->mutateType(PTy); in EmitOMPAllocateDecl()
2837 Entry, DummyGV->getType()); in EmitOMPAllocateDecl()
2841 DummyGV->replaceAllUsesWith(NewPtrForOldDecl); in EmitOMPAllocateDecl()
2842 DummyGV->eraseFromParent(); in EmitOMPAllocateDecl()
2848 if (const auto *AA = VD->getAttr<OMPAllocateDeclAttr>()) { in getOMPAllocateAlignment()
2849 if (Expr *Alignment = AA->getAlignment()) { in getOMPAllocateAlignment()
2851 Alignment->EvaluateKnownConstInt(getContext()).getExtValue(); in getOMPAllocateAlignment()
2853 getNaturalTypeAlignment(VD->getType().getNonReferenceType()); in getOMPAllocateAlignment()
2855 // OpenMP5.1 pg 185 lines 7-10 in getOMPAllocateAlignment()