38 #include "llvm/ADT/None.h" 39 #include "llvm/ADT/SmallPtrSet.h" 40 #include "llvm/ADT/SmallVector.h" 41 #include "llvm/ADT/iterator_range.h" 42 #include "llvm/Support/Casting.h" 43 #include "llvm/Support/ErrorHandling.h" 44 #include "llvm/Support/raw_ostream.h" 50 using namespace clang;
56 void AccessSpecDecl::anchor() {}
62 void LazyASTUnresolvedSet::getFromExternalSource(
ASTContext &
C)
const {
64 assert(Impl.Decls.isLazy() &&
"getFromExternalSource for non-lazy set");
65 assert(Source &&
"getFromExternalSource with no external source");
69 reinterpret_cast<uintptr_t>(I.getDecl()) >> 2)));
70 Impl.Decls.setLazy(
false);
73 CXXRecordDecl::DefinitionData::DefinitionData(
CXXRecordDecl *D)
74 : UserDeclaredConstructor(
false), UserDeclaredSpecialMembers(0),
75 Aggregate(
true), PlainOldData(
true), Empty(
true), Polymorphic(
false),
76 Abstract(
false), IsStandardLayout(
true), IsCXX11StandardLayout(
true),
77 HasBasesWithFields(
false), HasBasesWithNonStaticDataMembers(
false),
78 HasPrivateFields(
false), HasProtectedFields(
false),
79 HasPublicFields(
false), HasMutableFields(
false), HasVariantMembers(
false),
80 HasOnlyCMembers(
true), HasInClassInitializer(
false),
81 HasUninitializedReferenceMember(
false), HasUninitializedFields(
false),
82 HasInheritedConstructor(
false), HasInheritedAssignment(
false),
83 NeedOverloadResolutionForCopyConstructor(
false),
84 NeedOverloadResolutionForMoveConstructor(
false),
85 NeedOverloadResolutionForMoveAssignment(
false),
86 NeedOverloadResolutionForDestructor(
false),
87 DefaultedCopyConstructorIsDeleted(
false),
88 DefaultedMoveConstructorIsDeleted(
false),
89 DefaultedMoveAssignmentIsDeleted(
false),
90 DefaultedDestructorIsDeleted(
false), HasTrivialSpecialMembers(SMF_All),
91 HasTrivialSpecialMembersForCall(SMF_All),
92 DeclaredNonTrivialSpecialMembers(0),
93 DeclaredNonTrivialSpecialMembersForCall(0), HasIrrelevantDestructor(
true),
94 HasConstexprNonCopyMoveConstructor(
false),
95 HasDefaultedDefaultConstructor(
false),
96 DefaultedDefaultConstructorIsConstexpr(
true),
97 HasConstexprDefaultConstructor(
false),
98 HasNonLiteralTypeFieldsOrBases(
false), ComputedVisibleConversions(
false),
99 UserProvidedDefaultConstructor(
false), DeclaredSpecialMembers(0),
100 ImplicitCopyConstructorCanHaveConstParamForVBase(
true),
101 ImplicitCopyConstructorCanHaveConstParamForNonVBase(
true),
102 ImplicitCopyAssignmentHasConstParam(
true),
103 HasDeclaredCopyConstructorWithConstParam(
false),
104 HasDeclaredCopyAssignmentWithConstParam(
false), IsLambda(
false),
105 IsParsingBaseSpecifiers(
false), HasODRHash(
false), Definition(D) {}
108 return Bases.get(Definition->getASTContext().getExternalSource());
111 CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getVBasesSlowCase()
const {
112 return VBases.get(Definition->getASTContext().getExternalSource());
119 :
RecordDecl(K, TK, C, DC, StartLoc, IdLoc, Id, PrevDecl),
120 DefinitionData(PrevDecl ? PrevDecl->DefinitionData
127 bool DelayTypeCreation) {
128 auto *R =
new (
C, DC)
CXXRecordDecl(CXXRecord, TK, C, DC, StartLoc, IdLoc, Id,
130 R->setMayHaveOutOfDateDef(C.
getLangOpts().Modules);
133 if (!DelayTypeCreation)
141 bool Dependent,
bool IsGeneric,
145 R->setBeingDefined(
true);
147 new (
C)
struct LambdaDefinitionData(R, Info, Dependent, IsGeneric,
149 R->setMayHaveOutOfDateDef(
false);
150 R->setImplicit(
true);
160 R->setMayHaveOutOfDateDef(
false);
168 llvm::SmallPtrSet<const CXXRecordDecl*, 8> SeenBaseTypes;
170 while (!WorkList.empty()) {
173 if (
const CXXRecordDecl *B = BaseSpec.getType()->getAsCXXRecordDecl()) {
174 if (!SeenBaseTypes.insert(B).second)
176 WorkList.push_back(B);
188 if (!data().Bases.isOffset() && data().NumBases > 0)
195 data().Aggregate =
false;
200 data().PlainOldData =
false;
204 llvm::SmallPtrSet<CanQualType, 8> SeenVBaseTypes;
210 data().NumBases = NumBases;
211 for (
unsigned i = 0;
i < NumBases; ++
i) {
212 data().getBases()[
i] = *Bases[
i];
219 auto *BaseClassDecl =
227 if (BaseClassDecl->data().HasBasesWithFields ||
228 !BaseClassDecl->field_empty()) {
229 if (data().HasBasesWithFields)
231 data().IsStandardLayout =
false;
232 data().HasBasesWithFields =
true;
239 if (BaseClassDecl->data().HasBasesWithNonStaticDataMembers ||
240 BaseClassDecl->hasDirectFields()) {
241 if (data().HasBasesWithNonStaticDataMembers)
242 data().IsCXX11StandardLayout =
false;
243 data().HasBasesWithNonStaticDataMembers =
true;
246 if (!BaseClassDecl->isEmpty()) {
250 data().Empty =
false;
256 data().Aggregate =
false;
261 if (BaseClassDecl->isPolymorphic()) {
262 data().Polymorphic =
true;
265 data().Aggregate =
false;
271 if (!BaseClassDecl->isStandardLayout())
272 data().IsStandardLayout =
false;
273 if (!BaseClassDecl->isCXX11StandardLayout())
274 data().IsCXX11StandardLayout =
false;
278 data().HasNonLiteralTypeFieldsOrBases =
true;
281 for (
const auto &VBase : BaseClassDecl->vbases()) {
284 VBases.push_back(&VBase);
291 if (
CXXRecordDecl *VBaseDecl = VBase.getType()->getAsCXXRecordDecl())
292 if (!VBaseDecl->hasCopyConstructorWithConstParam())
293 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
297 data().Aggregate =
false;
304 VBases.push_back(Base);
309 data().Empty =
false;
313 data().Aggregate =
false;
319 data().HasTrivialSpecialMembers &= SMF_Destructor;
320 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
325 data().IsStandardLayout =
false;
326 data().IsCXX11StandardLayout =
false;
331 data().DefaultedDefaultConstructorIsConstexpr =
false;
338 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
339 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
345 if (!BaseClassDecl->hasTrivialDefaultConstructor())
346 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
353 if (!BaseClassDecl->hasTrivialCopyConstructor())
354 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
356 if (!BaseClassDecl->hasTrivialCopyConstructorForCall())
357 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
363 if (!BaseClassDecl->hasTrivialMoveConstructor())
364 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
366 if (!BaseClassDecl->hasTrivialMoveConstructorForCall())
367 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
374 if (!BaseClassDecl->hasTrivialCopyAssignment())
375 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
380 if (!BaseClassDecl->hasTrivialMoveAssignment())
381 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
387 if (!BaseClassDecl->hasConstexprDefaultConstructor())
388 data().DefaultedDefaultConstructorIsConstexpr =
false;
395 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
396 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
402 if (!BaseClassDecl->hasTrivialDestructor())
403 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
405 if (!BaseClassDecl->hasTrivialDestructorForCall())
406 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
408 if (!BaseClassDecl->hasIrrelevantDestructor())
409 data().HasIrrelevantDestructor =
false;
416 if (!BaseClassDecl->hasCopyAssignmentWithConstParam())
417 data().ImplicitCopyAssignmentHasConstParam =
false;
421 if (BaseClassDecl->hasObjectMember())
424 if (BaseClassDecl->hasVolatileMember())
427 if (BaseClassDecl->getArgPassingRestrictions() ==
432 if (BaseClassDecl->hasMutableFields()) {
433 data().HasMutableFields =
true;
434 data().NeedOverloadResolutionForCopyConstructor =
true;
437 if (BaseClassDecl->hasUninitializedReferenceMember())
438 data().HasUninitializedReferenceMember =
true;
440 if (!BaseClassDecl->allowConstDefaultInit())
441 data().HasUninitializedFields =
true;
443 addedClassSubobject(BaseClassDecl);
454 data().IsStandardLayout =
false;
456 if (VBases.empty()) {
457 data().IsParsingBaseSpecifiers =
false;
463 data().NumVBases = VBases.size();
464 for (
int I = 0, E = VBases.size(); I != E; ++I) {
468 data().getVBases()[I] = *VBases[I];
471 data().IsParsingBaseSpecifiers =
false;
475 assert(
hasDefinition() &&
"ODRHash only for records with definitions");
478 if (DefinitionData->HasODRHash)
479 return DefinitionData->ODRHash;
484 DefinitionData->HasODRHash =
true;
487 return DefinitionData->ODRHash;
490 void CXXRecordDecl::addedClassSubobject(
CXXRecordDecl *Subobj) {
498 data().NeedOverloadResolutionForCopyConstructor =
true;
500 data().NeedOverloadResolutionForMoveConstructor =
true;
509 data().NeedOverloadResolutionForMoveAssignment =
true;
519 data().NeedOverloadResolutionForCopyConstructor =
true;
520 data().NeedOverloadResolutionForMoveConstructor =
true;
521 data().NeedOverloadResolutionForDestructor =
true;
549 void CXXRecordDecl::markedVirtualFunctionPure() {
552 data().Abstract =
true;
555 bool CXXRecordDecl::hasSubobjectAtOffsetZeroOfEmptyBaseType(
560 llvm::SmallPtrSet<const CXXRecordDecl*, 8> Bases;
561 llvm::SmallPtrSet<const CXXRecordDecl*, 8> M;
566 RD = RD->getCanonicalDecl();
574 if (!RD->data().HasBasesWithFields) {
593 if (M.insert(RD).second)
594 WorkList.push_back(RD);
601 while (!WorkList.empty()) {
611 bool IsFirstField =
true;
612 for (
auto *FD : X->
fields()) {
615 if (FD->isUnnamedBitfield())
618 if (!IsFirstField && !FD->isZeroSize(Ctx))
628 IsFirstField =
false;
636 assert(
isLambda() &&
"not a lambda");
649 getLambdaData().NumCaptures != 0)
654 void CXXRecordDecl::addedMember(
Decl *D) {
656 !isa<FieldDecl>(D) &&
657 !isa<IndirectFieldDecl>(D) &&
658 (!isa<TagDecl>(D) || cast<TagDecl>(D)->getTagKind() ==
TTK_Class ||
660 data().HasOnlyCMembers =
false;
668 D = FunTmpl->getTemplatedDecl();
671 Decl *DUnderlying = D;
672 if (
auto *ND = dyn_cast<NamedDecl>(DUnderlying)) {
673 DUnderlying = ND->getUnderlyingDecl();
674 if (
auto *UnderlyingFunTmpl = dyn_cast<FunctionTemplateDecl>(DUnderlying))
675 DUnderlying = UnderlyingFunTmpl->getTemplatedDecl();
678 if (
const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
679 if (Method->isVirtual()) {
682 data().Aggregate =
false;
686 data().PlainOldData =
false;
690 data().Empty =
false;
695 data().Polymorphic =
true;
701 data().HasTrivialSpecialMembers &= SMF_Destructor;
702 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
707 data().IsStandardLayout =
false;
708 data().IsCXX11StandardLayout =
false;
716 L->AddedCXXImplicitMember(data().Definition, D);
722 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
723 if (!Constructor->isImplicit()) {
725 data().UserDeclaredConstructor =
true;
731 data().PlainOldData =
false;
734 if (Constructor->isDefaultConstructor()) {
735 SMKind |= SMF_DefaultConstructor;
737 if (Constructor->isUserProvided())
738 data().UserProvidedDefaultConstructor =
true;
739 if (Constructor->isConstexpr())
740 data().HasConstexprDefaultConstructor =
true;
741 if (Constructor->isDefaulted())
742 data().HasDefaultedDefaultConstructor =
true;
747 if (Constructor->isCopyConstructor(Quals)) {
748 SMKind |= SMF_CopyConstructor;
751 data().HasDeclaredCopyConstructorWithConstParam =
true;
752 }
else if (Constructor->isMoveConstructor())
753 SMKind |= SMF_MoveConstructor;
763 ? !Constructor->isImplicit()
764 : (Constructor->isUserProvided() || Constructor->isExplicit()))
765 data().Aggregate =
false;
769 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(DUnderlying)) {
776 if (Constructor->isConstexpr() && !Constructor->isCopyOrMoveConstructor())
777 data().HasConstexprNonCopyMoveConstructor =
true;
781 if (
const auto *DD = dyn_cast<CXXDestructorDecl>(D)) {
782 SMKind |= SMF_Destructor;
784 if (DD->isUserProvided())
785 data().HasIrrelevantDestructor =
false;
792 if (DD->isVirtual()) {
793 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
794 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
799 if (
const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
800 if (Method->isCopyAssignmentOperator()) {
801 SMKind |= SMF_CopyAssignment;
803 const auto *ParamTy =
805 if (!ParamTy || ParamTy->getPointeeType().isConstQualified())
806 data().HasDeclaredCopyAssignmentWithConstParam =
true;
809 if (Method->isMoveAssignmentOperator())
810 SMKind |= SMF_MoveAssignment;
813 if (
auto *Conversion = dyn_cast<CXXConversionDecl>(D)) {
822 if (Conversion->getPrimaryTemplate()) {
828 FunTmpl ? cast<NamedDecl>(FunTmpl) : cast<NamedDecl>(Conversion);
833 Conversions.
addDecl(Ctx, Primary, AS);
840 data().HasTrivialSpecialMembers &=
841 data().DeclaredSpecialMembers | ~SMKind;
842 data().HasTrivialSpecialMembersForCall &=
843 data().DeclaredSpecialMembers | ~SMKind;
845 if (!Method->isImplicit() && !Method->isUserProvided()) {
849 }
else if (Method->isTrivial()) {
850 data().HasTrivialSpecialMembers |= SMKind;
851 data().HasTrivialSpecialMembersForCall |= SMKind;
852 }
else if (Method->isTrivialForCall()) {
853 data().HasTrivialSpecialMembersForCall |= SMKind;
854 data().DeclaredNonTrivialSpecialMembers |= SMKind;
856 data().DeclaredNonTrivialSpecialMembers |= SMKind;
862 if (!Method->isUserProvided())
863 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
868 data().DeclaredSpecialMembers |= SMKind;
870 if (!Method->isImplicit()) {
871 data().UserDeclaredSpecialMembers |= SMKind;
884 data().PlainOldData =
false;
892 if (
const auto *Field = dyn_cast<FieldDecl>(D)) {
900 if (data().HasBasesWithFields)
901 data().IsStandardLayout =
false;
907 if (Field->isUnnamedBitfield()) {
911 if (data().Empty && !Field->isZeroLengthBitField(Context) &&
914 data().Empty =
false;
922 if (data().HasBasesWithNonStaticDataMembers)
923 data().IsCXX11StandardLayout =
false;
931 data().Aggregate =
false;
932 data().PlainOldData =
false;
937 bool IsFirstField = !data().HasPrivateFields &&
938 !data().HasProtectedFields && !data().HasPublicFields;
945 case AS_private: data().HasPrivateFields =
true;
break;
946 case AS_protected: data().HasProtectedFields =
true;
break;
947 case AS_public: data().HasPublicFields =
true;
break;
948 case AS_none: llvm_unreachable(
"Invalid access specifier");
950 if ((data().HasPrivateFields + data().HasProtectedFields +
951 data().HasPublicFields) > 1) {
952 data().IsStandardLayout =
false;
953 data().IsCXX11StandardLayout =
false;
957 if (Field->isMutable()) {
958 data().HasMutableFields =
true;
959 data().NeedOverloadResolutionForCopyConstructor =
true;
965 if (
isUnion() && !Field->isAnonymousStructOrUnion())
966 data().HasVariantMembers =
true;
985 struct DefinitionData &Data = data();
986 Data.PlainOldData =
false;
987 Data.HasTrivialSpecialMembers = 0;
993 data().HasTrivialSpecialMembersForCall = 0;
999 Data.HasIrrelevantDestructor =
false;
1002 data().DefaultedCopyConstructorIsDeleted =
true;
1003 data().DefaultedMoveConstructorIsDeleted =
true;
1004 data().DefaultedMoveAssignmentIsDeleted =
true;
1005 data().DefaultedDestructorIsDeleted =
true;
1006 data().NeedOverloadResolutionForCopyConstructor =
true;
1007 data().NeedOverloadResolutionForMoveConstructor =
true;
1008 data().NeedOverloadResolutionForMoveAssignment =
true;
1009 data().NeedOverloadResolutionForDestructor =
true;
1011 }
else if (!Context.
getLangOpts().ObjCAutoRefCount) {
1015 data().PlainOldData =
false;
1018 if (!Field->hasInClassInitializer())
1019 data().HasUninitializedReferenceMember =
true;
1024 data().IsStandardLayout =
false;
1025 data().IsCXX11StandardLayout =
false;
1031 data().DefaultedCopyConstructorIsDeleted =
true;
1034 if (!Field->hasInClassInitializer() && !Field->isMutable()) {
1036 if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
1037 data().HasUninitializedFields =
true;
1039 data().HasUninitializedFields =
true;
1045 data().HasNonLiteralTypeFieldsOrBases =
true;
1047 if (Field->hasInClassInitializer() ||
1048 (Field->isAnonymousStructOrUnion() &&
1049 Field->getType()->getAsCXXRecordDecl()->hasInClassInitializer())) {
1050 data().HasInClassInitializer =
true;
1055 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1063 data().Aggregate =
false;
1067 data().PlainOldData =
false;
1075 data().DefaultedMoveAssignmentIsDeleted =
true;
1079 bool IsZeroSize = Field->isZeroSize(Context);
1082 auto *FieldRec = cast<CXXRecordDecl>(RecordTy->getDecl());
1083 if (FieldRec->getDefinition()) {
1084 addedClassSubobject(FieldRec);
1092 data().NeedOverloadResolutionForCopyConstructor =
true;
1093 data().NeedOverloadResolutionForMoveConstructor =
true;
1094 data().NeedOverloadResolutionForMoveAssignment =
true;
1103 if (FieldRec->hasNonTrivialCopyConstructor())
1104 data().DefaultedCopyConstructorIsDeleted =
true;
1105 if (FieldRec->hasNonTrivialMoveConstructor())
1106 data().DefaultedMoveConstructorIsDeleted =
true;
1107 if (FieldRec->hasNonTrivialMoveAssignment())
1108 data().DefaultedMoveAssignmentIsDeleted =
true;
1109 if (FieldRec->hasNonTrivialDestructor())
1110 data().DefaultedDestructorIsDeleted =
true;
1115 if (Field->isAnonymousStructOrUnion()) {
1116 data().NeedOverloadResolutionForCopyConstructor |=
1117 FieldRec->data().NeedOverloadResolutionForCopyConstructor;
1118 data().NeedOverloadResolutionForMoveConstructor |=
1119 FieldRec->data().NeedOverloadResolutionForMoveConstructor;
1120 data().NeedOverloadResolutionForMoveAssignment |=
1121 FieldRec->data().NeedOverloadResolutionForMoveAssignment;
1122 data().NeedOverloadResolutionForDestructor |=
1123 FieldRec->data().NeedOverloadResolutionForDestructor;
1131 if (!FieldRec->hasTrivialDefaultConstructor())
1132 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1140 if (!FieldRec->hasTrivialCopyConstructor())
1141 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
1143 if (!FieldRec->hasTrivialCopyConstructorForCall())
1144 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
1149 if (!FieldRec->hasTrivialMoveConstructor())
1150 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
1152 if (!FieldRec->hasTrivialMoveConstructorForCall())
1153 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
1161 if (!FieldRec->hasTrivialCopyAssignment())
1162 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
1166 if (!FieldRec->hasTrivialMoveAssignment())
1167 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
1169 if (!FieldRec->hasTrivialDestructor())
1170 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1171 if (!FieldRec->hasTrivialDestructorForCall())
1172 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1173 if (!FieldRec->hasIrrelevantDestructor())
1174 data().HasIrrelevantDestructor =
false;
1175 if (FieldRec->hasObjectMember())
1177 if (FieldRec->hasVolatileMember())
1179 if (FieldRec->getArgPassingRestrictions() ==
1187 if (!FieldRec->isStandardLayout())
1188 data().IsStandardLayout =
false;
1189 if (!FieldRec->isCXX11StandardLayout())
1190 data().IsCXX11StandardLayout =
false;
1196 if (data().IsStandardLayout &&
1197 (
isUnion() || IsFirstField || IsZeroSize) &&
1198 hasSubobjectAtOffsetZeroOfEmptyBaseType(Context, FieldRec))
1199 data().IsStandardLayout =
false;
1205 if (data().IsCXX11StandardLayout && IsFirstField) {
1208 for (
const auto &BI :
bases()) {
1210 data().IsCXX11StandardLayout =
false;
1217 if (FieldRec->hasMutableFields()) {
1218 data().HasMutableFields =
true;
1219 data().NeedOverloadResolutionForCopyConstructor =
true;
1229 if (!Field->hasInClassInitializer() &&
1230 !FieldRec->hasConstexprDefaultConstructor() && !
isUnion())
1233 data().DefaultedDefaultConstructorIsConstexpr =
false;
1240 if (!FieldRec->hasCopyConstructorWithConstParam())
1241 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
1249 if (!FieldRec->hasCopyAssignmentWithConstParam())
1250 data().ImplicitCopyAssignmentHasConstParam =
false;
1252 if (FieldRec->hasUninitializedReferenceMember() &&
1253 !Field->hasInClassInitializer())
1254 data().HasUninitializedReferenceMember =
true;
1259 if (FieldRec->hasVariantMembers() &&
1260 Field->isAnonymousStructOrUnion())
1261 data().HasVariantMembers =
true;
1266 (!Field->hasInClassInitializer() && !
isUnion()))
1267 data().DefaultedDefaultConstructorIsConstexpr =
false;
1275 data().DefaultedMoveAssignmentIsDeleted =
true;
1281 if (data().Empty && !IsZeroSize)
1282 data().Empty =
false;
1286 if (
auto *Shadow = dyn_cast<UsingShadowDecl>(D)) {
1287 if (Shadow->getDeclName().getNameKind()
1290 data().Conversions.get(Ctx).addDecl(Ctx, Shadow, Shadow->getAccess());
1294 if (
const auto *Using = dyn_cast<UsingDecl>(D)) {
1295 if (Using->getDeclName().getNameKind() ==
1297 data().HasInheritedConstructor =
true;
1300 data().Aggregate =
false;
1303 if (Using->getDeclName().getCXXOverloadedOperator() == OO_Equal)
1304 data().HasInheritedAssignment =
true;
1312 unsigned SMKind = 0;
1314 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1315 if (Constructor->isDefaultConstructor()) {
1316 SMKind |= SMF_DefaultConstructor;
1317 if (Constructor->isConstexpr())
1318 data().HasConstexprDefaultConstructor =
true;
1320 if (Constructor->isCopyConstructor())
1321 SMKind |= SMF_CopyConstructor;
1322 else if (Constructor->isMoveConstructor())
1323 SMKind |= SMF_MoveConstructor;
1324 else if (Constructor->isConstexpr())
1326 data().HasConstexprNonCopyMoveConstructor =
true;
1327 }
else if (isa<CXXDestructorDecl>(D)) {
1328 SMKind |= SMF_Destructor;
1330 data().HasIrrelevantDestructor =
false;
1332 SMKind |= SMF_CopyAssignment;
1334 SMKind |= SMF_MoveAssignment;
1339 data().HasTrivialSpecialMembers |= SMKind;
1341 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1345 unsigned SMKind = 0;
1347 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1348 if (Constructor->isCopyConstructor())
1349 SMKind = SMF_CopyConstructor;
1350 else if (Constructor->isMoveConstructor())
1351 SMKind = SMF_MoveConstructor;
1352 }
else if (isa<CXXDestructorDecl>(D))
1353 SMKind = SMF_Destructor;
1356 data().HasTrivialSpecialMembersForCall |= SMKind;
1358 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1363 !TemplateOrInstantiation.isNull())
1368 return isPOD() && data().HasOnlyCMembers;
1373 return getLambdaData().IsGenericLambda;
1391 assert(!Calls.
empty() &&
"Missing lambda call operator!");
1393 "More than one lambda call operator!");
1396 if (
const auto *CallOpTmpl = dyn_cast<FunctionTemplateDecl>(CallOp))
1397 return cast<CXXMethodDecl>(CallOpTmpl->getTemplatedDecl());
1399 return cast<CXXMethodDecl>(CallOp);
1407 if (Invoker.
empty())
return nullptr;
1409 "More than one static invoker operator!");
1411 if (
const auto *InvokerTemplate = dyn_cast<FunctionTemplateDecl>(InvokerFun))
1412 return cast<CXXMethodDecl>(InvokerTemplate->getTemplatedDecl());
1414 return cast<CXXMethodDecl>(InvokerFun);
1418 llvm::DenseMap<const VarDecl *, FieldDecl *> &Captures,
1421 ThisCapture =
nullptr;
1423 LambdaDefinitionData &Lambda = getLambdaData();
1425 for (
const LambdaCapture *C = Lambda.Captures, *CEnd = C + Lambda.NumCaptures;
1426 C != CEnd; ++C, ++Field) {
1427 if (C->capturesThis())
1428 ThisCapture = *Field;
1429 else if (C->capturesVariable())
1430 Captures[C->getCapturedVar()] = *Field;
1440 return Tmpl->getTemplateParameters();
1450 assert(std::is_partitioned(List->
begin(), List->
end(),
1452 &&
"Explicit template params should be ordered before implicit ones");
1454 const auto ExplicitEnd = llvm::partition_point(
1456 return llvm::makeArrayRef(List->
begin(), ExplicitEnd);
1460 assert(
isLambda() &&
"Not a lambda closure type!");
1462 return getLambdaData().ContextDecl.get(Source);
1468 ->getConversionType();
1488 const llvm::SmallPtrSet<CanQualType, 8> &ParentHiddenTypes,
1491 llvm::SmallPtrSet<NamedDecl*, 8> &HiddenVBaseCs) {
1495 const llvm::SmallPtrSet<CanQualType, 8> *HiddenTypes = &ParentHiddenTypes;
1496 llvm::SmallPtrSet<CanQualType, 8> HiddenTypesBuffer;
1502 if (ConvI != ConvE) {
1503 HiddenTypesBuffer = ParentHiddenTypes;
1504 HiddenTypes = &HiddenTypesBuffer;
1508 bool Hidden = ParentHiddenTypes.count(ConvType);
1510 HiddenTypesBuffer.insert(ConvType);
1514 if (Hidden && InVirtual)
1515 HiddenVBaseCs.insert(cast<NamedDecl>(I.getDecl()->getCanonicalDecl()));
1523 VOutput.
addDecl(I.getDecl(), IAccess);
1525 Output.
addDecl(Context, I.getDecl(), IAccess);
1531 for (
const auto &I : Record->
bases()) {
1537 bool BaseInVirtual = InVirtual || I.isVirtual();
1541 *HiddenTypes, Output, VOutput, HiddenVBaseCs);
1559 llvm::SmallPtrSet<NamedDecl*, 8> HiddenVBaseCs;
1562 llvm::SmallPtrSet<CanQualType, 8> HiddenTypes;
1568 Output.
append(Context, ConvI, ConvE);
1569 for (; ConvI != ConvE; ++ConvI)
1573 for (
const auto &I : Record->
bases()) {
1578 I.isVirtual(), I.getAccessSpecifier(),
1579 HiddenTypes, Output, VBaseCs, HiddenVBaseCs);
1585 if (!HiddenVBaseCs.count(cast<NamedDecl>(I.getDecl()->getCanonicalDecl())))
1586 Output.
addDecl(Context, I.getDecl(), I.getAccess());
1592 llvm::iterator_range<CXXRecordDecl::conversion_iterator>
1599 Set = &data().Conversions.get(Ctx);
1601 Set = &data().VisibleConversions.get(Ctx);
1603 if (!data().ComputedVisibleConversions) {
1605 data().ComputedVisibleConversions =
true;
1608 return llvm::make_range(Set->
begin(), Set->
end());
1624 for (
unsigned I = 0, E = Convs.
size(); I != E; ++I) {
1625 if (Convs[I].getDecl() == ConvDecl) {
1627 assert(llvm::find(Convs, ConvDecl) == Convs.
end() &&
1628 "conversion was found multiple times in unresolved set");
1633 llvm_unreachable(
"conversion not found in set!");
1638 return cast<CXXRecordDecl>(MSInfo->getInstantiatedFrom());
1650 assert(TemplateOrInstantiation.isNull() &&
1651 "Previous template or instantiation?");
1652 assert(!isa<ClassTemplatePartialSpecializationDecl>(
this));
1653 TemplateOrInstantiation
1662 TemplateOrInstantiation = Template;
1666 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this))
1667 return Spec->getSpecializationKind();
1670 return MSInfo->getTemplateSpecializationKind();
1677 if (
auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1678 Spec->setSpecializationKind(TSK);
1683 MSInfo->setTemplateSpecializationKind(TSK);
1687 llvm_unreachable(
"Not a class template or member class specialization");
1691 auto GetDefinitionOrSelf =
1693 if (
auto *Def = D->getDefinition())
1700 if (
auto *TD = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1701 auto From = TD->getInstantiatedFrom();
1703 while (
auto *NewCTD = CTD->getInstantiatedFromMemberTemplate()) {
1704 if (NewCTD->isMemberSpecialization())
1708 return GetDefinitionOrSelf(CTD->getTemplatedDecl());
1712 while (
auto *NewCTPSD = CTPSD->getInstantiatedFromMember()) {
1713 if (NewCTPSD->isMemberSpecialization())
1717 return GetDefinitionOrSelf(CTPSD);
1726 return GetDefinitionOrSelf(RD);
1731 "couldn't find pattern for class template instantiation");
1751 if (Destructor->isNoReturn())
1757 if (RD->isAnyDestructorNoReturn())
1761 for (
const auto *Field :
fields())
1763 Field->getType()->getBaseElementTypeUnsafe()->getAsCXXRecordDecl())
1764 if (RD->isAnyDestructorNoReturn())
1781 assert(
hasDefinition() &&
"checking for interface-like without a definition");
1795 for (
const auto *
const Method :
methods())
1796 if (Method->isDefined() && !Method->isImplicit())
1800 const auto *Uuid = getAttr<UuidAttr>();
1807 Uuid->getGuid() ==
"00000000-0000-0000-C000-000000000046") ||
1809 Uuid->getGuid() ==
"00020400-0000-0000-C000-000000000046"))) {
1823 if (BaseSpec.isVirtual() || BaseSpec.getAccessSpecifier() !=
AS_public)
1825 const auto *
Base = BaseSpec.getType()->getAsCXXRecordDecl();
1826 if (
Base->isInterface() || !
Base->isInterfaceLike())
1842 if (!FinalOverriders) {
1844 FinalOverriders = &MyFinalOverriders;
1848 for (CXXFinalOverriderMap::iterator M = FinalOverriders->begin(),
1849 MEnd = FinalOverriders->end();
1850 M != MEnd && !Done; ++M) {
1852 SOEnd = M->second.end();
1853 SO != SOEnd && !Done; ++SO) {
1854 assert(SO->second.size() > 0 &&
1855 "All virtual functions have overriding virtual functions");
1861 if (SO->second.front().Method->isPure()) {
1862 data().Abstract =
true;
1873 I.setAccess((*I)->getAccess());
1877 if (data().Abstract ||
isInvalidDecl() || !data().Polymorphic ||
1881 for (
const auto &B :
bases()) {
1882 const auto *BaseDecl =
1883 cast<CXXRecordDecl>(B.getType()->getAs<
RecordType>()->getDecl());
1884 if (BaseDecl->isAbstract())
1891 void CXXDeductionGuideDecl::anchor() {}
1910 case Decl::Kind::CXXConstructor:
1911 return cast<CXXConstructorDecl>(
Function)->getExplicitSpecifier();
1912 case Decl::Kind::CXXConversion:
1913 return cast<CXXConversionDecl>(
Function)->getExplicitSpecifier();
1914 case Decl::Kind::CXXDeductionGuide:
1915 return cast<CXXDeductionGuideDecl>(
Function)->getExplicitSpecifier();
1926 TInfo, EndLocation);
1936 void CXXMethodDecl::anchor() {}
1945 return isStaticOverloadedOperator(OOK);
1966 if (isa<CXXDestructorDecl>(
this)) {
1993 if (
auto *MD = getCorrespondingMethodDeclaredInClass(RD, MayBeBase))
1996 for (
const auto &I : RD->
bases()) {
2000 const auto *
Base = cast<CXXRecordDecl>(RT->
getDecl());
2017 CXXMethodDecl(CXXMethod, C, RD, StartLoc, NameInfo, T, TInfo, SC,
2018 isInline, ConstexprKind, EndLocation);
2029 assert(isVirtual() &&
"this method is expected to be virtual");
2038 if (hasAttr<FinalAttr>())
2039 return isPure() ? nullptr :
this;
2053 if (!BestDynamicDecl)
2058 getCorrespondingMethodInClass(BestDynamicDecl);
2063 if (DevirtualizedMethod->
isPure())
2067 if (DevirtualizedMethod->
hasAttr<FinalAttr>())
2068 return DevirtualizedMethod;
2072 if (BestDynamicDecl->
hasAttr<FinalAttr>())
2073 return DevirtualizedMethod;
2075 if (
const auto *DRE = dyn_cast<DeclRefExpr>(Base)) {
2076 if (
const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
2077 if (VD->getType()->isRecordType())
2079 return DevirtualizedMethod;
2087 if (
const auto *ME = dyn_cast<MemberExpr>(Base)) {
2088 const ValueDecl *VD = ME->getMemberDecl();
2094 if (
auto *BO = dyn_cast<BinaryOperator>(Base)) {
2095 if (BO->isPtrMemOp()) {
2097 if (MPT->getPointeeType()->isRecordType())
2098 return DevirtualizedMethod;
2108 assert(PreventedBy.empty() &&
"PreventedBy is expected to be empty");
2109 if (getOverloadedOperator() != OO_Delete &&
2110 getOverloadedOperator() != OO_Array_Delete)
2116 if (getPrimaryTemplate())
2123 if (getNumParams() == 1)
2125 unsigned UsualParams = 1;
2132 if (isDestroyingOperatorDelete())
2146 if (UsualParams < getNumParams() &&
2151 if (UsualParams < getNumParams() &&
2152 getParamDecl(UsualParams)->getType()->isAlignValT())
2155 if (UsualParams != getNumParams())
2165 isDestroyingOperatorDelete())
2172 for (
const auto *D : R) {
2173 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
2174 if (FD->getNumParams() == 1) {
2175 PreventedBy.push_back(FD);
2188 if (getOverloadedOperator() != OO_Equal ||
2190 getPrimaryTemplate() || getDescribedFunctionTemplate() ||
2191 getNumParams() != 1)
2194 QualType ParamType = getParamDecl(0)->getType();
2209 if (getOverloadedOperator() != OO_Equal || isStatic() ||
2210 getPrimaryTemplate() || getDescribedFunctionTemplate() ||
2211 getNumParams() != 1)
2214 QualType ParamType = getParamDecl(0)->getType();
2215 if (!isa<RValueReferenceType>(ParamType))
2228 "Can't add an overridden method to a class template!");
2229 assert(MD->
isVirtual() &&
"Method is not virtual!");
2235 if (isa<CXXConstructorDecl>(
this))
return nullptr;
2240 if (isa<CXXConstructorDecl>(
this))
return nullptr;
2245 if (isa<CXXConstructorDecl>(
this))
return 0;
2251 if (isa<CXXConstructorDecl>(
this))
2281 assert(isInstance() &&
"No 'this' for static methods!");
2289 assert(isInstance() &&
"No 'this' for static methods!");
2311 if (StaticInvoker ==
this)
return true;
2313 return StaticInvoker == this->getPrimaryTemplate()->getTemplatedDecl();
2324 : Initializee(TInfo), MemberOrEllipsisLocation(EllipsisLoc), Init(Init),
2325 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(IsVirtual),
2326 IsWritten(
false), SourceOrder(0) {}
2333 : Initializee(Member), MemberOrEllipsisLocation(MemberLoc), Init(Init),
2334 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2335 IsWritten(
false), SourceOrder(0) {}
2342 : Initializee(Member), MemberOrEllipsisLocation(MemberLoc), Init(Init),
2343 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2344 IsWritten(
false), SourceOrder(0) {}
2350 : Initializee(TInfo), Init(Init), LParenLoc(L), RParenLoc(R),
2351 IsDelegating(
true), IsVirtual(
false), IsWritten(
false), SourceOrder(0) {}
2367 return Initializee.get<
TypeSourceInfo*>()->getType().getTypePtr();
2380 return TSInfo->getTypeLoc().getLocalSourceRange().getBegin();
2389 return I->getSourceRange();
2396 CXXConstructorDecl::CXXConstructorDecl(
2401 :
CXXMethodDecl(CXXConstructor, C, RD, StartLoc, NameInfo, T, TInfo,
2403 setNumCtorInitializers(0);
2404 setInheritingConstructor(static_cast<bool>(Inherited));
2405 setImplicit(isImplicitlyDeclared);
2406 CXXConstructorDeclBits.HasTrailingExplicitSpecifier = ES.
getExpr() ? 1 : 0;
2408 *getTrailingObjects<InheritedConstructor>() = Inherited;
2409 setExplicitSpecifier(ES);
2412 void CXXConstructorDecl::anchor() {}
2417 bool hasTraillingExplicit =
static_cast<bool>(AllocKind & TAKHasTailExplicit);
2418 bool isInheritingConstructor =
2419 static_cast<bool>(AllocKind & TAKInheritsConstructor);
2421 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2422 isInheritingConstructor, hasTraillingExplicit);
2428 Result->CXXConstructorDeclBits.HasTrailingExplicitSpecifier =
2429 hasTraillingExplicit;
2441 "Name must refer to a constructor");
2443 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2444 Inherited ? 1 : 0, ES.
getExpr() ? 1 : 0);
2445 return new (
C, RD, Extra)
2447 isImplicitlyDeclared, ConstexprKind, Inherited);
2451 return CtorInitializers.get(getASTContext().getExternalSource());
2455 assert(isDelegatingConstructor() &&
"Not a delegating constructor!");
2457 if (
const auto *Construct = dyn_cast<CXXConstructExpr>(E))
2458 return Construct->getConstructor();
2467 return (getNumParams() == 0) ||
2468 (getNumParams() > 0 && getParamDecl(0)->hasDefaultArg());
2473 return isCopyOrMoveConstructor(TypeQuals) &&
2474 getParamDecl(0)->getType()->isLValueReferenceType();
2478 return isCopyOrMoveConstructor(TypeQuals) &&
2479 getParamDecl(0)->getType()->isRValueReferenceType();
2494 if ((getNumParams() < 1) ||
2495 (getNumParams() > 1 && !getParamDecl(1)->hasDefaultArg()) ||
2496 (getPrimaryTemplate() !=
nullptr) ||
2497 (getDescribedFunctionTemplate() !=
nullptr))
2531 if (isExplicit() && !AllowExplicit)
2534 return (getNumParams() == 0 &&
2535 getType()->getAs<FunctionProtoType>()->isVariadic()) ||
2536 (getNumParams() == 1) ||
2537 (getNumParams() > 1 &&
2538 (getParamDecl(1)->hasDefaultArg() ||
2539 getParamDecl(1)->isParameterPack()));
2543 if ((getNumParams() < 1) ||
2544 (getNumParams() > 1 && !getParamDecl(1)->hasDefaultArg()) ||
2545 (getDescribedFunctionTemplate() !=
nullptr))
2562 void CXXDestructorDecl::anchor() {}
2568 QualType(),
nullptr,
false,
false);
2576 bool isInline,
bool isImplicitlyDeclared) {
2579 "Name must refer to a destructor");
2581 isInline, isImplicitlyDeclared);
2585 auto *
First = cast<CXXDestructorDecl>(getFirstDecl());
2586 if (OD && !
First->OperatorDelete) {
2587 First->OperatorDelete = OD;
2588 First->OperatorDeleteThisArg = ThisArg;
2589 if (
auto *L = getASTMutationListener())
2590 L->ResolvedOperatorDelete(
First, OD, ThisArg);
2594 void CXXConversionDecl::anchor() {}
2610 "Name must refer to a conversion function");
2613 ConstexprKind, EndLocation);
2617 return isImplicit() && getParent()->isLambda() &&
2618 getConversionType()->isBlockPointerType();
2627 LinkageSpecDeclBits.HasBraces = HasBraces;
2630 void LinkageSpecDecl::anchor() {}
2638 return new (
C, DC)
LinkageSpecDecl(DC, ExternLoc, LangLoc, Lang, HasBraces);
2647 void UsingDirectiveDecl::anchor() {}
2656 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(Used))
2657 Used = NS->getOriginalNamespace();
2659 IdentLoc, Used, CommonAncestor);
2671 if (
auto *NA = dyn_cast_or_null<NamespaceAliasDecl>(NominatedNamespace))
2672 return NA->getNamespace();
2673 return cast_or_null<NamespaceDecl>(NominatedNamespace);
2680 redeclarable_base(C), LocStart(StartLoc),
2681 AnonOrFirstNamespaceAndInline(
nullptr, Inline) {
2682 setPreviousDecl(PrevDecl);
2692 return new (
C, DC)
NamespaceDecl(C, DC, Inline, StartLoc, IdLoc, Id,
2705 return AnonOrFirstNamespaceAndInline.getPointer();
2712 return AnonOrFirstNamespaceAndInline.getPointer();
2718 return getNextRedeclaration();
2722 return getPreviousDecl();
2726 return getMostRecentDecl();
2729 void NamespaceAliasDecl::anchor() {}
2732 return getNextRedeclaration();
2736 return getPreviousDecl();
2740 return getMostRecentDecl();
2751 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(Namespace))
2752 Namespace = NS->getOriginalNamespace();
2754 QualifierLoc, IdentLoc, Namespace);
2765 void UsingShadowDecl::anchor() {}
2788 while (
const auto *NextShadow =
2789 dyn_cast<UsingShadowDecl>(Shadow->UsingOrNextShadow))
2790 Shadow = NextShadow;
2791 return cast<UsingDecl>(Shadow->UsingOrNextShadow);
2794 void ConstructorUsingShadowDecl::anchor() {}
2813 void UsingDecl::anchor() {}
2816 assert(std::find(shadow_begin(), shadow_end(), S) == shadow_end() &&
2817 "declaration already in set");
2820 if (FirstUsingShadow.getPointer())
2821 S->UsingOrNextShadow = FirstUsingShadow.getPointer();
2822 FirstUsingShadow.setPointer(S);
2826 assert(std::find(shadow_begin(), shadow_end(), S) != shadow_end() &&
2827 "declaration not in set");
2832 if (FirstUsingShadow.getPointer() == S) {
2833 FirstUsingShadow.setPointer(
2834 dyn_cast<UsingShadowDecl>(S->UsingOrNextShadow));
2835 S->UsingOrNextShadow =
this;
2840 while (Prev->UsingOrNextShadow != S)
2841 Prev = cast<UsingShadowDecl>(Prev->UsingOrNextShadow);
2842 Prev->UsingOrNextShadow = S->UsingOrNextShadow;
2843 S->UsingOrNextShadow =
this;
2850 return new (
C, DC)
UsingDecl(DC, UL, QualifierLoc, NameInfo, HasTypename);
2861 ? getQualifierLoc().getBeginLoc() : UsingLocation;
2865 void UsingPackDecl::anchor() {}
2870 size_t Extra = additionalSizeToAlloc<NamedDecl *>(UsingDecls.size());
2871 return new (
C, DC, Extra)
UsingPackDecl(DC, InstantiatedFrom, UsingDecls);
2875 unsigned NumExpansions) {
2876 size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
2878 Result->NumExpansions = NumExpansions;
2879 auto *Trail = Result->getTrailingObjects<
NamedDecl *>();
2880 for (
unsigned I = 0; I != NumExpansions; ++I)
2885 void UnresolvedUsingValueDecl::anchor() {}
2894 QualifierLoc, NameInfo,
2909 ? getQualifierLoc().getBeginLoc() : UsingLocation;
2913 void UnresolvedUsingTypenameDecl::anchor() {}
2924 DC, UsingLoc, TypenameLoc, QualifierLoc, TargetNameLoc,
2935 void StaticAssertDecl::anchor() {}
2953 void BindingDecl::anchor() {}
2967 return cast_or_null<ValueDecl>(Decomp.get(Source));
2971 Expr *B = getBinding();
2978 auto *VD = dyn_cast<
VarDecl>(DRE->getDecl());
2979 assert(VD->isImplicit() &&
"holding var for binding decl not implicit");
2983 void DecompositionDecl::anchor() {}
2991 size_t Extra = additionalSizeToAlloc<BindingDecl *>(Bindings.size());
2992 return new (
C, DC, Extra)
2998 unsigned NumBindings) {
2999 size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
3004 Result->NumBindings = NumBindings;
3005 auto *Trail = Result->getTrailingObjects<
BindingDecl *>();
3006 for (
unsigned I = 0; I != NumBindings; ++I)
3014 for (
const auto *B : bindings()) {
3023 void MSPropertyDecl::anchor() {}
3031 return new (
C, DC)
MSPropertyDecl(DC, L, N, T, TInfo, StartL, Getter, Setter);
3044 llvm_unreachable(
"Invalid access specifier!");
3052 llvm_unreachable(
"Invalid access specifier!");
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl)
Defines the clang::ASTContext interface.
static const char * getAccessName(AccessSpecifier AS)
void setImplicit(bool I=true)
Represents a function declaration or definition.
Expr * getInit() const
Get the initializer.
A (possibly-)qualified type.
virtual Decl * GetExternalDecl(uint32_t ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
bool replace(const NamedDecl *Old, NamedDecl *New, AccessSpecifier AS)
Replaces the given declaration with the new one, once.
const CXXMethodDecl *const * method_iterator
Attempt to be ABI-compatible with code generated by Clang 6.0.x (SVN r321711).
unsigned getNumBases() const
Retrieves the number of base classes of this class.
static UnresolvedUsingValueDecl * CreateDeserialized(ASTContext &C, unsigned ID)
This file contains the declaration of the ODRHash class, which calculates a hash based on AST nodes...
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
static UsingPackDecl * Create(ASTContext &C, DeclContext *DC, NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl *> UsingDecls)
void setInheritingConstructor(bool isIC=true)
State that this is an implicit constructor synthesized to model a call to a constructor inherited fro...
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
bool isInClassMemberInitializer() const
Determine whether this initializer is an implicit initializer generated for a field with an initializ...
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a member function...
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
static bool hasRepeatedBaseClass(const CXXRecordDecl *StartRD)
Determine whether a class has a repeated base class.
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
static AccessSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
C Language Family Type Representation.
QualType getThisType() const
Return the type of the this pointer.
bool hasNonTrivialCopyConstructor() const
Determine whether this class has a non-trivial copy constructor (C++ [class.copy]p6, C++11 [class.copy]p12)
bool isRecordType() const
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
Decl - This represents one declaration (or definition), e.g.
void append(ASTContext &C, iterator I, iterator E)
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
void setArgPassingRestrictions(ArgPassingKind Kind)
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
bool isPOD() const
Whether this class is a POD-type (C++ [class]p4)
Defines the C++ template declaration subclasses.
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
llvm::iterator_range< conversion_iterator > getVisibleConversionFunctions()
Get all conversion functions visible in current class, including conversion function templates...
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
ExplicitSpecKind getKind() const
The base class of the type hierarchy.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
Represent a C++ namespace.
virtual void completeDefinition()
Note that the definition of this type is now complete.
SourceLocation getEndLoc() const LLVM_READONLY
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
ArrayRef< NamedDecl * > getLambdaExplicitTemplateParameters() const
Retrieve the lambda template parameters that were specified explicitly.
A container of type source information.
Store information needed for an explicit specifier.
constexpr XRayInstrMask Function
bool isDefined(const FunctionDecl *&Definition) const
Returns true if the function has a definition that does not need to be instantiated.
bool hasFriends() const
Determines whether this record has any friends.
Describes the capture of a variable or of this, or of a C++1y init-capture.
Represents a C++ constructor within a class.
bool mayBeAbstract() const
Determine whether this class may end up being abstract, even though it is not yet known to be abstrac...
unsigned Access
Access - Used by C++ decls for the access specifier.
static QualType getThisObjectType(ASTContext &C, const FunctionProtoType *FPT, const CXXRecordDecl *Decl)
CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo, bool IsVirtual, SourceLocation L, Expr *Init, SourceLocation R, SourceLocation EllipsisLoc)
Creates a new base-class initializer.
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
This file provides some common utility functions for processing Lambda related AST Constructs...
Represents a variable declaration or definition.
ASTMutationListener * getASTMutationListener() const
void finishedDefaultedOrDeletedMember(CXXMethodDecl *MD)
Indicates that the declaration of a defaulted or deleted special member function is now complete...
const T * getAs() const
Member-template getAs<specific type>'.
static MSPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL, IdentifierInfo *Getter, IdentifierInfo *Setter)
The "__interface" keyword.
bool isExternCContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
bool isInvalidDecl() const
static bool allLookupResultsAreTheSame(const DeclContext::lookup_result &R)
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getODRHash() const
bool isInterfaceLike() const
CXXMethodDecl * getCorrespondingMethodDeclaredInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find if RD declares a function that overrides this function, and if so, return it.
bool hasDefinition() const
Represents a parameter to a function.
TemplateParameterList * getGenericLambdaTemplateParameterList() const
Retrieve the generic lambda's template parameter list.
Defines the clang::Expr interface and subclasses for C++ expressions.
SourceLocation getRParenLoc() const
VarDecl * getHoldingVar() const
Get the variable (if any) that holds the value of evaluating the binding.
CXXConstructorDecl * getTargetConstructor() const
When this constructor delegates to another, retrieve the target.
static CXXMethodDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInline, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation)
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the kind of specialization or template instantiation this is.
Base wrapper for a particular "section" of type source info.
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
Represents a struct/union/class.
Description of a constructor that was inherited from a base class.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
One of these records is kept for each identifier that is lexed.
const Expr * getBestDynamicClassTypeExpr() const
Get the inner expression that determines the best dynamic class.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
The results of name lookup within a DeclContext.
field_range fields() const
NameKind getNameKind() const
Determine what kind of name this is.
static DecompositionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation LSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl *> Bindings)
Represents a member of a struct/union/class.
static CXXRecordDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
conversion_iterator conversion_end() const
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isCopyOrMoveConstructor() const
Determine whether this a copy or move constructor.
bool isReferenceType() const
The iterator over UnresolvedSets.
static UnresolvedUsingTypenameDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation TypenameLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TargetNameLoc, DeclarationName TargetName, SourceLocation EllipsisLoc)
bool hasUserDeclaredDestructor() const
Determine whether this class has a user-declared destructor.
Represents an access specifier followed by colon ':'.
void addShadowDecl(UsingShadowDecl *S)
static StaticAssertDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static CXXRecordDecl * CreateLambda(const ASTContext &C, DeclContext *DC, TypeSourceInfo *Info, SourceLocation Loc, bool DependentLambda, bool IsGeneric, LambdaCaptureDefault CaptureDefault)
static NamespaceDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Represents a C++ using-declaration.
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
void completeDefinition() override
Indicates that the definition of this class is now complete.
bool hasNonLiteralTypeFieldsOrBases() const
Determine whether this class has a non-literal or/ volatile type non-static data member or base class...
static CXXDeductionGuideDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, ExplicitSpecifier ES, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation)
void addDecl(ASTContext &C, NamedDecl *D, AccessSpecifier AS)
TagKind getTagKind() const
AccessSpecifier getAccessSpecifier() const
Returns the access specifier for this base specifier.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
static UnresolvedUsingTypenameDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setHasObjectMember(bool val)
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
A set of unresolved declarations.
bool isRValueReferenceType() const
The argument of this type cannot be passed directly in registers.
Defines the Diagnostic-related interfaces.
bool isLambda() const
Determine whether this class describes a lambda function object.
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
field_iterator field_begin() const
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool isAnyMemberInitializer() const
base_class_iterator bases_begin()
FieldDecl * getAnyMember() const
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Namespace)
bool isEquivalent(const ExplicitSpecifier Other) const
Check for Equivalence of explicit specifiers.
static CXXConstructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, ExplicitSpecifier ES, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, InheritedConstructor Inherited=InheritedConstructor())
bool hasSimpleCopyConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous copy constructor that ...
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
Represents a linkage specification.
StringRef getLambdaStaticInvokerName()
A binding in a decomposition declaration.
init_iterator init_begin()
Retrieve an iterator to the first initializer.
CXXMethodDecl * getCorrespondingMethodInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find the method in RD that corresponds to this one.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
CXXRecordDecl(Kind K, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl)
bool isLambdaStaticInvoker() const
Determine whether this is a lambda closure type's static member function that is used for the result ...
static CXXDeductionGuideDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setBases(CXXBaseSpecifier const *const *Bases, unsigned NumBases)
Sets the base classes of this struct or class.
bool isTriviallyCopyable() const
Determine whether this class is considered trivially copyable per (C++11 [class]p6).
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
A little helper class used to produce diagnostics.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Represents a prototype with parameter type info, e.g.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
method_iterator end_overridden_methods() const
DeclarationNameTable DeclarationNames
static StaticAssertDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *Message, SourceLocation RParenLoc, bool Failed)
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
static CXXDestructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isImplicitlyDeclared)
bool isCLike() const
True if this class is C-like, without C++-specific features, e.g.
static bool recursivelyOverrides(const CXXMethodDecl *DerivedMD, const CXXMethodDecl *BaseMD)
static CXXConversionDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, ExplicitSpecifier ES, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation)
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
bool isObjCGCStrong() const
true when Type is objc's strong.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
This represents one expression.
Defines the clang::LangOptions interface.
static LinkageSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
const T * castAs() const
Member-template castAs<specific type>.
void getFinalOverriders(CXXFinalOverriderMap &FinaOverriders) const
Retrieve the final overriders for each virtual member function in the class hierarchy where this clas...
bool isObjCRetainableType() const
static UnresolvedUsingValueDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, SourceLocation EllipsisLoc)
Represents a C++ destructor within a class.
bool isCopyConstructor() const
Whether this constructor is a copy constructor (C++ [class.copy]p2, which can be used to copy the cla...
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
const CXXRecordDecl * getTemplateInstantiationPattern() const
Retrieve the record declaration from which this record could be instantiated.
Defines an enumeration for C++ overloaded operators.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
field_iterator field_end() const
overridden_method_range overridden_methods() const
ObjCLifetime getObjCLifetime() const
DeclContext * getDeclContext()
CXXRecordDecl * getDefinition() const
bool hasAnyDependentBases() const
Determine whether this class has any dependent base classes which are not the current instantiation...
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
StorageClass getStorageClass() const
Returns the storage class as written in the source.
const Expr * getExpr() const
Defines the clang::TypeLoc interface and its subclasses.
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
static CanQualType GetConversionType(ASTContext &Context, NamedDecl *Conv)
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
static NamespaceAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
unsigned getCVRQualifiers() const
Retrieve the const/volatile/restrict qualifiers.
StorageClass
Storage classes.
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
DeclContext * getParent()
getParent - Returns the containing DeclContext.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization, retrieves the member specialization information.
An lvalue reference type, per C++11 [dcl.ref].
bool isLambdaToBlockPointerConversion() const
Determine whether this conversion function is a conversion from a lambda closure type to a block poin...
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
bool hasSimpleMoveConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous move constructor that ...
void setOperatorDelete(FunctionDecl *OD, Expr *ThisArg)
Represents a C++ deduction guide declaration.
void setDescribedClassTemplate(ClassTemplateDecl *Template)
Represents a C++ conversion function within a class.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
The result type of a method or function.
static UsingDirectiveDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
bool hasNonTrivialMoveAssignment() const
Determine whether this class has a non-trivial move assignment operator (C++11 [class.copy]p25)
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
bool hasNonTrivialMoveConstructor() const
Determine whether this class has a non-trivial move constructor (C++11 [class.copy]p12) ...
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so...
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
bool isConstQualified() const
Determine whether this type is const-qualified.
RecordDecl * getDecl() const
Abstract interface for external sources of AST nodes.
unsigned size_overridden_methods() const
Decl::Kind getDeclKind() const
Assigning into this object requires the old value to be released and the new value to be retained...
static UsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
SourceRange getSourceRange() const LLVM_READONLY
Determine the source range covering the entire initializer.
static CXXDestructorDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Encodes a location in the source.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
bool isPure() const
Whether this virtual function is pure, i.e.
void setTrivialForCallFlags(CXXMethodDecl *MD)
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
DeclarationName getName() const
getName - Returns the embedded declaration name.
ASTContext & getASTContext() const LLVM_READONLY
static DecompositionDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumBindings)
Represents a dependent using declaration which was not marked with typename.
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set...
bool isUsualDeallocationFunction(SmallVectorImpl< const FunctionDecl *> &PreventedBy) const
Determine whether this is a usual deallocation function (C++ [basic.stc.dynamic.deallocation]p2), which is an overloaded delete or delete[] operator with a particular signature.
void removeShadowDecl(UsingShadowDecl *S)
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
Represents a static or instance method of a struct/union/class.
void addOverriddenMethod(const CXXMethodDecl *MD)
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
Qualifiers getMethodQuals() const
bool isGenericLambda() const
Determine whether this class describes a generic lambda function object (i.e.
void addDecl(NamedDecl *D)
static MSPropertyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static ConstructorUsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static bool isDeclContextInNamespace(const DeclContext *DC)
bool forallBases(ForallBasesCallback BaseMatches, bool AllowShortCircuit=true) const
Determines if the given callback holds for all the direct or indirect base classes of this type...
static ConstructorUsingShadowDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, UsingDecl *Using, NamedDecl *Target, bool IsVirtual)
const CXXRecordDecl * getBestDynamicClassType() const
For an expression of class type or pointer to class type, return the most derived class decl the expr...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
static ExplicitSpecifier getFromDecl(FunctionDecl *Function)
SourceLocation getMemberLocation() const
Represents a C++11 static_assert declaration.
bool isTrivialForCall() const
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
NamedDecl * getDecl() const
TypeLoc getBaseClassLoc() const
If this is a base class initializer, returns the type of the base class with location information...
Defines various enumerations that describe declaration and type specifiers.
bool hasSimpleDestructor() const
true if we know for sure that this class has an accessible destructor that is not deleted...
TagTypeKind
The kind of a tag type.
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
static LinkageSpecDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation ExternLoc, SourceLocation LangLoc, LanguageIDs Lang, bool HasBraces)
Dataflow Directional Tag Classes.
ConstexprSpecKind
Define the kind of constexpr specifier.
static CXXConversionDecl * CreateDeserialized(ASTContext &C, unsigned ID)
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
void setHasVolatileMember(bool val)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
method_iterator begin_overridden_methods() const
bool isCXX98PODType(const ASTContext &Context) const
Return true if this is a POD type according to the rules of the C++98 standard, regardless of the cur...
Represents a field injected from an anonymous union/struct into the parent scope. ...
SourceLocation getSourceLocation() const
Determine the source location of the initializer.
AccessSpecifier getAccess() const
void removeConversion(const NamedDecl *Old)
Removes a conversion function from this class.
A decomposition declaration.
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
MapType::iterator iterator
bool hasInlineBody() const
bool hasUserDeclaredConstructor() const
Determine whether this class has any user-declared constructors.
Represents a dependent using declaration which was marked with typename.
conversion_iterator conversion_begin() const
void AddCXXRecordDecl(const CXXRecordDecl *Record)
static UsingDirectiveDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation NamespaceLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Nominated, DeclContext *CommonAncestor)
The name of a declaration.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined...
bool isSpecializationCopyingObject() const
Determine whether this is a member template specialization that would copy the object to itself...
bool isAnyDestructorNoReturn() const
Returns true if the class destructor, or any implicitly invoked destructors are marked noreturn...
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
U cast(CodeGen::Address addr)
A mapping from each virtual member function to its set of final overriders.
UsingShadowDecl(Kind K, ASTContext &C, DeclContext *DC, SourceLocation Loc, UsingDecl *Using, NamedDecl *Target)
A pointer to member type per C++ 8.3.3 - Pointers to members.
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
llvm::BumpPtrAllocator & getAllocator() const
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext, providing only those that are of type SpecificDecl (or a class derived from it).
bool hasNonTrivialCopyAssignment() const
Determine whether this class has a non-trivial copy assignment operator (C++ [class.copy]p11, C++11 [class.copy]p25)
bool isMoveConstructor() const
Determine whether this constructor is a move constructor (C++11 [class.copy]p3), which can be used to...
UsingDecl * getUsingDecl() const
Gets the using declaration to which this declaration is tied.
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point...
static AccessSpecifier MergeAccess(AccessSpecifier PathAccess, AccessSpecifier DeclAccess)
Calculates the access of a decl that is reached along a path.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
CXXMethodDecl * getDevirtualizedMethod(const Expr *Base, bool IsAppleKext)
If it's possible to devirtualize a call to this method, return the called function.
Represents a C++ base or member initializer.
LanguageIDs
Represents the language in a linkage specification.
bool hasNonTrivialObjCLifetime() const
ValueDecl * getDecomposedDecl() const
Get the decomposition declaration that this binding represents a decomposition of.
An UnresolvedSet-like class which uses the ASTContext's allocator.
static CXXMethodDecl * CreateDeserialized(ASTContext &C, unsigned ID)
QualType getThisObjectType() const
Return the type of the object pointed by this.
Base for LValueReferenceType and RValueReferenceType.
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
Represents a base class of a C++ class.
void getCaptureFields(llvm::DenseMap< const VarDecl *, FieldDecl *> &Captures, FieldDecl *&ThisCapture) const
For a closure type, retrieve the mapping from captured variables and this to the non-static data memb...
static CXXConstructorDecl * CreateDeserialized(ASTContext &C, unsigned ID, uint64_t AllocKind)
CXXMethodDecl * getLambdaStaticInvoker() const
Retrieve the lambda static invoker, the address of which is returned by the conversion operator...
static BindingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id)
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
Reading or writing from this object requires a barrier call.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
void Deallocate(void *Ptr) const
Defines the clang::SourceLocation class and associated facilities.
Represents a C++ struct/union/class.
bool hasSimpleMoveAssignment() const
true if we know for sure that this class has a single, accessible, unambiguous move assignment operat...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Provides information a specialization of a member of a class template, which may be a member function...
LambdaCaptureDefault getLambdaCaptureDefault() const
void printName(raw_ostream &os) const override
base_class_iterator bases_end()
ASTImporterLookupTable & LT
static UsingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
Declaration of a class template.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
bool lambdaIsDefaultConstructibleAndAssignable() const
Determine whether this lambda should have an implicit default constructor and copy and move assignmen...
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
StringLiteral - This represents a string literal expression, e.g.
ASTContext & getParentASTContext() const
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Kind
Lists the kind of concrete classes of Decl.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
void AddStmt(const Stmt *S)
static UsingPackDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumExpansions)
bool isConvertingConstructor(bool AllowExplicit) const
Whether this constructor is a converting constructor (C++ [class.conv.ctor]), which can be used for u...
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
A reference to a declared variable, function, enum, etc.
bool isDeleted() const
Whether this function has been deleted.
ASTContext::overridden_method_range overridden_method_range
An instance of this class represents the declaration of a property member.
A trivial tuple used to represent a source range.
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
This represents a decl that may have a name.
bool isTranslationUnit() const
Represents a C++ namespace alias.
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
static UsingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static void CollectVisibleConversions(ASTContext &Context, CXXRecordDecl *Record, bool InVirtual, AccessSpecifier Access, const llvm::SmallPtrSet< CanQualType, 8 > &ParentHiddenTypes, ASTUnresolvedSet &Output, UnresolvedSetImpl &VOutput, llvm::SmallPtrSet< NamedDecl *, 8 > &HiddenVBaseCs)
Collect the visible conversions of a base class.
Represents C++ using-directive.
static BindingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
const LangOptions & getLangOpts() const
Declaration of a template function.
void setTargetDecl(NamedDecl *ND)
Sets the underlying declaration which has been brought into the local scope.
int64_t getID(const ASTContext &Context) const
SourceLocation getLocation() const
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Represents a pack of using declarations that a single using-declarator pack-expanded into...
bool isBeingDefined() const
Return true if this decl is currently being defined.
Defines the LambdaCapture class.
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
method_range methods() const
QualType getType() const
Retrieves the type of the base class.