Go to the documentation of this file.
39 #include "llvm/ADT/None.h"
40 #include "llvm/ADT/SmallPtrSet.h"
41 #include "llvm/ADT/SmallVector.h"
42 #include "llvm/ADT/iterator_range.h"
43 #include "llvm/Support/Casting.h"
44 #include "llvm/Support/ErrorHandling.h"
45 #include "llvm/Support/Format.h"
46 #include "llvm/Support/raw_ostream.h"
52 using namespace clang;
58 void AccessSpecDecl::anchor() {}
64 void LazyASTUnresolvedSet::getFromExternalSource(
ASTContext &C)
const {
66 assert(Impl.Decls.isLazy() &&
"getFromExternalSource for non-lazy set");
67 assert(Source &&
"getFromExternalSource with no external source");
71 reinterpret_cast<uintptr_t>(I.getDecl()) >> 2)));
72 Impl.Decls.setLazy(
false);
75 CXXRecordDecl::DefinitionData::DefinitionData(
CXXRecordDecl *D)
76 : UserDeclaredConstructor(
false), UserDeclaredSpecialMembers(0),
78 Abstract(
false), IsStandardLayout(
true), IsCXX11StandardLayout(
true),
79 HasBasesWithFields(
false), HasBasesWithNonStaticDataMembers(
false),
80 HasPrivateFields(
false), HasProtectedFields(
false),
81 HasPublicFields(
false), HasMutableFields(
false), HasVariantMembers(
false),
82 HasOnlyCMembers(
true), HasInitMethod(
false), HasInClassInitializer(
false),
83 HasUninitializedReferenceMember(
false), HasUninitializedFields(
false),
84 HasInheritedConstructor(
false), HasInheritedDefaultConstructor(
false),
85 HasInheritedAssignment(
false),
86 NeedOverloadResolutionForCopyConstructor(
false),
87 NeedOverloadResolutionForMoveConstructor(
false),
88 NeedOverloadResolutionForCopyAssignment(
false),
89 NeedOverloadResolutionForMoveAssignment(
false),
90 NeedOverloadResolutionForDestructor(
false),
91 DefaultedCopyConstructorIsDeleted(
false),
92 DefaultedMoveConstructorIsDeleted(
false),
93 DefaultedCopyAssignmentIsDeleted(
false),
94 DefaultedMoveAssignmentIsDeleted(
false),
95 DefaultedDestructorIsDeleted(
false), HasTrivialSpecialMembers(SMF_All),
96 HasTrivialSpecialMembersForCall(SMF_All),
97 DeclaredNonTrivialSpecialMembers(0),
98 DeclaredNonTrivialSpecialMembersForCall(0), HasIrrelevantDestructor(
true),
99 HasConstexprNonCopyMoveConstructor(
false),
100 HasDefaultedDefaultConstructor(
false),
101 DefaultedDefaultConstructorIsConstexpr(
true),
102 HasConstexprDefaultConstructor(
false),
103 DefaultedDestructorIsConstexpr(
true),
104 HasNonLiteralTypeFieldsOrBases(
false), StructuralIfLiteral(
true),
105 UserProvidedDefaultConstructor(
false), DeclaredSpecialMembers(0),
106 ImplicitCopyConstructorCanHaveConstParamForVBase(
true),
107 ImplicitCopyConstructorCanHaveConstParamForNonVBase(
true),
108 ImplicitCopyAssignmentHasConstParam(
true),
109 HasDeclaredCopyConstructorWithConstParam(
false),
110 HasDeclaredCopyAssignmentWithConstParam(
false),
111 IsAnyDestructorNoReturn(
false), IsLambda(
false),
112 IsParsingBaseSpecifiers(
false), ComputedVisibleConversions(
false),
113 HasODRHash(
false), Definition(D) {}
116 return Bases.get(
Definition->getASTContext().getExternalSource());
119 CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getVBasesSlowCase()
const {
120 return VBases.get(
Definition->getASTContext().getExternalSource());
127 :
RecordDecl(K, TK, C, DC, StartLoc, IdLoc,
Id, PrevDecl),
128 DefinitionData(PrevDecl ? PrevDecl->DefinitionData
135 bool DelayTypeCreation) {
136 auto *R =
new (C, DC)
CXXRecordDecl(CXXRecord, TK, C, DC, StartLoc, IdLoc,
Id,
138 R->setMayHaveOutOfDateDef(C.getLangOpts().Modules);
141 if (!DelayTypeCreation)
142 C.getTypeDeclType(R, PrevDecl);
149 unsigned DependencyKind,
bool IsGeneric,
153 R->setBeingDefined(
true);
154 R->DefinitionData =
new (C)
struct LambdaDefinitionData(
155 R, Info, DependencyKind, IsGeneric, CaptureDefault);
156 R->setMayHaveOutOfDateDef(
false);
157 R->setImplicit(
true);
159 C.getTypeDeclType(R,
nullptr);
168 R->setMayHaveOutOfDateDef(
false);
178 while (!WorkList.empty()) {
183 if (
const CXXRecordDecl *B = BaseSpec.getType()->getAsCXXRecordDecl()) {
184 if (!SeenBaseTypes.insert(B).second)
186 WorkList.push_back(B);
198 if (!data().Bases.isOffset() && data().NumBases > 0)
199 C.Deallocate(data().getBases());
202 if (!C.getLangOpts().CPlusPlus17) {
205 data().Aggregate =
false;
210 data().PlainOldData =
false;
220 data().NumBases = NumBases;
221 for (
unsigned i = 0; i < NumBases; ++i) {
222 data().getBases()[i] = *Bases[i];
229 auto *BaseClassDecl =
237 if (BaseClassDecl->data().HasBasesWithFields ||
238 !BaseClassDecl->field_empty()) {
239 if (data().HasBasesWithFields)
241 data().IsStandardLayout =
false;
242 data().HasBasesWithFields =
true;
249 if (BaseClassDecl->data().HasBasesWithNonStaticDataMembers ||
250 BaseClassDecl->hasDirectFields()) {
251 if (data().HasBasesWithNonStaticDataMembers)
252 data().IsCXX11StandardLayout =
false;
253 data().HasBasesWithNonStaticDataMembers =
true;
256 if (!BaseClassDecl->isEmpty()) {
260 data().Empty =
false;
266 data().Aggregate =
false;
271 data().StructuralIfLiteral =
false;
277 if (BaseClassDecl->isPolymorphic()) {
278 data().Polymorphic =
true;
281 data().Aggregate =
false;
287 if (!BaseClassDecl->isStandardLayout())
288 data().IsStandardLayout =
false;
289 if (!BaseClassDecl->isCXX11StandardLayout())
290 data().IsCXX11StandardLayout =
false;
294 data().HasNonLiteralTypeFieldsOrBases =
true;
297 for (
const auto &VBase : BaseClassDecl->vbases()) {
299 if (SeenVBaseTypes.insert(C.getCanonicalType(VBase.getType())).second) {
300 VBases.push_back(&VBase);
307 if (
CXXRecordDecl *VBaseDecl = VBase.getType()->getAsCXXRecordDecl())
308 if (!VBaseDecl->hasCopyConstructorWithConstParam())
309 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
313 data().Aggregate =
false;
317 if (
Base->isVirtual()) {
319 if (SeenVBaseTypes.insert(C.getCanonicalType(BaseType)).second)
320 VBases.push_back(
Base);
325 data().Empty =
false;
329 data().Aggregate =
false;
335 data().HasTrivialSpecialMembers &= SMF_Destructor;
336 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
341 data().IsStandardLayout =
false;
342 data().IsCXX11StandardLayout =
false;
348 data().DefaultedDefaultConstructorIsConstexpr =
false;
349 data().DefaultedDestructorIsConstexpr =
false;
356 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
357 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
363 if (!BaseClassDecl->hasTrivialDefaultConstructor())
364 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
371 if (!BaseClassDecl->hasTrivialCopyConstructor())
372 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
374 if (!BaseClassDecl->hasTrivialCopyConstructorForCall())
375 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
381 if (!BaseClassDecl->hasTrivialMoveConstructor())
382 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
384 if (!BaseClassDecl->hasTrivialMoveConstructorForCall())
385 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
392 if (!BaseClassDecl->hasTrivialCopyAssignment())
393 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
398 if (!BaseClassDecl->hasTrivialMoveAssignment())
399 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
405 if (!BaseClassDecl->hasConstexprDefaultConstructor())
406 data().DefaultedDefaultConstructorIsConstexpr =
false;
413 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
414 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
420 if (!BaseClassDecl->hasTrivialDestructor())
421 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
423 if (!BaseClassDecl->hasTrivialDestructorForCall())
424 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
426 if (!BaseClassDecl->hasIrrelevantDestructor())
427 data().HasIrrelevantDestructor =
false;
429 if (BaseClassDecl->isAnyDestructorNoReturn())
430 data().IsAnyDestructorNoReturn =
true;
437 if (!BaseClassDecl->hasCopyAssignmentWithConstParam())
438 data().ImplicitCopyAssignmentHasConstParam =
false;
442 if (BaseClassDecl->hasObjectMember())
445 if (BaseClassDecl->hasVolatileMember())
448 if (BaseClassDecl->getArgPassingRestrictions() ==
453 if (BaseClassDecl->hasMutableFields())
454 data().HasMutableFields =
true;
456 if (BaseClassDecl->hasUninitializedReferenceMember())
457 data().HasUninitializedReferenceMember =
true;
459 if (!BaseClassDecl->allowConstDefaultInit())
460 data().HasUninitializedFields =
true;
462 addedClassSubobject(BaseClassDecl);
473 data().IsStandardLayout =
false;
475 if (VBases.empty()) {
476 data().IsParsingBaseSpecifiers =
false;
482 data().NumVBases = VBases.size();
483 for (
int I = 0, E = VBases.size(); I != E; ++I) {
487 data().getVBases()[I] = *VBases[I];
490 data().IsParsingBaseSpecifiers =
false;
494 assert(
hasDefinition() &&
"ODRHash only for records with definitions");
497 if (DefinitionData->HasODRHash)
498 return DefinitionData->ODRHash;
503 DefinitionData->HasODRHash =
true;
506 return DefinitionData->ODRHash;
509 void CXXRecordDecl::addedClassSubobject(
CXXRecordDecl *Subobj) {
517 data().NeedOverloadResolutionForCopyConstructor =
true;
519 data().NeedOverloadResolutionForMoveConstructor =
true;
528 data().NeedOverloadResolutionForCopyAssignment =
true;
530 data().NeedOverloadResolutionForMoveAssignment =
true;
540 data().NeedOverloadResolutionForCopyConstructor =
true;
541 data().NeedOverloadResolutionForMoveConstructor =
true;
542 data().NeedOverloadResolutionForDestructor =
true;
551 data().DefaultedDestructorIsConstexpr =
false;
557 if (!Subobj->data().StructuralIfLiteral)
558 data().StructuralIfLiteral =
false;
590 void CXXRecordDecl::markedVirtualFunctionPure() {
593 data().Abstract =
true;
596 bool CXXRecordDecl::hasSubobjectAtOffsetZeroOfEmptyBaseType(
607 RD = RD->getCanonicalDecl();
615 if (!RD->data().HasBasesWithFields) {
634 if (M.insert(RD).second)
635 WorkList.push_back(RD);
642 while (!WorkList.empty()) {
652 bool IsFirstField =
true;
653 for (
auto *FD :
X->fields()) {
656 if (FD->isUnnamedBitfield())
659 if (!IsFirstField && !FD->isZeroSize(Ctx))
669 IsFirstField =
false;
677 assert(
isLambda() &&
"not a lambda");
694 void CXXRecordDecl::addedMember(
Decl *D) {
696 !isa<FieldDecl>(D) &&
697 !isa<IndirectFieldDecl>(D) &&
698 (!isa<TagDecl>(D) || cast<TagDecl>(D)->getTagKind() ==
TTK_Class ||
700 data().HasOnlyCMembers =
false;
706 auto *FunTmpl = dyn_cast<FunctionTemplateDecl>(D);
708 D = FunTmpl->getTemplatedDecl();
711 Decl *DUnderlying = D;
712 if (
auto *ND = dyn_cast<NamedDecl>(DUnderlying)) {
713 DUnderlying = ND->getUnderlyingDecl();
714 if (
auto *UnderlyingFunTmpl = dyn_cast<FunctionTemplateDecl>(DUnderlying))
715 DUnderlying = UnderlyingFunTmpl->getTemplatedDecl();
718 if (
const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
719 if (Method->isVirtual()) {
722 data().Aggregate =
false;
726 data().PlainOldData =
false;
730 data().Empty =
false;
735 data().Polymorphic =
true;
741 data().HasTrivialSpecialMembers &= SMF_Destructor;
742 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
747 data().IsStandardLayout =
false;
748 data().IsCXX11StandardLayout =
false;
756 L->AddedCXXImplicitMember(data().Definition, D);
762 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
769 data().UserDeclaredConstructor =
true;
776 data().PlainOldData =
false;
780 SMKind |= SMF_DefaultConstructor;
783 data().UserProvidedDefaultConstructor =
true;
785 data().HasConstexprDefaultConstructor =
true;
787 data().HasDefaultedDefaultConstructor =
true;
793 SMKind |= SMF_CopyConstructor;
796 data().HasDeclaredCopyConstructorWithConstParam =
true;
798 SMKind |= SMF_MoveConstructor;
810 data().Aggregate =
false;
815 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(DUnderlying)) {
823 data().HasConstexprNonCopyMoveConstructor =
true;
824 if (!isa<CXXConstructorDecl>(D) &&
Constructor->isDefaultConstructor())
825 data().HasInheritedDefaultConstructor =
true;
829 if (
const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
830 if (isa<CXXDestructorDecl>(D))
831 SMKind |= SMF_Destructor;
833 if (Method->isCopyAssignmentOperator()) {
834 SMKind |= SMF_CopyAssignment;
836 const auto *ParamTy =
838 if (!ParamTy || ParamTy->getPointeeType().isConstQualified())
839 data().HasDeclaredCopyAssignmentWithConstParam =
true;
842 if (Method->isMoveAssignmentOperator())
843 SMKind |= SMF_MoveAssignment;
846 if (
auto *Conversion = dyn_cast<CXXConversionDecl>(D)) {
855 if (Conversion->getPrimaryTemplate()) {
861 FunTmpl ? cast<NamedDecl>(FunTmpl) :
cast<
NamedDecl>(Conversion);
866 Conversions.
addDecl(Ctx, Primary, AS);
873 data().HasTrivialSpecialMembers &=
874 data().DeclaredSpecialMembers | ~SMKind;
875 data().HasTrivialSpecialMembersForCall &=
876 data().DeclaredSpecialMembers | ~SMKind;
880 data().DeclaredSpecialMembers |= SMKind;
881 if (!Method->isImplicit()) {
882 data().UserDeclaredSpecialMembers |= SMKind;
895 data().PlainOldData =
false;
900 if (!Method->isIneligibleOrNotSelected()) {
909 if (
const auto *Field = dyn_cast<FieldDecl>(D)) {
917 if (data().HasBasesWithFields)
918 data().IsStandardLayout =
false;
924 if (
Field->isUnnamedBitfield()) {
928 if (data().Empty && !
Field->isZeroLengthBitField(Context) &&
931 data().Empty =
false;
939 if (data().HasBasesWithNonStaticDataMembers)
940 data().IsCXX11StandardLayout =
false;
948 data().Aggregate =
false;
949 data().PlainOldData =
false;
954 data().StructuralIfLiteral =
false;
959 bool IsFirstField = !data().HasPrivateFields &&
960 !data().HasProtectedFields && !data().HasPublicFields;
967 case AS_private: data().HasPrivateFields =
true;
break;
968 case AS_protected: data().HasProtectedFields =
true;
break;
969 case AS_public: data().HasPublicFields =
true;
break;
970 case AS_none: llvm_unreachable(
"Invalid access specifier");
972 if ((data().HasPrivateFields + data().HasProtectedFields +
973 data().HasPublicFields) > 1) {
974 data().IsStandardLayout =
false;
975 data().IsCXX11StandardLayout =
false;
979 if (
Field->isMutable()) {
980 data().HasMutableFields =
true;
985 data().StructuralIfLiteral =
false;
992 data().HasVariantMembers =
true;
1011 struct DefinitionData &Data = data();
1012 Data.PlainOldData =
false;
1013 Data.HasTrivialSpecialMembers = 0;
1019 data().HasTrivialSpecialMembersForCall = 0;
1025 Data.HasIrrelevantDestructor =
false;
1028 data().DefaultedCopyConstructorIsDeleted =
true;
1029 data().DefaultedMoveConstructorIsDeleted =
true;
1030 data().DefaultedCopyAssignmentIsDeleted =
true;
1031 data().DefaultedMoveAssignmentIsDeleted =
true;
1032 data().DefaultedDestructorIsDeleted =
true;
1033 data().NeedOverloadResolutionForCopyConstructor =
true;
1034 data().NeedOverloadResolutionForMoveConstructor =
true;
1035 data().NeedOverloadResolutionForCopyAssignment =
true;
1036 data().NeedOverloadResolutionForMoveAssignment =
true;
1037 data().NeedOverloadResolutionForDestructor =
true;
1039 }
else if (!Context.
getLangOpts().ObjCAutoRefCount) {
1043 data().PlainOldData =
false;
1046 if (!
Field->hasInClassInitializer())
1047 data().HasUninitializedReferenceMember =
true;
1052 data().IsStandardLayout =
false;
1053 data().IsCXX11StandardLayout =
false;
1059 data().DefaultedCopyConstructorIsDeleted =
true;
1062 if (!
Field->hasInClassInitializer() && !
Field->isMutable()) {
1064 if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
1065 data().HasUninitializedFields =
true;
1067 data().HasUninitializedFields =
true;
1073 data().HasNonLiteralTypeFieldsOrBases =
true;
1075 if (
Field->hasInClassInitializer() ||
1076 (
Field->isAnonymousStructOrUnion() &&
1077 Field->getType()->getAsCXXRecordDecl()->hasInClassInitializer())) {
1078 data().HasInClassInitializer =
true;
1083 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1091 data().Aggregate =
false;
1095 data().PlainOldData =
false;
1103 data().DefaultedCopyAssignmentIsDeleted =
true;
1104 data().DefaultedMoveAssignmentIsDeleted =
true;
1109 bool IsZeroSize =
Field->isZeroSize(Context);
1112 auto *FieldRec = cast<CXXRecordDecl>(RecordTy->getDecl());
1113 if (FieldRec->getDefinition()) {
1114 addedClassSubobject(FieldRec);
1122 data().NeedOverloadResolutionForCopyConstructor =
true;
1123 data().NeedOverloadResolutionForMoveConstructor =
true;
1124 data().NeedOverloadResolutionForCopyAssignment =
true;
1125 data().NeedOverloadResolutionForMoveAssignment =
true;
1134 if (FieldRec->hasNonTrivialCopyConstructor())
1135 data().DefaultedCopyConstructorIsDeleted =
true;
1136 if (FieldRec->hasNonTrivialMoveConstructor())
1137 data().DefaultedMoveConstructorIsDeleted =
true;
1138 if (FieldRec->hasNonTrivialCopyAssignment())
1139 data().DefaultedCopyAssignmentIsDeleted =
true;
1140 if (FieldRec->hasNonTrivialMoveAssignment())
1141 data().DefaultedMoveAssignmentIsDeleted =
true;
1142 if (FieldRec->hasNonTrivialDestructor())
1143 data().DefaultedDestructorIsDeleted =
true;
1148 if (
Field->isAnonymousStructOrUnion()) {
1149 data().NeedOverloadResolutionForCopyConstructor |=
1150 FieldRec->data().NeedOverloadResolutionForCopyConstructor;
1151 data().NeedOverloadResolutionForMoveConstructor |=
1152 FieldRec->data().NeedOverloadResolutionForMoveConstructor;
1153 data().NeedOverloadResolutionForCopyAssignment |=
1154 FieldRec->data().NeedOverloadResolutionForCopyAssignment;
1155 data().NeedOverloadResolutionForMoveAssignment |=
1156 FieldRec->data().NeedOverloadResolutionForMoveAssignment;
1157 data().NeedOverloadResolutionForDestructor |=
1158 FieldRec->data().NeedOverloadResolutionForDestructor;
1166 if (!FieldRec->hasTrivialDefaultConstructor())
1167 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1175 if (!FieldRec->hasTrivialCopyConstructor())
1176 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
1178 if (!FieldRec->hasTrivialCopyConstructorForCall())
1179 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
1184 if (!FieldRec->hasTrivialMoveConstructor())
1185 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
1187 if (!FieldRec->hasTrivialMoveConstructorForCall())
1188 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
1196 if (!FieldRec->hasTrivialCopyAssignment())
1197 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
1201 if (!FieldRec->hasTrivialMoveAssignment())
1202 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
1204 if (!FieldRec->hasTrivialDestructor())
1205 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1206 if (!FieldRec->hasTrivialDestructorForCall())
1207 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1208 if (!FieldRec->hasIrrelevantDestructor())
1209 data().HasIrrelevantDestructor =
false;
1210 if (FieldRec->isAnyDestructorNoReturn())
1211 data().IsAnyDestructorNoReturn =
true;
1212 if (FieldRec->hasObjectMember())
1214 if (FieldRec->hasVolatileMember())
1216 if (FieldRec->getArgPassingRestrictions() ==
1224 if (!FieldRec->isStandardLayout())
1225 data().IsStandardLayout =
false;
1226 if (!FieldRec->isCXX11StandardLayout())
1227 data().IsCXX11StandardLayout =
false;
1233 if (data().IsStandardLayout &&
1234 (
isUnion() || IsFirstField || IsZeroSize) &&
1235 hasSubobjectAtOffsetZeroOfEmptyBaseType(Context, FieldRec))
1236 data().IsStandardLayout =
false;
1242 if (data().IsCXX11StandardLayout && IsFirstField) {
1245 for (
const auto &BI :
bases()) {
1247 data().IsCXX11StandardLayout =
false;
1254 if (FieldRec->hasMutableFields())
1255 data().HasMutableFields =
true;
1257 if (
Field->isMutable()) {
1261 data().NeedOverloadResolutionForCopyConstructor =
true;
1262 data().NeedOverloadResolutionForCopyAssignment =
true;
1272 if (!
Field->hasInClassInitializer() &&
1273 !FieldRec->hasConstexprDefaultConstructor() && !
isUnion())
1276 data().DefaultedDefaultConstructorIsConstexpr =
false;
1283 if (!FieldRec->hasCopyConstructorWithConstParam())
1284 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
1292 if (!FieldRec->hasCopyAssignmentWithConstParam())
1293 data().ImplicitCopyAssignmentHasConstParam =
false;
1295 if (FieldRec->hasUninitializedReferenceMember() &&
1296 !
Field->hasInClassInitializer())
1297 data().HasUninitializedReferenceMember =
true;
1302 if (FieldRec->hasVariantMembers() &&
1303 Field->isAnonymousStructOrUnion())
1304 data().HasVariantMembers =
true;
1311 data().DefaultedDefaultConstructorIsConstexpr =
false;
1319 data().DefaultedCopyAssignmentIsDeleted =
true;
1320 data().DefaultedMoveAssignmentIsDeleted =
true;
1329 data().StructuralIfLiteral =
false;
1335 if (data().Empty && !IsZeroSize)
1336 data().Empty =
false;
1340 if (
auto *Shadow = dyn_cast<UsingShadowDecl>(D)) {
1341 if (Shadow->getDeclName().getNameKind()
1344 data().Conversions.get(Ctx).addDecl(Ctx, Shadow, Shadow->getAccess());
1348 if (
const auto *Using = dyn_cast<UsingDecl>(D)) {
1349 if (
Using->getDeclName().getNameKind() ==
1351 data().HasInheritedConstructor =
true;
1354 data().Aggregate =
false;
1357 if (
Using->getDeclName().getCXXOverloadedOperator() == OO_Equal)
1358 data().HasInheritedAssignment =
true;
1369 if (
const auto *DD = dyn_cast<CXXDestructorDecl>(MD)) {
1370 if (DD->isUserProvided())
1371 data().HasIrrelevantDestructor =
false;
1378 if (DD->isVirtual()) {
1379 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1380 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1383 if (DD->isNoReturn())
1384 data().IsAnyDestructorNoReturn =
true;
1393 data().HasTrivialSpecialMembers |= SMKind;
1394 data().HasTrivialSpecialMembersForCall |= SMKind;
1396 data().HasTrivialSpecialMembersForCall |= SMKind;
1397 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1399 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1406 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1414 unsigned SMKind = 0;
1416 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1417 if (Constructor->isDefaultConstructor()) {
1418 SMKind |= SMF_DefaultConstructor;
1419 if (Constructor->isConstexpr())
1420 data().HasConstexprDefaultConstructor =
true;
1422 if (Constructor->isCopyConstructor())
1423 SMKind |= SMF_CopyConstructor;
1424 else if (Constructor->isMoveConstructor())
1425 SMKind |= SMF_MoveConstructor;
1426 else if (Constructor->isConstexpr())
1428 data().HasConstexprNonCopyMoveConstructor =
true;
1429 }
else if (isa<CXXDestructorDecl>(D)) {
1430 SMKind |= SMF_Destructor;
1432 data().HasIrrelevantDestructor =
false;
1434 SMKind |= SMF_CopyAssignment;
1436 SMKind |= SMF_MoveAssignment;
1441 data().HasTrivialSpecialMembers |= SMKind;
1443 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1448 CXXRecordDecl::LambdaDefinitionData &Data = getLambdaData();
1451 Data.NumCaptures = Captures.size();
1452 Data.NumExplicitCaptures = 0;
1456 for (
unsigned I = 0, N = Captures.size(); I != N; ++I) {
1457 if (Captures[I].isExplicit())
1458 ++Data.NumExplicitCaptures;
1460 *ToCapture++ = Captures[I];
1464 Data.DefaultedCopyAssignmentIsDeleted =
true;
1468 unsigned SMKind = 0;
1470 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1471 if (Constructor->isCopyConstructor())
1472 SMKind = SMF_CopyConstructor;
1473 else if (Constructor->isMoveConstructor())
1474 SMKind = SMF_MoveConstructor;
1475 }
else if (isa<CXXDestructorDecl>(D))
1476 SMKind = SMF_Destructor;
1479 data().HasTrivialSpecialMembersForCall |= SMKind;
1481 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1486 !TemplateOrInstantiation.isNull())
1491 return isPOD() && data().HasOnlyCMembers;
1496 return getLambdaData().IsGenericLambda;
1509 if (!RD.
isLambda())
return nullptr;
1514 assert(!Calls.
empty() &&
"Missing lambda call operator!");
1516 "More than one lambda call operator!");
1517 return Calls.
front();
1522 return dyn_cast_or_null<FunctionTemplateDecl>(CallOp);
1528 if (CallOp ==
nullptr)
1531 if (
const auto *CallOpTmpl = dyn_cast<FunctionTemplateDecl>(CallOp))
1532 return cast<CXXMethodDecl>(CallOpTmpl->getTemplatedDecl());
1534 return cast<CXXMethodDecl>(CallOp);
1545 assert(RD.
isLambda() &&
"Must be a lambda");
1552 if (
const auto *InvokerTemplate = dyn_cast<FunctionTemplateDecl>(ND))
1553 return cast<CXXMethodDecl>(InvokerTemplate->getTemplatedDecl());
1554 return cast<CXXMethodDecl>(ND);
1564 cast<ValueDecl>(ND->getAsFunction())->getType()->castAs<
FunctionType>();
1565 if (FTy->getCallConv() == CC)
1573 llvm::DenseMap<const VarDecl *, FieldDecl *> &Captures,
1576 ThisCapture =
nullptr;
1578 LambdaDefinitionData &Lambda = getLambdaData();
1580 for (
const LambdaCapture *
C = Lambda.Captures, *CEnd =
C + Lambda.NumCaptures;
1581 C != CEnd; ++
C, ++Field) {
1582 if (
C->capturesThis())
1583 ThisCapture = *Field;
1584 else if (
C->capturesVariable())
1585 Captures[
C->getCapturedVar()] = *Field;
1595 return Tmpl->getTemplateParameters();
1605 assert(std::is_partitioned(List->begin(), List->end(),
1606 [](
const NamedDecl *D) { return !D->isImplicit(); })
1607 &&
"Explicit template params should be ordered before implicit ones");
1609 const auto ExplicitEnd = llvm::partition_point(
1611 return llvm::makeArrayRef(List->begin(), ExplicitEnd);
1615 assert(
isLambda() &&
"Not a lambda closure type!");
1617 return getLambdaData().ContextDecl.get(Source);
1621 assert(
isLambda() &&
"Not a lambda closure type!");
1627 assert(
isLambda() &&
"Not a lambda closure type!");
1628 auto I =
getASTContext().DeviceLambdaManglingNumbers.find(
this);
1637 ->getConversionType();
1669 if (ConvI != ConvE) {
1670 HiddenTypesBuffer = ParentHiddenTypes;
1671 HiddenTypes = &HiddenTypesBuffer;
1675 bool Hidden = ParentHiddenTypes.count(ConvType);
1677 HiddenTypesBuffer.insert(ConvType);
1681 if (Hidden && InVirtual)
1682 HiddenVBaseCs.insert(cast<NamedDecl>(I.getDecl()->getCanonicalDecl()));
1690 VOutput.
addDecl(I.getDecl(), IAccess);
1692 Output.
addDecl(Context, I.getDecl(), IAccess);
1698 for (
const auto &I : Record->
bases()) {
1699 const auto *RT = I.getType()->getAs<
RecordType>();
1704 bool BaseInVirtual = InVirtual || I.isVirtual();
1706 auto *
Base = cast<CXXRecordDecl>(RT->getDecl());
1708 *HiddenTypes, Output, VOutput, HiddenVBaseCs);
1735 Output.
append(Context, ConvI, ConvE);
1736 for (; ConvI != ConvE; ++ConvI)
1740 for (
const auto &I : Record->
bases()) {
1741 const auto *RT = I.getType()->getAs<
RecordType>();
1745 I.isVirtual(), I.getAccessSpecifier(),
1746 HiddenTypes, Output, VBaseCs, HiddenVBaseCs);
1752 if (!HiddenVBaseCs.count(cast<NamedDecl>(I.getDecl()->getCanonicalDecl())))
1753 Output.
addDecl(Context, I.getDecl(), I.getAccess());
1759 llvm::iterator_range<CXXRecordDecl::conversion_iterator>
1766 Set = &data().Conversions.get(Ctx);
1768 Set = &data().VisibleConversions.get(Ctx);
1770 if (!data().ComputedVisibleConversions) {
1772 data().ComputedVisibleConversions =
true;
1775 return llvm::make_range(Set->
begin(), Set->
end());
1791 for (
unsigned I = 0, E = Convs.
size(); I != E; ++I) {
1792 if (Convs[I].getDecl() == ConvDecl) {
1794 assert(!llvm::is_contained(Convs, ConvDecl) &&
1795 "conversion was found multiple times in unresolved set");
1800 llvm_unreachable(
"conversion not found in set!");
1805 return cast<CXXRecordDecl>(MSInfo->getInstantiatedFrom());
1817 assert(TemplateOrInstantiation.isNull() &&
1818 "Previous template or instantiation?");
1819 assert(!isa<ClassTemplatePartialSpecializationDecl>(
this));
1820 TemplateOrInstantiation
1829 TemplateOrInstantiation = Template;
1833 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this))
1834 return Spec->getSpecializationKind();
1837 return MSInfo->getTemplateSpecializationKind();
1844 if (
auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1845 Spec->setSpecializationKind(TSK);
1850 MSInfo->setTemplateSpecializationKind(TSK);
1854 llvm_unreachable(
"Not a class template or member class specialization");
1858 auto GetDefinitionOrSelf =
1860 if (
auto *Def = D->getDefinition())
1867 if (
auto *TD = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1868 auto From = TD->getInstantiatedFrom();
1870 while (
auto *NewCTD = CTD->getInstantiatedFromMemberTemplate()) {
1871 if (NewCTD->isMemberSpecialization())
1875 return GetDefinitionOrSelf(CTD->getTemplatedDecl());
1879 while (
auto *NewCTPSD = CTPSD->getInstantiatedFromMember()) {
1880 if (NewCTPSD->isMemberSpecialization())
1884 return GetDefinitionOrSelf(CTPSD);
1893 return GetDefinitionOrSelf(RD);
1898 "couldn't find pattern for class template instantiation");
1914 for (
auto *
Decl : R) {
1915 auto* DD = dyn_cast<CXXDestructorDecl>(
Decl);
1916 if (DD && !DD->isIneligibleOrNotSelected())
1932 assert(
hasDefinition() &&
"checking for interface-like without a definition");
1946 for (
const auto *
const Method :
methods())
1947 if (Method->isDefined() && !Method->isImplicit())
1951 const auto *Uuid = getAttr<UuidAttr>();
1958 Uuid->getGuid() ==
"00000000-0000-0000-C000-000000000046") ||
1960 Uuid->getGuid() ==
"00020400-0000-0000-C000-000000000046"))) {
1974 if (BaseSpec.isVirtual() || BaseSpec.getAccessSpecifier() !=
AS_public)
1976 const auto *
Base = BaseSpec.getType()->getAsCXXRecordDecl();
1977 if (
Base->isInterface() || !
Base->isInterfaceLike())
1993 if (!FinalOverriders) {
1995 FinalOverriders = &MyFinalOverriders;
1999 for (CXXFinalOverriderMap::iterator M = FinalOverriders->begin(),
2000 MEnd = FinalOverriders->end();
2001 M != MEnd && !Done; ++M) {
2003 SOEnd = M->second.end();
2004 SO != SOEnd && !Done; ++SO) {
2005 assert(SO->second.size() > 0 &&
2006 "All virtual functions have overriding virtual functions");
2012 if (SO->second.front().Method->isPure()) {
2013 data().Abstract =
true;
2024 I.setAccess((*I)->getAccess());
2028 if (data().Abstract ||
isInvalidDecl() || !data().Polymorphic ||
2032 for (
const auto &B :
bases()) {
2033 const auto *BaseDecl =
2035 if (BaseDecl->isAbstract())
2046 if (Def->hasAttr<FinalAttr>())
2048 if (
const auto *Dtor = Def->getDestructor())
2049 if (Dtor->hasAttr<FinalAttr>())
2054 void CXXDeductionGuideDecl::anchor() {}
2072 switch (Function->getDeclKind()) {
2073 case Decl::Kind::CXXConstructor:
2074 return cast<CXXConstructorDecl>(Function)->getExplicitSpecifier();
2075 case Decl::Kind::CXXConversion:
2076 return cast<CXXConversionDecl>(Function)->getExplicitSpecifier();
2077 case Decl::Kind::CXXDeductionGuide:
2078 return cast<CXXDeductionGuideDecl>(Function)->getExplicitSpecifier();
2091 TInfo, EndLocation, Ctor);
2111 void CXXMethodDecl::anchor() {}
2141 if (isa<CXXDestructorDecl>(
this)) {
2153 auto *MD = dyn_cast<CXXMethodDecl>(ND);
2181 llvm::erase_if(FinalOverriders, [&](
CXXMethodDecl *OtherD) {
2185 FinalOverriders.push_back(D);
2188 for (
const auto &I : RD->
bases()) {
2192 const auto *
Base = cast<CXXRecordDecl>(RT->
getDecl());
2194 AddFinalOverrider(D);
2197 return FinalOverriders.size() == 1 ? FinalOverriders.front() :
nullptr;
2206 Expr *TrailingRequiresClause) {
2208 CXXMethod,
C, RD, StartLoc, NameInfo, T, TInfo, SC,
UsesFPIntrin,
2209 isInline, ConstexprKind, EndLocation, TrailingRequiresClause);
2221 assert(
isVirtual() &&
"this method is expected to be virtual");
2230 if (hasAttr<FinalAttr>())
2231 return isPure() ? nullptr :
this;
2239 Base =
Base->getBestDynamicClassTypeExpr();
2240 if (
Base->isPRValue() &&
Base->getType()->isRecordType())
2245 if (!BestDynamicDecl)
2254 if (!DevirtualizedMethod)
2260 if (DevirtualizedMethod->
isPure())
2264 if (DevirtualizedMethod->
hasAttr<FinalAttr>())
2265 return DevirtualizedMethod;
2271 return DevirtualizedMethod;
2273 if (
const auto *DRE = dyn_cast<DeclRefExpr>(
Base)) {
2274 if (
const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
2275 if (VD->getType()->isRecordType())
2277 return DevirtualizedMethod;
2285 if (
const auto *ME = dyn_cast<MemberExpr>(
Base)) {
2286 const ValueDecl *VD = ME->getMemberDecl();
2292 if (
auto *BO = dyn_cast<BinaryOperator>(
Base)) {
2293 if (BO->isPtrMemOp()) {
2295 if (MPT->getPointeeType()->isRecordType())
2296 return DevirtualizedMethod;
2306 assert(PreventedBy.empty() &&
"PreventedBy is expected to be empty");
2323 unsigned UsualParams = 1;
2370 for (
const auto *D : R) {
2371 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
2372 if (FD->getNumParams() == 1) {
2373 PreventedBy.push_back(FD);
2413 if (!isa<RValueReferenceType>(ParamType))
2426 "Can't add an overridden method to a class template!");
2427 assert(MD->
isVirtual() &&
"Method is not virtual!");
2433 if (isa<CXXConstructorDecl>(
this))
return nullptr;
2438 if (isa<CXXConstructorDecl>(
this))
return nullptr;
2443 if (isa<CXXConstructorDecl>(
this))
return 0;
2449 if (isa<CXXConstructorDecl>(
this))
2464 return C.getPointerType(ObjectTy);
2479 assert(
isInstance() &&
"No 'this' for static methods!");
2486 assert(
isInstance() &&
"No 'this' for static methods!");
2514 : Initializee(TInfo), Init(Init), MemberOrEllipsisLocation(EllipsisLoc),
2515 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(IsVirtual),
2516 IsWritten(
false), SourceOrder(0) {}
2522 : Initializee(
Member), Init(Init), MemberOrEllipsisLocation(MemberLoc),
2523 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2524 IsWritten(
false), SourceOrder(0) {}
2531 : Initializee(
Member), Init(Init), MemberOrEllipsisLocation(MemberLoc),
2532 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2533 IsWritten(
false), SourceOrder(0) {}
2539 : Initializee(TInfo), Init(Init), LParenLoc(L), RParenLoc(R),
2540 IsDelegating(
true), IsVirtual(
false), IsWritten(
false), SourceOrder(0) {}
2556 return Initializee.get<
TypeSourceInfo*>()->getType().getTypePtr();
2569 return TSInfo->getTypeLoc().getLocalSourceRange().getBegin();
2578 return I->getSourceRange();
2585 CXXConstructorDecl::CXXConstructorDecl(
2591 :
CXXMethodDecl(CXXConstructor,
C, RD, StartLoc, NameInfo, T, TInfo,
2592 SC_None, UsesFPIntrin, isInline, ConstexprKind,
2594 setNumCtorInitializers(0);
2595 setInheritingConstructor(
static_cast<bool>(Inherited));
2596 setImplicit(isImplicitlyDeclared);
2597 CXXConstructorDeclBits.HasTrailingExplicitSpecifier = ES.
getExpr() ? 1 : 0;
2599 *getTrailingObjects<InheritedConstructor>() = Inherited;
2600 setExplicitSpecifier(ES);
2603 void CXXConstructorDecl::anchor() {}
2608 bool hasTrailingExplicit =
static_cast<bool>(AllocKind & TAKHasTailExplicit);
2610 static_cast<bool>(AllocKind & TAKInheritsConstructor);
2612 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2619 Result->CXXConstructorDeclBits.HasTrailingExplicitSpecifier =
2620 hasTrailingExplicit;
2633 "Name must refer to a constructor");
2635 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2636 Inherited ? 1 : 0, ES.
getExpr() ? 1 : 0);
2638 C, RD, StartLoc, NameInfo, T, TInfo, ES,
UsesFPIntrin, isInline,
2639 isImplicitlyDeclared, ConstexprKind, Inherited, TrailingRequiresClause);
2649 if (
const auto *Construct = dyn_cast<CXXConstructExpr>(E))
2650 return Construct->getConstructor();
2750 void CXXDestructorDecl::anchor() {}
2762 bool UsesFPIntrin,
bool isInline,
bool isImplicitlyDeclared,
2766 "Name must refer to a destructor");
2768 C, RD, StartLoc, NameInfo, T, TInfo,
UsesFPIntrin, isInline,
2769 isImplicitlyDeclared, ConstexprKind, TrailingRequiresClause);
2774 if (OD && !
First->OperatorDelete) {
2775 First->OperatorDelete = OD;
2776 First->OperatorDeleteThisArg = ThisArg;
2778 L->ResolvedOperatorDelete(
First, OD, ThisArg);
2782 void CXXConversionDecl::anchor() {}
2797 Expr *TrailingRequiresClause) {
2800 "Name must refer to a conversion function");
2802 C, RD, StartLoc, NameInfo, T, TInfo,
UsesFPIntrin, isInline, ES,
2803 ConstexprKind, EndLocation, TrailingRequiresClause);
2820 void LinkageSpecDecl::anchor() {}
2828 return new (
C, DC)
LinkageSpecDecl(DC, ExternLoc, LangLoc, Lang, HasBraces);
2837 void UsingDirectiveDecl::anchor() {}
2846 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(
Used))
2847 Used = NS->getOriginalNamespace();
2849 IdentLoc,
Used, CommonAncestor);
2861 if (
auto *NA = dyn_cast_or_null<NamespaceAliasDecl>(NominatedNamespace))
2862 return NA->getNamespace();
2863 return cast_or_null<NamespaceDecl>(NominatedNamespace);
2870 redeclarable_base(
C), LocStart(StartLoc),
2871 AnonOrFirstNamespaceAndInline(nullptr, Inline) {
2872 setPreviousDecl(PrevDecl);
2895 return AnonOrFirstNamespaceAndInline.getPointer();
2902 return AnonOrFirstNamespaceAndInline.getPointer();
2919 void NamespaceAliasDecl::anchor() {}
2941 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(Namespace))
2942 Namespace = NS->getOriginalNamespace();
2944 QualifierLoc, IdentLoc, Namespace);
2955 void LifetimeExtendedTemporaryDecl::anchor() {}
2964 if (isa<FieldDecl>(ExtendingDecl))
2968 if (isa<BindingDecl>(ExtendingDecl))
2971 return cast<VarDecl>(ExtendingDecl)->getStorageDuration();
2976 "don't need to cache the computed value for this temporary");
2977 if (MayCreate && !
Value) {
2981 assert(
Value &&
"may not be null");
2985 void UsingShadowDecl::anchor() {}
2991 UsingOrNextShadow(Introducer) {
2993 assert(!isa<UsingShadowDecl>(
Target));
3010 while (
const auto *NextShadow =
3011 dyn_cast<UsingShadowDecl>(Shadow->UsingOrNextShadow))
3012 Shadow = NextShadow;
3013 return cast<BaseUsingDecl>(Shadow->UsingOrNextShadow);
3016 void ConstructorUsingShadowDecl::anchor() {}
3035 void BaseUsingDecl::anchor() {}
3038 assert(!llvm::is_contained(
shadows(), S) &&
"declaration already in set");
3039 assert(S->getIntroducer() ==
this);
3041 if (FirstUsingShadow.getPointer())
3042 S->UsingOrNextShadow = FirstUsingShadow.getPointer();
3043 FirstUsingShadow.setPointer(S);
3047 assert(llvm::is_contained(
shadows(), S) &&
"declaration not in set");
3048 assert(S->getIntroducer() ==
this);
3052 if (FirstUsingShadow.getPointer() == S) {
3053 FirstUsingShadow.setPointer(
3054 dyn_cast<UsingShadowDecl>(S->UsingOrNextShadow));
3055 S->UsingOrNextShadow =
this;
3060 while (Prev->UsingOrNextShadow != S)
3061 Prev = cast<UsingShadowDecl>(Prev->UsingOrNextShadow);
3062 Prev->UsingOrNextShadow = S->UsingOrNextShadow;
3063 S->UsingOrNextShadow =
this;
3066 void UsingDecl::anchor() {}
3072 return new (
C, DC)
UsingDecl(DC, UL, QualifierLoc, NameInfo, HasTypename);
3087 void UsingEnumDecl::anchor() {}
3104 void UsingPackDecl::anchor() {}
3109 size_t Extra = additionalSizeToAlloc<NamedDecl *>(UsingDecls.size());
3110 return new (
C, DC, Extra)
UsingPackDecl(DC, InstantiatedFrom, UsingDecls);
3114 unsigned NumExpansions) {
3115 size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
3117 Result->NumExpansions = NumExpansions;
3118 auto *Trail = Result->getTrailingObjects<
NamedDecl *>();
3119 for (
unsigned I = 0; I != NumExpansions; ++I)
3124 void UnresolvedUsingValueDecl::anchor() {}
3133 QualifierLoc, NameInfo,
3152 void UnresolvedUsingTypenameDecl::anchor() {}
3163 DC, UsingLoc, TypenameLoc, QualifierLoc, TargetNameLoc,
3182 return new (Ctx,
ID)
3186 UnresolvedUsingIfExistsDecl::UnresolvedUsingIfExistsDecl(
DeclContext *DC,
3189 :
NamedDecl(
Decl::UnresolvedUsingIfExists, DC, Loc, Name) {}
3191 void UnresolvedUsingIfExistsDecl::anchor() {}
3193 void StaticAssertDecl::anchor() {}
3211 void BindingDecl::anchor() {}
3230 auto *VD = cast<VarDecl>(DRE->getDecl());
3231 assert(VD->isImplicit() &&
"holding var for binding decl not implicit");
3235 void DecompositionDecl::anchor() {}
3243 size_t Extra = additionalSizeToAlloc<BindingDecl *>(
Bindings.size());
3244 return new (
C, DC, Extra)
3250 unsigned NumBindings) {
3251 size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
3252 auto *Result =
new (
C,
ID, Extra)
3256 Result->NumBindings = NumBindings;
3257 auto *Trail = Result->getTrailingObjects<
BindingDecl *>();
3258 for (
unsigned I = 0; I != NumBindings; ++I)
3275 void MSPropertyDecl::anchor() {}
3283 return new (
C, DC)
MSPropertyDecl(DC, L, N, T, TInfo, StartL, Getter, Setter);
3293 void MSGuidDecl::anchor() {}
3309 OS << llvm::format(
"GUID{%08" PRIx32
"-%04" PRIx16
"-%04" PRIx16
"-",
3312 for (uint8_t Byte : PartVal.
Part4And5) {
3313 OS << llvm::format(
"%02" PRIx8, Byte);
3326 auto IsInt = [&Ctx](
unsigned N) {
3333 auto IsArray = [&Ctx](MatcherRef Elem,
unsigned N) {
3334 return [&Ctx, Elem, N](
QualType T) {
3340 auto IsStruct = [](std::initializer_list<MatcherRef> Fields) {
3348 if (
auto *CXXRD = dyn_cast<CXXRecordDecl>(RD))
3349 if (CXXRD->getNumBases())
3351 auto MatcherIt = Fields.begin();
3353 if (FD->isUnnamedBitfield())
continue;
3354 if (FD->isBitField() || MatcherIt == Fields.end() ||
3355 !(*MatcherIt)(FD->getType()))
3359 return MatcherIt == Fields.end();
3364 return IsStruct({IsInt(32), IsInt(16), IsInt(16), IsArray(IsInt(8), 8)})(T);
3377 for (
unsigned I = 0; I != 8; ++I) {
3389 void UnnamedGlobalConstantDecl::anchor() {}
3391 UnnamedGlobalConstantDecl::UnnamedGlobalConstantDecl(
const ASTContext &
C,
3400 if (
Value.needsCleanup())
3401 C.addDestruction(&
Value);
3412 UnnamedGlobalConstantDecl::CreateDeserialized(
ASTContext &
C,
unsigned ID) {
3418 OS <<
"unnamed-global-constant";
3424 llvm_unreachable(
"Invalid access specifier!");
3432 llvm_unreachable(
"Invalid access specifier!");
void printName(raw_ostream &os) const override
Pretty-print the unqualified name of this declaration.
Store information needed for an explicit specifier.
QualType getThisType() const
Return the type of the this pointer.
bool hasSimpleCopyConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous copy constructor that ...
SourceLocation getMemberLocation() const
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
FieldDecl * getAnyMember() const
bool isRecordType() const
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl)
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
ASTContext & getASTContext() const LLVM_READONLY
Represents an access specifier followed by colon ':'.
NamedDecl * getDecl() const
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
field_iterator field_begin() const
unsigned getDeviceLambdaManglingNumber() const
Retrieve the device side mangling number.
QualType getThisObjectType() const
Return the type of the object pointed by this.
Represents a C++ constructor within a class.
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
bool isLambdaStaticInvoker() const
Determine whether this is a lambda closure type's static member function that is used for the result ...
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
ASTContext & getParentASTContext() const
bool isLambdaToBlockPointerConversion() const
Determine whether this conversion function is a conversion from a lambda closure type to a block poin...
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
bool isBlockPointerType() const
FunctionTemplateDecl * getDependentLambdaCallOperator() const
Retrieve the dependent lambda call operator of the closure type if this is a templated closure type.
void setArgPassingRestrictions(ArgPassingKind Kind)
bool hasAnyDependentBases() const
Determine whether this class has any dependent base classes which are not the current instantiation.
bool isTriviallyCopyable() const
Determine whether this class is considered trivially copyable per (C++11 [class]p6).
static UsingDirectiveDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation NamespaceLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Nominated, DeclContext *CommonAncestor)
ASTImporterLookupTable & LT
bool hasSimpleDestructor() const
true if we know for sure that this class has an accessible destructor that is not deleted.
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext,...
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
bool isEffectivelyFinal() const
Determine whether it's impossible for a class to be derived from this class.
static UsingPackDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumExpansions)
A mapping from each virtual member function to its set of final overriders.
Provides information a specialization of a member of a class template, which may be a member function...
A set of unresolved declarations.
SourceLocation getEndLoc() const LLVM_READONLY
bool isObjCRetainableType() const
Represents a linkage specification.
A trivial tuple used to represent a source range.
ArrayRef< BindingDecl * > bindings() const
bool isCLike() const
True if this class is C-like, without C++-specific features, e.g.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
static BindingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id)
static StaticAssertDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *Message, SourceLocation RParenLoc, bool Failed)
Describes the capture of a variable or of this, or of a C++1y init-capture.
Represents a C++ conversion function within a class.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization,...
Represents a C++ namespace alias.
APValue * getOrCreateValue(bool MayCreate) const
Get the storage for the constant value of a materialized temporary of static storage duration.
static DecompositionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation LSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl * > Bindings)
bool isConstQualified() const
Determine whether this type is const-qualified.
bool hasNonTrivialMoveConstructor() const
Determine whether this class has a non-trivial move constructor (C++11 [class.copy]p12)
Represents the canonical version of C arrays with a specified constant size.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
bool hasNonTrivialMoveAssignment() const
Determine whether this class has a non-trivial move assignment operator (C++11 [class....
bool isDeleted() const
Whether this function has been deleted.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
Represents C++ using-directive.
const llvm::APInt & getSize() const
void setOperatorDelete(FunctionDecl *OD, Expr *ThisArg)
ASTMutationListener * getASTMutationListener() const
A binding in a decomposition declaration.
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
void removeConversion(const NamedDecl *Old)
Removes a conversion function from this class.
static UsingDirectiveDecl * CreateDeserialized(ASTContext &C, unsigned ID)
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Encodes a location in the source.
conversion_iterator conversion_begin() const
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
unsigned getIntWidth(QualType T) const
@ TTK_Struct
The "struct" keyword.
bool hasOneParamOrDefaultArgs() const
Determine whether this function has a single parameter, or multiple parameters where all but the firs...
This represents a decl that may have a name.
bool isExplicit() const
Return true if the declartion is already resolved to be explicit.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
DeclarationNameTable DeclarationNames
void setHasVolatileMember(bool val)
bool isDelegatingConstructor() const
Determine whether this constructor is a delegating constructor.
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
CXXRecordDecl * getDefinition() const
A (possibly-)qualified type.
const Type * getTypeForDecl() const
bool hasNonTrivialCopyAssignment() const
Determine whether this class has a non-trivial copy assignment operator (C++ [class....
static bool recursivelyOverrides(const CXXMethodDecl *DerivedMD, const CXXMethodDecl *BaseMD)
const ParmVarDecl * getParamDecl(unsigned i) const
static bool isValidStructGUID(ASTContext &Ctx, QualType T)
Determine if T is a valid 'struct _GUID' of the shape that we expect.
void setCaptures(ASTContext &Context, ArrayRef< LambdaCapture > Captures)
Set the captures for this lambda closure type.
U cast(CodeGen::Address addr)
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
The iterator over UnresolvedSets.
static AccessSpecifier MergeAccess(AccessSpecifier PathAccess, AccessSpecifier DeclAccess)
Calculates the access of a decl that is reached along a path.
Represents a member of a struct/union/class.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set.
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
static bool isDeclContextInNamespace(const DeclContext *DC)
Represents a parameter to a function.
static NamespaceAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
FunctionDecl * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
static MSPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL, IdentifierInfo *Getter, IdentifierInfo *Setter)
DeclarationNameInfo getNameInfo() const
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
static UnresolvedUsingValueDecl * CreateDeserialized(ASTContext &C, unsigned ID)
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
bool UsesFPIntrin() const
Determine whether the function was declared in source context that requires constrained FP intrinsics...
static bool hasRepeatedBaseClass(const CXXRecordDecl *StartRD)
Determine whether a class has a repeated base class.
bool isGenericLambda() const
Determine whether this class describes a generic lambda function object (i.e.
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
bool hasUserDeclaredConstructor() const
Determine whether this class has any user-declared constructors.
const LangOptions & getLangOpts() const LLVM_READONLY
Helper to get the language options from the ASTContext.
bool isAnyMemberInitializer() const
Represents a pack of using declarations that a single using-declarator pack-expanded into.
@ APK_CanNeverPassInRegs
The argument of this type cannot be passed directly in registers.
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
uint32_t Part1
{01234567-...
bool isRValueReferenceType() const
FunctionType - C99 6.7.5.3 - Function Declarators.
@ SD_Automatic
Automatic storage duration (most local variables).
@ TTK_Interface
The "__interface" keyword.
The name of a declaration.
base_class_iterator bases_end()
VarDecl * getHoldingVar() const
Get the variable (if any) that holds the value of evaluating the binding.
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...
CXXMethodDecl * getCorrespondingMethodInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find the method in RD that corresponds to this one.
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
The base class of the type hierarchy.
static DeclContext::lookup_result getLambdaStaticInvokers(const CXXRecordDecl &RD)
SourceLocation getSourceLocation() const
Determine the source location of the initializer.
StorageDuration
The storage duration for an object (per C++ [basic.stc]).
static CXXMethodDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin, bool isInline, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
static CXXConstructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, ExplicitSpecifier ES, bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, InheritedConstructor Inherited=InheritedConstructor(), Expr *TrailingRequiresClause=nullptr)
void setHasObjectMember(bool val)
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
static CXXConstructorDecl * CreateDeserialized(ASTContext &C, unsigned ID, uint64_t AllocKind)
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
void * Allocate(size_t Size, unsigned Align=8) const
static CXXRecordDecl * CreateLambda(const ASTContext &C, DeclContext *DC, TypeSourceInfo *Info, SourceLocation Loc, unsigned DependencyKind, bool IsGeneric, LambdaCaptureDefault CaptureDefault)
Represents a dependent using declaration which was marked with typename.
bool isInClassMemberInitializer() const
Determine whether this initializer is an implicit initializer generated for a field with an initializ...
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Declaration of a template function.
bool isStructuralType() const
Determine if this type is a structural type, per C++20 [temp.param]p7.
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
bool isReferenceType() const
static UnresolvedUsingTypenameDecl * CreateDeserialized(ASTContext &C, unsigned ID)
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
bool hasNonTrivialObjCLifetime() const
Kind
Lists the kind of concrete classes of Decl.
LambdaCaptureDefault getLambdaCaptureDefault() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
overridden_method_range overridden_methods() const
TypeLoc getBaseClassLoc() const
If this is a base class initializer, returns the type of the base class with location information.
static const char * getAccessName(AccessSpecifier AS)
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
static NamespaceDecl * CreateDeserialized(ASTContext &C, unsigned ID)
An UnresolvedSet-like class which uses the ASTContext's allocator.
MapType::iterator iterator
BaseUsingDecl * getIntroducer() const
Gets the (written or instantiated) using declaration that introduced this declaration.
Represents the body of a requires-expression.
const ConstantArrayType * getAsConstantArrayType(QualType T) const
AccessSpecifier getAccess() const
method_range methods() const
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
void append(ASTContext &C, iterator I, iterator E)
TagTypeKind
The kind of a tag type.
bool isObjCGCStrong() const
true when Type is objc's strong.
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
FunctionDecl * getTemplateInstantiationPattern(bool ForDefinition=true) const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
static UsingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
SourceRange getSourceRange() const LLVM_READONLY
Determine the source range covering the entire initializer.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
static ConstructorUsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
CXXMethodDecl * getLambdaStaticInvoker() const
Retrieve the lambda static invoker, the address of which is returned by the conversion operator,...
A decomposition declaration.
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...
const T * getAs() const
Member-template getAs<specific type>'.
unsigned getNumBases() const
Retrieves the number of base classes of this class.
static CXXConversionDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isInvalidDecl() const
void setIneligibleOrNotSelected(bool II)
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
UsingDecl * getIntroducer() const
Override the UsingShadowDecl's getIntroducer, returning the UsingDecl that introduced this.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
bool isLValueReferenceType() const
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Represents a C++ destructor within a class.
bool isTranslationUnit() const
static UsingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
shadow_range shadows() const
bool isPOD() const
Whether this class is a POD-type (C++ [class]p4)
unsigned getCVRQualifiers() const
Retrieve the const/volatile/restrict qualifiers.
void removeShadowDecl(UsingShadowDecl *S)
APValue & getAsAPValue() const
Get the value of this MSGuidDecl as an APValue.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Represents a variable declaration or definition.
static UnresolvedUsingIfExistsDecl * CreateDeserialized(ASTContext &Ctx, unsigned ID)
static MSPropertyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
Stores a list of template parameters for a TemplateDecl and its derived classes.
bool replace(const NamedDecl *Old, NamedDecl *New, AccessSpecifier AS)
Replaces the given declaration with the new one, once.
bool hasConstexprDestructor() const
Determine whether this class has a constexpr destructor.
StringLiteral - This represents a string literal expression, e.g.
@ SD_FullExpression
Full-expression storage duration (for temporaries).
static NamedDecl * getLambdaCallOperatorHelper(const CXXRecordDecl &RD)
@ TTK_Class
The "class" keyword.
UsingShadowDecl(Kind K, ASTContext &C, DeclContext *DC, SourceLocation Loc, DeclarationName Name, BaseUsingDecl *Introducer, NamedDecl *Target)
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
LanguageIDs
Represents the language in a linkage specification.
bool hasFriends() const
Determines whether this record has any friends.
void addDestruction(T *Ptr) const
If T isn't trivially destructible, calls AddDeallocation to register it for destruction.
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
void printName(llvm::raw_ostream &OS) const override
Print this UUID in a human-readable format.
static CXXDeductionGuideDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, ExplicitSpecifier ES, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation, CXXConstructorDecl *Ctor=nullptr)
bool forallBases(ForallBasesCallback BaseMatches) const
Determines if the given callback holds for all the direct or indirect base classes of this type.
A C++ nested-name-specifier augmented with source location information.
NamespaceDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to call this function.
static ExplicitSpecifier getFromDecl(FunctionDecl *Function)
bool isUnsignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is unsigned or an enumeration types whose underlying ...
OverloadedOperatorKind getOverloadedOperator() const
getOverloadedOperator - Which C++ overloaded operator this function represents, if any.
Represents a dependent using declaration which was not marked with typename.
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
bool isConvertingConstructor(bool AllowExplicit) const
Whether this constructor is a converting constructor (C++ [class.conv.ctor]), which can be used for u...
bool hasSimpleMoveAssignment() const
true if we know for sure that this class has a single, accessible, unambiguous move assignment operat...
APValue & getArrayInitializedElt(unsigned I)
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
void setImplicit(bool I=true)
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
static ConstructorUsingShadowDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, UsingDecl *Using, NamedDecl *Target, bool IsVirtual)
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
static CXXDestructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, Expr *TrailingRequiresClause=nullptr)
bool isEquivalent(const ExplicitSpecifier Other) const
Check for equivalence of explicit specifiers.
unsigned getODRHash() const
Represents a C++ using-declaration.
DeclarationName getName() const
getName - Returns the embedded declaration name.
static UsingEnumDecl * CreateDeserialized(ASTContext &C, unsigned ID)
NamedDecl * getMostRecentDecl()
void addedSelectedDestructor(CXXDestructorDecl *DD)
Notify the class that this destructor is now selected.
void addDecl(ASTContext &C, NamedDecl *D, AccessSpecifier AS)
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
@ CXXConversionFunctionName
const Expr * getExpr() const
bool isDestroyingOperatorDelete() const
Determine whether this is a destroying operator delete.
static LinkageSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
const T * castAs() const
Member-template castAs<specific type>.
ConstexprSpecKind
Define the kind of constexpr specifier.
void addedEligibleSpecialMemberFunction(const CXXMethodDecl *MD, unsigned SMKind)
Notify the class that an eligible SMF has been added.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
method_iterator end_overridden_methods() const
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
Represents a C++ using-enum-declaration.
Represents a C++ struct/union/class.
method_iterator begin_overridden_methods() const
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
conversion_iterator conversion_end() const
static CXXDeductionGuideDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
SourceLocation getRParenLoc() const
static DecompositionDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumBindings)
static UsingPackDecl * Create(ASTContext &C, DeclContext *DC, NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl * > UsingDecls)
unsigned size_overridden_methods() const
LinkageSpecDeclBitfields LinkageSpecDeclBits
static BindingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Represents a C++11 static_assert declaration.
bool hasSimpleCopyAssignment() const
true if we know for sure that this class has a single, accessible, unambiguous copy assignment operat...
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
void setDeviceLambdaManglingNumber(unsigned Num) const
Set the device side mangling number.
bool isBeingDefined() const
Return true if this decl is currently being defined.
bool hasNonTrivialCopyConstructor() const
Determine whether this class has a non-trivial copy constructor (C++ [class.copy]p6,...
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
Declaration of a class template.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
virtual void completeDefinition()
Note that the definition of this type is now complete.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl.
Represents a prototype with parameter type info, e.g.
static UnresolvedUsingIfExistsDecl * Create(ASTContext &Ctx, DeclContext *DC, SourceLocation Loc, DeclarationName Name)
DeclContext * getParent()
getParent - Returns the containing DeclContext.
NamespaceDecl * getNextRedeclaration() const
field_range fields() const
QualType getConversionType() const
Returns the type that this conversion function is converting to.
bool isIdentifier() const
Predicate functions for querying what type of name this is.
CXXConstructorDecl * getTargetConstructor() const
When this constructor delegates to another, retrieve the target.
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
Decl - This represents one declaration (or definition), e.g.
uint16_t Part2
...-89ab-...
bool isPure() const
Whether this virtual function is pure, i.e.
Base wrapper for a particular "section" of type source info.
bool isCopyOrMoveConstructor() const
Determine whether this a copy or move constructor.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
DeclarationNameInfo getNameInfo() const
ArrayRef< NamedDecl * > getLambdaExplicitTemplateParameters() const
Retrieve the lambda template parameters that were specified explicitly.
bool isTrivialForCall() const
const CXXMethodDecl *const * method_iterator
@ SD_Static
Static storage duration.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo, bool IsVirtual, SourceLocation L, Expr *Init, SourceLocation R, SourceLocation EllipsisLoc)
Creates a new base-class initializer.
static bool isStaticOverloadedOperator(OverloadedOperatorKind OOK)
Returns true if the given operator is implicitly static in a record context.
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Namespace)
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
APValue & getStructField(unsigned i)
init_iterator init_begin()
Retrieve an iterator to the first initializer.
unsigned capture_size() const
void AddCXXRecordDecl(const CXXRecordDecl *Record)
bool mayBeAbstract() const
Determine whether this class may end up being abstract, even though it is not yet known to be abstrac...
llvm::iterator_range< llvm::TinyPtrVector< const CXXMethodDecl * >::const_iterator > overridden_method_range
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
One of these records is kept for each identifier that is lexed.
void finishedDefaultedOrDeletedMember(CXXMethodDecl *MD)
Indicates that the declaration of a defaulted or deleted special member function is now complete.
field_iterator field_end() const
CXXMethodDecl * getCorrespondingMethodDeclaredInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find if RD declares a function that overrides this function, and if so, return it.
void printName(llvm::raw_ostream &OS) const override
Print this in a human-readable format.
Qualifiers getMethodQuals() const
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
TemplateParameterList * getGenericLambdaTemplateParameterList() const
Retrieve the generic lambda's template parameter list.
A pointer to member type per C++ 8.3.3 - Pointers to members.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the kind of specialization or template instantiation this is.
void addShadowDecl(UsingShadowDecl *S)
T * get(ExternalASTSource *Source) const
Retrieve the pointer to the AST node that this lazy pointer points to.
void AddStmt(const Stmt *S)
Represents a C++ deduction guide declaration.
bool hasNonLiteralTypeFieldsOrBases() const
Determine whether this class has a non-literal or/ volatile type non-static data member or base class...
void setBases(CXXBaseSpecifier const *const *Bases, unsigned NumBases)
Sets the base classes of this struct or class.
static UnresolvedUsingTypenameDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation TypenameLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TargetNameLoc, DeclarationName TargetName, SourceLocation EllipsisLoc)
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
NameKind getNameKind() const
Determine what kind of name this is.
void addOverriddenMethod(const CXXMethodDecl *MD)
static LinkageSpecDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation ExternLoc, SourceLocation LangLoc, LanguageIDs Lang, bool HasBraces)
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
Represents a field injected from an anonymous union/struct into the parent scope.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
bool isSpecializationCopyingObject() const
Determine whether this is a member template specialization that would copy the object to itself.
uint8_t Part4And5[8]
...-0123-456789abcdef}
void addDecl(NamedDecl *D)
ObjCLifetime getObjCLifetime() const
static RequiresExprBodyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static UsingEnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, SourceLocation EnumL, SourceLocation NameL, EnumDecl *ED)
static CXXRecordDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
An instance of this class represents the declaration of a property member.
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
int64_t getID(const ASTContext &Context) const
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
bool hasInlineBody() const
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 UnresolvedUsingValueDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, SourceLocation EllipsisLoc)
base_class_iterator bases_begin()
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
bool isInterfaceLike() const
uint16_t Part3
...-cdef-...
Represents a base class of a C++ class.
bool hasDefinition() const
A container of type source information.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
static CXXMethodDecl * getInvokerAsMethod(NamedDecl *ND)
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
static QualType getThisObjectType(ASTContext &C, const FunctionProtoType *FPT, const CXXRecordDecl *Decl)
void getFinalOverriders(CXXFinalOverriderMap &FinaOverriders) const
Retrieve the final overriders for each virtual member function in the class hierarchy where this clas...
CXXMethodDecl * getDevirtualizedMethod(const Expr *Base, bool IsAppleKext)
If it's possible to devirtualize a call to this method, return the called function.
bool isVariadic() const
Whether this function is variadic.
This node is generated when a using-declaration that was annotated with attribute((using_if_exists)) ...
ValueDecl * getExtendingDecl()
TagKind getTagKind() const
static bool allLookupResultsAreTheSame(const DeclContext::lookup_result &R)
void completeDefinition() override
Indicates that the definition of this class is now complete.
ExplicitSpecKind getKind() const
The results of name lookup within a DeclContext.
bool isUsualDeallocationFunction(SmallVectorImpl< const FunctionDecl * > &PreventedBy) const
Determine whether this is a usual deallocation function (C++ [basic.stc.dynamic.deallocation]p2),...
RecordDecl * getDecl() const
Expr * getBinding() const
Get the expression to which this declaration is bound.
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
Base for LValueReferenceType and RValueReferenceType.
bool isExternCContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
Description of a constructor that was inherited from a base class.
virtual Decl * GetExternalDecl(uint32_t ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
bool isLambda() const
Determine whether this class describes a lambda function object.
bool isCopyConstructor() const
Whether this constructor is a copy constructor (C++ [class.copy]p2, which can be used to copy the cla...
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
bool hasSimpleMoveConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous move constructor that ...
bool hasUserDeclaredDestructor() const
Determine whether this class has a user-declared destructor.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
QualType getElementType() const
This represents one expression.
Represents a C++ declaration that introduces decls from somewhere else.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
CXXMethodDecl(Kind DK, ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin, bool isInline, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
static UsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool defaultedDestructorIsConstexpr() const
Determine whether a defaulted default constructor for this class would be constexpr.
Represents a C++ base or member initializer.
Abstract interface for external sources of AST nodes.
static StaticAssertDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isFunctionOrMethod() const
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
static CXXDestructorDecl * CreateDeserialized(ASTContext &C, unsigned ID)
SourceLocation getLocation() const
const CXXRecordDecl * getTemplateInstantiationPattern() const
Retrieve the record declaration from which this record could be instantiated.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Represent a C++ namespace.
Represents a function declaration or definition.
static CXXMethodDecl * CreateDeserialized(ASTContext &C, unsigned ID)
CXXRecordDecl(Kind K, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl)
Represents a struct/union/class.
bool isMoveConstructor() const
Determine whether this constructor is a move constructor (C++11 [class.copy]p3), which can be used to...
StorageClass getStorageClass() const
Returns the storage class as written in the source.
static AccessSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static CXXConversionDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool UsesFPIntrin, bool isInline, ExplicitSpecifier ES, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
static void CollectVisibleConversions(ASTContext &Context, const 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.
@ Ver6
Attempt to be ABI-compatible with code generated by Clang 6.0.x (SVN r321711).
StringRef getLambdaStaticInvokerName()
bool isDefined(const FunctionDecl *&Definition, bool CheckForPendingFriendDefinition=false) const
Returns true if the function has a definition that does not need to be instantiated.
const LangOptions & getLangOpts() const
llvm::BumpPtrAllocator & getAllocator() const
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
void setTargetDecl(NamedDecl *ND)
Sets the underlying declaration which has been brought into the local scope.
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
bool isInheritingConstructor() const
Determine whether this is an implicit constructor synthesized to model a call to a constructor inheri...
void setTrivialForCallFlags(CXXMethodDecl *MD)
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
static CanQualType GetConversionType(ASTContext &Context, NamedDecl *Conv)
void setDescribedClassTemplate(ClassTemplateDecl *Template)
An lvalue reference type, per C++11 [dcl.ref].
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
Represents a static or instance method of a struct/union/class.
llvm::iterator_range< conversion_iterator > getVisibleConversionFunctions() const
Get all conversion functions visible in current class, including conversion function templates.
DeclContext * getDeclContext()
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a member function.
StorageClass
Storage classes.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.