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"
58void AccessSpecDecl::anchor() {}
64void 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);
75CXXRecordDecl::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),
116 return Bases.get(
Definition->getASTContext().getExternalSource());
120 return VBases.get(
Definition->getASTContext().getExternalSource());
128 DefinitionData(PrevDecl ? PrevDecl->DefinitionData
135 bool DelayTypeCreation) {
141 if (!DelayTypeCreation)
142 C.getTypeDeclType(R, PrevDecl);
149 unsigned DependencyKind,
bool IsGeneric,
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);
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;
509void 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;
590void CXXRecordDecl::markedVirtualFunctionPure() {
593 data().Abstract =
true;
596bool 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");
694void 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;
779 data().PlainOldData =
false;
784 SMKind |= SMF_DefaultConstructor;
787 data().UserProvidedDefaultConstructor =
true;
789 data().HasConstexprDefaultConstructor =
true;
791 data().HasDefaultedDefaultConstructor =
true;
797 SMKind |= SMF_CopyConstructor;
800 data().HasDeclaredCopyConstructorWithConstParam =
true;
802 SMKind |= SMF_MoveConstructor;
814 data().Aggregate =
false;
819 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(DUnderlying)) {
827 data().HasConstexprNonCopyMoveConstructor =
true;
828 if (!isa<CXXConstructorDecl>(D) &&
Constructor->isDefaultConstructor())
829 data().HasInheritedDefaultConstructor =
true;
833 if (
const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
834 if (isa<CXXDestructorDecl>(D))
835 SMKind |= SMF_Destructor;
837 if (Method->isCopyAssignmentOperator()) {
838 SMKind |= SMF_CopyAssignment;
840 const auto *ParamTy =
842 if (!ParamTy || ParamTy->getPointeeType().isConstQualified())
843 data().HasDeclaredCopyAssignmentWithConstParam =
true;
846 if (Method->isMoveAssignmentOperator())
847 SMKind |= SMF_MoveAssignment;
850 if (
auto *Conversion = dyn_cast<CXXConversionDecl>(D)) {
859 if (Conversion->getPrimaryTemplate()) {
865 FunTmpl ? cast<NamedDecl>(FunTmpl) :
cast<
NamedDecl>(Conversion);
870 Conversions.
addDecl(Ctx, Primary, AS);
877 data().HasTrivialSpecialMembers &=
878 data().DeclaredSpecialMembers | ~SMKind;
879 data().HasTrivialSpecialMembersForCall &=
880 data().DeclaredSpecialMembers | ~SMKind;
884 data().DeclaredSpecialMembers |= SMKind;
885 if (!Method->isImplicit()) {
886 data().UserDeclaredSpecialMembers |= SMKind;
889 if ((!Method->isDeleted() && !Method->isDefaulted() &&
890 SMKind != SMF_MoveAssignment) ||
904 data().PlainOldData =
false;
912 if (!Method->isIneligibleOrNotSelected()) {
921 if (
const auto *Field = dyn_cast<FieldDecl>(D)) {
929 if (data().HasBasesWithFields)
930 data().IsStandardLayout =
false;
936 if (
Field->isUnnamedBitfield()) {
940 if (data().Empty && !
Field->isZeroLengthBitField(Context) &&
943 data().Empty =
false;
951 if (data().HasBasesWithNonStaticDataMembers)
952 data().IsCXX11StandardLayout =
false;
960 data().Aggregate =
false;
961 data().PlainOldData =
false;
966 data().StructuralIfLiteral =
false;
971 bool IsFirstField = !data().HasPrivateFields &&
972 !data().HasProtectedFields && !data().HasPublicFields;
979 case AS_private: data().HasPrivateFields =
true;
break;
980 case AS_protected: data().HasProtectedFields =
true;
break;
981 case AS_public: data().HasPublicFields =
true;
break;
982 case AS_none: llvm_unreachable(
"Invalid access specifier");
984 if ((data().HasPrivateFields + data().HasProtectedFields +
985 data().HasPublicFields) > 1) {
986 data().IsStandardLayout =
false;
987 data().IsCXX11StandardLayout =
false;
991 if (
Field->isMutable()) {
992 data().HasMutableFields =
true;
997 data().StructuralIfLiteral =
false;
1004 data().HasVariantMembers =
true;
1023 struct DefinitionData &
Data = data();
1024 Data.PlainOldData =
false;
1025 Data.HasTrivialSpecialMembers = 0;
1031 data().HasTrivialSpecialMembersForCall = 0;
1037 Data.HasIrrelevantDestructor =
false;
1040 data().DefaultedCopyConstructorIsDeleted =
true;
1041 data().DefaultedMoveConstructorIsDeleted =
true;
1042 data().DefaultedCopyAssignmentIsDeleted =
true;
1043 data().DefaultedMoveAssignmentIsDeleted =
true;
1044 data().DefaultedDestructorIsDeleted =
true;
1045 data().NeedOverloadResolutionForCopyConstructor =
true;
1046 data().NeedOverloadResolutionForMoveConstructor =
true;
1047 data().NeedOverloadResolutionForCopyAssignment =
true;
1048 data().NeedOverloadResolutionForMoveAssignment =
true;
1049 data().NeedOverloadResolutionForDestructor =
true;
1051 }
else if (!Context.
getLangOpts().ObjCAutoRefCount) {
1055 data().PlainOldData =
false;
1058 if (!
Field->hasInClassInitializer())
1059 data().HasUninitializedReferenceMember =
true;
1064 data().IsStandardLayout =
false;
1065 data().IsCXX11StandardLayout =
false;
1071 data().DefaultedCopyConstructorIsDeleted =
true;
1074 if (!
Field->hasInClassInitializer() && !
Field->isMutable()) {
1076 if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
1077 data().HasUninitializedFields =
true;
1079 data().HasUninitializedFields =
true;
1085 data().HasNonLiteralTypeFieldsOrBases =
true;
1087 if (
Field->hasInClassInitializer() ||
1088 (
Field->isAnonymousStructOrUnion() &&
1089 Field->getType()->getAsCXXRecordDecl()->hasInClassInitializer())) {
1090 data().HasInClassInitializer =
true;
1095 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1103 data().Aggregate =
false;
1107 data().PlainOldData =
false;
1115 data().DefaultedCopyAssignmentIsDeleted =
true;
1116 data().DefaultedMoveAssignmentIsDeleted =
true;
1121 bool IsZeroSize =
Field->isZeroSize(Context);
1124 auto *FieldRec = cast<CXXRecordDecl>(RecordTy->getDecl());
1125 if (FieldRec->getDefinition()) {
1126 addedClassSubobject(FieldRec);
1134 data().NeedOverloadResolutionForCopyConstructor =
true;
1135 data().NeedOverloadResolutionForMoveConstructor =
true;
1136 data().NeedOverloadResolutionForCopyAssignment =
true;
1137 data().NeedOverloadResolutionForMoveAssignment =
true;
1146 if (FieldRec->hasNonTrivialCopyConstructor())
1147 data().DefaultedCopyConstructorIsDeleted =
true;
1148 if (FieldRec->hasNonTrivialMoveConstructor())
1149 data().DefaultedMoveConstructorIsDeleted =
true;
1150 if (FieldRec->hasNonTrivialCopyAssignment())
1151 data().DefaultedCopyAssignmentIsDeleted =
true;
1152 if (FieldRec->hasNonTrivialMoveAssignment())
1153 data().DefaultedMoveAssignmentIsDeleted =
true;
1154 if (FieldRec->hasNonTrivialDestructor())
1155 data().DefaultedDestructorIsDeleted =
true;
1160 if (
Field->isAnonymousStructOrUnion()) {
1161 data().NeedOverloadResolutionForCopyConstructor |=
1162 FieldRec->data().NeedOverloadResolutionForCopyConstructor;
1163 data().NeedOverloadResolutionForMoveConstructor |=
1164 FieldRec->data().NeedOverloadResolutionForMoveConstructor;
1165 data().NeedOverloadResolutionForCopyAssignment |=
1166 FieldRec->data().NeedOverloadResolutionForCopyAssignment;
1167 data().NeedOverloadResolutionForMoveAssignment |=
1168 FieldRec->data().NeedOverloadResolutionForMoveAssignment;
1169 data().NeedOverloadResolutionForDestructor |=
1170 FieldRec->data().NeedOverloadResolutionForDestructor;
1178 if (!FieldRec->hasTrivialDefaultConstructor())
1179 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1187 if (!FieldRec->hasTrivialCopyConstructor())
1188 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
1190 if (!FieldRec->hasTrivialCopyConstructorForCall())
1191 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
1196 if (!FieldRec->hasTrivialMoveConstructor())
1197 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
1199 if (!FieldRec->hasTrivialMoveConstructorForCall())
1200 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
1208 if (!FieldRec->hasTrivialCopyAssignment())
1209 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
1213 if (!FieldRec->hasTrivialMoveAssignment())
1214 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
1216 if (!FieldRec->hasTrivialDestructor())
1217 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1218 if (!FieldRec->hasTrivialDestructorForCall())
1219 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1220 if (!FieldRec->hasIrrelevantDestructor())
1221 data().HasIrrelevantDestructor =
false;
1222 if (FieldRec->isAnyDestructorNoReturn())
1223 data().IsAnyDestructorNoReturn =
true;
1224 if (FieldRec->hasObjectMember())
1226 if (FieldRec->hasVolatileMember())
1228 if (FieldRec->getArgPassingRestrictions() ==
1236 if (!FieldRec->isStandardLayout())
1237 data().IsStandardLayout =
false;
1238 if (!FieldRec->isCXX11StandardLayout())
1239 data().IsCXX11StandardLayout =
false;
1245 if (data().IsStandardLayout &&
1246 (
isUnion() || IsFirstField || IsZeroSize) &&
1247 hasSubobjectAtOffsetZeroOfEmptyBaseType(Context, FieldRec))
1248 data().IsStandardLayout =
false;
1254 if (data().IsCXX11StandardLayout && IsFirstField) {
1257 for (
const auto &BI :
bases()) {
1259 data().IsCXX11StandardLayout =
false;
1266 if (FieldRec->hasMutableFields())
1267 data().HasMutableFields =
true;
1269 if (
Field->isMutable()) {
1273 data().NeedOverloadResolutionForCopyConstructor =
true;
1274 data().NeedOverloadResolutionForCopyAssignment =
true;
1284 if (!
Field->hasInClassInitializer() &&
1285 !FieldRec->hasConstexprDefaultConstructor() && !
isUnion())
1288 data().DefaultedDefaultConstructorIsConstexpr =
false;
1295 if (!FieldRec->hasCopyConstructorWithConstParam())
1296 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
1304 if (!FieldRec->hasCopyAssignmentWithConstParam())
1305 data().ImplicitCopyAssignmentHasConstParam =
false;
1307 if (FieldRec->hasUninitializedReferenceMember() &&
1308 !
Field->hasInClassInitializer())
1309 data().HasUninitializedReferenceMember =
true;
1314 if (FieldRec->hasVariantMembers() &&
1315 Field->isAnonymousStructOrUnion())
1316 data().HasVariantMembers =
true;
1323 data().DefaultedDefaultConstructorIsConstexpr =
false;
1331 data().DefaultedCopyAssignmentIsDeleted =
true;
1332 data().DefaultedMoveAssignmentIsDeleted =
true;
1341 data().StructuralIfLiteral =
false;
1347 if (data().Empty && !IsZeroSize)
1348 data().Empty =
false;
1352 if (
auto *Shadow = dyn_cast<UsingShadowDecl>(D)) {
1353 if (Shadow->getDeclName().getNameKind()
1356 data().Conversions.get(Ctx).addDecl(Ctx, Shadow, Shadow->getAccess());
1360 if (
const auto *Using = dyn_cast<UsingDecl>(D)) {
1361 if (
Using->getDeclName().getNameKind() ==
1363 data().HasInheritedConstructor =
true;
1366 data().Aggregate =
false;
1369 if (
Using->getDeclName().getCXXOverloadedOperator() == OO_Equal)
1370 data().HasInheritedAssignment =
true;
1385 if (
const auto *DD = dyn_cast<CXXDestructorDecl>(MD)) {
1386 if (DD->isUserProvided())
1387 data().HasIrrelevantDestructor =
false;
1394 if (DD->isVirtual()) {
1395 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1396 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1399 if (DD->isNoReturn())
1400 data().IsAnyDestructorNoReturn =
true;
1409 data().HasTrivialSpecialMembers |= SMKind;
1410 data().HasTrivialSpecialMembersForCall |= SMKind;
1412 data().HasTrivialSpecialMembersForCall |= SMKind;
1413 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1415 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1422 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1430 unsigned SMKind = 0;
1432 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1433 if (Constructor->isDefaultConstructor()) {
1434 SMKind |= SMF_DefaultConstructor;
1435 if (Constructor->isConstexpr())
1436 data().HasConstexprDefaultConstructor =
true;
1438 if (Constructor->isCopyConstructor())
1439 SMKind |= SMF_CopyConstructor;
1440 else if (Constructor->isMoveConstructor())
1441 SMKind |= SMF_MoveConstructor;
1442 else if (Constructor->isConstexpr())
1444 data().HasConstexprNonCopyMoveConstructor =
true;
1445 }
else if (isa<CXXDestructorDecl>(D)) {
1446 SMKind |= SMF_Destructor;
1448 data().HasIrrelevantDestructor =
false;
1450 SMKind |= SMF_CopyAssignment;
1452 SMKind |= SMF_MoveAssignment;
1458 data().HasTrivialSpecialMembers |= SMKind;
1460 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1464void CXXRecordDecl::LambdaDefinitionData::AddCaptureList(
ASTContext &Ctx,
1466 Captures.push_back(CaptureList);
1467 if (Captures.size() == 2) {
1475 CXXRecordDecl::LambdaDefinitionData &
Data = getLambdaData();
1478 Data.NumCaptures = Captures.size();
1479 Data.NumExplicitCaptures = 0;
1482 Data.AddCaptureList(Context, ToCapture);
1483 for (
unsigned I = 0, N = Captures.size(); I != N; ++I) {
1484 if (Captures[I].isExplicit())
1485 ++
Data.NumExplicitCaptures;
1487 *ToCapture++ = Captures[I];
1491 Data.DefaultedCopyAssignmentIsDeleted =
true;
1495 unsigned SMKind = 0;
1497 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1498 if (Constructor->isCopyConstructor())
1499 SMKind = SMF_CopyConstructor;
1500 else if (Constructor->isMoveConstructor())
1501 SMKind = SMF_MoveConstructor;
1502 }
else if (isa<CXXDestructorDecl>(D))
1503 SMKind = SMF_Destructor;
1506 data().HasTrivialSpecialMembersForCall |= SMKind;
1508 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1513 !TemplateOrInstantiation.isNull())
1518 return isPOD() && data().HasOnlyCMembers;
1523 return getLambdaData().IsGenericLambda;
1536 if (!RD.
isLambda())
return nullptr;
1541 assert(!Calls.
empty() &&
"Missing lambda call operator!");
1543 "More than one lambda call operator!");
1544 return Calls.
front();
1549 return dyn_cast_or_null<FunctionTemplateDecl>(CallOp);
1555 if (CallOp ==
nullptr)
1558 if (
const auto *CallOpTmpl = dyn_cast<FunctionTemplateDecl>(CallOp))
1559 return cast<CXXMethodDecl>(CallOpTmpl->getTemplatedDecl());
1561 return cast<CXXMethodDecl>(CallOp);
1572 assert(RD.
isLambda() &&
"Must be a lambda");
1579 if (
const auto *InvokerTemplate = dyn_cast<FunctionTemplateDecl>(ND))
1580 return cast<CXXMethodDecl>(InvokerTemplate->getTemplatedDecl());
1581 return cast<CXXMethodDecl>(ND);
1591 cast<ValueDecl>(ND->getAsFunction())->getType()->castAs<
FunctionType>();
1592 if (FTy->getCallConv() == CC)
1600 llvm::DenseMap<const ValueDecl *, FieldDecl *> &Captures,
1603 ThisCapture =
nullptr;
1605 LambdaDefinitionData &Lambda = getLambdaData();
1609 C != CEnd; ++
C, ++Field) {
1610 if (
C->capturesThis())
1611 ThisCapture = *Field;
1612 else if (
C->capturesVariable())
1613 Captures[
C->getCapturedVar()] = *Field;
1624 return Tmpl->getTemplateParameters();
1634 assert(std::is_partitioned(List->begin(), List->end(),
1635 [](
const NamedDecl *D) { return !D->isImplicit(); })
1636 &&
"Explicit template params should be ordered before implicit ones");
1638 const auto ExplicitEnd = llvm::partition_point(
1644 assert(
isLambda() &&
"Not a lambda closure type!");
1646 return getLambdaData().ContextDecl.get(Source);
1650 assert(
isLambda() &&
"Not a lambda closure type!");
1656 assert(
isLambda() &&
"Not a lambda closure type!");
1657 auto I =
getASTContext().DeviceLambdaManglingNumbers.find(
this);
1666 ->getConversionType();
1698 if (ConvI != ConvE) {
1699 HiddenTypesBuffer = ParentHiddenTypes;
1700 HiddenTypes = &HiddenTypesBuffer;
1704 bool Hidden = ParentHiddenTypes.count(ConvType);
1706 HiddenTypesBuffer.insert(ConvType);
1710 if (Hidden && InVirtual)
1711 HiddenVBaseCs.insert(cast<NamedDecl>(I.getDecl()->getCanonicalDecl()));
1719 VOutput.
addDecl(I.getDecl(), IAccess);
1721 Output.
addDecl(Context, I.getDecl(), IAccess);
1727 for (
const auto &I : Record->bases()) {
1728 const auto *RT = I.getType()->getAs<
RecordType>();
1733 bool BaseInVirtual = InVirtual || I.isVirtual();
1735 auto *
Base = cast<CXXRecordDecl>(RT->getDecl());
1737 *HiddenTypes, Output, VOutput, HiddenVBaseCs);
1764 Output.
append(Context, ConvI, ConvE);
1765 for (; ConvI != ConvE; ++ConvI)
1769 for (
const auto &I : Record->bases()) {
1770 const auto *RT = I.getType()->getAs<
RecordType>();
1774 I.isVirtual(), I.getAccessSpecifier(),
1775 HiddenTypes, Output, VBaseCs, HiddenVBaseCs);
1781 if (!HiddenVBaseCs.count(cast<NamedDecl>(I.getDecl()->getCanonicalDecl())))
1782 Output.
addDecl(Context, I.getDecl(), I.getAccess());
1788llvm::iterator_range<CXXRecordDecl::conversion_iterator>
1795 Set = &data().Conversions.get(Ctx);
1797 Set = &data().VisibleConversions.get(Ctx);
1799 if (!data().ComputedVisibleConversions) {
1801 data().ComputedVisibleConversions =
true;
1804 return llvm::make_range(Set->
begin(), Set->
end());
1820 for (
unsigned I = 0, E = Convs.
size(); I != E; ++I) {
1821 if (Convs[I].getDecl() == ConvDecl) {
1823 assert(!llvm::is_contained(Convs, ConvDecl) &&
1824 "conversion was found multiple times in unresolved set");
1829 llvm_unreachable(
"conversion not found in set!");
1834 return cast<CXXRecordDecl>(MSInfo->getInstantiatedFrom());
1846 assert(TemplateOrInstantiation.isNull() &&
1847 "Previous template or instantiation?");
1848 assert(!isa<ClassTemplatePartialSpecializationDecl>(
this));
1849 TemplateOrInstantiation
1858 TemplateOrInstantiation = Template;
1862 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this))
1863 return Spec->getSpecializationKind();
1866 return MSInfo->getTemplateSpecializationKind();
1873 if (
auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1874 Spec->setSpecializationKind(TSK);
1879 MSInfo->setTemplateSpecializationKind(TSK);
1883 llvm_unreachable(
"Not a class template or member class specialization");
1887 auto GetDefinitionOrSelf =
1889 if (
auto *Def = D->getDefinition())
1896 if (
auto *TD = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1897 auto From = TD->getInstantiatedFrom();
1899 while (
auto *NewCTD = CTD->getInstantiatedFromMemberTemplate()) {
1900 if (NewCTD->isMemberSpecialization())
1904 return GetDefinitionOrSelf(CTD->getTemplatedDecl());
1908 while (
auto *NewCTPSD = CTPSD->getInstantiatedFromMember()) {
1909 if (NewCTPSD->isMemberSpecialization())
1913 return GetDefinitionOrSelf(CTPSD);
1922 return GetDefinitionOrSelf(RD);
1927 "couldn't find pattern for class template instantiation");
1943 for (
auto *
Decl : R) {
1944 auto* DD = dyn_cast<CXXDestructorDecl>(
Decl);
1945 if (DD && !DD->isIneligibleOrNotSelected())
1961 assert(
hasDefinition() &&
"checking for interface-like without a definition");
1975 for (
const auto *
const Method :
methods())
1976 if (Method->isDefined() && !Method->isImplicit())
1980 const auto *Uuid = getAttr<UuidAttr>();
1987 Uuid->getGuid() ==
"00000000-0000-0000-C000-000000000046") ||
1989 Uuid->getGuid() ==
"00020400-0000-0000-C000-000000000046"))) {
2003 if (BaseSpec.isVirtual() || BaseSpec.getAccessSpecifier() !=
AS_public)
2005 const auto *
Base = BaseSpec.getType()->getAsCXXRecordDecl();
2006 if (
Base->isInterface() || !
Base->isInterfaceLike())
2022 if (!FinalOverriders) {
2024 FinalOverriders = &MyFinalOverriders;
2028 for (CXXFinalOverriderMap::iterator M = FinalOverriders->begin(),
2029 MEnd = FinalOverriders->end();
2030 M != MEnd && !Done; ++M) {
2032 SOEnd = M->second.end();
2033 SO != SOEnd && !Done; ++SO) {
2034 assert(SO->second.size() > 0 &&
2035 "All virtual functions have overriding virtual functions");
2041 if (SO->second.front().Method->isPure()) {
2042 data().Abstract =
true;
2053 I.setAccess((*I)->getAccess());
2057 if (data().Abstract ||
isInvalidDecl() || !data().Polymorphic ||
2061 for (
const auto &B :
bases()) {
2062 const auto *BaseDecl =
2064 if (BaseDecl->isAbstract())
2075 if (Def->hasAttr<FinalAttr>())
2077 if (
const auto *Dtor = Def->getDestructor())
2078 if (Dtor->hasAttr<FinalAttr>())
2083void CXXDeductionGuideDecl::anchor() {}
2086 if ((
getKind() != Other.getKind() ||
2092 OtherHash.
AddStmt(Other.getExpr());
2101 switch (Function->getDeclKind()) {
2102 case Decl::Kind::CXXConstructor:
2103 return cast<CXXConstructorDecl>(Function)->getExplicitSpecifier();
2104 case Decl::Kind::CXXConversion:
2105 return cast<CXXConversionDecl>(Function)->getExplicitSpecifier();
2106 case Decl::Kind::CXXDeductionGuide:
2107 return cast<CXXDeductionGuideDecl>(Function)->getExplicitSpecifier();
2120 TInfo, EndLocation, Ctor);
2140void CXXMethodDecl::anchor() {}
2170 if (isa<CXXDestructorDecl>(
this)) {
2182 auto *MD = dyn_cast<CXXMethodDecl>(ND);
2210 llvm::erase_if(FinalOverriders, [&](
CXXMethodDecl *OtherD) {
2214 FinalOverriders.push_back(D);
2217 for (
const auto &I : RD->
bases()) {
2221 const auto *
Base = cast<CXXRecordDecl>(RT->
getDecl());
2223 AddFinalOverrider(D);
2226 return FinalOverriders.size() == 1 ? FinalOverriders.front() :
nullptr;
2235 Expr *TrailingRequiresClause) {
2237 CXXMethod,
C, RD, StartLoc, NameInfo, T, TInfo, SC,
UsesFPIntrin,
2238 isInline, ConstexprKind, EndLocation, TrailingRequiresClause);
2250 assert(
isVirtual() &&
"this method is expected to be virtual");
2259 if (hasAttr<FinalAttr>())
2260 return isPure() ? nullptr :
this;
2268 Base =
Base->getBestDynamicClassTypeExpr();
2269 if (
Base->isPRValue() &&
Base->getType()->isRecordType())
2274 if (!BestDynamicDecl)
2283 if (!DevirtualizedMethod)
2289 if (DevirtualizedMethod->
isPure())
2293 if (DevirtualizedMethod->
hasAttr<FinalAttr>())
2294 return DevirtualizedMethod;
2300 return DevirtualizedMethod;
2302 if (
const auto *DRE = dyn_cast<DeclRefExpr>(
Base)) {
2303 if (
const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
2304 if (VD->getType()->isRecordType())
2306 return DevirtualizedMethod;
2314 if (
const auto *ME = dyn_cast<MemberExpr>(
Base)) {
2315 const ValueDecl *VD = ME->getMemberDecl();
2321 if (
auto *BO = dyn_cast<BinaryOperator>(
Base)) {
2322 if (BO->isPtrMemOp()) {
2324 if (MPT->getPointeeType()->isRecordType())
2325 return DevirtualizedMethod;
2335 assert(PreventedBy.empty() &&
"PreventedBy is expected to be empty");
2352 unsigned UsualParams = 1;
2399 for (
const auto *D : R) {
2400 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
2401 if (FD->getNumParams() == 1) {
2402 PreventedBy.push_back(FD);
2455 "Can't add an overridden method to a class template!");
2456 assert(MD->
isVirtual() &&
"Method is not virtual!");
2462 if (isa<CXXConstructorDecl>(
this))
return nullptr;
2467 if (isa<CXXConstructorDecl>(
this))
return nullptr;
2472 if (isa<CXXConstructorDecl>(
this))
return 0;
2478 if (isa<CXXConstructorDecl>(
this))
2493 return C.getPointerType(ObjectTy);
2499 return ::getThisObjectType(
C, FPT,
Decl);
2508 assert(
isInstance() &&
"No 'this' for static methods!");
2515 assert(
isInstance() &&
"No 'this' for static methods!");
2543 : Initializee(TInfo), Init(Init), MemberOrEllipsisLocation(EllipsisLoc),
2544 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(IsVirtual),
2545 IsWritten(
false), SourceOrder(0) {}
2551 : Initializee(
Member), Init(Init), MemberOrEllipsisLocation(MemberLoc),
2552 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2553 IsWritten(
false), SourceOrder(0) {}
2560 : Initializee(
Member), Init(Init), MemberOrEllipsisLocation(MemberLoc),
2561 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2562 IsWritten(
false), SourceOrder(0) {}
2568 : Initializee(TInfo), Init(Init), LParenLoc(L), RParenLoc(R),
2569 IsDelegating(
true), IsVirtual(
false), IsWritten(
false), SourceOrder(0) {}
2585 return Initializee.get<
TypeSourceInfo*>()->getType().getTypePtr();
2598 return TSInfo->getTypeLoc().getBeginLoc();
2607 return I->getSourceRange();
2614CXXConstructorDecl::CXXConstructorDecl(
2620 :
CXXMethodDecl(CXXConstructor,
C, RD, StartLoc, NameInfo, T, TInfo,
2621 SC_None, UsesFPIntrin, isInline, ConstexprKind,
2623 setNumCtorInitializers(0);
2624 setInheritingConstructor(
static_cast<bool>(Inherited));
2625 setImplicit(isImplicitlyDeclared);
2626 CXXConstructorDeclBits.HasTrailingExplicitSpecifier = ES.
getExpr() ? 1 : 0;
2628 *getTrailingObjects<InheritedConstructor>() = Inherited;
2629 setExplicitSpecifier(ES);
2632void CXXConstructorDecl::anchor() {}
2636 uint64_t AllocKind) {
2637 bool hasTrailingExplicit =
static_cast<bool>(AllocKind & TAKHasTailExplicit);
2639 static_cast<bool>(AllocKind & TAKInheritsConstructor);
2641 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2648 Result->CXXConstructorDeclBits.HasTrailingExplicitSpecifier =
2649 hasTrailingExplicit;
2662 "Name must refer to a constructor");
2664 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2665 Inherited ? 1 : 0, ES.
getExpr() ? 1 : 0);
2667 C, RD, StartLoc, NameInfo, T, TInfo, ES,
UsesFPIntrin, isInline,
2668 isImplicitlyDeclared, ConstexprKind, Inherited, TrailingRequiresClause);
2678 if (
const auto *Construct = dyn_cast<CXXConstructExpr>(E))
2679 return Construct->getConstructor();
2779void CXXDestructorDecl::anchor() {}
2791 bool UsesFPIntrin,
bool isInline,
bool isImplicitlyDeclared,
2795 "Name must refer to a destructor");
2797 C, RD, StartLoc, NameInfo, T, TInfo,
UsesFPIntrin, isInline,
2798 isImplicitlyDeclared, ConstexprKind, TrailingRequiresClause);
2803 if (OD && !
First->OperatorDelete) {
2804 First->OperatorDelete = OD;
2805 First->OperatorDeleteThisArg = ThisArg;
2807 L->ResolvedOperatorDelete(
First, OD, ThisArg);
2811void CXXConversionDecl::anchor() {}
2826 Expr *TrailingRequiresClause) {
2829 "Name must refer to a conversion function");
2831 C, RD, StartLoc, NameInfo, T, TInfo,
UsesFPIntrin, isInline, ES,
2832 ConstexprKind, EndLocation, TrailingRequiresClause);
2849void LinkageSpecDecl::anchor() {}
2857 return new (
C, DC)
LinkageSpecDecl(DC, ExternLoc, LangLoc, Lang, HasBraces);
2866void UsingDirectiveDecl::anchor() {}
2875 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(
Used))
2876 Used = NS->getOriginalNamespace();
2878 IdentLoc,
Used, CommonAncestor);
2890 if (
auto *NA = dyn_cast_or_null<NamespaceAliasDecl>(NominatedNamespace))
2891 return NA->getNamespace();
2892 return cast_or_null<NamespaceDecl>(NominatedNamespace);
2900 redeclarable_base(
C), LocStart(StartLoc) {
2906 AnonOrFirstNamespaceAndFlags = {
nullptr, Flags};
2907 setPreviousDecl(PrevDecl);
2930 return AnonOrFirstNamespaceAndFlags.getPointer();
2937 return AnonOrFirstNamespaceAndFlags.getPointer();
2954void NamespaceAliasDecl::anchor() {}
2976 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(Namespace))
2977 Namespace = NS->getOriginalNamespace();
2979 QualifierLoc, IdentLoc, Namespace);
2990void LifetimeExtendedTemporaryDecl::anchor() {}
2999 if (isa<FieldDecl>(ExtendingDecl))
3003 if (isa<BindingDecl>(ExtendingDecl))
3006 return cast<VarDecl>(ExtendingDecl)->getStorageDuration();
3011 "don't need to cache the computed value for this temporary");
3012 if (MayCreate && !
Value) {
3016 assert(
Value &&
"may not be null");
3020void UsingShadowDecl::anchor() {}
3026 UsingOrNextShadow(Introducer) {
3028 assert(!isa<UsingShadowDecl>(
Target));
3045 while (
const auto *NextShadow =
3046 dyn_cast<UsingShadowDecl>(Shadow->UsingOrNextShadow))
3047 Shadow = NextShadow;
3048 return cast<BaseUsingDecl>(Shadow->UsingOrNextShadow);
3051void ConstructorUsingShadowDecl::anchor() {}
3070void BaseUsingDecl::anchor() {}
3073 assert(!llvm::is_contained(
shadows(), S) &&
"declaration already in set");
3074 assert(S->getIntroducer() ==
this);
3076 if (FirstUsingShadow.getPointer())
3077 S->UsingOrNextShadow = FirstUsingShadow.getPointer();
3078 FirstUsingShadow.setPointer(S);
3082 assert(llvm::is_contained(
shadows(), S) &&
"declaration not in set");
3083 assert(S->getIntroducer() ==
this);
3087 if (FirstUsingShadow.getPointer() == S) {
3088 FirstUsingShadow.setPointer(
3089 dyn_cast<UsingShadowDecl>(S->UsingOrNextShadow));
3090 S->UsingOrNextShadow =
this;
3095 while (Prev->UsingOrNextShadow != S)
3096 Prev = cast<UsingShadowDecl>(Prev->UsingOrNextShadow);
3097 Prev->UsingOrNextShadow = S->UsingOrNextShadow;
3098 S->UsingOrNextShadow =
this;
3101void UsingDecl::anchor() {}
3107 return new (
C, DC)
UsingDecl(DC, UL, QualifierLoc, NameInfo, HasTypename);
3122void UsingEnumDecl::anchor() {}
3144void UsingPackDecl::anchor() {}
3149 size_t Extra = additionalSizeToAlloc<NamedDecl *>(UsingDecls.size());
3150 return new (
C, DC, Extra)
UsingPackDecl(DC, InstantiatedFrom, UsingDecls);
3154 unsigned NumExpansions) {
3155 size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
3157 new (
C, ID, Extra)
UsingPackDecl(
nullptr,
nullptr, std::nullopt);
3158 Result->NumExpansions = NumExpansions;
3160 for (
unsigned I = 0; I != NumExpansions; ++I)
3165void UnresolvedUsingValueDecl::anchor() {}
3174 QualifierLoc, NameInfo,
3193void UnresolvedUsingTypenameDecl::anchor() {}
3204 DC, UsingLoc, TypenameLoc, QualifierLoc, TargetNameLoc,
3223 return new (Ctx, ID)
3227UnresolvedUsingIfExistsDecl::UnresolvedUsingIfExistsDecl(
DeclContext *DC,
3230 :
NamedDecl(
Decl::UnresolvedUsingIfExists, DC, Loc, Name) {}
3232void UnresolvedUsingIfExistsDecl::anchor() {}
3234void StaticAssertDecl::anchor() {}
3253 assert((isa<VarDecl, BindingDecl>(
this)) &&
3254 "expected a VarDecl or a BindingDecl");
3255 if (
auto *Var = llvm::dyn_cast<VarDecl>(
this))
3257 if (
auto *BD = llvm::dyn_cast<BindingDecl>(
this))
3258 return llvm::dyn_cast<VarDecl>(BD->getDecomposedDecl());
3262void BindingDecl::anchor() {}
3281 auto *VD = cast<VarDecl>(DRE->getDecl());
3282 assert(VD->isImplicit() &&
"holding var for binding decl not implicit");
3286void DecompositionDecl::anchor() {}
3294 size_t Extra = additionalSizeToAlloc<BindingDecl *>(
Bindings.size());
3295 return new (
C, DC, Extra)
3301 unsigned NumBindings) {
3302 size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
3303 auto *
Result =
new (
C, ID, Extra)
3307 Result->NumBindings = NumBindings;
3309 for (
unsigned I = 0; I != NumBindings; ++I)
3321 B->printName(OS, Policy);
3327void MSPropertyDecl::anchor() {}
3335 return new (
C, DC)
MSPropertyDecl(DC, L, N, T, TInfo, StartL, Getter, Setter);
3345void MSGuidDecl::anchor() {}
3362 OS << llvm::format(
"GUID{%08" PRIx32
"-%04" PRIx16
"-%04" PRIx16
"-",
3365 for (uint8_t Byte : PartVal.
Part4And5) {
3366 OS << llvm::format(
"%02" PRIx8, Byte);
3379 auto IsInt = [&Ctx](
unsigned N) {
3386 auto IsArray = [&Ctx](MatcherRef Elem,
unsigned N) {
3387 return [&Ctx, Elem, N](
QualType T) {
3393 auto IsStruct = [](std::initializer_list<MatcherRef> Fields) {
3401 if (
auto *CXXRD = dyn_cast<CXXRecordDecl>(RD))
3402 if (CXXRD->getNumBases())
3404 auto MatcherIt = Fields.begin();
3406 if (FD->isUnnamedBitfield())
continue;
3407 if (FD->isBitField() || MatcherIt == Fields.end() ||
3408 !(*MatcherIt)(FD->getType()))
3412 return MatcherIt == Fields.end();
3417 return IsStruct({IsInt(32), IsInt(16), IsInt(16), IsArray(IsInt(8), 8)})(T);
3430 for (
unsigned I = 0; I != 8; ++I) {
3442void UnnamedGlobalConstantDecl::anchor() {}
3444UnnamedGlobalConstantDecl::UnnamedGlobalConstantDecl(
const ASTContext &
C,
3453 if (
Value.needsCleanup())
3454 C.addDestruction(&
Value);
3465UnnamedGlobalConstantDecl::CreateDeserialized(
ASTContext &
C,
unsigned ID) {
3472 OS <<
"unnamed-global-constant";
3478 llvm_unreachable(
"Invalid access specifier!");
3486 llvm_unreachable(
"Invalid access specifier!");
Defines the clang::ASTContext interface.
ASTImporterLookupTable & LT
This file provides some common utility functions for processing Lambda related AST Constructs.
Defines the Diagnostic-related interfaces.
static CompilationDatabasePluginRegistry::Add< FixedCompilationDatabasePlugin > X("fixed-compilation-database", "Reads plain-text flags file")
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.
static const char * getAccessName(AccessSpecifier AS)
static bool recursivelyOverrides(const CXXMethodDecl *DerivedMD, const CXXMethodDecl *BaseMD)
static bool isValidStructGUID(ASTContext &Ctx, QualType T)
Determine if T is a valid 'struct _GUID' of the shape that we expect.
static DeclContext::lookup_result getLambdaStaticInvokers(const CXXRecordDecl &RD)
static NamedDecl * getLambdaCallOperatorHelper(const CXXRecordDecl &RD)
static QualType getThisObjectType(ASTContext &C, const FunctionProtoType *FPT, const CXXRecordDecl *Decl)
static bool allLookupResultsAreTheSame(const DeclContext::lookup_result &R)
static bool isDeclContextInNamespace(const DeclContext *DC)
static bool hasRepeatedBaseClass(const CXXRecordDecl *StartRD)
Determine whether a class has a repeated base class.
static CanQualType GetConversionType(ASTContext &Context, NamedDecl *Conv)
static CXXMethodDecl * getInvokerAsMethod(NamedDecl *ND)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the LambdaCapture class.
Defines the clang::LangOptions interface.
This file contains the declaration of the ODRHash class, which calculates a hash based on AST nodes,...
Defines an enumeration for C++ overloaded operators.
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream.
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
APValue & getArrayInitializedElt(unsigned I)
APValue & getStructField(unsigned i)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const ConstantArrayType * getAsConstantArrayType(QualType T) const
unsigned getIntWidth(QualType T) const
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl.
DeclarationNameTable DeclarationNames
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
const LangOptions & getLangOpts() const
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
llvm::BumpPtrAllocator & getAllocator() const
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
void * Allocate(size_t Size, unsigned Align=8) const
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
const TargetInfo & getTargetInfo() const
void addDestruction(T *Ptr) const
If T isn't trivially destructible, calls AddDeallocation to register it for destruction.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
An UnresolvedSet-like class which uses the ASTContext's allocator.
void append(ASTContext &C, iterator I, iterator E)
bool replace(const NamedDecl *Old, NamedDecl *New, AccessSpecifier AS)
Replaces the given declaration with the new one, once.
void addDecl(ASTContext &C, NamedDecl *D, AccessSpecifier AS)
Represents an access specifier followed by colon ':'.
static AccessSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
QualType getElementType() const
Represents a C++ declaration that introduces decls from somewhere else.
void addShadowDecl(UsingShadowDecl *S)
shadow_range shadows() const
void removeShadowDecl(UsingShadowDecl *S)
A binding in a decomposition declaration.
static BindingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
VarDecl * getHoldingVar() const
Get the variable (if any) that holds the value of evaluating the binding.
Expr * getBinding() const
Get the expression to which this declaration is bound.
static BindingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id)
Represents a base class of a C++ class.
Represents a C++ constructor within a class.
bool isExplicit() const
Return true if the declaration is already resolved to be explicit.
init_iterator init_begin()
Retrieve an iterator to the first initializer.
CXXConstructorDecl * getTargetConstructor() const
When this constructor delegates to another, retrieve the target.
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
bool isDelegatingConstructor() const
Determine whether this constructor is a delegating constructor.
bool isSpecializationCopyingObject() const
Determine whether this is a member template specialization that would copy the object to itself.
bool isMoveConstructor() const
Determine whether this constructor is a move constructor (C++11 [class.copy]p3), which can be used to...
bool isCopyOrMoveConstructor() const
Determine whether this a copy or move constructor.
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)
bool isInheritingConstructor() const
Determine whether this is an implicit constructor synthesized to model a call to a constructor inheri...
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
bool isConvertingConstructor(bool AllowExplicit) const
Whether this constructor is a converting constructor (C++ [class.conv.ctor]), which can be used for u...
bool isCopyConstructor() const
Whether this constructor is a copy constructor (C++ [class.copy]p2, which can be used to copy the cla...
static CXXConstructorDecl * CreateDeserialized(ASTContext &C, unsigned ID, uint64_t AllocKind)
Represents a C++ conversion function within a class.
bool isLambdaToBlockPointerConversion() const
Determine whether this conversion function is a conversion from a lambda closure type to a block poin...
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)
QualType getConversionType() const
Returns the type that this conversion function is converting to.
static CXXConversionDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Represents a C++ base or member initializer.
SourceLocation getRParenLoc() const
SourceRange getSourceRange() const LLVM_READONLY
Determine the source range covering the entire initializer.
SourceLocation getSourceLocation() const
Determine the source location of the initializer.
bool isAnyMemberInitializer() const
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
int64_t getID(const ASTContext &Context) const
bool isInClassMemberInitializer() const
Determine whether this initializer is an implicit initializer generated for a field with an initializ...
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
SourceLocation getMemberLocation() const
FieldDecl * getAnyMember() const
TypeLoc getBaseClassLoc() const
If this is a base class initializer, returns the type of the base class with location information.
CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo, bool IsVirtual, SourceLocation L, Expr *Init, SourceLocation R, SourceLocation EllipsisLoc)
Creates a new base-class initializer.
Represents a C++ deduction guide declaration.
static CXXDeductionGuideDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static CXXDeductionGuideDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, ExplicitSpecifier ES, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation, CXXConstructorDecl *Ctor=nullptr)
Represents a C++ destructor within a class.
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)
void setOperatorDelete(FunctionDecl *OD, Expr *ThisArg)
static CXXDestructorDecl * CreateDeserialized(ASTContext &C, unsigned ID)
A mapping from each virtual member function to its set of final overriders.
Represents a static or instance method of a struct/union/class.
CXXMethodDecl * getCorrespondingMethodDeclaredInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find if RD declares a function that overrides this function, and if so, return it.
void addOverriddenMethod(const CXXMethodDecl *MD)
bool hasInlineBody() const
static CXXMethodDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isUsualDeallocationFunction(SmallVectorImpl< const FunctionDecl * > &PreventedBy) const
Determine whether this is a usual deallocation function (C++ [basic.stc.dynamic.deallocation]p2),...
overridden_method_range overridden_methods() const
unsigned size_overridden_methods() const
const CXXMethodDecl *const * method_iterator
method_iterator begin_overridden_methods() const
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
QualType getThisType() const
Return the type of the this pointer.
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
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)
CXXMethodDecl * getDevirtualizedMethod(const Expr *Base, bool IsAppleKext)
If it's possible to devirtualize a call to this method, return the called function.
static bool isStaticOverloadedOperator(OverloadedOperatorKind OOK)
Returns true if the given operator is implicitly static in a record context.
CXXMethodDecl * getCorrespondingMethodInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find the method in RD that corresponds to this one.
llvm::iterator_range< llvm::TinyPtrVector< const CXXMethodDecl * >::const_iterator > overridden_method_range
QualType getThisObjectType() const
Return the type of the object pointed by this.
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
method_iterator end_overridden_methods() const
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isLambdaStaticInvoker() const
Determine whether this is a lambda closure type's static member function that is used for the result ...
Represents a C++ struct/union/class.
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
bool mayBeAbstract() const
Determine whether this class may end up being abstract, even though it is not yet known to be abstrac...
bool isTriviallyCopyable() const
Determine whether this class is considered trivially copyable per (C++11 [class]p6).
bool hasNonTrivialCopyAssignment() const
Determine whether this class has a non-trivial copy assignment operator (C++ [class....
TemplateParameterList * getGenericLambdaTemplateParameterList() const
Retrieve the generic lambda's template parameter list.
bool isEffectivelyFinal() const
Determine whether it's impossible for a class to be derived from this class.
bool hasSimpleMoveConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous move constructor that ...
void setBases(CXXBaseSpecifier const *const *Bases, unsigned NumBases)
Sets the base classes of this struct or class.
bool isGenericLambda() const
Determine whether this class describes a generic lambda function object (i.e.
base_class_iterator bases_end()
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
bool hasUserDeclaredDestructor() const
Determine whether this class has a user-declared destructor.
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
void completeDefinition() override
Indicates that the definition of this class is now complete.
bool defaultedDestructorIsConstexpr() const
Determine whether a defaulted default constructor for this class would be constexpr.
void setCaptures(ASTContext &Context, ArrayRef< LambdaCapture > Captures)
Set the captures for this lambda closure type.
unsigned getDeviceLambdaManglingNumber() const
Retrieve the device side mangling number.
bool hasAnyDependentBases() const
Determine whether this class has any dependent base classes which are not the current instantiation.
void setTrivialForCallFlags(CXXMethodDecl *MD)
static CXXRecordDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
bool isLambda() const
Determine whether this class describes a lambda function object.
void addedSelectedDestructor(CXXDestructorDecl *DD)
Notify the class that this destructor is now selected.
bool hasFriends() const
Determines whether this record has any friends.
method_range methods() const
CXXRecordDecl * getDefinition() const
static AccessSpecifier MergeAccess(AccessSpecifier PathAccess, AccessSpecifier DeclAccess)
Calculates the access of a decl that is reached along a path.
void getCaptureFields(llvm::DenseMap< const ValueDecl *, FieldDecl * > &Captures, FieldDecl *&ThisCapture) const
For a closure type, retrieve the mapping from captured variables and this to the non-static data memb...
static CXXRecordDecl * CreateLambda(const ASTContext &C, DeclContext *DC, TypeSourceInfo *Info, SourceLocation Loc, unsigned DependencyKind, bool IsGeneric, LambdaCaptureDefault CaptureDefault)
llvm::iterator_range< conversion_iterator > getVisibleConversionFunctions() const
Get all conversion functions visible in current class, including conversion function templates.
bool hasConstexprDestructor() const
Determine whether this class has a constexpr destructor.
unsigned getNumBases() const
Retrieves the number of base classes of this class.
bool hasNonLiteralTypeFieldsOrBases() const
Determine whether this class has a non-literal or/ volatile type non-static data member or base class...
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
const CXXRecordDecl * getTemplateInstantiationPattern() const
Retrieve the record declaration from which this record could be instantiated.
bool lambdaIsDefaultConstructibleAndAssignable() const
Determine whether this lambda should have an implicit default constructor and copy and move assignmen...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
base_class_iterator bases_begin()
FunctionTemplateDecl * getDependentLambdaCallOperator() const
Retrieve the dependent lambda call operator of the closure type if this is a templated closure type.
void addedEligibleSpecialMemberFunction(const CXXMethodDecl *MD, unsigned SMKind)
Notify the class that an eligible SMF has been added.
conversion_iterator conversion_end() const
void finishedDefaultedOrDeletedMember(CXXMethodDecl *MD)
Indicates that the declaration of a defaulted or deleted special member function is now complete.
CXXRecordDecl(Kind K, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl)
bool isCLike() const
True if this class is C-like, without C++-specific features, e.g.
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
bool hasSimpleMoveAssignment() const
true if we know for sure that this class has a single, accessible, unambiguous move assignment operat...
bool hasNonTrivialMoveConstructor() const
Determine whether this class has a non-trivial move constructor (C++11 [class.copy]p12)
void setDeviceLambdaManglingNumber(unsigned Num) const
Set the device side mangling number.
bool hasUserDeclaredConstructor() const
Determine whether this class has any user-declared constructors.
unsigned getODRHash() const
bool hasDefinition() const
ArrayRef< NamedDecl * > getLambdaExplicitTemplateParameters() const
Retrieve the lambda template parameters that were specified explicitly.
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
bool isPOD() const
Whether this class is a POD-type (C++ [class]p4)
void getFinalOverriders(CXXFinalOverriderMap &FinaOverriders) const
Retrieve the final overriders for each virtual member function in the class hierarchy where this clas...
void removeConversion(const NamedDecl *Old)
Removes a conversion function from this class.
bool hasSimpleCopyConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous copy constructor that ...
LambdaCaptureDefault getLambdaCaptureDefault() const
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
bool hasNonTrivialMoveAssignment() const
Determine whether this class has a non-trivial move assignment operator (C++11 [class....
CXXMethodDecl * getLambdaStaticInvoker() const
Retrieve the lambda static invoker, the address of which is returned by the conversion operator,...
bool hasSimpleDestructor() const
true if we know for sure that this class has an accessible destructor that is not deleted.
void setDescribedClassTemplate(ClassTemplateDecl *Template)
bool isInterfaceLike() const
unsigned capture_size() const
bool forallBases(ForallBasesCallback BaseMatches) const
Determines if the given callback holds for all the direct or indirect base classes of this type.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization,...
bool hasNonTrivialCopyConstructor() const
Determine whether this class has a non-trivial copy constructor (C++ [class.copy]p6,...
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
bool hasSimpleCopyAssignment() const
true if we know for sure that this class has a single, accessible, unambiguous copy assignment operat...
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the kind of specialization or template instantiation this is.
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
conversion_iterator conversion_begin() const
unsigned getCVRQualifiers() const
Retrieve the const/volatile/restrict qualifiers.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
Declaration of a class template.
Represents the canonical version of C arrays with a specified constant size.
const llvm::APInt & getSize() const
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
UsingDecl * getIntroducer() const
Override the UsingShadowDecl's getIntroducer, returning the UsingDecl that introduced this.
static ConstructorUsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static ConstructorUsingShadowDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, UsingDecl *Using, NamedDecl *Target, bool IsVirtual)
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
The results of name lookup within a DeclContext.
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext,...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
ASTContext & getParentASTContext() const
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
bool isTranslationUnit() const
bool isFunctionOrMethod() const
bool isExternCContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
LinkageSpecDeclBitfields LinkageSpecDeclBits
Decl - This represents one declaration (or definition), e.g.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
SourceLocation getEndLoc() const LLVM_READONLY
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
ASTContext & getASTContext() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
ASTMutationListener * getASTMutationListener() const
Kind
Lists the kind of concrete classes of Decl.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
bool isInvalidDecl() const
SourceLocation getLocation() const
void setImplicit(bool I=true)
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
const LangOptions & getLangOpts() const LLVM_READONLY
Helper to get the language options from the ASTContext.
The name of a declaration.
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
@ CXXConversionFunctionName
NameKind getNameKind() const
Determine what kind of name this is.
bool isIdentifier() const
Predicate functions for querying what type of name this is.
A decomposition declaration.
void printName(raw_ostream &OS, const PrintingPolicy &Policy) const override
Pretty-print the unqualified name of this declaration.
ArrayRef< BindingDecl * > bindings() const
static DecompositionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation LSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl * > Bindings)
static DecompositionDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumBindings)
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
Store information needed for an explicit specifier.
ExplicitSpecKind getKind() const
const Expr * getExpr() const
static ExplicitSpecifier getFromDecl(FunctionDecl *Function)
bool isEquivalent(const ExplicitSpecifier Other) const
Check for equivalence of explicit specifiers.
This represents one expression.
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
Abstract interface for external sources of AST nodes.
virtual Decl * GetExternalDecl(uint32_t ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
Represents a member of a struct/union/class.
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set.
Represents a function declaration or definition.
const ParmVarDecl * getParamDecl(unsigned i) const
bool isTrivialForCall() const
bool isPure() const
Whether this virtual function is pure, i.e.
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to call this function.
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
bool isDestroyingOperatorDelete() const
Determine whether this is a destroying operator delete.
bool UsesFPIntrin() const
Determine whether the function was declared in source context that requires constrained FP intrinsics...
FunctionDecl * getTemplateInstantiationPattern(bool ForDefinition=true) const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
bool isVariadic() const
Whether this function is variadic.
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
bool isDeleted() const
Whether this function has been deleted.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a member function.
bool isIneligibleOrNotSelected() const
void setIneligibleOrNotSelected(bool II)
OverloadedOperatorKind getOverloadedOperator() const
getOverloadedOperator - Which C++ overloaded operator this function represents, if any.
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration.
bool hasOneParamOrDefaultArgs() const
Determine whether this function has a single parameter, or multiple parameters where all but the firs...
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
bool isDefined(const FunctionDecl *&Definition, bool CheckForPendingFriendDefinition=false) const
Returns true if the function has a definition that does not need to be instantiated.
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
Represents a prototype with parameter type info, e.g.
Qualifiers getMethodQuals() const
Declaration of a template function.
FunctionType - C99 6.7.5.3 - Function Declarators.
One of these records is kept for each identifier that is lexed.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Represents a field injected from an anonymous union/struct into the parent scope.
Description of a constructor that was inherited from a base class.
An lvalue reference type, per C++11 [dcl.ref].
Describes the capture of a variable or of this, or of a C++1y init-capture.
@ Ver6
Attempt to be ABI-compatible with code generated by Clang 6.0.x (SVN r321711).
APValue * getOrCreateValue(bool MayCreate) const
Get the storage for the constant value of a materialized temporary of static storage duration.
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
ValueDecl * getExtendingDecl()
Represents a linkage specification.
static LinkageSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static LinkageSpecDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation ExternLoc, SourceLocation LangLoc, LanguageIDs Lang, bool HasBraces)
LanguageIDs
Represents the language in a linkage specification.
APValue & getAsAPValue() const
Get the value of this MSGuidDecl as an APValue.
void printName(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const override
Print this UUID in a human-readable format.
An instance of this class represents the declaration of a property member.
static MSPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL, IdentifierInfo *Getter, IdentifierInfo *Setter)
static MSPropertyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
A pointer to member type per C++ 8.3.3 - Pointers to members.
Provides information a specialization of a member of a class template, which may be a member function...
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
NamedDecl * getMostRecentDecl()
Represents a C++ namespace alias.
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Namespace)
static NamespaceAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Represent a C++ namespace.
static NamespaceDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl, bool Nested)
A C++ nested-name-specifier augmented with source location information.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
void AddStmt(const Stmt *S)
void AddCXXRecordDecl(const CXXRecordDecl *Record)
MapType::iterator iterator
Represents a parameter to a function.
A (possibly-)qualified type.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
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...
bool isObjCGCStrong() const
true when Type is objc's strong.
bool isConstQualified() const
Determine whether this type is const-qualified.
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
bool hasNonTrivialObjCLifetime() const
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
ObjCLifetime getObjCLifetime() const
Represents a struct/union/class.
field_iterator field_end() const
field_range fields() const
void setHasObjectMember(bool val)
void setHasVolatileMember(bool val)
virtual void completeDefinition()
Note that the definition of this type is now complete.
@ APK_CanNeverPassInRegs
The argument of this type cannot be passed directly in registers.
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
void setArgPassingRestrictions(ArgPassingKind Kind)
field_iterator field_begin() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
FunctionDecl * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
NamespaceDecl * getNextRedeclaration() const
NamespaceDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
Base for LValueReferenceType and RValueReferenceType.
Represents the body of a requires-expression.
static RequiresExprBodyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
Encodes a location in the source.
A trivial tuple used to represent a source range.
Represents a C++11 static_assert declaration.
static StaticAssertDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *Message, SourceLocation RParenLoc, bool Failed)
static StaticAssertDecl * CreateDeserialized(ASTContext &C, unsigned ID)
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
StringLiteral - This represents a string literal expression, e.g.
bool isBeingDefined() const
Return true if this decl is currently being defined.
void setMayHaveOutOfDateDef(bool V=true)
Indicates whether it is possible for declarations of this kind to have an out-of-date definition.
void setBeingDefined(bool V=true)
True if this decl is currently being defined.
TagKind getTagKind() const
Exposes information about the current target.
virtual bool areDefaultedSMFStillPOD(const LangOptions &) const
Controls whether explicitly defaulted (= default) special member functions disqualify something from ...
Stores a list of template parameters for a TemplateDecl and its derived classes.
const Type * getTypeForDecl() const
Base wrapper for a particular "section" of type source info.
A container of type source information.
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBlockPointerType() const
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
bool isUnsignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is unsigned or an enumeration types whose underlying ...
bool isRValueReferenceType() const
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isLValueReferenceType() const
bool isStructuralType() const
Determine if this type is a structural type, per C++20 [temp.param]p7.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
const T * getAs() const
Member-template getAs<specific type>'.
bool isRecordType() const
bool isObjCRetainableType() const
TagDecl * getAsTagDecl() const
Retrieves the TagDecl that this type refers to, either because the type is a TagType or because it is...
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
void printName(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const override
Print this in a human-readable format.
A set of unresolved declarations.
void addDecl(NamedDecl *D)
The iterator over UnresolvedSets.
NamedDecl * getDecl() const
A set of unresolved declarations.
This node is generated when a using-declaration that was annotated with attribute((using_if_exists)) ...
static UnresolvedUsingIfExistsDecl * Create(ASTContext &Ctx, DeclContext *DC, SourceLocation Loc, DeclarationName Name)
static UnresolvedUsingIfExistsDecl * CreateDeserialized(ASTContext &Ctx, unsigned ID)
Represents a dependent using declaration which was marked with typename.
static UnresolvedUsingTypenameDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation TypenameLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TargetNameLoc, DeclarationName TargetName, SourceLocation EllipsisLoc)
static UnresolvedUsingTypenameDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Represents a dependent using declaration which was not marked with typename.
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
static UnresolvedUsingValueDecl * CreateDeserialized(ASTContext &C, unsigned ID)
DeclarationNameInfo getNameInfo() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static UnresolvedUsingValueDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, SourceLocation EllipsisLoc)
Represents a C++ using-declaration.
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
DeclarationNameInfo getNameInfo() const
static UsingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
static UsingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Represents C++ using-directive.
static UsingDirectiveDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation NamespaceLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Nominated, DeclContext *CommonAncestor)
static UsingDirectiveDecl * CreateDeserialized(ASTContext &C, unsigned ID)
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Represents a C++ using-enum-declaration.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static UsingEnumDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static UsingEnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, SourceLocation EnumL, SourceLocation NameL, TypeSourceInfo *EnumType)
Represents a pack of using declarations that a single using-declarator pack-expanded into.
static UsingPackDecl * Create(ASTContext &C, DeclContext *DC, NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl * > UsingDecls)
static UsingPackDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumExpansions)
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
void setTargetDecl(NamedDecl *ND)
Sets the underlying declaration which has been brought into the local scope.
static UsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
UsingShadowDecl(Kind K, ASTContext &C, DeclContext *DC, SourceLocation Loc, DeclarationName Name, BaseUsingDecl *Introducer, NamedDecl *Target)
BaseUsingDecl * getIntroducer() const
Gets the (written or instantiated) using declaration that introduced this declaration.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
VarDecl * getPotentiallyDecomposedVarDecl()
Represents a variable declaration or definition.
Defines the clang::TargetInfo interface.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
ConstexprSpecKind
Define the kind of constexpr specifier.
StorageClass
Storage classes.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
@ C
Languages that the frontend can parse and compile.
StorageDuration
The storage duration for an object (per C++ [basic.stc]).
@ SD_Static
Static storage duration.
@ SD_FullExpression
Full-expression storage duration (for temporaries).
@ SD_Automatic
Automatic storage duration (most local variables).
@ Result
The result type of a method or function.
TagTypeKind
The kind of a tag type.
@ TTK_Class
The "class" keyword.
@ TTK_Struct
The "struct" keyword.
@ TTK_Interface
The "__interface" keyword.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
StringRef getLambdaStaticInvokerName()
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
CallingConv
CallingConv - Specifies the calling convention that a function uses.
U cast(CodeGen::Address addr)
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
DeclarationName getName() const
getName - Returns the embedded declaration name.
T * get(ExternalASTSource *Source) const
Retrieve the pointer to the AST node that this lazy pointer points to.
uint16_t Part2
...-89ab-...
uint32_t Part1
{01234567-...
uint16_t Part3
...-cdef-...
uint8_t Part4And5[8]
...-0123-456789abcdef}
Describes how types, statements, expressions, and declarations should be printed.