Lines Matching +full:id +full:- +full:base

1 //===- DeclCXX.cpp - C++ Declaration AST Node Implementation --------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
54 //===----------------------------------------------------------------------===//
56 //===----------------------------------------------------------------------===//
61 GlobalDeclID ID) { in CreateDeserialized() argument
62 return new (C, ID) AccessSpecDecl(EmptyShell()); in CreateDeserialized()
67 assert(Impl.Decls.isLazy() && "getFromExternalSource for non-lazy set"); in getFromExternalSource()
72 cast<NamedDecl>(Source->GetExternalDecl(GlobalDeclID(I.getDeclID())))); in getFromExternalSource()
117 return Bases.get(Definition->getASTContext().getExternalSource()); in getBasesSlowCase()
121 return VBases.get(Definition->getASTContext().getExternalSource()); in getVBasesSlowCase()
126 SourceLocation IdLoc, IdentifierInfo *Id, in CXXRecordDecl() argument
128 : RecordDecl(K, TK, C, DC, StartLoc, IdLoc, Id, PrevDecl), in CXXRecordDecl()
129 DefinitionData(PrevDecl ? PrevDecl->DefinitionData in CXXRecordDecl()
134 SourceLocation IdLoc, IdentifierInfo *Id, in Create() argument
137 auto *R = new (C, DC) CXXRecordDecl(CXXRecord, TK, C, DC, StartLoc, IdLoc, Id, in Create()
139 R->setMayHaveOutOfDateDef(C.getLangOpts().Modules); in Create()
154 R->setBeingDefined(true); in CreateLambda()
155 R->DefinitionData = new (C) struct LambdaDefinitionData( in CreateLambda()
157 R->setMayHaveOutOfDateDef(false); in CreateLambda()
158 R->setImplicit(true); in CreateLambda()
165 GlobalDeclID ID) { in CreateDeserialized() argument
166 auto *R = new (C, ID) in CreateDeserialized()
169 R->setMayHaveOutOfDateDef(false); in CreateDeserialized()
173 /// Determine whether a class has a repeated base class. This is intended for
174 /// use when determining if a class is standard-layout, so makes no attempt to
181 if (RD->getTypeForDecl()->isDependentType()) in hasRepeatedBaseClass()
183 for (const CXXBaseSpecifier &BaseSpec : RD->bases()) { in hasRepeatedBaseClass()
184 if (const CXXRecordDecl *B = BaseSpec.getType()->getAsCXXRecordDecl()) { in hasRepeatedBaseClass()
205 // An aggregate is [...] a class with [...] no base classes [...]. in setBases()
210 // A POD-struct is an aggregate class... in setBases()
214 // The set of seen virtual base types. in setBases()
224 // Keep track of inherited vbases for this base class. in setBases()
225 const CXXBaseSpecifier *Base = Bases[i]; in setBases() local
226 QualType BaseType = Base->getType(); in setBases()
228 if (BaseType->isDependentType()) in setBases()
231 cast<CXXRecordDecl>(BaseType->castAs<RecordType>()->getDecl()); in setBases()
234 // A standard-layout class is a class that: in setBases()
236 // -- has all non-static data members and bit-fields in the class and in setBases()
237 // its base classes first declared in the same class in setBases()
238 if (BaseClassDecl->data().HasBasesWithFields || in setBases()
239 !BaseClassDecl->field_empty()) { in setBases()
241 // Two bases have members or bit-fields: not standard-layout. in setBases()
247 // A standard-layout class is a class that: in setBases()
248 // -- [...] has [...] at most one base class with non-static data in setBases()
250 if (BaseClassDecl->data().HasBasesWithNonStaticDataMembers || in setBases()
251 BaseClassDecl->hasDirectFields()) { in setBases()
257 if (!BaseClassDecl->isEmpty()) { in setBases()
259 // T is a class type [...] with [...] no base class B for which in setBases()
265 // An aggregate is a class with [...] no private or protected base classes in setBases()
266 if (Base->getAccessSpecifier() != AS_public) { in setBases()
270 // A structural type is [...] a literal class type with [...] all base in setBases()
278 if (BaseClassDecl->isPolymorphic()) { in setBases()
286 // A standard-layout class is a class that: [...] in setBases()
287 // -- has no non-standard-layout base classes in setBases()
288 if (!BaseClassDecl->isStandardLayout()) in setBases()
290 if (!BaseClassDecl->isCXX11StandardLayout()) in setBases()
293 // Record if this base is the first non-literal field or base. in setBases()
294 if (!hasNonLiteralTypeFieldsOrBases() && !BaseType->isLiteralType(C)) in setBases()
297 // Now go through all virtual bases of this base and add them. in setBases()
298 for (const auto &VBase : BaseClassDecl->vbases()) { in setBases()
299 // Add this base if it's not already in the list. in setBases()
304 // The implicitly-declared copy constructor for a class X will have in setBases()
305 // the form 'X::X(const X&)' if each [...] virtual base class B of X in setBases()
308 if (CXXRecordDecl *VBaseDecl = VBase.getType()->getAsCXXRecordDecl()) in setBases()
309 if (!VBaseDecl->hasCopyConstructorWithConstParam()) in setBases()
313 // An aggregate is a class with [...] no virtual base classes in setBases()
318 if (Base->isVirtual()) { in setBases()
319 // Add this base if it's not already in the list. in setBases()
321 VBases.push_back(Base); in setBases()
324 // T is a class type, but not a union type, with ... no virtual base in setBases()
329 // An aggregate is a class with [...] no virtual base classes in setBases()
335 // -- class X has [...] no virtual base classes in setBases()
340 // A standard-layout class is a class that: [...] in setBases()
341 // -- has [...] no virtual base classes in setBases()
347 // -- if the function is a constructor or destructor, in setBases()
348 // its class shall not have any virtual base classes in setBases()
353 // The implicitly-declared copy constructor for a class X will have in setBases()
357 if (!BaseClassDecl->hasCopyConstructorWithConstParam()) in setBases()
362 // -- all the direct base classes of its class have trivial default in setBases()
364 if (!BaseClassDecl->hasTrivialDefaultConstructor()) in setBases()
370 // -- the constructor selected to copy/move each direct base class in setBases()
372 if (!BaseClassDecl->hasTrivialCopyConstructor()) in setBases()
375 if (!BaseClassDecl->hasTrivialCopyConstructorForCall()) in setBases()
378 // If the base class doesn't have a simple move constructor, we'll eagerly in setBases()
382 if (!BaseClassDecl->hasTrivialMoveConstructor()) in setBases()
385 if (!BaseClassDecl->hasTrivialMoveConstructorForCall()) in setBases()
391 // -- the assignment operator selected to copy/move each direct base in setBases()
393 if (!BaseClassDecl->hasTrivialCopyAssignment()) in setBases()
395 // If the base class doesn't have a simple move assignment, we'll eagerly in setBases()
399 if (!BaseClassDecl->hasTrivialMoveAssignment()) in setBases()
403 // If that user-written default constructor would satisfy the in setBases()
405 // implicitly-defined default constructor is constexpr. in setBases()
406 if (!BaseClassDecl->hasConstexprDefaultConstructor()) in setBases()
411 // The implicitly-declared copy constructor for a class X will have in setBases()
415 if (!BaseClassDecl->hasCopyConstructorWithConstParam()) in setBases()
420 // A destructor is trivial if all the direct base classes of its class in setBases()
422 if (!BaseClassDecl->hasTrivialDestructor()) in setBases()
425 if (!BaseClassDecl->hasTrivialDestructorForCall()) in setBases()
428 if (!BaseClassDecl->hasIrrelevantDestructor()) in setBases()
431 if (BaseClassDecl->isAnyDestructorNoReturn()) in setBases()
435 // The implicitly-declared copy assignment operator for a class X will in setBases()
436 // have the form 'X& X::operator=(const X&)' if each direct base class B in setBases()
439 if (!BaseClassDecl->hasCopyAssignmentWithConstParam()) in setBases()
442 // A class has an Objective-C object member if... or any of its bases in setBases()
443 // has an Objective-C object member. in setBases()
444 if (BaseClassDecl->hasObjectMember()) in setBases()
447 if (BaseClassDecl->hasVolatileMember()) in setBases()
450 if (BaseClassDecl->getArgPassingRestrictions() == in setBases()
455 if (BaseClassDecl->hasMutableFields()) in setBases()
458 if (BaseClassDecl->hasUninitializedReferenceMember()) in setBases()
461 if (!BaseClassDecl->allowConstDefaultInit()) in setBases()
468 // A class S is a standard-layout class if it: in setBases()
469 // -- has at most one base class subobject of any given type in setBases()
471 // Note that we only need to check this for classes with more than one base in setBases()
472 // class. If there's only one base class, and it's standard layout, then in setBases()
473 // we know there are no repeated base classes. in setBases()
482 // Create base specifier for any direct or indirect virtual bases. in setBases()
486 QualType Type = VBases[I]->getType(); in setBases()
487 if (!Type->isDependentType()) in setBases()
488 addedClassSubobject(Type->getAsCXXRecordDecl()); in setBases()
499 if (DefinitionData->HasODRHash) in getODRHash()
500 return DefinitionData->ODRHash; in getODRHash()
505 DefinitionData->HasODRHash = true; in getODRHash()
506 DefinitionData->ODRHash = Hash.CalculateHash(); in getODRHash()
508 return DefinitionData->ODRHash; in getODRHash()
515 // -- a direct or virtual base class B that cannot be copied/moved [...] in addedClassSubobject()
516 // -- a non-static data member of class type M (or array thereof) in addedClassSubobject()
518 if (!Subobj->hasSimpleCopyConstructor()) in addedClassSubobject()
520 if (!Subobj->hasSimpleMoveConstructor()) in addedClassSubobject()
526 // -- a direct or virtual base class B that cannot be copied/moved [...] in addedClassSubobject()
527 // -- a non-static data member of class type M (or array thereof) in addedClassSubobject()
529 if (!Subobj->hasSimpleCopyAssignment()) in addedClassSubobject()
531 if (!Subobj->hasSimpleMoveAssignment()) in addedClassSubobject()
537 // -- any direct or virtual base class [...] has a type with a destructor in addedClassSubobject()
539 // -- any non-static data member has a type with a destructor in addedClassSubobject()
541 if (!Subobj->hasSimpleDestructor()) { in addedClassSubobject()
550 // -- for every subobject of class type or (possibly multi-dimensional) in addedClassSubobject()
552 if (!Subobj->hasConstexprDestructor()) in addedClassSubobject()
558 // of all base classes and non-static data members are structural types or in addedClassSubobject()
559 // (possibly multi-dimensional) array thereof in addedClassSubobject()
560 if (!Subobj->data().StructuralIfLiteral) in addedClassSubobject()
567 "getStandardLayoutBaseWithFields called on a non-standard-layout type"); in getStandardLayoutBaseWithFields()
574 forallBases([&](const CXXRecordDecl *Base) -> bool { in getStandardLayoutBaseWithFields() argument
575 if (!Base->field_empty()) in getStandardLayoutBaseWithFields()
578 UniqueBases.insert(Base->getCanonicalDecl()).second && in getStandardLayoutBaseWithFields()
579 "Standard layout struct has multiple base classes of the same type"); in getStandardLayoutBaseWithFields()
589 forallBases([&](const CXXRecordDecl *Base) -> bool { in getStandardLayoutBaseWithFields() argument
590 if (!Base->field_empty()) { in getStandardLayoutBaseWithFields()
591 // This is the base where the fields are declared; return early in getStandardLayoutBaseWithFields()
592 Result = Base; in getStandardLayoutBaseWithFields()
602 return Dtor ? Dtor->isConstexpr() : defaultedDestructorIsConstexpr(); in hasConstexprDestructor()
615 // -- has no non-trivial copy constructors, in isTriviallyCopyable()
617 // -- has no non-trivial move constructors, in isTriviallyCopyable()
619 // -- has no non-trivial copy assignment operators, in isTriviallyCopyable()
621 // -- has no non-trivial move assignment operators, and in isTriviallyCopyable()
623 // -- has a trivial destructor. in isTriviallyCopyable()
632 // -- has no non-trivial copy constructors, in isTriviallyCopyConstructible()
635 // -- has a trivial destructor. in isTriviallyCopyConstructible()
658 auto Visit = [&](const CXXRecordDecl *RD) -> bool { in hasSubobjectAtOffsetZeroOfEmptyBaseType()
659 RD = RD->getCanonicalDecl(); in hasSubobjectAtOffsetZeroOfEmptyBaseType()
662 // A class S is a standard-layout class if it [...] has no element of the in hasSubobjectAtOffsetZeroOfEmptyBaseType()
663 // set M(S) of types as a base class. in hasSubobjectAtOffsetZeroOfEmptyBaseType()
665 // If we find a subobject of an empty type, it might also be a base class, in hasSubobjectAtOffsetZeroOfEmptyBaseType()
666 // so we'll need to walk the base classes to check. in hasSubobjectAtOffsetZeroOfEmptyBaseType()
667 if (!RD->data().HasBasesWithFields) { in hasSubobjectAtOffsetZeroOfEmptyBaseType()
671 bool RDIsBase = !forallBases([&](const CXXRecordDecl *Base) -> bool { in hasSubobjectAtOffsetZeroOfEmptyBaseType() argument
672 Base = Base->getCanonicalDecl(); in hasSubobjectAtOffsetZeroOfEmptyBaseType()
673 if (RD == Base) in hasSubobjectAtOffsetZeroOfEmptyBaseType()
675 Bases.insert(Base); in hasSubobjectAtOffsetZeroOfEmptyBaseType()
700 // -- If X is a non-union class type with a non-static data member in hasSubobjectAtOffsetZeroOfEmptyBaseType()
702 // first non-static data member of X in hasSubobjectAtOffsetZeroOfEmptyBaseType()
703 // -- If X is a union type, [recurse to union members] in hasSubobjectAtOffsetZeroOfEmptyBaseType()
705 for (auto *FD : X->fields()) { in hasSubobjectAtOffsetZeroOfEmptyBaseType()
706 // FIXME: Should we really care about the type of the first non-static in hasSubobjectAtOffsetZeroOfEmptyBaseType()
707 // data member of a non-union if there are preceding unnamed bit-fields? in hasSubobjectAtOffsetZeroOfEmptyBaseType()
708 if (FD->isUnnamedBitField()) in hasSubobjectAtOffsetZeroOfEmptyBaseType()
711 if (!IsFirstField && !FD->isZeroSize(Ctx)) in hasSubobjectAtOffsetZeroOfEmptyBaseType()
714 if (FD->isInvalidDecl()) in hasSubobjectAtOffsetZeroOfEmptyBaseType()
717 // -- If X is n array type, [visit the element type] in hasSubobjectAtOffsetZeroOfEmptyBaseType()
718 QualType T = Ctx.getBaseElementType(FD->getType()); in hasSubobjectAtOffsetZeroOfEmptyBaseType()
719 if (auto *RD = T->getAsCXXRecordDecl()) in hasSubobjectAtOffsetZeroOfEmptyBaseType()
723 if (!X->isUnion()) in hasSubobjectAtOffsetZeroOfEmptyBaseType()
735 // The closure type associated with a lambda-expression has no default in lambdaIsDefaultConstructibleAndAssignable()
736 // constructor if the lambda-expression has a lambda-capture and a in lambdaIsDefaultConstructibleAndAssignable()
738 // assignment operator if the lambda-expression has a lambda-capture and in lambdaIsDefaultConstructibleAndAssignable()
742 // The closure type associated with a lambda-expression has no default in lambdaIsDefaultConstructibleAndAssignable()
750 if (!D->isImplicit() && !isa<FieldDecl>(D) && !isa<IndirectFieldDecl>(D) && in addedMember()
752 cast<TagDecl>(D)->getTagKind() == TagTypeKind::Class || in addedMember()
753 cast<TagDecl>(D)->getTagKind() == TagTypeKind::Interface)) in addedMember()
757 if (D->getFriendObjectKind() || D->isInvalidDecl()) in addedMember()
762 D = FunTmpl->getTemplatedDecl(); in addedMember()
767 DUnderlying = ND->getUnderlyingDecl(); in addedMember()
769 DUnderlying = UnderlyingFunTmpl->getTemplatedDecl(); in addedMember()
773 if (Method->isVirtual()) { in addedMember()
779 // A POD-struct is an aggregate class... in addedMember()
794 // -- class X has no virtual functions [...] in addedMember()
799 // A standard-layout class is a class that: [...] in addedMember()
800 // -- has no virtual functions in addedMember()
808 if (!isBeingDefined() && D->isImplicit()) in addedMember()
810 L->AddedCXXImplicitMember(data().Definition, D); in addedMember()
817 if (Constructor->isInheritingConstructor()) { in addedMember()
821 if (!Constructor->isImplicit()) { in addedMember()
822 // Note that we have a user-declared constructor. in addedMember()
826 if ((!Constructor->isDeleted() && !Constructor->isDefaulted()) || in addedMember()
829 // A POD-struct is an aggregate class [...] in addedMember()
830 // Since the POD bit is meant to be C++03 POD-ness, clear it even if in addedMember()
837 if (Constructor->isDefaultConstructor()) { in addedMember()
840 if (Constructor->isUserProvided()) in addedMember()
842 if (Constructor->isConstexpr()) in addedMember()
844 if (Constructor->isDefaulted()) in addedMember()
850 if (Constructor->isCopyConstructor(Quals)) { in addedMember()
855 } else if (Constructor->isMoveConstructor()) in addedMember()
860 // An aggregate is an array or a class with no user-provided [or] in addedMember()
863 // An aggregate is an array or a class with no user-declared [...] in addedMember()
866 ? !Constructor->isImplicit() in addedMember()
867 : (Constructor->isUserProvided() || Constructor->isExplicit())) in addedMember()
872 // Handle constructors, including those inherited from base classes. in addedMember()
878 // (possibly inherited from a base class) that is not a copy or move in addedMember()
880 if (Constructor->isConstexpr() && !Constructor->isCopyOrMoveConstructor()) in addedMember()
882 if (!isa<CXXConstructorDecl>(D) && Constructor->isDefaultConstructor()) in addedMember()
891 if (Method->isCopyAssignmentOperator()) { in addedMember()
895 Method->getNonObjectParameter(0)->getType()->getAs<ReferenceType>(); in addedMember()
896 if (!ParamTy || ParamTy->getPointeeType().isConstQualified()) in addedMember()
900 if (Method->isMoveAssignmentOperator()) in addedMember()
903 // Keep the list of conversion functions up-to-date. in addedMember()
911 AccessSpecifier AS = Conversion->getAccessUnsafe(); in addedMember()
913 if (Conversion->getPrimaryTemplate()) { in addedMember()
920 if (Primary->getPreviousDecl()) in addedMember()
921 Conversions.replace(cast<NamedDecl>(Primary->getPreviousDecl()), in addedMember()
939 if (!Method->isImplicit()) { in addedMember()
943 if ((!Method->isDeleted() && !Method->isDefaulted() && in addedMember()
947 // A POD-struct is an aggregate class that has [...] no user-defined in addedMember()
948 // copy assignment operator and no user-defined destructor. in addedMember()
950 // Since the POD bit is meant to be C++03 POD-ness, and in C++03, in addedMember()
956 // Also, a user-declared move assignment operator makes a class in addedMember()
957 // non-POD. This is an extension in C++03. in addedMember()
966 if (!Method->isIneligibleOrNotSelected()) { in addedMember()
974 // Handle non-static data members. in addedMember()
979 // A standard-layout class is a class that: in addedMember()
981 // -- has all non-static data members and bit-fields in the class and in addedMember()
982 // its base classes first declared in the same class in addedMember()
987 // A declaration for a bit-field that omits the identifier declares an in addedMember()
988 // unnamed bit-field. Unnamed bit-fields are not members and cannot be in addedMember()
990 if (Field->isUnnamedBitField()) { in addedMember()
992 // T is a class type [...] with [...] no unnamed bit-fields of non-zero in addedMember()
994 if (data().Empty && !Field->isZeroLengthBitField(Context) && in addedMember()
1002 // A standard-layout class is a class that: in addedMember()
1003 // -- either has no non-static data members in the most derived class in addedMember()
1004 // [...] or has no base classes with non-static data members in addedMember()
1010 // private or protected non-static data members (clause 11). in addedMember()
1013 if (D->getAccess() == AS_private || D->getAccess() == AS_protected) { in addedMember()
1019 // non-static data members are public in addedMember()
1024 // whether the class is standard-layout below. in addedMember()
1029 // A standard-layout class is a class that: in addedMember()
1031 // -- has the same access control for all non-static data members, in addedMember()
1032 switch (D->getAccess()) { in addedMember()
1045 if (Field->isMutable()) { in addedMember()
1050 // non-static data members are public in addedMember()
1055 // If X is a union, a non-static data member of X that is not an anonymous in addedMember()
1057 if (isUnion() && !Field->isAnonymousStructOrUnion()) in addedMember()
1062 // standard-layout class, and has no non-static data members of type in addedMember()
1063 // non-POD struct, non-POD union (or array of such types). in addedMember()
1065 // Automatic Reference Counting: the presence of a member of Objective-C pointer type in addedMember()
1066 // that does not explicitly have no lifetime makes the class a non-POD. in addedMember()
1067 QualType T = Context.getBaseElementType(Field->getType()); in addedMember()
1068 if (T->isObjCRetainableType() || T.isObjCGCStrong()) { in addedMember()
1070 // Objective-C Automatic Reference Counting: in addedMember()
1071 // If a class has a non-static data member of Objective-C pointer in addedMember()
1072 // type (or array thereof), it is a non-POD type and its in addedMember()
1075 // non-trivial. in addedMember()
1081 // __strong or __weak fields do not make special functions non-trivial in addedMember()
1111 if (T->isReferenceType()) { in addedMember()
1112 if (!Field->hasInClassInitializer()) in addedMember()
1116 // A standard-layout class is a class that: in addedMember()
1117 // -- has no non-static data members of type [...] reference, in addedMember()
1123 // -- a non-static data member of rvalue reference type in addedMember()
1124 if (T->isRValueReferenceType()) in addedMember()
1128 if (!Field->hasInClassInitializer() && !Field->isMutable()) { in addedMember()
1129 if (CXXRecordDecl *FieldType = T->getAsCXXRecordDecl()) { in addedMember()
1130 if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit()) in addedMember()
1137 // Record if this field is the first non-literal or volatile field or base. in addedMember()
1138 if (!T->isLiteralType(Context) || T.isVolatileQualified()) in addedMember()
1141 if (Field->hasInClassInitializer() || in addedMember()
1142 (Field->isAnonymousStructOrUnion() && in addedMember()
1143 Field->getType()->getAsCXXRecordDecl()->hasInClassInitializer())) { in addedMember()
1147 // A default constructor is trivial if [...] no non-static data member in addedMember()
1148 // of its class has a brace-or-equal-initializer. in addedMember()
1153 // brace-or-equal-initializers for non-static data members. in addedMember()
1167 // -- a non-static data member of reference type in addedMember()
1168 if (T->isReferenceType()) { in addedMember()
1173 // Bitfields of length 0 are also zero-sized, but we already bailed out for in addedMember()
1175 bool IsZeroSize = Field->isZeroSize(Context); in addedMember()
1177 if (const auto *RecordTy = T->getAs<RecordType>()) { in addedMember()
1178 auto *FieldRec = cast<CXXRecordDecl>(RecordTy->getDecl()); in addedMember()
1179 if (FieldRec->getDefinition()) { in addedMember()
1186 // implicit copy constructor might be declared with a non-const in addedMember()
1197 // -- X is a union-like class that has a variant member with a in addedMember()
1198 // non-trivial [corresponding special member] in addedMember()
1200 if (FieldRec->hasNonTrivialCopyConstructor()) in addedMember()
1202 if (FieldRec->hasNonTrivialMoveConstructor()) in addedMember()
1204 if (FieldRec->hasNonTrivialCopyAssignment()) in addedMember()
1206 if (FieldRec->hasNonTrivialMoveAssignment()) in addedMember()
1208 if (FieldRec->hasNonTrivialDestructor()) in addedMember()
1214 if (Field->isAnonymousStructOrUnion()) { in addedMember()
1216 FieldRec->data().NeedOverloadResolutionForCopyConstructor; in addedMember()
1218 FieldRec->data().NeedOverloadResolutionForMoveConstructor; in addedMember()
1220 FieldRec->data().NeedOverloadResolutionForCopyAssignment; in addedMember()
1222 FieldRec->data().NeedOverloadResolutionForMoveAssignment; in addedMember()
1224 FieldRec->data().NeedOverloadResolutionForDestructor; in addedMember()
1229 // -- for all the non-static data members of its class that are of in addedMember()
1232 if (!FieldRec->hasTrivialDefaultConstructor()) in addedMember()
1238 // -- for each non-static data member of X that is of class type (or in addedMember()
1241 if (!FieldRec->hasTrivialCopyConstructor()) in addedMember()
1244 if (!FieldRec->hasTrivialCopyConstructorForCall()) in addedMember()
1250 if (!FieldRec->hasTrivialMoveConstructor()) in addedMember()
1253 if (!FieldRec->hasTrivialMoveConstructorForCall()) in addedMember()
1259 // -- for each non-static data member of X that is of class type (or in addedMember()
1262 if (!FieldRec->hasTrivialCopyAssignment()) in addedMember()
1267 if (!FieldRec->hasTrivialMoveAssignment()) in addedMember()
1270 if (!FieldRec->hasTrivialDestructor()) in addedMember()
1272 if (!FieldRec->hasTrivialDestructorForCall()) in addedMember()
1274 if (!FieldRec->hasIrrelevantDestructor()) in addedMember()
1276 if (FieldRec->isAnyDestructorNoReturn()) in addedMember()
1278 if (FieldRec->hasObjectMember()) in addedMember()
1280 if (FieldRec->hasVolatileMember()) in addedMember()
1282 if (FieldRec->getArgPassingRestrictions() == in addedMember()
1287 // A standard-layout class is a class that: in addedMember()
1288 // -- has no non-static data members of type non-standard-layout in addedMember()
1290 if (!FieldRec->isStandardLayout()) in addedMember()
1292 if (!FieldRec->isCXX11StandardLayout()) in addedMember()
1296 // A standard-layout class is a class that: in addedMember()
1298 // -- has no element of the set M(S) of types as a base class. in addedMember()
1305 // A standard-layout class is a class that: in addedMember()
1306 // -- has no base classes of the same type as the first non-static in addedMember()
1309 // FIXME: We should check all base classes here, not just direct in addedMember()
1310 // base classes. in addedMember()
1320 if (FieldRec->hasMutableFields()) in addedMember()
1323 if (Field->isMutable()) { in addedMember()
1332 // If the implicitly-defined constructor would satisfy the in addedMember()
1333 // requirements of a constexpr constructor, the implicitly-defined in addedMember()
1336 // -- every constructor involved in initializing non-static data in addedMember()
1338 if (!Field->hasInClassInitializer() && in addedMember()
1339 !FieldRec->hasConstexprDefaultConstructor() && !isUnion()) in addedMember()
1340 // The standard requires any in-class initializer to be a constant in addedMember()
1346 // The implicitly-declared copy constructor for a class X will have in addedMember()
1350 if (!FieldRec->hasCopyConstructorWithConstParam()) in addedMember()
1354 // The implicitly-declared copy assignment oeprator for a class X will in addedMember()
1356 // non-static data members of X that are of a class type M (or array in addedMember()
1359 if (!FieldRec->hasCopyAssignmentWithConstParam()) in addedMember()
1362 if (FieldRec->hasUninitializedReferenceMember() && in addedMember()
1363 !Field->hasInClassInitializer()) in addedMember()
1367 // a non-static data member of an anonymous union that is a member of in addedMember()
1369 if (FieldRec->hasVariantMembers() && in addedMember()
1370 Field->isAnonymousStructOrUnion()) in addedMember()
1374 // Base element type of field is a non-class type. in addedMember()
1375 if (!T->isLiteralType(Context) || in addedMember()
1376 (!Field->hasInClassInitializer() && !isUnion() && in addedMember()
1383 // -- a non-static data member of const non-class type (or array in addedMember()
1392 // types of all non-static data members are structural types or in addedMember()
1395 if (!T->isStructuralType()) in addedMember()
1400 // T is a class type [...] with [...] no non-static data members other in addedMember()
1408 if (Shadow->getDeclName().getNameKind() in addedMember()
1411 data().Conversions.get(Ctx).addDecl(Ctx, Shadow, Shadow->getAccess()); in addedMember()
1416 if (Using->getDeclName().getNameKind() == in addedMember()
1424 if (Using->getDeclName().getCXXOverloadedOperator() == OO_Equal) in addedMember()
1438 // members or at least one variant member of non-volatile literal type, in isLiteral()
1443 return !D->getType().isVolatileQualified() && in isLiteral()
1444 D->getType()->isLiteralType(getASTContext()); in isLiteral()
1455 DD->setIneligibleOrNotSelected(false); in addedSelectedDestructor()
1463 // See https://github.com/llvm/llvm-project/issues/59206 in addedEligibleSpecialMemberFunction()
1466 if (DD->isUserProvided()) in addedEligibleSpecialMemberFunction()
1474 if (DD->isVirtual()) { in addedEligibleSpecialMemberFunction()
1479 if (DD->isNoReturn()) in addedEligibleSpecialMemberFunction()
1483 if (!MD->isImplicit() && !MD->isUserProvided()) { in addedEligibleSpecialMemberFunction()
1484 // This method is user-declared but not user-provided. We can't work in addedEligibleSpecialMemberFunction()
1488 } else if (MD->isTrivial()) { in addedEligibleSpecialMemberFunction()
1491 } else if (MD->isTrivialForCall()) { in addedEligibleSpecialMemberFunction()
1496 // If this is a user-provided function, do not set in addedEligibleSpecialMemberFunction()
1498 // yet whether the method would be considered non-trivial for the in addedEligibleSpecialMemberFunction()
1501 if (!MD->isUserProvided()) in addedEligibleSpecialMemberFunction()
1507 assert(!D->isImplicit() && !D->isUserProvided()); in finishedDefaultedOrDeletedMember()
1513 if (Constructor->isDefaultConstructor()) { in finishedDefaultedOrDeletedMember()
1515 if (Constructor->isConstexpr()) in finishedDefaultedOrDeletedMember()
1518 if (Constructor->isCopyConstructor()) in finishedDefaultedOrDeletedMember()
1520 else if (Constructor->isMoveConstructor()) in finishedDefaultedOrDeletedMember()
1522 else if (Constructor->isConstexpr()) in finishedDefaultedOrDeletedMember()
1527 if (!D->isTrivial() || D->getAccess() != AS_public || D->isDeleted()) in finishedDefaultedOrDeletedMember()
1529 } else if (D->isCopyAssignmentOperator()) in finishedDefaultedOrDeletedMember()
1531 else if (D->isMoveAssignmentOperator()) in finishedDefaultedOrDeletedMember()
1534 // Update which trivial / non-trivial special members we have. in finishedDefaultedOrDeletedMember()
1536 if (!D->isIneligibleOrNotSelected()) { in finishedDefaultedOrDeletedMember()
1537 if (D->isTrivial()) in finishedDefaultedOrDeletedMember()
1579 if (Constructor->isCopyConstructor()) in setTrivialForCallFlags()
1581 else if (Constructor->isMoveConstructor()) in setTrivialForCallFlags()
1586 if (D->isTrivialForCall()) in setTrivialForCallFlags()
1611 return D->isInvalidDecl() || declaresSameEntity(D, R.front()); in allLookupResultsAreTheSame()
1640 return cast<CXXMethodDecl>(CallOpTmpl->getTemplatedDecl()); in getLambdaCallOperator()
1647 CallingConv CC = CallOp->getType()->castAs<FunctionType>()->getCallConv(); in getLambdaStaticInvoker()
1661 return cast<CXXMethodDecl>(InvokerTemplate->getTemplatedDecl()); in getInvokerAsMethod()
1672 cast<ValueDecl>(ND->getAsFunction())->getType()->castAs<FunctionType>(); in getLambdaStaticInvoker()
1673 if (FTy->getCallConv() == CC) in getLambdaStaticInvoker()
1691 if (C->capturesThis()) in getCaptureFields()
1693 else if (C->capturesVariable()) in getCaptureFields()
1694 Captures[C->getCapturedVar()] = *Field; in getCaptureFields()
1704 if (FunctionTemplateDecl *Tmpl = CallOp->getDescribedFunctionTemplate()) in getGenericLambdaTemplateParameterList()
1705 return Tmpl->getTemplateParameters(); in getGenericLambdaTemplateParameterList()
1715 assert(std::is_partitioned(List->begin(), List->end(), in getLambdaExplicitTemplateParameters()
1716 [](const NamedDecl *D) { return !D->isImplicit(); }) in getLambdaExplicitTemplateParameters()
1720 *List, [](const NamedDecl *D) { return !D->isImplicit(); }); in getLambdaExplicitTemplateParameters()
1721 return llvm::ArrayRef(List->begin(), ExplicitEnd); in getLambdaExplicitTemplateParameters()
1748 cast<CXXConversionDecl>(Conv->getUnderlyingDecl()->getAsFunction()) in GetConversionType()
1749 ->getConversionType(); in GetConversionType()
1753 /// Collect the visible conversions of a base class.
1755 /// \param Record a base class of the class we're considering
1756 /// \param InVirtual whether this base class is a virtual base (or a base
1757 /// of a virtual base)
1758 /// \param Access the access along the inheritance path to this base
1760 /// of this base
1761 /// \param Output the set to which to add conversions from non-virtual bases
1764 /// virtual base along some inheritance path
1779 CXXRecordDecl::conversion_iterator ConvI = Record->conversion_begin(); in CollectVisibleConversions()
1780 CXXRecordDecl::conversion_iterator ConvE = Record->conversion_end(); in CollectVisibleConversions()
1791 // If this conversion is hidden and we're in a virtual base, in CollectVisibleConversions()
1794 HiddenVBaseCs.insert(cast<NamedDecl>(I.getDecl()->getCanonicalDecl())); in CollectVisibleConversions()
1809 // Collect information recursively from any base classes. in CollectVisibleConversions()
1810 for (const auto &I : Record->bases()) { in CollectVisibleConversions()
1811 const auto *RT = I.getType()->getAs<RecordType>(); in CollectVisibleConversions()
1818 auto *Base = cast<CXXRecordDecl>(RT->getDecl()); in CollectVisibleConversions() local
1819 CollectVisibleConversions(Context, Base, BaseInVirtual, BaseAccess, in CollectVisibleConversions()
1827 /// bases. It might be worth special-casing that, really.
1833 // appear in the hidden-conversions set. in CollectVisibleConversions()
1844 // hidden-types set. in CollectVisibleConversions()
1845 CXXRecordDecl::conversion_iterator ConvI = Record->conversion_begin(); in CollectVisibleConversions()
1846 CXXRecordDecl::conversion_iterator ConvE = Record->conversion_end(); in CollectVisibleConversions()
1851 // Recursively collect conversions from base classes. in CollectVisibleConversions()
1852 for (const auto &I : Record->bases()) { in CollectVisibleConversions()
1853 const auto *RT = I.getType()->getAs<RecordType>(); in CollectVisibleConversions()
1856 CollectVisibleConversions(Context, cast<CXXRecordDecl>(RT->getDecl()), in CollectVisibleConversions()
1864 if (!HiddenVBaseCs.count(cast<NamedDecl>(I.getDecl()->getCanonicalDecl()))) in CollectVisibleConversions()
1869 /// getVisibleConversionFunctions - get all conversion functions visible
1887 return llvm::make_range(Set->begin(), Set->end()); in getVisibleConversionFunctions()
1899 // with sufficiently large numbers of directly-declared conversions in removeConversion()
1917 return cast<CXXRecordDecl>(MSInfo->getInstantiatedFrom()); in getInstantiatedFromMemberClass()
1946 return Spec->getSpecializationKind(); in getTemplateSpecializationKind()
1949 return MSInfo->getTemplateSpecializationKind(); in getTemplateSpecializationKind()
1957 Spec->setSpecializationKind(TSK); in setTemplateSpecializationKind()
1962 MSInfo->setTemplateSpecializationKind(TSK); in setTemplateSpecializationKind()
1971 [](const CXXRecordDecl *D) -> const CXXRecordDecl * { in getTemplateInstantiationPattern()
1972 if (auto *Def = D->getDefinition()) in getTemplateInstantiationPattern()
1980 auto From = TD->getInstantiatedFrom(); in getTemplateInstantiationPattern()
1982 while (auto *NewCTD = CTD->getInstantiatedFromMemberTemplate()) { in getTemplateInstantiationPattern()
1983 if (NewCTD->isMemberSpecialization()) in getTemplateInstantiationPattern()
1987 return GetDefinitionOrSelf(CTD->getTemplatedDecl()); in getTemplateInstantiationPattern()
1991 while (auto *NewCTPSD = CTPSD->getInstantiatedFromMember()) { in getTemplateInstantiationPattern()
1992 if (NewCTPSD->isMemberSpecialization()) in getTemplateInstantiationPattern()
2001 if (isTemplateInstantiation(MSInfo->getTemplateSpecializationKind())) { in getTemplateInstantiationPattern()
2003 while (auto *NewRD = RD->getInstantiatedFromMemberClass()) in getTemplateInstantiationPattern()
2009 assert(!isTemplateInstantiation(this->getTemplateSpecializationKind()) && in getTemplateInstantiationPattern()
2028 if (DD && !DD->isIneligibleOrNotSelected()) in getDestructor()
2035 while (!DC->isTranslationUnit()) { in isDeclContextInNamespace()
2036 if (DC->isNamespace()) in isDeclContextInNamespace()
2038 DC = DC->getParent(); in isDeclContextInNamespace()
2044 assert(hasDefinition() && "checking for interface-like without a definition"); in isInterfaceLike()
2045 // All __interfaces are inheritently interface-like. in isInterfaceLike()
2049 // Interface-like types cannot have a user declared constructor, destructor, in isInterfaceLike()
2054 getNumVBases() > 0 || conversion_end() - conversion_begin() > 0) in isInterfaceLike()
2057 // No interface-like type can have a method with a definition. in isInterfaceLike()
2059 if (Method->isDefined() && !Method->isImplicit()) in isInterfaceLike()
2067 if (Uuid && isStruct() && !getDeclContext()->isExternCContext() && in isInterfaceLike()
2070 Uuid->getGuid() == "00000000-0000-0000-C000-000000000046") || in isInterfaceLike()
2072 Uuid->getGuid() == "00020400-0000-0000-C000-000000000046"))) { in isInterfaceLike()
2081 // If this isn't a 'special' type, it must have a single interface-like base. in isInterfaceLike()
2088 const auto *Base = BaseSpec.getType()->getAsCXXRecordDecl(); in isInterfaceLike() local
2089 if (Base->isInterface() || !Base->isInterfaceLike()) in isInterfaceLike()
2112 if (SubobjOverrides.front().Method->isPureVirtual()) in hasPureVirtualFinalOverrider()
2132 // Set access bits correctly on the directly-declared conversions. in completeDefinition()
2135 I.setAccess((*I)->getAccess()); in completeDefinition()
2145 cast<CXXRecordDecl>(B.getType()->castAs<RecordType>()->getDecl()); in mayBeAbstract()
2146 if (BaseDecl->isAbstract()) in mayBeAbstract()
2157 if (Def->hasAttr<FinalAttr>()) in isEffectivelyFinal()
2159 if (const auto *Dtor = Def->getDestructor()) in isEffectivelyFinal()
2160 if (Dtor->hasAttr<FinalAttr>()) in isEffectivelyFinal()
2183 switch (Function->getDeclKind()) { in getFromDecl()
2185 return cast<CXXConstructorDecl>(Function)->getExplicitSpecifier(); in getFromDecl()
2187 return cast<CXXConversionDecl>(Function)->getExplicitSpecifier(); in getFromDecl()
2189 return cast<CXXDeductionGuideDecl>(Function)->getExplicitSpecifier(); in getFromDecl()
2205 CXXDeductionGuideDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { in CreateDeserialized() argument
2206 return new (C, ID) CXXDeductionGuideDecl( in CreateDeserialized()
2218 RequiresExprBodyDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { in CreateDeserialized() argument
2219 return new (C, ID) RequiresExprBodyDecl(C, nullptr, SourceLocation()); in CreateDeserialized()
2227 if (MD->getStorageClass() == SC_Static) in isStatic()
2236 for (const CXXMethodDecl *MD : DerivedMD->overridden_methods()) { in recursivelyOverrides()
2237 if (MD->getCanonicalDecl() == BaseMD->getCanonicalDecl()) in recursivelyOverrides()
2248 if (this->getParent()->getCanonicalDecl() == RD->getCanonicalDecl()) in getCorrespondingMethodDeclaredInClass()
2253 CXXMethodDecl *MD = RD->getDestructor(); in getCorrespondingMethodDeclaredInClass()
2263 for (auto *ND : RD->lookup(getDeclName())) { in getCorrespondingMethodDeclaredInClass()
2299 for (const auto &I : RD->bases()) { in getCorrespondingMethodInClass()
2300 const RecordType *RT = I.getType()->getAs<RecordType>(); in getCorrespondingMethodInClass()
2303 const auto *Base = cast<CXXRecordDecl>(RT->getDecl()); in getCorrespondingMethodInClass() local
2304 if (CXXMethodDecl *D = this->getCorrespondingMethodInClass(Base)) in getCorrespondingMethodInClass()
2324 GlobalDeclID ID) { in CreateDeserialized() argument
2325 return new (C, ID) CXXMethodDecl( in CreateDeserialized()
2331 CXXMethodDecl *CXXMethodDecl::getDevirtualizedMethod(const Expr *Base, in getDevirtualizedMethod() argument
2335 // When building with -fapple-kext, all calls must go through the vtable since in getDevirtualizedMethod()
2345 // If Base is unknown, we cannot devirtualize. in getDevirtualizedMethod()
2346 if (!Base) in getDevirtualizedMethod()
2349 // If the base expression (after skipping derived-to-base conversions) is a in getDevirtualizedMethod()
2351 Base = Base->getBestDynamicClassTypeExpr(); in getDevirtualizedMethod()
2352 if (Base->isPRValue() && Base->getType()->isRecordType()) in getDevirtualizedMethod()
2356 const CXXRecordDecl *BestDynamicDecl = Base->getBestDynamicClassType(); in getDevirtualizedMethod()
2372 if (DevirtualizedMethod->isPureVirtual()) in getDevirtualizedMethod()
2376 if (DevirtualizedMethod->hasAttr<FinalAttr>()) in getDevirtualizedMethod()
2382 if (BestDynamicDecl->isEffectivelyFinal()) in getDevirtualizedMethod()
2385 if (const auto *DRE = dyn_cast<DeclRefExpr>(Base)) { in getDevirtualizedMethod()
2386 if (const auto *VD = dyn_cast<VarDecl>(DRE->getDecl())) in getDevirtualizedMethod()
2387 if (VD->getType()->isRecordType()) in getDevirtualizedMethod()
2397 if (const auto *ME = dyn_cast<MemberExpr>(Base)) { in getDevirtualizedMethod()
2398 const ValueDecl *VD = ME->getMemberDecl(); in getDevirtualizedMethod()
2399 return VD->getType()->isRecordType() ? DevirtualizedMethod : nullptr; in getDevirtualizedMethod()
2402 // Likewise for calls on an object accessed by a (non-reference) pointer to in getDevirtualizedMethod()
2404 if (auto *BO = dyn_cast<BinaryOperator>(Base)) { in getDevirtualizedMethod()
2405 if (BO->isPtrMemOp()) { in getDevirtualizedMethod()
2406 auto *MPT = BO->getRHS()->getType()->castAs<MemberPointerType>(); in getDevirtualizedMethod()
2407 if (MPT->getPointeeType()->isRecordType()) in getDevirtualizedMethod()
2431 // with exactly one parameter, then that function is a usual (non-placement) in isUsualDeallocationFunction()
2457 Context.hasSameUnqualifiedType(getParamDecl(UsualParams)->getType(), in isUsualDeallocationFunction()
2462 getParamDecl(UsualParams)->getType()->isAlignValT()) in isUsualDeallocationFunction()
2469 // usual deallocation functions. Honor this behavior when post-C++14 in isUsualDeallocationFunction()
2479 // single-parameter deallocation functions of the same kind. in isUsualDeallocationFunction()
2480 DeclContext::lookup_result R = getDeclContext()->lookup(getDeclName()); in isUsualDeallocationFunction()
2484 if (FD->getNumParams() == 1) { in isUsualDeallocationFunction()
2495 // An explicit object member function is a non-static member in isExplicitObjectMemberFunction()
2506 // A user-declared copy assignment operator X::operator= is a non-static in isCopyAssignmentOperator()
2507 // non-template member function of class X with exactly one parameter of in isCopyAssignmentOperator()
2510 /*non-static*/ isStatic() || in isCopyAssignmentOperator()
2512 /*non-template*/ getPrimaryTemplate() || getDescribedFunctionTemplate() || in isCopyAssignmentOperator()
2516 QualType ParamType = getNonObjectParameter(0)->getType(); in isCopyAssignmentOperator()
2517 if (const auto *Ref = ParamType->getAs<LValueReferenceType>()) in isCopyAssignmentOperator()
2518 ParamType = Ref->getPointeeType(); in isCopyAssignmentOperator()
2528 // A user-declared move assignment operator X::operator= is a non-static in isMoveAssignmentOperator()
2529 // non-template member function of class X with exactly one parameter of type in isMoveAssignmentOperator()
2536 QualType ParamType = getNonObjectParameter(0)->getType(); in isMoveAssignmentOperator()
2537 if (!ParamType->isRValueReferenceType()) in isMoveAssignmentOperator()
2539 ParamType = ParamType->getPointeeType(); in isMoveAssignmentOperator()
2548 assert(MD->isCanonicalDecl() && "Method is not canonical!"); in addOverriddenMethod()
2549 assert(!MD->getParent()->isDependentContext() && in addOverriddenMethod()
2551 assert(MD->isVirtual() && "Method is not virtual!"); in addOverriddenMethod()
2581 return C.getQualifiedType(ClassTy, FPT->getMethodQuals()); in getThisObjectType()
2586 ASTContext &C = Decl->getASTContext(); in getThisType()
2591 bool Restrict = FPT->getMethodQuals().hasRestrict(); in getThisType()
2610 return CXXMethodDecl::getThisType(getType()->castAs<FunctionProtoType>(), in getThisType()
2616 return parameters()[0]->getType(); in getFunctionObjectParameterReferenceType()
2619 const FunctionProtoType *FPT = getType()->castAs<FunctionProtoType>(); in getFunctionObjectParameterReferenceType()
2621 RefQualifierKind RK = FPT->getRefQualifier(); in getFunctionObjectParameterReferenceType()
2635 return CheckFn->isDefined(fn) && !fn->isOutOfLine() && in hasInlineBody()
2636 (fn->doesThisDeclarationHaveABody() || fn->willHaveBody()); in hasInlineBody()
2641 return P->isLambda() && getDeclName().isIdentifier() && in isLambdaStaticInvoker()
2685 return Initializee.get<TypeSourceInfo*>()->getTypeLoc(); in getBaseClassLoc()
2692 return Initializee.get<TypeSourceInfo*>()->getType().getTypePtr(); in getBaseClass()
2699 return getAnyMember()->getLocation(); in getSourceLocation()
2705 return TSInfo->getTypeLoc().getBeginLoc(); in getSourceLocation()
2713 if (Expr *I = D->getInClassInitializer()) in getSourceRange()
2714 return I->getSourceRange(); in getSourceRange()
2742 GlobalDeclID ID, in CreateDeserialized() argument
2750 auto *Result = new (C, ID, Extra) CXXConstructorDecl( in CreateDeserialized()
2754 Result->setInheritingConstructor(isInheritingConstructor); in CreateDeserialized()
2755 Result->CXXConstructorDeclBits.HasTrailingExplicitSpecifier = in CreateDeserialized()
2757 Result->setExplicitSpecifier(ExplicitSpecifier()); in CreateDeserialized()
2784 Expr *E = (*init_begin())->getInit()->IgnoreImplicit(); in getTargetConstructor()
2786 return Construct->getConstructor(); in getTargetConstructor()
2802 getParamDecl(0)->getType()->isLValueReferenceType(); in isCopyConstructor()
2807 getParamDecl(0)->getType()->isRValueReferenceType(); in isMoveConstructor()
2813 // A non-template constructor for class X is a copy constructor in isCopyOrMoveConstructor()
2818 // A non-template constructor for class X is a move constructor if its in isCopyOrMoveConstructor()
2829 const auto *ParamRefType = Param->getType()->getAs<ReferenceType>(); in isCopyOrMoveConstructor()
2837 = Context.getCanonicalType(ParamRefType->getPointeeType()); in isCopyOrMoveConstructor()
2852 // A constructor declared without the function-specifier explicit in isConvertingConstructor()
2864 ? getType()->castAs<FunctionProtoType>()->isVariadic() in isConvertingConstructor()
2875 CanQualType ParamType = Context.getCanonicalType(Param->getType()); in isSpecializationCopyingObject()
2889 GlobalDeclID ID) { in CreateDeserialized() argument
2890 return new (C, ID) CXXDestructorDecl( in CreateDeserialized()
2910 if (OD && !First->OperatorDelete) { in setOperatorDelete()
2911 First->OperatorDelete = OD; in setOperatorDelete()
2912 First->OperatorDeleteThisArg = ThisArg; in setOperatorDelete()
2914 L->ResolvedOperatorDelete(First, OD, ThisArg); in setOperatorDelete()
2921 GlobalDeclID ID) { in CreateDeserialized() argument
2922 return new (C, ID) CXXConversionDecl( in CreateDeserialized()
2943 return isImplicit() && getParent()->isLambda() && in isLambdaToBlockPointerConversion()
2944 getConversionType()->isBlockPointerType(); in isLambdaToBlockPointerConversion()
2967 GlobalDeclID ID) { in CreateDeserialized() argument
2968 return new (C, ID) in CreateDeserialized()
2983 Used = NS->getFirstDecl(); in Create()
2989 GlobalDeclID ID) { in CreateDeserialized() argument
2990 return new (C, ID) UsingDirectiveDecl(nullptr, SourceLocation(), in CreateDeserialized()
2998 return NA->getNamespace(); in getNominatedNamespace()
3004 IdentifierInfo *Id, NamespaceDecl *PrevDecl, in NamespaceDecl() argument
3006 : NamedDecl(Namespace, DC, IdLoc, Id), DeclContext(Namespace), in NamespaceDecl()
3015 SourceLocation IdLoc, IdentifierInfo *Id, in Create() argument
3018 NamespaceDecl(C, DC, Inline, StartLoc, IdLoc, Id, PrevDecl, Nested); in Create()
3022 GlobalDeclID ID) { in CreateDeserialized() argument
3023 return new (C, ID) NamespaceDecl(C, nullptr, false, SourceLocation(), in CreateDeserialized()
3062 Namespace = NS->getFirstDecl(); in Create()
3068 GlobalDeclID ID) { in CreateDeserialized() argument
3069 return new (C, ID) NamespaceAliasDecl(C, nullptr, SourceLocation(), in CreateDeserialized()
3089 return ExtendingDecl->getDeclContext()->isFunctionOrMethod() ? SD_Automatic in getStorageDuration()
3091 return cast<VarDecl>(ExtendingDecl)->getStorageDuration(); in getStorageDuration()
3124 GlobalDeclID ID) { in CreateDeserialized() argument
3125 return new (C, ID) UsingShadowDecl(UsingShadow, C, EmptyShell()); in CreateDeserialized()
3131 dyn_cast<UsingShadowDecl>(Shadow->UsingOrNextShadow)) in getIntroducer()
3133 return cast<BaseUsingDecl>(Shadow->UsingOrNextShadow); in getIntroducer()
3147 ConstructorUsingShadowDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { in CreateDeserialized() argument
3148 return new (C, ID) ConstructorUsingShadowDecl(C, EmptyShell()); in CreateDeserialized()
3152 return getIntroducer()->getQualifier()->getAsRecordDecl(); in getNominatedBaseClass()
3159 assert(S->getIntroducer() == this); in addShadowDecl()
3162 S->UsingOrNextShadow = FirstUsingShadow.getPointer(); in addShadowDecl()
3168 assert(S->getIntroducer() == this); in removeShadowDecl()
3174 dyn_cast<UsingShadowDecl>(S->UsingOrNextShadow)); in removeShadowDecl()
3175 S->UsingOrNextShadow = this; in removeShadowDecl()
3180 while (Prev->UsingOrNextShadow != S) in removeShadowDecl()
3181 Prev = cast<UsingShadowDecl>(Prev->UsingOrNextShadow); in removeShadowDecl()
3182 Prev->UsingOrNextShadow = S->UsingOrNextShadow; in removeShadowDecl()
3183 S->UsingOrNextShadow = this; in removeShadowDecl()
3195 UsingDecl *UsingDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { in CreateDeserialized() argument
3196 return new (C, ID) UsingDecl(nullptr, SourceLocation(), in CreateDeserialized()
3214 assert(isa<EnumDecl>(EnumType->getType()->getAsTagDecl())); in Create()
3216 UsingEnumDecl(DC, EnumType->getType()->getAsTagDecl()->getDeclName(), UL, EL, NL, EnumType); in Create()
3220 GlobalDeclID ID) { in CreateDeserialized() argument
3221 return new (C, ID) in CreateDeserialized()
3227 return SourceRange(UsingLocation, EnumType->getTypeLoc().getEndLoc()); in getSourceRange()
3239 UsingPackDecl *UsingPackDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID, in CreateDeserialized() argument
3243 new (C, ID, Extra) UsingPackDecl(nullptr, nullptr, std::nullopt); in CreateDeserialized()
3244 Result->NumExpansions = NumExpansions; in CreateDeserialized()
3245 auto *Trail = Result->getTrailingObjects<NamedDecl *>(); in CreateDeserialized()
3265 UnresolvedUsingValueDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { in CreateDeserialized() argument
3266 return new (C, ID) UnresolvedUsingValueDecl(nullptr, QualType(), in CreateDeserialized()
3296 GlobalDeclID ID) { in CreateDeserialized() argument
3297 return new (C, ID) UnresolvedUsingTypenameDecl( in CreateDeserialized()
3310 GlobalDeclID ID) { in CreateDeserialized() argument
3311 return new (Ctx, ID) in CreateDeserialized()
3334 GlobalDeclID ID) { in CreateDeserialized() argument
3335 return new (C, ID) StaticAssertDecl(nullptr, SourceLocation(), nullptr, in CreateDeserialized()
3345 return llvm::dyn_cast<VarDecl>(BD->getDecomposedDecl()); in getPotentiallyDecomposedVarDecl()
3352 SourceLocation IdLoc, IdentifierInfo *Id) { in Create() argument
3353 return new (C, DC) BindingDecl(DC, IdLoc, Id); in Create()
3356 BindingDecl *BindingDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { in CreateDeserialized() argument
3357 return new (C, ID) BindingDecl(nullptr, SourceLocation(), nullptr); in CreateDeserialized()
3364 auto *DRE = dyn_cast<DeclRefExpr>(B->IgnoreImplicit()); in getHoldingVar()
3368 auto *VD = cast<VarDecl>(DRE->getDecl()); in getHoldingVar()
3369 assert(VD->isImplicit() && "holding var for binding decl not implicit"); in getHoldingVar()
3387 GlobalDeclID ID, in CreateDeserialized() argument
3390 auto *Result = new (C, ID, Extra) in CreateDeserialized()
3394 Result->NumBindings = NumBindings; in CreateDeserialized()
3395 auto *Trail = Result->getTrailingObjects<BindingDecl *>(); in CreateDeserialized()
3408 B->printName(OS, Policy); in printName()
3426 GlobalDeclID ID) { in CreateDeserialized() argument
3427 return new (C, ID) MSPropertyDecl(nullptr, SourceLocation(), in CreateDeserialized()
3443 MSGuidDecl *MSGuidDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { in CreateDeserialized() argument
3444 return new (C, ID) MSGuidDecl(nullptr, QualType(), Parts()); in CreateDeserialized()
3449 OS << llvm::format("GUID{%08" PRIx32 "-%04" PRIx16 "-%04" PRIx16 "-", in printName()
3455 OS << '-'; in printName()
3468 return T->isUnsignedIntegerOrEnumerationType() && in isValidStructGUID()
3476 return CAT && CAT->getSize() == N && Elem(CAT->getElementType()); in isValidStructGUID()
3482 const RecordDecl *RD = T->getAsRecordDecl(); in isValidStructGUID()
3483 if (!RD || RD->isUnion()) in isValidStructGUID()
3485 RD = RD->getDefinition(); in isValidStructGUID()
3489 if (CXXRD->getNumBases()) in isValidStructGUID()
3492 for (const FieldDecl *FD : RD->fields()) { in isValidStructGUID()
3493 if (FD->isUnnamedBitField()) in isValidStructGUID()
3495 if (FD->isBitField() || MatcherIt == Fields.end() || in isValidStructGUID()
3496 !(*MatcherIt)(FD->getType())) in isValidStructGUID()
3553 UnnamedGlobalConstantDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { in CreateDeserialized() argument
3554 return new (C, ID) in CreateDeserialized()
3560 OS << "unnamed-global-constant"; in printName()