Lines Matching +full:zero +full:- +full:initialised

1 //===--- Pointer.cpp - Types for the constexpr VM ---------------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
25 : Pointer(Pointee, Pointee->getDescriptor()->getMetadataSize(), in Pointer()
26 Pointee->getDescriptor()->getMetadataSize()) {} in Pointer()
36 PointeeStorage.BS.Pointee->addPointer(this); in Pointer()
46 Pointee->addPointer(this); in Pointer()
54 PointeeStorage.BS.Pointee->replacePointer(&P, this); in Pointer()
62 Pointee->removePointer(this); in ~Pointer()
63 Pointee->cleanup(); in ~Pointer()
74 PointeeStorage.BS.Pointee->removePointer(this); in operator =()
75 Old->cleanup(); in operator =()
87 PointeeStorage.BS.Pointee->addPointer(this); in operator =()
102 PointeeStorage.BS.Pointee->removePointer(this); in operator =()
103 Old->cleanup(); in operator =()
115 PointeeStorage.BS.Pointee->addPointer(this); in operator =()
127 return APValue(static_cast<const Expr *>(nullptr), CharUnits::Zero(), Path, in toAPValue()
131 CharUnits::fromQuantity(asIntPointer().Value + this->Offset), in toAPValue()
138 if (const auto *VD = Desc->asValueDecl()) in toAPValue()
140 else if (const auto *E = Desc->asExpr()) in toAPValue()
145 if (isUnknownSizeArray() || Desc->asExpr()) in toAPValue()
146 return APValue(Base, CharUnits::Zero(), Path, in toAPValue()
149 CharUnits Offset = CharUnits::Zero(); in toAPValue()
151 auto getFieldOffset = [&](const FieldDecl *FD) -> CharUnits { in toAPValue()
154 if (FD->getParent()->isInvalidDecl()) in toAPValue()
155 return CharUnits::Zero(); in toAPValue()
156 const ASTRecordLayout &Layout = ASTCtx.getASTRecordLayout(FD->getParent()); in toAPValue()
157 unsigned FieldIndex = FD->getFieldIndex(); in toAPValue()
166 {Ptr.getFieldDesc()->asDecl(), /*IsVirtual=*/false})); in toAPValue()
168 if (const auto *FD = dyn_cast<FieldDecl>(Ptr.getFieldDesc()->asDecl())) in toAPValue()
187 if (const auto *BaseOrMember = Desc->asDecl()) { in toAPValue()
197 cast<CXXRecordDecl>(BaseRecord->getDecl())); in toAPValue()
245 OS << B->getSize(); in print()
271 *reinterpret_cast<const GlobalInlineDescriptor *>(block()->rawData()); in isInitialized()
279 if (Desc->isPrimitiveArray()) { in isInitialized()
288 if (IM->first) in isInitialized()
291 return IM->second->isElementInitialized(getIndex()); in isInitialized()
298 return getInlineDesc()->IsInitialized; in isInitialized()
310 asBlockPointer().Pointee->rawData()); in initialize()
316 if (Desc->isPrimitiveArray()) { in initialize()
322 if (Desc->getNumElems() == 0) in initialize()
328 std::make_pair(false, std::make_shared<InitMap>(Desc->getNumElems())); in initialize()
333 if (IM->first) in initialize()
336 if (IM->second->initializeElement(getIndex())) { in initialize()
337 IM->first = true; in initialize()
338 IM->second.reset(); in initialize()
345 "Only composite fields can be initialised"); in initialize()
346 getInlineDesc()->IsInitialized = true; in initialize()
352 "Only composite fields can be initialised"); in activate()
357 getInlineDesc()->IsActive = true; in activate()
381 A.getFieldDesc()->IsArray; in hasSameArray()
392 if (const auto *AT = Ty->getAs<AtomicType>()) in toRValue()
393 Ty = AT->getValueType(); in toRValue()
406 if (const auto *RT = Ty->getAs<RecordType>()) { in toRValue()
411 if (RT->getDecl()->isUnion()) { in toRValue()
414 for (const auto &F : Record->fields()) { in toRValue()
416 QualType FieldTy = F.Decl->getType(); in toRValue()
423 ActiveField = FP.getFieldDesc()->asFieldDecl(); in toRValue()
429 unsigned NF = Record->getNumFields(); in toRValue()
430 unsigned NB = Record->getNumBases(); in toRValue()
431 unsigned NV = Ptr.isBaseClass() ? 0 : Record->getNumVirtualBases(); in toRValue()
436 const Record::Field *FD = Record->getField(I); in toRValue()
437 QualType FieldTy = FD->Decl->getType(); in toRValue()
438 const Pointer &FP = Ptr.atField(FD->Offset); in toRValue()
449 const Record::Base *BD = Record->getBase(I); in toRValue()
450 QualType BaseTy = Ctx.getASTContext().getRecordType(BD->Decl); in toRValue()
451 const Pointer &BP = Ptr.atField(BD->Offset); in toRValue()
456 const Record::Base *VD = Record->getVirtualBase(I); in toRValue()
457 QualType VirtBaseTy = Ctx.getASTContext().getRecordType(VD->Decl); in toRValue()
458 const Pointer &VP = Ptr.atField(VD->Offset); in toRValue()
465 if (Ty->isIncompleteArrayType()) { in toRValue()
470 if (const auto *AT = Ty->getAsArrayTypeUnsafe()) { in toRValue()
472 QualType ElemTy = AT->getElementType(); in toRValue()
489 if (const auto *CT = Ty->getAs<ComplexType>()) { in toRValue()
490 QualType ElemTy = CT->getElementType(); in toRValue()
492 if (ElemTy->isIntegerType()) { in toRValue()
501 } else if (ElemTy->isFloatingType()) { in toRValue()
510 if (const auto *VT = Ty->getAs<VectorType>()) { in toRValue()
511 assert(Ptr.getFieldDesc()->isPrimitiveArray()); in toRValue()
512 QualType ElemTy = VT->getElementType(); in toRValue()
516 Values.reserve(VT->getNumElements()); in toRValue()
517 for (unsigned I = 0; I != VT->getNumElements(); ++I) { in toRValue()
523 assert(Values.size() == VT->getNumElements()); in toRValue()
541 TYPE_SWITCH(*T, return this->deref<T>().toAPValue(ASTCtx)); in toRValue()