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/raw_ostream.h" 51 using namespace clang;
57 void AccessSpecDecl::anchor() {}
63 void LazyASTUnresolvedSet::getFromExternalSource(
ASTContext &
C)
const {
65 assert(Impl.Decls.isLazy() &&
"getFromExternalSource for non-lazy set");
66 assert(Source &&
"getFromExternalSource with no external source");
70 reinterpret_cast<uintptr_t>(I.getDecl()) >> 2)));
71 Impl.Decls.setLazy(
false);
74 CXXRecordDecl::DefinitionData::DefinitionData(
CXXRecordDecl *D)
75 : UserDeclaredConstructor(
false), UserDeclaredSpecialMembers(0),
76 Aggregate(
true), PlainOldData(
true), Empty(
true), Polymorphic(
false),
77 Abstract(
false), IsStandardLayout(
true), IsCXX11StandardLayout(
true),
78 HasBasesWithFields(
false), HasBasesWithNonStaticDataMembers(
false),
79 HasPrivateFields(
false), HasProtectedFields(
false),
80 HasPublicFields(
false), HasMutableFields(
false), HasVariantMembers(
false),
81 HasOnlyCMembers(
true), HasInClassInitializer(
false),
82 HasUninitializedReferenceMember(
false), HasUninitializedFields(
false),
83 HasInheritedConstructor(
false), HasInheritedAssignment(
false),
84 NeedOverloadResolutionForCopyConstructor(
false),
85 NeedOverloadResolutionForMoveConstructor(
false),
86 NeedOverloadResolutionForMoveAssignment(
false),
87 NeedOverloadResolutionForDestructor(
false),
88 DefaultedCopyConstructorIsDeleted(
false),
89 DefaultedMoveConstructorIsDeleted(
false),
90 DefaultedMoveAssignmentIsDeleted(
false),
91 DefaultedDestructorIsDeleted(
false), HasTrivialSpecialMembers(SMF_All),
92 HasTrivialSpecialMembersForCall(SMF_All),
93 DeclaredNonTrivialSpecialMembers(0),
94 DeclaredNonTrivialSpecialMembersForCall(0), HasIrrelevantDestructor(
true),
95 HasConstexprNonCopyMoveConstructor(
false),
96 HasDefaultedDefaultConstructor(
false),
97 DefaultedDefaultConstructorIsConstexpr(
true),
98 HasConstexprDefaultConstructor(
false),
99 DefaultedDestructorIsConstexpr(
true),
100 HasNonLiteralTypeFieldsOrBases(
false),
101 UserProvidedDefaultConstructor(
false), DeclaredSpecialMembers(0),
102 ImplicitCopyConstructorCanHaveConstParamForVBase(
true),
103 ImplicitCopyConstructorCanHaveConstParamForNonVBase(
true),
104 ImplicitCopyAssignmentHasConstParam(
true),
105 HasDeclaredCopyConstructorWithConstParam(
false),
106 HasDeclaredCopyAssignmentWithConstParam(
false), IsLambda(
false),
107 IsParsingBaseSpecifiers(
false), ComputedVisibleConversions(
false),
108 HasODRHash(
false), Definition(D) {}
111 return Bases.get(Definition->getASTContext().getExternalSource());
114 CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getVBasesSlowCase()
const {
115 return VBases.get(Definition->getASTContext().getExternalSource());
122 :
RecordDecl(K, TK, C, DC, StartLoc, IdLoc, Id, PrevDecl),
123 DefinitionData(PrevDecl ? PrevDecl->DefinitionData
130 bool DelayTypeCreation) {
131 auto *R =
new (
C, DC)
CXXRecordDecl(CXXRecord, TK, C, DC, StartLoc, IdLoc, Id,
133 R->setMayHaveOutOfDateDef(C.
getLangOpts().Modules);
136 if (!DelayTypeCreation)
144 bool Dependent,
bool IsGeneric,
148 R->setBeingDefined(
true);
150 new (
C)
struct LambdaDefinitionData(R, Info, Dependent, IsGeneric,
152 R->setMayHaveOutOfDateDef(
false);
153 R->setImplicit(
true);
163 R->setMayHaveOutOfDateDef(
false);
171 llvm::SmallPtrSet<const CXXRecordDecl*, 8> SeenBaseTypes;
173 while (!WorkList.empty()) {
176 if (
const CXXRecordDecl *B = BaseSpec.getType()->getAsCXXRecordDecl()) {
177 if (!SeenBaseTypes.insert(B).second)
179 WorkList.push_back(B);
191 if (!data().Bases.isOffset() && data().NumBases > 0)
198 data().Aggregate =
false;
203 data().PlainOldData =
false;
207 llvm::SmallPtrSet<CanQualType, 8> SeenVBaseTypes;
213 data().NumBases = NumBases;
214 for (
unsigned i = 0; i < NumBases; ++i) {
215 data().getBases()[i] = *Bases[i];
222 auto *BaseClassDecl =
230 if (BaseClassDecl->data().HasBasesWithFields ||
231 !BaseClassDecl->field_empty()) {
232 if (data().HasBasesWithFields)
234 data().IsStandardLayout =
false;
235 data().HasBasesWithFields =
true;
242 if (BaseClassDecl->data().HasBasesWithNonStaticDataMembers ||
243 BaseClassDecl->hasDirectFields()) {
244 if (data().HasBasesWithNonStaticDataMembers)
245 data().IsCXX11StandardLayout =
false;
246 data().HasBasesWithNonStaticDataMembers =
true;
249 if (!BaseClassDecl->isEmpty()) {
253 data().Empty =
false;
259 data().Aggregate =
false;
264 if (BaseClassDecl->isPolymorphic()) {
265 data().Polymorphic =
true;
268 data().Aggregate =
false;
274 if (!BaseClassDecl->isStandardLayout())
275 data().IsStandardLayout =
false;
276 if (!BaseClassDecl->isCXX11StandardLayout())
277 data().IsCXX11StandardLayout =
false;
281 data().HasNonLiteralTypeFieldsOrBases =
true;
284 for (
const auto &VBase : BaseClassDecl->vbases()) {
287 VBases.push_back(&VBase);
294 if (
CXXRecordDecl *VBaseDecl = VBase.getType()->getAsCXXRecordDecl())
295 if (!VBaseDecl->hasCopyConstructorWithConstParam())
296 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
300 data().Aggregate =
false;
307 VBases.push_back(Base);
312 data().Empty =
false;
316 data().Aggregate =
false;
322 data().HasTrivialSpecialMembers &= SMF_Destructor;
323 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
328 data().IsStandardLayout =
false;
329 data().IsCXX11StandardLayout =
false;
335 data().DefaultedDefaultConstructorIsConstexpr =
false;
336 data().DefaultedDestructorIsConstexpr =
false;
343 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
344 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
350 if (!BaseClassDecl->hasTrivialDefaultConstructor())
351 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
358 if (!BaseClassDecl->hasTrivialCopyConstructor())
359 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
361 if (!BaseClassDecl->hasTrivialCopyConstructorForCall())
362 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
368 if (!BaseClassDecl->hasTrivialMoveConstructor())
369 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
371 if (!BaseClassDecl->hasTrivialMoveConstructorForCall())
372 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
379 if (!BaseClassDecl->hasTrivialCopyAssignment())
380 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
385 if (!BaseClassDecl->hasTrivialMoveAssignment())
386 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
392 if (!BaseClassDecl->hasConstexprDefaultConstructor())
393 data().DefaultedDefaultConstructorIsConstexpr =
false;
400 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
401 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
407 if (!BaseClassDecl->hasTrivialDestructor())
408 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
410 if (!BaseClassDecl->hasTrivialDestructorForCall())
411 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
413 if (!BaseClassDecl->hasIrrelevantDestructor())
414 data().HasIrrelevantDestructor =
false;
421 if (!BaseClassDecl->hasCopyAssignmentWithConstParam())
422 data().ImplicitCopyAssignmentHasConstParam =
false;
426 if (BaseClassDecl->hasObjectMember())
429 if (BaseClassDecl->hasVolatileMember())
432 if (BaseClassDecl->getArgPassingRestrictions() ==
437 if (BaseClassDecl->hasMutableFields()) {
438 data().HasMutableFields =
true;
439 data().NeedOverloadResolutionForCopyConstructor =
true;
442 if (BaseClassDecl->hasUninitializedReferenceMember())
443 data().HasUninitializedReferenceMember =
true;
445 if (!BaseClassDecl->allowConstDefaultInit())
446 data().HasUninitializedFields =
true;
448 addedClassSubobject(BaseClassDecl);
459 data().IsStandardLayout =
false;
461 if (VBases.empty()) {
462 data().IsParsingBaseSpecifiers =
false;
468 data().NumVBases = VBases.size();
469 for (
int I = 0, E = VBases.size(); I != E; ++I) {
473 data().getVBases()[I] = *VBases[I];
476 data().IsParsingBaseSpecifiers =
false;
480 assert(
hasDefinition() &&
"ODRHash only for records with definitions");
483 if (DefinitionData->HasODRHash)
484 return DefinitionData->ODRHash;
489 DefinitionData->HasODRHash =
true;
492 return DefinitionData->ODRHash;
495 void CXXRecordDecl::addedClassSubobject(
CXXRecordDecl *Subobj) {
503 data().NeedOverloadResolutionForCopyConstructor =
true;
505 data().NeedOverloadResolutionForMoveConstructor =
true;
514 data().NeedOverloadResolutionForMoveAssignment =
true;
524 data().NeedOverloadResolutionForCopyConstructor =
true;
525 data().NeedOverloadResolutionForMoveConstructor =
true;
526 data().NeedOverloadResolutionForDestructor =
true;
535 data().DefaultedDestructorIsConstexpr =
false;
567 void CXXRecordDecl::markedVirtualFunctionPure() {
570 data().Abstract =
true;
573 bool CXXRecordDecl::hasSubobjectAtOffsetZeroOfEmptyBaseType(
578 llvm::SmallPtrSet<const CXXRecordDecl*, 8> Bases;
579 llvm::SmallPtrSet<const CXXRecordDecl*, 8> M;
584 RD = RD->getCanonicalDecl();
592 if (!RD->data().HasBasesWithFields) {
611 if (M.insert(RD).second)
612 WorkList.push_back(RD);
619 while (!WorkList.empty()) {
629 bool IsFirstField =
true;
630 for (
auto *FD : X->
fields()) {
633 if (FD->isUnnamedBitfield())
636 if (!IsFirstField && !FD->isZeroSize(Ctx))
646 IsFirstField =
false;
654 assert(
isLambda() &&
"not a lambda");
667 getLambdaData().NumCaptures != 0)
672 void CXXRecordDecl::addedMember(
Decl *D) {
674 !isa<FieldDecl>(D) &&
675 !isa<IndirectFieldDecl>(D) &&
676 (!isa<TagDecl>(D) || cast<TagDecl>(D)->getTagKind() ==
TTK_Class ||
678 data().HasOnlyCMembers =
false;
686 D = FunTmpl->getTemplatedDecl();
689 Decl *DUnderlying = D;
690 if (
auto *ND = dyn_cast<NamedDecl>(DUnderlying)) {
691 DUnderlying = ND->getUnderlyingDecl();
692 if (
auto *UnderlyingFunTmpl = dyn_cast<FunctionTemplateDecl>(DUnderlying))
693 DUnderlying = UnderlyingFunTmpl->getTemplatedDecl();
696 if (
const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
697 if (Method->isVirtual()) {
700 data().Aggregate =
false;
704 data().PlainOldData =
false;
708 data().Empty =
false;
713 data().Polymorphic =
true;
719 data().HasTrivialSpecialMembers &= SMF_Destructor;
720 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
725 data().IsStandardLayout =
false;
726 data().IsCXX11StandardLayout =
false;
734 L->AddedCXXImplicitMember(data().Definition, D);
740 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
741 if (Constructor->isInheritingConstructor()) {
745 if (!Constructor->isImplicit()) {
747 data().UserDeclaredConstructor =
true;
754 data().PlainOldData =
false;
757 if (Constructor->isDefaultConstructor()) {
758 SMKind |= SMF_DefaultConstructor;
760 if (Constructor->isUserProvided())
761 data().UserProvidedDefaultConstructor =
true;
762 if (Constructor->isConstexpr())
763 data().HasConstexprDefaultConstructor =
true;
764 if (Constructor->isDefaulted())
765 data().HasDefaultedDefaultConstructor =
true;
770 if (Constructor->isCopyConstructor(Quals)) {
771 SMKind |= SMF_CopyConstructor;
774 data().HasDeclaredCopyConstructorWithConstParam =
true;
775 }
else if (Constructor->isMoveConstructor())
776 SMKind |= SMF_MoveConstructor;
786 ? !Constructor->isImplicit()
787 : (Constructor->isUserProvided() || Constructor->isExplicit()))
788 data().Aggregate =
false;
793 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(DUnderlying)) {
800 if (Constructor->isConstexpr() && !Constructor->isCopyOrMoveConstructor())
801 data().HasConstexprNonCopyMoveConstructor =
true;
805 if (
const auto *DD = dyn_cast<CXXDestructorDecl>(D)) {
806 SMKind |= SMF_Destructor;
808 if (DD->isUserProvided())
809 data().HasIrrelevantDestructor =
false;
816 if (DD->isVirtual()) {
817 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
818 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
823 if (
const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
824 if (Method->isCopyAssignmentOperator()) {
825 SMKind |= SMF_CopyAssignment;
827 const auto *ParamTy =
829 if (!ParamTy || ParamTy->getPointeeType().isConstQualified())
830 data().HasDeclaredCopyAssignmentWithConstParam =
true;
833 if (Method->isMoveAssignmentOperator())
834 SMKind |= SMF_MoveAssignment;
837 if (
auto *Conversion = dyn_cast<CXXConversionDecl>(D)) {
846 if (Conversion->getPrimaryTemplate()) {
852 FunTmpl ? cast<NamedDecl>(FunTmpl) : cast<NamedDecl>(Conversion);
857 Conversions.
addDecl(Ctx, Primary, AS);
864 data().HasTrivialSpecialMembers &=
865 data().DeclaredSpecialMembers | ~SMKind;
866 data().HasTrivialSpecialMembersForCall &=
867 data().DeclaredSpecialMembers | ~SMKind;
869 if (!Method->isImplicit() && !Method->isUserProvided()) {
873 }
else if (Method->isTrivial()) {
874 data().HasTrivialSpecialMembers |= SMKind;
875 data().HasTrivialSpecialMembersForCall |= SMKind;
876 }
else if (Method->isTrivialForCall()) {
877 data().HasTrivialSpecialMembersForCall |= SMKind;
878 data().DeclaredNonTrivialSpecialMembers |= SMKind;
880 data().DeclaredNonTrivialSpecialMembers |= SMKind;
886 if (!Method->isUserProvided())
887 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
892 data().DeclaredSpecialMembers |= SMKind;
894 if (!Method->isImplicit()) {
895 data().UserDeclaredSpecialMembers |= SMKind;
908 data().PlainOldData =
false;
916 if (
const auto *Field = dyn_cast<FieldDecl>(D)) {
924 if (data().HasBasesWithFields)
925 data().IsStandardLayout =
false;
931 if (Field->isUnnamedBitfield()) {
935 if (data().Empty && !Field->isZeroLengthBitField(Context) &&
938 data().Empty =
false;
946 if (data().HasBasesWithNonStaticDataMembers)
947 data().IsCXX11StandardLayout =
false;
955 data().Aggregate =
false;
956 data().PlainOldData =
false;
961 bool IsFirstField = !data().HasPrivateFields &&
962 !data().HasProtectedFields && !data().HasPublicFields;
969 case AS_private: data().HasPrivateFields =
true;
break;
970 case AS_protected: data().HasProtectedFields =
true;
break;
971 case AS_public: data().HasPublicFields =
true;
break;
972 case AS_none: llvm_unreachable(
"Invalid access specifier");
974 if ((data().HasPrivateFields + data().HasProtectedFields +
975 data().HasPublicFields) > 1) {
976 data().IsStandardLayout =
false;
977 data().IsCXX11StandardLayout =
false;
981 if (Field->isMutable()) {
982 data().HasMutableFields =
true;
983 data().NeedOverloadResolutionForCopyConstructor =
true;
989 if (
isUnion() && !Field->isAnonymousStructOrUnion())
990 data().HasVariantMembers =
true;
1009 struct DefinitionData &Data = data();
1010 Data.PlainOldData =
false;
1011 Data.HasTrivialSpecialMembers = 0;
1017 data().HasTrivialSpecialMembersForCall = 0;
1023 Data.HasIrrelevantDestructor =
false;
1026 data().DefaultedCopyConstructorIsDeleted =
true;
1027 data().DefaultedMoveConstructorIsDeleted =
true;
1028 data().DefaultedMoveAssignmentIsDeleted =
true;
1029 data().DefaultedDestructorIsDeleted =
true;
1030 data().NeedOverloadResolutionForCopyConstructor =
true;
1031 data().NeedOverloadResolutionForMoveConstructor =
true;
1032 data().NeedOverloadResolutionForMoveAssignment =
true;
1033 data().NeedOverloadResolutionForDestructor =
true;
1035 }
else if (!Context.
getLangOpts().ObjCAutoRefCount) {
1039 data().PlainOldData =
false;
1042 if (!Field->hasInClassInitializer())
1043 data().HasUninitializedReferenceMember =
true;
1048 data().IsStandardLayout =
false;
1049 data().IsCXX11StandardLayout =
false;
1055 data().DefaultedCopyConstructorIsDeleted =
true;
1058 if (!Field->hasInClassInitializer() && !Field->isMutable()) {
1060 if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
1061 data().HasUninitializedFields =
true;
1063 data().HasUninitializedFields =
true;
1069 data().HasNonLiteralTypeFieldsOrBases =
true;
1071 if (Field->hasInClassInitializer() ||
1072 (Field->isAnonymousStructOrUnion() &&
1073 Field->getType()->getAsCXXRecordDecl()->hasInClassInitializer())) {
1074 data().HasInClassInitializer =
true;
1079 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1087 data().Aggregate =
false;
1091 data().PlainOldData =
false;
1099 data().DefaultedMoveAssignmentIsDeleted =
true;
1103 bool IsZeroSize = Field->isZeroSize(Context);
1106 auto *FieldRec = cast<CXXRecordDecl>(RecordTy->getDecl());
1107 if (FieldRec->getDefinition()) {
1108 addedClassSubobject(FieldRec);
1116 data().NeedOverloadResolutionForCopyConstructor =
true;
1117 data().NeedOverloadResolutionForMoveConstructor =
true;
1118 data().NeedOverloadResolutionForMoveAssignment =
true;
1127 if (FieldRec->hasNonTrivialCopyConstructor())
1128 data().DefaultedCopyConstructorIsDeleted =
true;
1129 if (FieldRec->hasNonTrivialMoveConstructor())
1130 data().DefaultedMoveConstructorIsDeleted =
true;
1131 if (FieldRec->hasNonTrivialMoveAssignment())
1132 data().DefaultedMoveAssignmentIsDeleted =
true;
1133 if (FieldRec->hasNonTrivialDestructor())
1134 data().DefaultedDestructorIsDeleted =
true;
1139 if (Field->isAnonymousStructOrUnion()) {
1140 data().NeedOverloadResolutionForCopyConstructor |=
1141 FieldRec->data().NeedOverloadResolutionForCopyConstructor;
1142 data().NeedOverloadResolutionForMoveConstructor |=
1143 FieldRec->data().NeedOverloadResolutionForMoveConstructor;
1144 data().NeedOverloadResolutionForMoveAssignment |=
1145 FieldRec->data().NeedOverloadResolutionForMoveAssignment;
1146 data().NeedOverloadResolutionForDestructor |=
1147 FieldRec->data().NeedOverloadResolutionForDestructor;
1155 if (!FieldRec->hasTrivialDefaultConstructor())
1156 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1164 if (!FieldRec->hasTrivialCopyConstructor())
1165 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
1167 if (!FieldRec->hasTrivialCopyConstructorForCall())
1168 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
1173 if (!FieldRec->hasTrivialMoveConstructor())
1174 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
1176 if (!FieldRec->hasTrivialMoveConstructorForCall())
1177 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
1185 if (!FieldRec->hasTrivialCopyAssignment())
1186 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
1190 if (!FieldRec->hasTrivialMoveAssignment())
1191 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
1193 if (!FieldRec->hasTrivialDestructor())
1194 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1195 if (!FieldRec->hasTrivialDestructorForCall())
1196 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1197 if (!FieldRec->hasIrrelevantDestructor())
1198 data().HasIrrelevantDestructor =
false;
1199 if (FieldRec->hasObjectMember())
1201 if (FieldRec->hasVolatileMember())
1203 if (FieldRec->getArgPassingRestrictions() ==
1211 if (!FieldRec->isStandardLayout())
1212 data().IsStandardLayout =
false;
1213 if (!FieldRec->isCXX11StandardLayout())
1214 data().IsCXX11StandardLayout =
false;
1220 if (data().IsStandardLayout &&
1221 (
isUnion() || IsFirstField || IsZeroSize) &&
1222 hasSubobjectAtOffsetZeroOfEmptyBaseType(Context, FieldRec))
1223 data().IsStandardLayout =
false;
1229 if (data().IsCXX11StandardLayout && IsFirstField) {
1232 for (
const auto &BI :
bases()) {
1234 data().IsCXX11StandardLayout =
false;
1241 if (FieldRec->hasMutableFields()) {
1242 data().HasMutableFields =
true;
1243 data().NeedOverloadResolutionForCopyConstructor =
true;
1253 if (!Field->hasInClassInitializer() &&
1254 !FieldRec->hasConstexprDefaultConstructor() && !
isUnion())
1257 data().DefaultedDefaultConstructorIsConstexpr =
false;
1264 if (!FieldRec->hasCopyConstructorWithConstParam())
1265 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
1273 if (!FieldRec->hasCopyAssignmentWithConstParam())
1274 data().ImplicitCopyAssignmentHasConstParam =
false;
1276 if (FieldRec->hasUninitializedReferenceMember() &&
1277 !Field->hasInClassInitializer())
1278 data().HasUninitializedReferenceMember =
true;
1283 if (FieldRec->hasVariantMembers() &&
1284 Field->isAnonymousStructOrUnion())
1285 data().HasVariantMembers =
true;
1290 (!Field->hasInClassInitializer() && !
isUnion() &&
1292 data().DefaultedDefaultConstructorIsConstexpr =
false;
1300 data().DefaultedMoveAssignmentIsDeleted =
true;
1306 if (data().Empty && !IsZeroSize)
1307 data().Empty =
false;
1311 if (
auto *Shadow = dyn_cast<UsingShadowDecl>(D)) {
1312 if (Shadow->getDeclName().getNameKind()
1315 data().Conversions.get(Ctx).addDecl(Ctx, Shadow, Shadow->getAccess());
1319 if (
const auto *Using = dyn_cast<UsingDecl>(D)) {
1320 if (Using->getDeclName().getNameKind() ==
1322 data().HasInheritedConstructor =
true;
1325 data().Aggregate =
false;
1328 if (Using->getDeclName().getCXXOverloadedOperator() == OO_Equal)
1329 data().HasInheritedAssignment =
true;
1337 unsigned SMKind = 0;
1339 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1340 if (Constructor->isDefaultConstructor()) {
1341 SMKind |= SMF_DefaultConstructor;
1342 if (Constructor->isConstexpr())
1343 data().HasConstexprDefaultConstructor =
true;
1345 if (Constructor->isCopyConstructor())
1346 SMKind |= SMF_CopyConstructor;
1347 else if (Constructor->isMoveConstructor())
1348 SMKind |= SMF_MoveConstructor;
1349 else if (Constructor->isConstexpr())
1351 data().HasConstexprNonCopyMoveConstructor =
true;
1352 }
else if (isa<CXXDestructorDecl>(D)) {
1353 SMKind |= SMF_Destructor;
1355 data().HasIrrelevantDestructor =
false;
1357 SMKind |= SMF_CopyAssignment;
1359 SMKind |= SMF_MoveAssignment;
1364 data().HasTrivialSpecialMembers |= SMKind;
1366 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1370 unsigned SMKind = 0;
1372 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1373 if (Constructor->isCopyConstructor())
1374 SMKind = SMF_CopyConstructor;
1375 else if (Constructor->isMoveConstructor())
1376 SMKind = SMF_MoveConstructor;
1377 }
else if (isa<CXXDestructorDecl>(D))
1378 SMKind = SMF_Destructor;
1381 data().HasTrivialSpecialMembersForCall |= SMKind;
1383 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1388 !TemplateOrInstantiation.isNull())
1393 return isPOD() && data().HasOnlyCMembers;
1398 return getLambdaData().IsGenericLambda;
1411 if (!RD.
isLambda())
return nullptr;
1416 assert(!Calls.
empty() &&
"Missing lambda call operator!");
1418 "More than one lambda call operator!");
1419 return Calls.
front();
1424 return dyn_cast_or_null<FunctionTemplateDecl>(CallOp);
1430 if (CallOp ==
nullptr)
1433 if (
const auto *CallOpTmpl = dyn_cast<FunctionTemplateDecl>(CallOp))
1434 return cast<CXXMethodDecl>(CallOpTmpl->getTemplatedDecl());
1436 return cast<CXXMethodDecl>(CallOp);
1444 if (Invoker.
empty())
return nullptr;
1446 "More than one static invoker operator!");
1448 if (
const auto *InvokerTemplate = dyn_cast<FunctionTemplateDecl>(InvokerFun))
1449 return cast<CXXMethodDecl>(InvokerTemplate->getTemplatedDecl());
1451 return cast<CXXMethodDecl>(InvokerFun);
1455 llvm::DenseMap<const VarDecl *, FieldDecl *> &Captures,
1458 ThisCapture =
nullptr;
1460 LambdaDefinitionData &Lambda = getLambdaData();
1462 for (
const LambdaCapture *C = Lambda.Captures, *CEnd = C + Lambda.NumCaptures;
1463 C != CEnd; ++C, ++Field) {
1464 if (C->capturesThis())
1465 ThisCapture = *Field;
1466 else if (C->capturesVariable())
1467 Captures[C->getCapturedVar()] = *Field;
1477 return Tmpl->getTemplateParameters();
1487 assert(std::is_partitioned(List->
begin(), List->
end(),
1489 &&
"Explicit template params should be ordered before implicit ones");
1491 const auto ExplicitEnd = llvm::partition_point(
1493 return llvm::makeArrayRef(List->
begin(), ExplicitEnd);
1497 assert(
isLambda() &&
"Not a lambda closure type!");
1499 return getLambdaData().ContextDecl.get(Source);
1505 ->getConversionType();
1524 const llvm::SmallPtrSet<CanQualType, 8> &ParentHiddenTypes,
1526 llvm::SmallPtrSet<NamedDecl *, 8> &HiddenVBaseCs) {
1530 const llvm::SmallPtrSet<CanQualType, 8> *HiddenTypes = &ParentHiddenTypes;
1531 llvm::SmallPtrSet<CanQualType, 8> HiddenTypesBuffer;
1537 if (ConvI != ConvE) {
1538 HiddenTypesBuffer = ParentHiddenTypes;
1539 HiddenTypes = &HiddenTypesBuffer;
1543 bool Hidden = ParentHiddenTypes.count(ConvType);
1545 HiddenTypesBuffer.insert(ConvType);
1549 if (Hidden && InVirtual)
1550 HiddenVBaseCs.insert(cast<NamedDecl>(I.getDecl()->getCanonicalDecl()));
1558 VOutput.
addDecl(I.getDecl(), IAccess);
1560 Output.
addDecl(Context, I.getDecl(), IAccess);
1566 for (
const auto &I : Record->
bases()) {
1567 const auto *RT = I.getType()->getAs<
RecordType>();
1572 bool BaseInVirtual = InVirtual || I.isVirtual();
1574 auto *
Base = cast<CXXRecordDecl>(RT->getDecl());
1576 *HiddenTypes, Output, VOutput, HiddenVBaseCs);
1594 llvm::SmallPtrSet<NamedDecl*, 8> HiddenVBaseCs;
1597 llvm::SmallPtrSet<CanQualType, 8> HiddenTypes;
1603 Output.
append(Context, ConvI, ConvE);
1604 for (; ConvI != ConvE; ++ConvI)
1608 for (
const auto &I : Record->
bases()) {
1609 const auto *RT = I.getType()->getAs<
RecordType>();
1613 I.isVirtual(), I.getAccessSpecifier(),
1614 HiddenTypes, Output, VBaseCs, HiddenVBaseCs);
1620 if (!HiddenVBaseCs.count(cast<NamedDecl>(I.getDecl()->getCanonicalDecl())))
1621 Output.
addDecl(Context, I.getDecl(), I.getAccess());
1627 llvm::iterator_range<CXXRecordDecl::conversion_iterator>
1634 Set = &data().Conversions.get(Ctx);
1636 Set = &data().VisibleConversions.get(Ctx);
1638 if (!data().ComputedVisibleConversions) {
1640 data().ComputedVisibleConversions =
true;
1643 return llvm::make_range(Set->
begin(), Set->
end());
1659 for (
unsigned I = 0, E = Convs.
size(); I != E; ++I) {
1660 if (Convs[I].getDecl() == ConvDecl) {
1662 assert(llvm::find(Convs, ConvDecl) == Convs.
end() &&
1663 "conversion was found multiple times in unresolved set");
1668 llvm_unreachable(
"conversion not found in set!");
1673 return cast<CXXRecordDecl>(MSInfo->getInstantiatedFrom());
1685 assert(TemplateOrInstantiation.isNull() &&
1686 "Previous template or instantiation?");
1687 assert(!isa<ClassTemplatePartialSpecializationDecl>(
this));
1688 TemplateOrInstantiation
1697 TemplateOrInstantiation = Template;
1701 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this))
1702 return Spec->getSpecializationKind();
1705 return MSInfo->getTemplateSpecializationKind();
1712 if (
auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1713 Spec->setSpecializationKind(TSK);
1718 MSInfo->setTemplateSpecializationKind(TSK);
1722 llvm_unreachable(
"Not a class template or member class specialization");
1726 auto GetDefinitionOrSelf =
1728 if (
auto *Def = D->getDefinition())
1735 if (
auto *TD = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1736 auto From = TD->getInstantiatedFrom();
1738 while (
auto *NewCTD = CTD->getInstantiatedFromMemberTemplate()) {
1739 if (NewCTD->isMemberSpecialization())
1743 return GetDefinitionOrSelf(CTD->getTemplatedDecl());
1747 while (
auto *NewCTPSD = CTPSD->getInstantiatedFromMember()) {
1748 if (NewCTPSD->isMemberSpecialization())
1752 return GetDefinitionOrSelf(CTPSD);
1761 return GetDefinitionOrSelf(RD);
1766 "couldn't find pattern for class template instantiation");
1786 if (Destructor->isNoReturn())
1792 if (RD->isAnyDestructorNoReturn())
1796 for (
const auto *Field :
fields())
1798 Field->getType()->getBaseElementTypeUnsafe()->getAsCXXRecordDecl())
1799 if (RD->isAnyDestructorNoReturn())
1816 assert(
hasDefinition() &&
"checking for interface-like without a definition");
1830 for (
const auto *
const Method :
methods())
1831 if (Method->isDefined() && !Method->isImplicit())
1835 const auto *Uuid = getAttr<UuidAttr>();
1842 Uuid->getGuid() ==
"00000000-0000-0000-C000-000000000046") ||
1844 Uuid->getGuid() ==
"00020400-0000-0000-C000-000000000046"))) {
1858 if (BaseSpec.isVirtual() || BaseSpec.getAccessSpecifier() !=
AS_public)
1860 const auto *
Base = BaseSpec.getType()->getAsCXXRecordDecl();
1861 if (
Base->isInterface() || !
Base->isInterfaceLike())
1877 if (!FinalOverriders) {
1879 FinalOverriders = &MyFinalOverriders;
1883 for (CXXFinalOverriderMap::iterator M = FinalOverriders->begin(),
1884 MEnd = FinalOverriders->end();
1885 M != MEnd && !Done; ++M) {
1887 SOEnd = M->second.end();
1888 SO != SOEnd && !Done; ++SO) {
1889 assert(SO->second.size() > 0 &&
1890 "All virtual functions have overriding virtual functions");
1896 if (SO->second.front().Method->isPure()) {
1897 data().Abstract =
true;
1908 I.setAccess((*I)->getAccess());
1912 if (data().Abstract ||
isInvalidDecl() || !data().Polymorphic ||
1916 for (
const auto &B :
bases()) {
1917 const auto *BaseDecl =
1918 cast<CXXRecordDecl>(B.getType()->castAs<
RecordType>()->getDecl());
1919 if (BaseDecl->isAbstract())
1926 void CXXDeductionGuideDecl::anchor() {}
1945 case Decl::Kind::CXXConstructor:
1946 return cast<CXXConstructorDecl>(
Function)->getExplicitSpecifier();
1947 case Decl::Kind::CXXConversion:
1948 return cast<CXXConversionDecl>(
Function)->getExplicitSpecifier();
1949 case Decl::Kind::CXXDeductionGuide:
1950 return cast<CXXDeductionGuideDecl>(
Function)->getExplicitSpecifier();
1961 TInfo, EndLocation);
1981 void CXXMethodDecl::anchor() {}
1990 return isStaticOverloadedOperator(OOK);
2011 if (isa<CXXDestructorDecl>(
this)) {
2038 if (
auto *MD = getCorrespondingMethodDeclaredInClass(RD, MayBeBase))
2051 FinalOverriders.erase(
2052 std::remove_if(FinalOverriders.begin(), FinalOverriders.end(),
2056 FinalOverriders.end());
2058 FinalOverriders.push_back(D);
2061 for (
const auto &I : RD->
bases()) {
2065 const auto *
Base = cast<CXXRecordDecl>(RT->
getDecl());
2067 AddFinalOverrider(D);
2070 return FinalOverriders.size() == 1 ? FinalOverriders.front() :
nullptr;
2080 Expr *TrailingRequiresClause) {
2082 CXXMethodDecl(CXXMethod, C, RD, StartLoc, NameInfo, T, TInfo, SC,
2083 isInline, ConstexprKind, EndLocation,
2084 TrailingRequiresClause);
2096 assert(isVirtual() &&
"this method is expected to be virtual");
2105 if (hasAttr<FinalAttr>())
2106 return isPure() ? nullptr :
this;
2120 if (!BestDynamicDecl)
2125 getCorrespondingMethodInClass(BestDynamicDecl);
2129 if (!DevirtualizedMethod)
2135 if (DevirtualizedMethod->
isPure())
2139 if (DevirtualizedMethod->
hasAttr<FinalAttr>())
2140 return DevirtualizedMethod;
2145 if (BestDynamicDecl->
hasAttr<FinalAttr>())
2146 return DevirtualizedMethod;
2148 if (dtor->hasAttr<FinalAttr>())
2149 return DevirtualizedMethod;
2152 if (
const auto *DRE = dyn_cast<DeclRefExpr>(Base)) {
2153 if (
const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
2154 if (VD->getType()->isRecordType())
2156 return DevirtualizedMethod;
2164 if (
const auto *ME = dyn_cast<MemberExpr>(Base)) {
2165 const ValueDecl *VD = ME->getMemberDecl();
2171 if (
auto *BO = dyn_cast<BinaryOperator>(Base)) {
2172 if (BO->isPtrMemOp()) {
2174 if (MPT->getPointeeType()->isRecordType())
2175 return DevirtualizedMethod;
2185 assert(PreventedBy.empty() &&
"PreventedBy is expected to be empty");
2186 if (getOverloadedOperator() != OO_Delete &&
2187 getOverloadedOperator() != OO_Array_Delete)
2193 if (getPrimaryTemplate())
2200 if (getNumParams() == 1)
2202 unsigned UsualParams = 1;
2209 if (isDestroyingOperatorDelete())
2223 if (UsualParams < getNumParams() &&
2228 if (UsualParams < getNumParams() &&
2229 getParamDecl(UsualParams)->getType()->isAlignValT())
2232 if (UsualParams != getNumParams())
2242 isDestroyingOperatorDelete())
2249 for (
const auto *D : R) {
2250 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
2251 if (FD->getNumParams() == 1) {
2252 PreventedBy.push_back(FD);
2265 if (getOverloadedOperator() != OO_Equal ||
2267 getPrimaryTemplate() || getDescribedFunctionTemplate() ||
2268 getNumParams() != 1)
2271 QualType ParamType = getParamDecl(0)->getType();
2286 if (getOverloadedOperator() != OO_Equal || isStatic() ||
2287 getPrimaryTemplate() || getDescribedFunctionTemplate() ||
2288 getNumParams() != 1)
2291 QualType ParamType = getParamDecl(0)->getType();
2292 if (!isa<RValueReferenceType>(ParamType))
2305 "Can't add an overridden method to a class template!");
2306 assert(MD->
isVirtual() &&
"Method is not virtual!");
2312 if (isa<CXXConstructorDecl>(
this))
return nullptr;
2317 if (isa<CXXConstructorDecl>(
this))
return nullptr;
2322 if (isa<CXXConstructorDecl>(
this))
return 0;
2328 if (isa<CXXConstructorDecl>(
this))
2358 assert(isInstance() &&
"No 'this' for static methods!");
2366 assert(isInstance() &&
"No 'this' for static methods!");
2388 if (StaticInvoker ==
this)
return true;
2390 return StaticInvoker == this->getPrimaryTemplate()->getTemplatedDecl();
2401 : Initializee(TInfo), MemberOrEllipsisLocation(EllipsisLoc), Init(Init),
2402 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(IsVirtual),
2403 IsWritten(
false), SourceOrder(0) {}
2410 : Initializee(Member), MemberOrEllipsisLocation(MemberLoc), Init(Init),
2411 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2412 IsWritten(
false), SourceOrder(0) {}
2419 : Initializee(Member), MemberOrEllipsisLocation(MemberLoc), Init(Init),
2420 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2421 IsWritten(
false), SourceOrder(0) {}
2427 : Initializee(TInfo), Init(Init), LParenLoc(L), RParenLoc(R),
2428 IsDelegating(
true), IsVirtual(
false), IsWritten(
false), SourceOrder(0) {}
2444 return Initializee.get<
TypeSourceInfo*>()->getType().getTypePtr();
2457 return TSInfo->getTypeLoc().getLocalSourceRange().getBegin();
2466 return I->getSourceRange();
2473 CXXConstructorDecl::CXXConstructorDecl(
2478 Expr *TrailingRequiresClause)
2479 :
CXXMethodDecl(CXXConstructor, C, RD, StartLoc, NameInfo, T, TInfo,
2481 TrailingRequiresClause) {
2482 setNumCtorInitializers(0);
2483 setInheritingConstructor(static_cast<bool>(Inherited));
2484 setImplicit(isImplicitlyDeclared);
2485 CXXConstructorDeclBits.HasTrailingExplicitSpecifier = ES.
getExpr() ? 1 : 0;
2487 *getTrailingObjects<InheritedConstructor>() = Inherited;
2488 setExplicitSpecifier(ES);
2491 void CXXConstructorDecl::anchor() {}
2496 bool hasTraillingExplicit =
static_cast<bool>(AllocKind & TAKHasTailExplicit);
2497 bool isInheritingConstructor =
2498 static_cast<bool>(AllocKind & TAKInheritsConstructor);
2500 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2501 isInheritingConstructor, hasTraillingExplicit);
2507 Result->CXXConstructorDeclBits.HasTrailingExplicitSpecifier =
2508 hasTraillingExplicit;
2518 Expr *TrailingRequiresClause) {
2521 "Name must refer to a constructor");
2523 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2524 Inherited ? 1 : 0, ES.
getExpr() ? 1 : 0);
2525 return new (
C, RD, Extra)
2527 isImplicitlyDeclared, ConstexprKind, Inherited,
2528 TrailingRequiresClause);
2532 return CtorInitializers.get(getASTContext().getExternalSource());
2536 assert(isDelegatingConstructor() &&
"Not a delegating constructor!");
2538 if (
const auto *Construct = dyn_cast<CXXConstructExpr>(E))
2539 return Construct->getConstructor();
2548 return (getNumParams() == 0) ||
2549 (getNumParams() > 0 && getParamDecl(0)->hasDefaultArg());
2554 return isCopyOrMoveConstructor(TypeQuals) &&
2555 getParamDecl(0)->getType()->isLValueReferenceType();
2559 return isCopyOrMoveConstructor(TypeQuals) &&
2560 getParamDecl(0)->getType()->isRValueReferenceType();
2575 if ((getNumParams() < 1) ||
2576 (getNumParams() > 1 && !getParamDecl(1)->hasDefaultArg()) ||
2577 (getPrimaryTemplate() !=
nullptr) ||
2578 (getDescribedFunctionTemplate() !=
nullptr))
2612 if (isExplicit() && !AllowExplicit)
2615 return (getNumParams() == 0 &&
2616 getType()->castAs<FunctionProtoType>()->isVariadic()) ||
2617 (getNumParams() == 1) ||
2618 (getNumParams() > 1 &&
2619 (getParamDecl(1)->hasDefaultArg() ||
2620 getParamDecl(1)->isParameterPack()));
2624 if ((getNumParams() < 1) ||
2625 (getNumParams() > 1 && !getParamDecl(1)->hasDefaultArg()) ||
2626 (getDescribedFunctionTemplate() !=
nullptr))
2643 void CXXDestructorDecl::anchor() {}
2657 Expr *TrailingRequiresClause) {
2660 "Name must refer to a destructor");
2663 isImplicitlyDeclared, ConstexprKind,
2664 TrailingRequiresClause);
2668 auto *
First = cast<CXXDestructorDecl>(getFirstDecl());
2669 if (OD && !
First->OperatorDelete) {
2670 First->OperatorDelete = OD;
2671 First->OperatorDeleteThisArg = ThisArg;
2672 if (
auto *L = getASTMutationListener())
2673 L->ResolvedOperatorDelete(
First, OD, ThisArg);
2677 void CXXConversionDecl::anchor() {}
2693 "Name must refer to a conversion function");
2696 ConstexprKind, EndLocation, TrailingRequiresClause);
2700 return isImplicit() && getParent()->isLambda() &&
2701 getConversionType()->isBlockPointerType();
2710 LinkageSpecDeclBits.HasBraces = HasBraces;
2713 void LinkageSpecDecl::anchor() {}
2721 return new (
C, DC)
LinkageSpecDecl(DC, ExternLoc, LangLoc, Lang, HasBraces);
2730 void UsingDirectiveDecl::anchor() {}
2739 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(Used))
2740 Used = NS->getOriginalNamespace();
2742 IdentLoc, Used, CommonAncestor);
2754 if (
auto *NA = dyn_cast_or_null<NamespaceAliasDecl>(NominatedNamespace))
2755 return NA->getNamespace();
2756 return cast_or_null<NamespaceDecl>(NominatedNamespace);
2763 redeclarable_base(C), LocStart(StartLoc),
2764 AnonOrFirstNamespaceAndInline(
nullptr, Inline) {
2765 setPreviousDecl(PrevDecl);
2775 return new (
C, DC)
NamespaceDecl(C, DC, Inline, StartLoc, IdLoc, Id,
2788 return AnonOrFirstNamespaceAndInline.getPointer();
2795 return AnonOrFirstNamespaceAndInline.getPointer();
2801 return getNextRedeclaration();
2805 return getPreviousDecl();
2809 return getMostRecentDecl();
2812 void NamespaceAliasDecl::anchor() {}
2815 return getNextRedeclaration();
2819 return getPreviousDecl();
2823 return getMostRecentDecl();
2834 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(Namespace))
2835 Namespace = NS->getOriginalNamespace();
2837 QualifierLoc, IdentLoc, Namespace);
2848 void LifetimeExtendedTemporaryDecl::anchor() {}
2852 const ValueDecl *ExtendingDecl = getExtendingDecl();
2857 if (isa<FieldDecl>(ExtendingDecl))
2861 if (isa<BindingDecl>(ExtendingDecl))
2864 return cast<VarDecl>(ExtendingDecl)->getStorageDuration();
2868 assert(getStorageDuration() ==
SD_Static &&
2869 "don't need to cache the computed value for this temporary");
2870 if (MayCreate && !
Value) {
2872 getASTContext().addDestruction(
Value);
2874 assert(
Value &&
"may not be null");
2878 void UsingShadowDecl::anchor() {}
2901 while (
const auto *NextShadow =
2902 dyn_cast<UsingShadowDecl>(Shadow->UsingOrNextShadow))
2903 Shadow = NextShadow;
2904 return cast<UsingDecl>(Shadow->UsingOrNextShadow);
2907 void ConstructorUsingShadowDecl::anchor() {}
2926 void UsingDecl::anchor() {}
2929 assert(std::find(shadow_begin(), shadow_end(), S) == shadow_end() &&
2930 "declaration already in set");
2933 if (FirstUsingShadow.getPointer())
2934 S->UsingOrNextShadow = FirstUsingShadow.getPointer();
2935 FirstUsingShadow.setPointer(S);
2939 assert(std::find(shadow_begin(), shadow_end(), S) != shadow_end() &&
2940 "declaration not in set");
2945 if (FirstUsingShadow.getPointer() == S) {
2946 FirstUsingShadow.setPointer(
2947 dyn_cast<UsingShadowDecl>(S->UsingOrNextShadow));
2948 S->UsingOrNextShadow =
this;
2953 while (Prev->UsingOrNextShadow != S)
2954 Prev = cast<UsingShadowDecl>(Prev->UsingOrNextShadow);
2955 Prev->UsingOrNextShadow = S->UsingOrNextShadow;
2956 S->UsingOrNextShadow =
this;
2963 return new (
C, DC)
UsingDecl(DC, UL, QualifierLoc, NameInfo, HasTypename);
2974 ? getQualifierLoc().getBeginLoc() : UsingLocation;
2978 void UsingPackDecl::anchor() {}
2983 size_t Extra = additionalSizeToAlloc<NamedDecl *>(UsingDecls.size());
2984 return new (
C, DC, Extra)
UsingPackDecl(DC, InstantiatedFrom, UsingDecls);
2988 unsigned NumExpansions) {
2989 size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
2991 Result->NumExpansions = NumExpansions;
2992 auto *Trail = Result->getTrailingObjects<
NamedDecl *>();
2993 for (
unsigned I = 0; I != NumExpansions; ++I)
2998 void UnresolvedUsingValueDecl::anchor() {}
3007 QualifierLoc, NameInfo,
3022 ? getQualifierLoc().getBeginLoc() : UsingLocation;
3026 void UnresolvedUsingTypenameDecl::anchor() {}
3037 DC, UsingLoc, TypenameLoc, QualifierLoc, TargetNameLoc,
3048 void StaticAssertDecl::anchor() {}
3066 void BindingDecl::anchor() {}
3080 return cast_or_null<ValueDecl>(Decomp.get(Source));
3084 Expr *B = getBinding();
3091 auto *VD = dyn_cast<
VarDecl>(DRE->getDecl());
3092 assert(VD->isImplicit() &&
"holding var for binding decl not implicit");
3096 void DecompositionDecl::anchor() {}
3104 size_t Extra = additionalSizeToAlloc<BindingDecl *>(Bindings.size());
3105 return new (
C, DC, Extra)
3111 unsigned NumBindings) {
3112 size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
3117 Result->NumBindings = NumBindings;
3118 auto *Trail = Result->getTrailingObjects<
BindingDecl *>();
3119 for (
unsigned I = 0; I != NumBindings; ++I)
3127 for (
const auto *B : bindings()) {
3136 void MSPropertyDecl::anchor() {}
3144 return new (
C, DC)
MSPropertyDecl(DC, L, N, T, TInfo, StartL, Getter, Setter);
3157 llvm_unreachable(
"Invalid access specifier!");
3165 llvm_unreachable(
"Invalid access specifier!");
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl)
Defines the clang::ASTContext interface.
static const char * getAccessName(AccessSpecifier AS)
bool hasConstexprDestructor() const
Determine whether this class has a constexpr destructor.
void setImplicit(bool I=true)
Represents a function declaration or definition.
Expr * getInit() const
Get the initializer.
A (possibly-)qualified type.
virtual Decl * GetExternalDecl(uint32_t ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
bool replace(const NamedDecl *Old, NamedDecl *New, AccessSpecifier AS)
Replaces the given declaration with the new one, once.
const CXXMethodDecl *const * method_iterator
Attempt to be ABI-compatible with code generated by Clang 6.0.x (SVN r321711).
unsigned getNumBases() const
Retrieves the number of base classes of this class.
static UnresolvedUsingValueDecl * CreateDeserialized(ASTContext &C, unsigned ID)
This file contains the declaration of the ODRHash class, which calculates a hash based on AST nodes...
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
static UsingPackDecl * Create(ASTContext &C, DeclContext *DC, NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl *> UsingDecls)
void setInheritingConstructor(bool isIC=true)
State that this is an implicit constructor synthesized to model a call to a constructor inherited fro...
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
bool isInClassMemberInitializer() const
Determine whether this initializer is an implicit initializer generated for a field with an initializ...
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a member function...
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
static bool hasRepeatedBaseClass(const CXXRecordDecl *StartRD)
Determine whether a class has a repeated base class.
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
static AccessSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
C Language Family Type Representation.
QualType getThisType() const
Return the type of the this pointer.
bool hasNonTrivialCopyConstructor() const
Determine whether this class has a non-trivial copy constructor (C++ [class.copy]p6, C++11 [class.copy]p12)
bool isRecordType() const
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
Decl - This represents one declaration (or definition), e.g.
void append(ASTContext &C, iterator I, iterator E)
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
void setArgPassingRestrictions(ArgPassingKind Kind)
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
bool isPOD() const
Whether this class is a POD-type (C++ [class]p4)
Defines the C++ template declaration subclasses.
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
ExplicitSpecKind getKind() const
The base class of the type hierarchy.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
Represent a C++ namespace.
virtual void completeDefinition()
Note that the definition of this type is now complete.
SourceLocation getEndLoc() const LLVM_READONLY
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
ArrayRef< NamedDecl * > getLambdaExplicitTemplateParameters() const
Retrieve the lambda template parameters that were specified explicitly.
A container of type source information.
Store information needed for an explicit specifier.
StorageDuration
The storage duration for an object (per C++ [basic.stc]).
constexpr XRayInstrMask Function
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
bool isDefined(const FunctionDecl *&Definition) const
Returns true if the function has a definition that does not need to be instantiated.
bool hasFriends() const
Determines whether this record has any friends.
Describes the capture of a variable or of this, or of a C++1y init-capture.
Represents a C++ constructor within a class.
bool mayBeAbstract() const
Determine whether this class may end up being abstract, even though it is not yet known to be abstrac...
unsigned Access
Access - Used by C++ decls for the access specifier.
static QualType getThisObjectType(ASTContext &C, const FunctionProtoType *FPT, const CXXRecordDecl *Decl)
CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo, bool IsVirtual, SourceLocation L, Expr *Init, SourceLocation R, SourceLocation EllipsisLoc)
Creates a new base-class initializer.
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
This file provides some common utility functions for processing Lambda related AST Constructs...
Represents a variable declaration or definition.
ASTMutationListener * getASTMutationListener() const
void finishedDefaultedOrDeletedMember(CXXMethodDecl *MD)
Indicates that the declaration of a defaulted or deleted special member function is now complete...
const T * getAs() const
Member-template getAs<specific type>'.
static MSPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL, IdentifierInfo *Getter, IdentifierInfo *Setter)
The "__interface" keyword.
bool isExternCContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
bool isInvalidDecl() const
static bool allLookupResultsAreTheSame(const DeclContext::lookup_result &R)
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getODRHash() const
bool isInterfaceLike() const
CXXMethodDecl * getCorrespondingMethodDeclaredInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find if RD declares a function that overrides this function, and if so, return it.
bool hasDefinition() const
Represents a parameter to a function.
TemplateParameterList * getGenericLambdaTemplateParameterList() const
Retrieve the generic lambda's template parameter list.
Defines the clang::Expr interface and subclasses for C++ expressions.
SourceLocation getRParenLoc() const
VarDecl * getHoldingVar() const
Get the variable (if any) that holds the value of evaluating the binding.
CXXConstructorDecl * getTargetConstructor() const
When this constructor delegates to another, retrieve the target.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the kind of specialization or template instantiation this is.
Base wrapper for a particular "section" of type source info.
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
Represents a struct/union/class.
Description of a constructor that was inherited from a base class.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
One of these records is kept for each identifier that is lexed.
const Expr * getBestDynamicClassTypeExpr() const
Get the inner expression that determines the best dynamic class.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
The results of name lookup within a DeclContext.
field_range fields() const
NameKind getNameKind() const
Determine what kind of name this is.
static DecompositionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation LSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl *> Bindings)
Represents a member of a struct/union/class.
static CXXRecordDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
conversion_iterator conversion_end() const
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isCopyOrMoveConstructor() const
Determine whether this a copy or move constructor.
bool isReferenceType() const
The iterator over UnresolvedSets.
static UnresolvedUsingTypenameDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation TypenameLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TargetNameLoc, DeclarationName TargetName, SourceLocation EllipsisLoc)
bool hasUserDeclaredDestructor() const
Determine whether this class has a user-declared destructor.
Represents an access specifier followed by colon ':'.
void addShadowDecl(UsingShadowDecl *S)
static StaticAssertDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static CXXRecordDecl * CreateLambda(const ASTContext &C, DeclContext *DC, TypeSourceInfo *Info, SourceLocation Loc, bool DependentLambda, bool IsGeneric, LambdaCaptureDefault CaptureDefault)
static NamespaceDecl * CreateDeserialized(ASTContext &C, unsigned ID)
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.
Represents a C++ using-declaration.
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
void completeDefinition() override
Indicates that the definition of this class is now complete.
bool hasNonLiteralTypeFieldsOrBases() const
Determine whether this class has a non-literal or/ volatile type non-static data member or base class...
static CXXDeductionGuideDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, ExplicitSpecifier ES, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation)
void addDecl(ASTContext &C, NamedDecl *D, AccessSpecifier AS)
TagKind getTagKind() const
AccessSpecifier getAccessSpecifier() const
Returns the access specifier for this base specifier.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
static UnresolvedUsingTypenameDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setHasObjectMember(bool val)
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
A set of unresolved declarations.
bool isRValueReferenceType() const
The argument of this type cannot be passed directly in registers.
Defines the Diagnostic-related interfaces.
bool isLambda() const
Determine whether this class describes a lambda function object.
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
field_iterator field_begin() const
static CXXMethodDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInline, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool isAnyMemberInitializer() const
llvm::iterator_range< conversion_iterator > getVisibleConversionFunctions() const
Get all conversion functions visible in current class, including conversion function templates...
base_class_iterator bases_begin()
FieldDecl * getAnyMember() const
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Namespace)
bool isEquivalent(const ExplicitSpecifier Other) const
Check for equivalence of explicit specifiers.
bool hasSimpleCopyConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous copy constructor that ...
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
Represents a linkage specification.
StringRef getLambdaStaticInvokerName()
A binding in a decomposition declaration.
init_iterator init_begin()
Retrieve an iterator to the first initializer.
CXXMethodDecl * getCorrespondingMethodInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find the method in RD that corresponds to this one.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
CXXRecordDecl(Kind K, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl)
static CXXConstructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, ExplicitSpecifier ES, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, InheritedConstructor Inherited=InheritedConstructor(), Expr *TrailingRequiresClause=nullptr)
bool isLambdaStaticInvoker() const
Determine whether this is a lambda closure type's static member function that is used for the result ...
static CXXDeductionGuideDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setBases(CXXBaseSpecifier const *const *Bases, unsigned NumBases)
Sets the base classes of this struct or class.
bool isTriviallyCopyable() const
Determine whether this class is considered trivially copyable per (C++11 [class]p6).
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
A little helper class used to produce diagnostics.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Represents a prototype with parameter type info, e.g.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
method_iterator end_overridden_methods() const
DeclarationNameTable DeclarationNames
static StaticAssertDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *Message, SourceLocation RParenLoc, bool Failed)
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
bool isCLike() const
True if this class is C-like, without C++-specific features, e.g.
static bool recursivelyOverrides(const CXXMethodDecl *DerivedMD, const CXXMethodDecl *BaseMD)
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
bool isObjCGCStrong() const
true when Type is objc's strong.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
This represents one expression.
Defines the clang::LangOptions interface.
Represents the body of a requires-expression.
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration...
static LinkageSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
const T * castAs() const
Member-template castAs<specific type>.
void getFinalOverriders(CXXFinalOverriderMap &FinaOverriders) const
Retrieve the final overriders for each virtual member function in the class hierarchy where this clas...
bool isObjCRetainableType() const
bool defaultedDestructorIsConstexpr() const
Determine whether a defaulted default constructor for this class would be constexpr.
static UnresolvedUsingValueDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, SourceLocation EllipsisLoc)
Represents a C++ destructor within a class.
bool isCopyConstructor() const
Whether this constructor is a copy constructor (C++ [class.copy]p2, which can be used to copy the cla...
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
const CXXRecordDecl * getTemplateInstantiationPattern() const
Retrieve the record declaration from which this record could be instantiated.
Defines an enumeration for C++ overloaded operators.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
field_iterator field_end() const
overridden_method_range overridden_methods() const
ObjCLifetime getObjCLifetime() const
DeclContext * getDeclContext()
CXXRecordDecl * getDefinition() const
bool hasAnyDependentBases() const
Determine whether this class has any dependent base classes which are not the current instantiation...
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
StorageClass getStorageClass() const
Returns the storage class as written in the source.
const Expr * getExpr() const
Defines the clang::TypeLoc interface and its subclasses.
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
static CanQualType GetConversionType(ASTContext &Context, NamedDecl *Conv)
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
static NamespaceAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isFunctionOrMethod() const
unsigned getCVRQualifiers() const
Retrieve the const/volatile/restrict qualifiers.
StorageClass
Storage classes.
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
DeclContext * getParent()
getParent - Returns the containing DeclContext.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization, retrieves the member specialization information.
An lvalue reference type, per C++11 [dcl.ref].
bool isLambdaToBlockPointerConversion() const
Determine whether this conversion function is a conversion from a lambda closure type to a block poin...
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
bool hasSimpleMoveConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous move constructor that ...
void setOperatorDelete(FunctionDecl *OD, Expr *ThisArg)
Represents a C++ deduction guide declaration.
void setDescribedClassTemplate(ClassTemplateDecl *Template)
Represents a C++ conversion function within a class.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
The result type of a method or function.
static UsingDirectiveDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
bool hasNonTrivialMoveAssignment() const
Determine whether this class has a non-trivial move assignment operator (C++11 [class.copy]p25)
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
bool hasNonTrivialMoveConstructor() const
Determine whether this class has a non-trivial move constructor (C++11 [class.copy]p12) ...
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so...
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
bool isConstQualified() const
Determine whether this type is const-qualified.
RecordDecl * getDecl() const
Abstract interface for external sources of AST nodes.
unsigned size_overridden_methods() const
Decl::Kind getDeclKind() const
Assigning into this object requires the old value to be released and the new value to be retained...
static UsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
SourceRange getSourceRange() const LLVM_READONLY
Determine the source range covering the entire initializer.
static CXXDestructorDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Encodes a location in the source.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
bool isPure() const
Whether this virtual function is pure, i.e.
FunctionTemplateDecl * getDependentLambdaCallOperator() const
Retrieve the dependent lambda call operator of the closure type if this is a templated closure type...
void setTrivialForCallFlags(CXXMethodDecl *MD)
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
DeclarationName getName() const
getName - Returns the embedded declaration name.
ASTContext & getASTContext() const LLVM_READONLY
static DecompositionDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumBindings)
Represents a dependent using declaration which was not marked with typename.
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set...
bool isUsualDeallocationFunction(SmallVectorImpl< const FunctionDecl *> &PreventedBy) const
Determine whether this is a usual deallocation function (C++ [basic.stc.dynamic.deallocation]p2), which is an overloaded delete or delete[] operator with a particular signature.
void removeShadowDecl(UsingShadowDecl *S)
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
Represents a static or instance method of a struct/union/class.
void addOverriddenMethod(const CXXMethodDecl *MD)
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
Qualifiers getMethodQuals() const
bool isGenericLambda() const
Determine whether this class describes a generic lambda function object (i.e.
void addDecl(NamedDecl *D)
static MSPropertyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static ConstructorUsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static bool isDeclContextInNamespace(const DeclContext *DC)
bool forallBases(ForallBasesCallback BaseMatches, bool AllowShortCircuit=true) const
Determines if the given callback holds for all the direct or indirect base classes of this type...
static ConstructorUsingShadowDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, UsingDecl *Using, NamedDecl *Target, bool IsVirtual)
const CXXRecordDecl * getBestDynamicClassType() const
For an expression of class type or pointer to class type, return the most derived class decl the expr...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
static ExplicitSpecifier getFromDecl(FunctionDecl *Function)
SourceLocation getMemberLocation() const
Represents a C++11 static_assert declaration.
bool isTrivialForCall() const
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
NamedDecl * getDecl() const
TypeLoc getBaseClassLoc() const
If this is a base class initializer, returns the type of the base class with location information...
Defines various enumerations that describe declaration and type specifiers.
bool hasSimpleDestructor() const
true if we know for sure that this class has an accessible destructor that is not deleted...
TagTypeKind
The kind of a tag type.
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
static LinkageSpecDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation ExternLoc, SourceLocation LangLoc, LanguageIDs Lang, bool HasBraces)
Dataflow Directional Tag Classes.
APValue * getOrCreateValue(bool MayCreate) const
Get the storage for the constant value of a materialized temporary of static storage duration...
ConstexprSpecKind
Define the kind of constexpr specifier.
static CXXConversionDecl * CreateDeserialized(ASTContext &C, unsigned ID)
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
void setHasVolatileMember(bool val)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
method_iterator begin_overridden_methods() const
bool isCXX98PODType(const ASTContext &Context) const
Return true if this is a POD type according to the rules of the C++98 standard, regardless of the cur...
Represents a field injected from an anonymous union/struct into the parent scope. ...
SourceLocation getSourceLocation() const
Determine the source location of the initializer.
AccessSpecifier getAccess() const
void removeConversion(const NamedDecl *Old)
Removes a conversion function from this class.
A decomposition declaration.
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
MapType::iterator iterator
bool hasInlineBody() const
bool hasUserDeclaredConstructor() const
Determine whether this class has any user-declared constructors.
Represents a dependent using declaration which was marked with typename.
conversion_iterator conversion_begin() const
void AddCXXRecordDecl(const CXXRecordDecl *Record)
static UsingDirectiveDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation NamespaceLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Nominated, DeclContext *CommonAncestor)
The name of a declaration.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined...
bool isSpecializationCopyingObject() const
Determine whether this is a member template specialization that would copy the object to itself...
bool isAnyDestructorNoReturn() const
Returns true if the class destructor, or any implicitly invoked destructors are marked noreturn...
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
U cast(CodeGen::Address addr)
A mapping from each virtual member function to its set of final overriders.
UsingShadowDecl(Kind K, ASTContext &C, DeclContext *DC, SourceLocation Loc, UsingDecl *Using, NamedDecl *Target)
A pointer to member type per C++ 8.3.3 - Pointers to members.
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
llvm::BumpPtrAllocator & getAllocator() const
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext, providing only those that are of type SpecificDecl (or a class derived from it).
bool hasNonTrivialCopyAssignment() const
Determine whether this class has a non-trivial copy assignment operator (C++ [class.copy]p11, C++11 [class.copy]p25)
static NamedDecl * getLambdaCallOperatorHelper(const CXXRecordDecl &RD)
bool isMoveConstructor() const
Determine whether this constructor is a move constructor (C++11 [class.copy]p3), which can be used to...
UsingDecl * getUsingDecl() const
Gets the using declaration to which this declaration is tied.
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point...
static AccessSpecifier MergeAccess(AccessSpecifier PathAccess, AccessSpecifier DeclAccess)
Calculates the access of a decl that is reached along a path.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
CXXMethodDecl * getDevirtualizedMethod(const Expr *Base, bool IsAppleKext)
If it's possible to devirtualize a call to this method, return the called function.
Represents a C++ base or member initializer.
LanguageIDs
Represents the language in a linkage specification.
bool hasNonTrivialObjCLifetime() const
ValueDecl * getDecomposedDecl() const
Get the decomposition declaration that this binding represents a decomposition of.
An UnresolvedSet-like class which uses the ASTContext's allocator.
static CXXMethodDecl * CreateDeserialized(ASTContext &C, unsigned ID)
QualType getThisObjectType() const
Return the type of the object pointed by this.
Base for LValueReferenceType and RValueReferenceType.
static CXXDestructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, Expr *TrailingRequiresClause=nullptr)
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
static CXXConversionDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, ExplicitSpecifier ES, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
Represents a base class of a C++ class.
void getCaptureFields(llvm::DenseMap< const VarDecl *, FieldDecl *> &Captures, FieldDecl *&ThisCapture) const
For a closure type, retrieve the mapping from captured variables and this to the non-static data memb...
static CXXConstructorDecl * CreateDeserialized(ASTContext &C, unsigned ID, uint64_t AllocKind)
CXXMethodDecl * getLambdaStaticInvoker() const
Retrieve the lambda static invoker, the address of which is returned by the conversion operator...
static BindingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id)
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
Reading or writing from this object requires a barrier call.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
void Deallocate(void *Ptr) const
Defines the clang::SourceLocation class and associated facilities.
Represents a C++ struct/union/class.
bool hasSimpleMoveAssignment() const
true if we know for sure that this class has a single, accessible, unambiguous move assignment operat...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Provides information a specialization of a member of a class template, which may be a member function...
LambdaCaptureDefault getLambdaCaptureDefault() const
void printName(raw_ostream &os) const override
base_class_iterator bases_end()
ASTImporterLookupTable & LT
static UsingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
static RequiresExprBodyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Declaration of a class template.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
bool lambdaIsDefaultConstructibleAndAssignable() const
Determine whether this lambda should have an implicit default constructor and copy and move assignmen...
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
StringLiteral - This represents a string literal expression, e.g.
Full-expression storage duration (for temporaries).
ASTContext & getParentASTContext() const
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Kind
Lists the kind of concrete classes of Decl.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
void AddStmt(const Stmt *S)
static UsingPackDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumExpansions)
bool isConvertingConstructor(bool AllowExplicit) const
Whether this constructor is a converting constructor (C++ [class.conv.ctor]), which can be used for u...
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
A reference to a declared variable, function, enum, etc.
bool isDeleted() const
Whether this function has been deleted.
ASTContext::overridden_method_range overridden_method_range
An instance of this class represents the declaration of a property member.
A trivial tuple used to represent a source range.
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
This represents a decl that may have a name.
bool isTranslationUnit() const
Represents a C++ namespace alias.
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
static UsingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Automatic storage duration (most local variables).
Represents C++ using-directive.
static BindingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
const LangOptions & getLangOpts() const
Declaration of a template function.
void setTargetDecl(NamedDecl *ND)
Sets the underlying declaration which has been brought into the local scope.
int64_t getID(const ASTContext &Context) const
SourceLocation getLocation() const
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Represents a pack of using declarations that a single using-declarator pack-expanded into...
bool isBeingDefined() const
Return true if this decl is currently being defined.
Defines the LambdaCapture class.
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
method_range methods() const
QualType getType() const
Retrieves the type of the base class.