39 #include "llvm/ADT/None.h" 40 #include "llvm/ADT/SmallPtrSet.h" 41 #include "llvm/ADT/SmallVector.h" 42 #include "llvm/ADT/iterator_range.h" 43 #include "llvm/Support/Casting.h" 44 #include "llvm/Support/ErrorHandling.h" 45 #include "llvm/Support/Format.h" 46 #include "llvm/Support/raw_ostream.h" 52 using namespace clang;
58 void AccessSpecDecl::anchor() {}
64 void LazyASTUnresolvedSet::getFromExternalSource(
ASTContext &C)
const {
66 assert(Impl.Decls.isLazy() &&
"getFromExternalSource for non-lazy set");
67 assert(Source &&
"getFromExternalSource with no external source");
71 reinterpret_cast<uintptr_t>(I.getDecl()) >> 2)));
72 Impl.Decls.setLazy(
false);
75 CXXRecordDecl::DefinitionData::DefinitionData(
CXXRecordDecl *D)
76 : UserDeclaredConstructor(
false), UserDeclaredSpecialMembers(0),
78 Abstract(
false), IsStandardLayout(
true), IsCXX11StandardLayout(
true),
79 HasBasesWithFields(
false), HasBasesWithNonStaticDataMembers(
false),
80 HasPrivateFields(
false), HasProtectedFields(
false),
81 HasPublicFields(
false), HasMutableFields(
false), HasVariantMembers(
false),
82 HasOnlyCMembers(
true), HasInClassInitializer(
false),
83 HasUninitializedReferenceMember(
false), HasUninitializedFields(
false),
84 HasInheritedConstructor(
false), HasInheritedAssignment(
false),
85 NeedOverloadResolutionForCopyConstructor(
false),
86 NeedOverloadResolutionForMoveConstructor(
false),
87 NeedOverloadResolutionForCopyAssignment(
false),
88 NeedOverloadResolutionForMoveAssignment(
false),
89 NeedOverloadResolutionForDestructor(
false),
90 DefaultedCopyConstructorIsDeleted(
false),
91 DefaultedMoveConstructorIsDeleted(
false),
92 DefaultedCopyAssignmentIsDeleted(
false),
93 DefaultedMoveAssignmentIsDeleted(
false),
94 DefaultedDestructorIsDeleted(
false), HasTrivialSpecialMembers(SMF_All),
95 HasTrivialSpecialMembersForCall(SMF_All),
96 DeclaredNonTrivialSpecialMembers(0),
97 DeclaredNonTrivialSpecialMembersForCall(0), HasIrrelevantDestructor(
true),
98 HasConstexprNonCopyMoveConstructor(
false),
99 HasDefaultedDefaultConstructor(
false),
100 DefaultedDefaultConstructorIsConstexpr(
true),
101 HasConstexprDefaultConstructor(
false),
102 DefaultedDestructorIsConstexpr(
true),
103 HasNonLiteralTypeFieldsOrBases(
false), StructuralIfLiteral(
true),
104 UserProvidedDefaultConstructor(
false), DeclaredSpecialMembers(0),
105 ImplicitCopyConstructorCanHaveConstParamForVBase(
true),
106 ImplicitCopyConstructorCanHaveConstParamForNonVBase(
true),
107 ImplicitCopyAssignmentHasConstParam(
true),
108 HasDeclaredCopyConstructorWithConstParam(
false),
109 HasDeclaredCopyAssignmentWithConstParam(
false), IsLambda(
false),
110 IsParsingBaseSpecifiers(
false), ComputedVisibleConversions(
false),
111 HasODRHash(
false), Definition(D) {}
114 return Bases.get(
Definition->getASTContext().getExternalSource());
117 CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getVBasesSlowCase()
const {
118 return VBases.get(
Definition->getASTContext().getExternalSource());
125 :
RecordDecl(K, TK, C, DC, StartLoc, IdLoc,
Id, PrevDecl),
126 DefinitionData(PrevDecl ? PrevDecl->DefinitionData
133 bool DelayTypeCreation) {
136 R->setMayHaveOutOfDateDef(
C.getLangOpts().Modules);
139 if (!DelayTypeCreation)
140 C.getTypeDeclType(R, PrevDecl);
147 bool Dependent,
bool IsGeneric,
151 R->setBeingDefined(
true);
153 new (
C)
struct LambdaDefinitionData(R, Info, Dependent, IsGeneric,
155 R->setMayHaveOutOfDateDef(
false);
156 R->setImplicit(
true);
157 C.getTypeDeclType(R,
nullptr);
166 R->setMayHaveOutOfDateDef(
false);
176 while (!WorkList.empty()) {
179 if (
const CXXRecordDecl *B = BaseSpec.getType()->getAsCXXRecordDecl()) {
180 if (!SeenBaseTypes.insert(B).second)
182 WorkList.push_back(B);
194 if (!data().Bases.isOffset() && data().NumBases > 0)
195 C.Deallocate(data().getBases());
198 if (!
C.getLangOpts().CPlusPlus17) {
201 data().Aggregate =
false;
206 data().PlainOldData =
false;
216 data().NumBases = NumBases;
217 for (
unsigned i = 0; i < NumBases; ++i) {
218 data().getBases()[i] = *Bases[i];
225 auto *BaseClassDecl =
233 if (BaseClassDecl->data().HasBasesWithFields ||
234 !BaseClassDecl->field_empty()) {
235 if (data().HasBasesWithFields)
237 data().IsStandardLayout =
false;
238 data().HasBasesWithFields =
true;
245 if (BaseClassDecl->data().HasBasesWithNonStaticDataMembers ||
246 BaseClassDecl->hasDirectFields()) {
247 if (data().HasBasesWithNonStaticDataMembers)
248 data().IsCXX11StandardLayout =
false;
249 data().HasBasesWithNonStaticDataMembers =
true;
252 if (!BaseClassDecl->isEmpty()) {
256 data().Empty =
false;
262 data().Aggregate =
false;
267 data().StructuralIfLiteral =
false;
273 if (BaseClassDecl->isPolymorphic()) {
274 data().Polymorphic =
true;
277 data().Aggregate =
false;
283 if (!BaseClassDecl->isStandardLayout())
284 data().IsStandardLayout =
false;
285 if (!BaseClassDecl->isCXX11StandardLayout())
286 data().IsCXX11StandardLayout =
false;
290 data().HasNonLiteralTypeFieldsOrBases =
true;
293 for (
const auto &VBase : BaseClassDecl->vbases()) {
295 if (SeenVBaseTypes.insert(
C.getCanonicalType(VBase.getType())).second) {
296 VBases.push_back(&VBase);
303 if (
CXXRecordDecl *VBaseDecl = VBase.getType()->getAsCXXRecordDecl())
304 if (!VBaseDecl->hasCopyConstructorWithConstParam())
305 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
309 data().Aggregate =
false;
313 if (
Base->isVirtual()) {
315 if (SeenVBaseTypes.insert(
C.getCanonicalType(BaseType)).second)
316 VBases.push_back(
Base);
321 data().Empty =
false;
325 data().Aggregate =
false;
331 data().HasTrivialSpecialMembers &= SMF_Destructor;
332 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
337 data().IsStandardLayout =
false;
338 data().IsCXX11StandardLayout =
false;
344 data().DefaultedDefaultConstructorIsConstexpr =
false;
345 data().DefaultedDestructorIsConstexpr =
false;
352 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
353 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
359 if (!BaseClassDecl->hasTrivialDefaultConstructor())
360 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
367 if (!BaseClassDecl->hasTrivialCopyConstructor())
368 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
370 if (!BaseClassDecl->hasTrivialCopyConstructorForCall())
371 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
377 if (!BaseClassDecl->hasTrivialMoveConstructor())
378 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
380 if (!BaseClassDecl->hasTrivialMoveConstructorForCall())
381 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
388 if (!BaseClassDecl->hasTrivialCopyAssignment())
389 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
394 if (!BaseClassDecl->hasTrivialMoveAssignment())
395 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
401 if (!BaseClassDecl->hasConstexprDefaultConstructor())
402 data().DefaultedDefaultConstructorIsConstexpr =
false;
409 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
410 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
416 if (!BaseClassDecl->hasTrivialDestructor())
417 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
419 if (!BaseClassDecl->hasTrivialDestructorForCall())
420 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
422 if (!BaseClassDecl->hasIrrelevantDestructor())
423 data().HasIrrelevantDestructor =
false;
430 if (!BaseClassDecl->hasCopyAssignmentWithConstParam())
431 data().ImplicitCopyAssignmentHasConstParam =
false;
435 if (BaseClassDecl->hasObjectMember())
438 if (BaseClassDecl->hasVolatileMember())
441 if (BaseClassDecl->getArgPassingRestrictions() ==
446 if (BaseClassDecl->hasMutableFields())
447 data().HasMutableFields =
true;
449 if (BaseClassDecl->hasUninitializedReferenceMember())
450 data().HasUninitializedReferenceMember =
true;
452 if (!BaseClassDecl->allowConstDefaultInit())
453 data().HasUninitializedFields =
true;
455 addedClassSubobject(BaseClassDecl);
466 data().IsStandardLayout =
false;
468 if (VBases.empty()) {
469 data().IsParsingBaseSpecifiers =
false;
475 data().NumVBases = VBases.size();
476 for (
int I = 0, E = VBases.size(); I != E; ++I) {
480 data().getVBases()[I] = *VBases[I];
483 data().IsParsingBaseSpecifiers =
false;
487 assert(
hasDefinition() &&
"ODRHash only for records with definitions");
490 if (DefinitionData->HasODRHash)
491 return DefinitionData->ODRHash;
496 DefinitionData->HasODRHash =
true;
499 return DefinitionData->ODRHash;
502 void CXXRecordDecl::addedClassSubobject(
CXXRecordDecl *Subobj) {
510 data().NeedOverloadResolutionForCopyConstructor =
true;
512 data().NeedOverloadResolutionForMoveConstructor =
true;
521 data().NeedOverloadResolutionForCopyAssignment =
true;
523 data().NeedOverloadResolutionForMoveAssignment =
true;
533 data().NeedOverloadResolutionForCopyConstructor =
true;
534 data().NeedOverloadResolutionForMoveConstructor =
true;
535 data().NeedOverloadResolutionForDestructor =
true;
544 data().DefaultedDestructorIsConstexpr =
false;
550 if (!Subobj->data().StructuralIfLiteral)
551 data().StructuralIfLiteral =
false;
583 void CXXRecordDecl::markedVirtualFunctionPure() {
586 data().Abstract =
true;
589 bool CXXRecordDecl::hasSubobjectAtOffsetZeroOfEmptyBaseType(
600 RD = RD->getCanonicalDecl();
608 if (!RD->data().HasBasesWithFields) {
627 if (M.insert(RD).second)
628 WorkList.push_back(RD);
635 while (!WorkList.empty()) {
645 bool IsFirstField =
true;
646 for (
auto *FD :
X->fields()) {
649 if (FD->isUnnamedBitfield())
652 if (!IsFirstField && !FD->isZeroSize(Ctx))
662 IsFirstField =
false;
670 assert(
isLambda() &&
"not a lambda");
687 void CXXRecordDecl::addedMember(
Decl *D) {
689 !isa<FieldDecl>(D) &&
690 !isa<IndirectFieldDecl>(D) &&
691 (!isa<TagDecl>(D) || cast<TagDecl>(D)->getTagKind() ==
TTK_Class ||
693 data().HasOnlyCMembers =
false;
699 auto *FunTmpl = dyn_cast<FunctionTemplateDecl>(D);
701 D = FunTmpl->getTemplatedDecl();
704 Decl *DUnderlying = D;
705 if (
auto *ND = dyn_cast<NamedDecl>(DUnderlying)) {
706 DUnderlying = ND->getUnderlyingDecl();
707 if (
auto *UnderlyingFunTmpl = dyn_cast<FunctionTemplateDecl>(DUnderlying))
708 DUnderlying = UnderlyingFunTmpl->getTemplatedDecl();
711 if (
const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
712 if (Method->isVirtual()) {
715 data().Aggregate =
false;
719 data().PlainOldData =
false;
723 data().Empty =
false;
728 data().Polymorphic =
true;
734 data().HasTrivialSpecialMembers &= SMF_Destructor;
735 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
740 data().IsStandardLayout =
false;
741 data().IsCXX11StandardLayout =
false;
749 L->AddedCXXImplicitMember(data().
Definition, D);
755 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
762 data().UserDeclaredConstructor =
true;
769 data().PlainOldData =
false;
773 SMKind |= SMF_DefaultConstructor;
776 data().UserProvidedDefaultConstructor =
true;
778 data().HasConstexprDefaultConstructor =
true;
780 data().HasDefaultedDefaultConstructor =
true;
786 SMKind |= SMF_CopyConstructor;
789 data().HasDeclaredCopyConstructorWithConstParam =
true;
791 SMKind |= SMF_MoveConstructor;
803 data().Aggregate =
false;
808 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(DUnderlying)) {
816 data().HasConstexprNonCopyMoveConstructor =
true;
820 if (
const auto *DD = dyn_cast<CXXDestructorDecl>(D)) {
821 SMKind |= SMF_Destructor;
823 if (DD->isUserProvided())
824 data().HasIrrelevantDestructor =
false;
831 if (DD->isVirtual()) {
832 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
833 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
838 if (
const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
839 if (Method->isCopyAssignmentOperator()) {
840 SMKind |= SMF_CopyAssignment;
842 const auto *ParamTy =
844 if (!ParamTy || ParamTy->getPointeeType().isConstQualified())
845 data().HasDeclaredCopyAssignmentWithConstParam =
true;
848 if (Method->isMoveAssignmentOperator())
849 SMKind |= SMF_MoveAssignment;
852 if (
auto *Conversion = dyn_cast<CXXConversionDecl>(D)) {
861 if (Conversion->getPrimaryTemplate()) {
867 FunTmpl ? cast<NamedDecl>(FunTmpl) :
cast<
NamedDecl>(Conversion);
872 Conversions.
addDecl(Ctx, Primary, AS);
879 data().HasTrivialSpecialMembers &=
880 data().DeclaredSpecialMembers | ~SMKind;
881 data().HasTrivialSpecialMembersForCall &=
882 data().DeclaredSpecialMembers | ~SMKind;
884 if (!Method->isImplicit() && !Method->isUserProvided()) {
888 }
else if (Method->isTrivial()) {
889 data().HasTrivialSpecialMembers |= SMKind;
890 data().HasTrivialSpecialMembersForCall |= SMKind;
891 }
else if (Method->isTrivialForCall()) {
892 data().HasTrivialSpecialMembersForCall |= SMKind;
893 data().DeclaredNonTrivialSpecialMembers |= SMKind;
895 data().DeclaredNonTrivialSpecialMembers |= SMKind;
901 if (!Method->isUserProvided())
902 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
907 data().DeclaredSpecialMembers |= SMKind;
909 if (!Method->isImplicit()) {
910 data().UserDeclaredSpecialMembers |= SMKind;
923 data().PlainOldData =
false;
931 if (
const auto *Field = dyn_cast<FieldDecl>(D)) {
939 if (data().HasBasesWithFields)
940 data().IsStandardLayout =
false;
946 if (
Field->isUnnamedBitfield()) {
950 if (data().Empty && !
Field->isZeroLengthBitField(Context) &&
953 data().Empty =
false;
961 if (data().HasBasesWithNonStaticDataMembers)
962 data().IsCXX11StandardLayout =
false;
970 data().Aggregate =
false;
971 data().PlainOldData =
false;
976 data().StructuralIfLiteral =
false;
981 bool IsFirstField = !data().HasPrivateFields &&
982 !data().HasProtectedFields && !data().HasPublicFields;
989 case AS_private: data().HasPrivateFields =
true;
break;
990 case AS_protected: data().HasProtectedFields =
true;
break;
991 case AS_public: data().HasPublicFields =
true;
break;
992 case AS_none: llvm_unreachable(
"Invalid access specifier");
994 if ((data().HasPrivateFields + data().HasProtectedFields +
995 data().HasPublicFields) > 1) {
996 data().IsStandardLayout =
false;
997 data().IsCXX11StandardLayout =
false;
1001 if (
Field->isMutable()) {
1002 data().HasMutableFields =
true;
1007 data().StructuralIfLiteral =
false;
1014 data().HasVariantMembers =
true;
1033 struct DefinitionData &Data = data();
1034 Data.PlainOldData =
false;
1035 Data.HasTrivialSpecialMembers = 0;
1041 data().HasTrivialSpecialMembersForCall = 0;
1047 Data.HasIrrelevantDestructor =
false;
1050 data().DefaultedCopyConstructorIsDeleted =
true;
1051 data().DefaultedMoveConstructorIsDeleted =
true;
1052 data().DefaultedCopyAssignmentIsDeleted =
true;
1053 data().DefaultedMoveAssignmentIsDeleted =
true;
1054 data().DefaultedDestructorIsDeleted =
true;
1055 data().NeedOverloadResolutionForCopyConstructor =
true;
1056 data().NeedOverloadResolutionForMoveConstructor =
true;
1057 data().NeedOverloadResolutionForCopyAssignment =
true;
1058 data().NeedOverloadResolutionForMoveAssignment =
true;
1059 data().NeedOverloadResolutionForDestructor =
true;
1061 }
else if (!Context.
getLangOpts().ObjCAutoRefCount) {
1065 data().PlainOldData =
false;
1068 if (!
Field->hasInClassInitializer())
1069 data().HasUninitializedReferenceMember =
true;
1074 data().IsStandardLayout =
false;
1075 data().IsCXX11StandardLayout =
false;
1081 data().DefaultedCopyConstructorIsDeleted =
true;
1084 if (!
Field->hasInClassInitializer() && !
Field->isMutable()) {
1086 if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
1087 data().HasUninitializedFields =
true;
1089 data().HasUninitializedFields =
true;
1095 data().HasNonLiteralTypeFieldsOrBases =
true;
1097 if (
Field->hasInClassInitializer() ||
1098 (
Field->isAnonymousStructOrUnion() &&
1099 Field->getType()->getAsCXXRecordDecl()->hasInClassInitializer())) {
1100 data().HasInClassInitializer =
true;
1105 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1113 data().Aggregate =
false;
1117 data().PlainOldData =
false;
1125 data().DefaultedCopyAssignmentIsDeleted =
true;
1126 data().DefaultedMoveAssignmentIsDeleted =
true;
1131 bool IsZeroSize =
Field->isZeroSize(Context);
1134 auto *FieldRec = cast<CXXRecordDecl>(RecordTy->getDecl());
1135 if (FieldRec->getDefinition()) {
1136 addedClassSubobject(FieldRec);
1144 data().NeedOverloadResolutionForCopyConstructor =
true;
1145 data().NeedOverloadResolutionForMoveConstructor =
true;
1146 data().NeedOverloadResolutionForCopyAssignment =
true;
1147 data().NeedOverloadResolutionForMoveAssignment =
true;
1156 if (FieldRec->hasNonTrivialCopyConstructor())
1157 data().DefaultedCopyConstructorIsDeleted =
true;
1158 if (FieldRec->hasNonTrivialMoveConstructor())
1159 data().DefaultedMoveConstructorIsDeleted =
true;
1160 if (FieldRec->hasNonTrivialCopyAssignment())
1161 data().DefaultedCopyAssignmentIsDeleted =
true;
1162 if (FieldRec->hasNonTrivialMoveAssignment())
1163 data().DefaultedMoveAssignmentIsDeleted =
true;
1164 if (FieldRec->hasNonTrivialDestructor())
1165 data().DefaultedDestructorIsDeleted =
true;
1170 if (
Field->isAnonymousStructOrUnion()) {
1171 data().NeedOverloadResolutionForCopyConstructor |=
1172 FieldRec->data().NeedOverloadResolutionForCopyConstructor;
1173 data().NeedOverloadResolutionForMoveConstructor |=
1174 FieldRec->data().NeedOverloadResolutionForMoveConstructor;
1175 data().NeedOverloadResolutionForCopyAssignment |=
1176 FieldRec->data().NeedOverloadResolutionForCopyAssignment;
1177 data().NeedOverloadResolutionForMoveAssignment |=
1178 FieldRec->data().NeedOverloadResolutionForMoveAssignment;
1179 data().NeedOverloadResolutionForDestructor |=
1180 FieldRec->data().NeedOverloadResolutionForDestructor;
1188 if (!FieldRec->hasTrivialDefaultConstructor())
1189 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1197 if (!FieldRec->hasTrivialCopyConstructor())
1198 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
1200 if (!FieldRec->hasTrivialCopyConstructorForCall())
1201 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
1206 if (!FieldRec->hasTrivialMoveConstructor())
1207 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
1209 if (!FieldRec->hasTrivialMoveConstructorForCall())
1210 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
1218 if (!FieldRec->hasTrivialCopyAssignment())
1219 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
1223 if (!FieldRec->hasTrivialMoveAssignment())
1224 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
1226 if (!FieldRec->hasTrivialDestructor())
1227 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1228 if (!FieldRec->hasTrivialDestructorForCall())
1229 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1230 if (!FieldRec->hasIrrelevantDestructor())
1231 data().HasIrrelevantDestructor =
false;
1232 if (FieldRec->hasObjectMember())
1234 if (FieldRec->hasVolatileMember())
1236 if (FieldRec->getArgPassingRestrictions() ==
1244 if (!FieldRec->isStandardLayout())
1245 data().IsStandardLayout =
false;
1246 if (!FieldRec->isCXX11StandardLayout())
1247 data().IsCXX11StandardLayout =
false;
1253 if (data().IsStandardLayout &&
1254 (
isUnion() || IsFirstField || IsZeroSize) &&
1255 hasSubobjectAtOffsetZeroOfEmptyBaseType(Context, FieldRec))
1256 data().IsStandardLayout =
false;
1262 if (data().IsCXX11StandardLayout && IsFirstField) {
1265 for (
const auto &BI :
bases()) {
1267 data().IsCXX11StandardLayout =
false;
1274 if (FieldRec->hasMutableFields())
1275 data().HasMutableFields =
true;
1277 if (
Field->isMutable()) {
1281 data().NeedOverloadResolutionForCopyConstructor =
true;
1282 data().NeedOverloadResolutionForCopyAssignment =
true;
1292 if (!
Field->hasInClassInitializer() &&
1293 !FieldRec->hasConstexprDefaultConstructor() && !
isUnion())
1296 data().DefaultedDefaultConstructorIsConstexpr =
false;
1303 if (!FieldRec->hasCopyConstructorWithConstParam())
1304 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
1312 if (!FieldRec->hasCopyAssignmentWithConstParam())
1313 data().ImplicitCopyAssignmentHasConstParam =
false;
1315 if (FieldRec->hasUninitializedReferenceMember() &&
1316 !
Field->hasInClassInitializer())
1317 data().HasUninitializedReferenceMember =
true;
1322 if (FieldRec->hasVariantMembers() &&
1323 Field->isAnonymousStructOrUnion())
1324 data().HasVariantMembers =
true;
1331 data().DefaultedDefaultConstructorIsConstexpr =
false;
1339 data().DefaultedCopyAssignmentIsDeleted =
true;
1340 data().DefaultedMoveAssignmentIsDeleted =
true;
1349 data().StructuralIfLiteral =
false;
1355 if (data().Empty && !IsZeroSize)
1356 data().Empty =
false;
1360 if (
auto *Shadow = dyn_cast<UsingShadowDecl>(D)) {
1361 if (Shadow->getDeclName().getNameKind()
1364 data().Conversions.get(Ctx).addDecl(Ctx, Shadow, Shadow->getAccess());
1368 if (
const auto *Using = dyn_cast<UsingDecl>(D)) {
1369 if (
Using->getDeclName().getNameKind() ==
1371 data().HasInheritedConstructor =
true;
1374 data().Aggregate =
false;
1377 if (
Using->getDeclName().getCXXOverloadedOperator() == OO_Equal)
1378 data().HasInheritedAssignment =
true;
1386 unsigned SMKind = 0;
1388 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1389 if (Constructor->isDefaultConstructor()) {
1390 SMKind |= SMF_DefaultConstructor;
1391 if (Constructor->isConstexpr())
1392 data().HasConstexprDefaultConstructor =
true;
1394 if (Constructor->isCopyConstructor())
1395 SMKind |= SMF_CopyConstructor;
1396 else if (Constructor->isMoveConstructor())
1397 SMKind |= SMF_MoveConstructor;
1398 else if (Constructor->isConstexpr())
1400 data().HasConstexprNonCopyMoveConstructor =
true;
1401 }
else if (isa<CXXDestructorDecl>(D)) {
1402 SMKind |= SMF_Destructor;
1404 data().HasIrrelevantDestructor =
false;
1406 SMKind |= SMF_CopyAssignment;
1408 SMKind |= SMF_MoveAssignment;
1413 data().HasTrivialSpecialMembers |= SMKind;
1415 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1420 CXXRecordDecl::LambdaDefinitionData &Data = getLambdaData();
1423 Data.NumCaptures = Captures.size();
1424 Data.NumExplicitCaptures = 0;
1428 for (
unsigned I = 0, N = Captures.size(); I != N; ++I) {
1429 if (Captures[I].isExplicit())
1430 ++Data.NumExplicitCaptures;
1432 *ToCapture++ = Captures[I];
1436 Data.DefaultedCopyAssignmentIsDeleted =
true;
1440 unsigned SMKind = 0;
1442 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1443 if (Constructor->isCopyConstructor())
1444 SMKind = SMF_CopyConstructor;
1445 else if (Constructor->isMoveConstructor())
1446 SMKind = SMF_MoveConstructor;
1447 }
else if (isa<CXXDestructorDecl>(D))
1448 SMKind = SMF_Destructor;
1451 data().HasTrivialSpecialMembersForCall |= SMKind;
1453 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1458 !TemplateOrInstantiation.isNull())
1463 return isPOD() && data().HasOnlyCMembers;
1468 return getLambdaData().IsGenericLambda;
1481 if (!RD.
isLambda())
return nullptr;
1486 assert(!Calls.
empty() &&
"Missing lambda call operator!");
1488 "More than one lambda call operator!");
1489 return Calls.
front();
1494 return dyn_cast_or_null<FunctionTemplateDecl>(CallOp);
1500 if (CallOp ==
nullptr)
1503 if (
const auto *CallOpTmpl = dyn_cast<FunctionTemplateDecl>(CallOp))
1504 return cast<CXXMethodDecl>(CallOpTmpl->getTemplatedDecl());
1506 return cast<CXXMethodDecl>(CallOp);
1517 assert(RD.
isLambda() &&
"Must be a lambda");
1524 if (
const auto *InvokerTemplate = dyn_cast<FunctionTemplateDecl>(ND))
1525 return cast<CXXMethodDecl>(InvokerTemplate->getTemplatedDecl());
1526 return cast<CXXMethodDecl>(ND);
1536 cast<ValueDecl>(ND->getAsFunction())->getType()->castAs<
FunctionType>();
1537 if (FTy->getCallConv() == CC)
1545 llvm::DenseMap<const VarDecl *, FieldDecl *> &Captures,
1548 ThisCapture =
nullptr;
1550 LambdaDefinitionData &Lambda = getLambdaData();
1552 for (
const LambdaCapture *
C = Lambda.Captures, *CEnd =
C + Lambda.NumCaptures;
1553 C != CEnd; ++
C, ++Field) {
1554 if (
C->capturesThis())
1555 ThisCapture = *Field;
1556 else if (
C->capturesVariable())
1557 Captures[
C->getCapturedVar()] = *Field;
1567 return Tmpl->getTemplateParameters();
1577 assert(std::is_partitioned(List->begin(), List->end(),
1579 &&
"Explicit template params should be ordered before implicit ones");
1581 const auto ExplicitEnd = llvm::partition_point(
1583 return llvm::makeArrayRef(List->begin(), ExplicitEnd);
1587 assert(
isLambda() &&
"Not a lambda closure type!");
1589 return getLambdaData().ContextDecl.get(Source);
1595 ->getConversionType();
1627 if (ConvI != ConvE) {
1628 HiddenTypesBuffer = ParentHiddenTypes;
1629 HiddenTypes = &HiddenTypesBuffer;
1633 bool Hidden = ParentHiddenTypes.count(ConvType);
1635 HiddenTypesBuffer.insert(ConvType);
1639 if (Hidden && InVirtual)
1640 HiddenVBaseCs.insert(cast<NamedDecl>(I.getDecl()->getCanonicalDecl()));
1648 VOutput.
addDecl(I.getDecl(), IAccess);
1650 Output.
addDecl(Context, I.getDecl(), IAccess);
1656 for (
const auto &I : Record->
bases()) {
1657 const auto *RT = I.getType()->getAs<
RecordType>();
1662 bool BaseInVirtual = InVirtual || I.isVirtual();
1664 auto *
Base = cast<CXXRecordDecl>(RT->getDecl());
1666 *HiddenTypes, Output, VOutput, HiddenVBaseCs);
1693 Output.
append(Context, ConvI, ConvE);
1694 for (; ConvI != ConvE; ++ConvI)
1698 for (
const auto &I : Record->
bases()) {
1699 const auto *RT = I.getType()->getAs<
RecordType>();
1703 I.isVirtual(), I.getAccessSpecifier(),
1704 HiddenTypes, Output, VBaseCs, HiddenVBaseCs);
1710 if (!HiddenVBaseCs.count(cast<NamedDecl>(I.getDecl()->getCanonicalDecl())))
1711 Output.
addDecl(Context, I.getDecl(), I.getAccess());
1717 llvm::iterator_range<CXXRecordDecl::conversion_iterator>
1724 Set = &data().Conversions.get(Ctx);
1726 Set = &data().VisibleConversions.get(Ctx);
1728 if (!data().ComputedVisibleConversions) {
1730 data().ComputedVisibleConversions =
true;
1733 return llvm::make_range(Set->
begin(), Set->
end());
1749 for (
unsigned I = 0, E = Convs.
size(); I != E; ++I) {
1750 if (Convs[I].getDecl() == ConvDecl) {
1752 assert(llvm::find(Convs, ConvDecl) == Convs.
end() &&
1753 "conversion was found multiple times in unresolved set");
1758 llvm_unreachable(
"conversion not found in set!");
1763 return cast<CXXRecordDecl>(MSInfo->getInstantiatedFrom());
1775 assert(TemplateOrInstantiation.isNull() &&
1776 "Previous template or instantiation?");
1777 assert(!isa<ClassTemplatePartialSpecializationDecl>(
this));
1778 TemplateOrInstantiation
1787 TemplateOrInstantiation = Template;
1791 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this))
1792 return Spec->getSpecializationKind();
1795 return MSInfo->getTemplateSpecializationKind();
1802 if (
auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1803 Spec->setSpecializationKind(TSK);
1808 MSInfo->setTemplateSpecializationKind(TSK);
1812 llvm_unreachable(
"Not a class template or member class specialization");
1816 auto GetDefinitionOrSelf =
1818 if (
auto *Def = D->getDefinition())
1825 if (
auto *TD = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1826 auto From = TD->getInstantiatedFrom();
1828 while (
auto *NewCTD = CTD->getInstantiatedFromMemberTemplate()) {
1829 if (NewCTD->isMemberSpecialization())
1833 return GetDefinitionOrSelf(CTD->getTemplatedDecl());
1837 while (
auto *NewCTPSD = CTPSD->getInstantiatedFromMember()) {
1838 if (NewCTPSD->isMemberSpecialization())
1842 return GetDefinitionOrSelf(CTPSD);
1851 return GetDefinitionOrSelf(RD);
1856 "couldn't find pattern for class template instantiation");
1870 return R.
empty() ? nullptr : dyn_cast<CXXDestructorDecl>(R.
front());
1876 if (Destructor->isNoReturn())
1882 if (RD->isAnyDestructorNoReturn())
1886 for (
const auto *Field :
fields())
1888 Field->getType()->getBaseElementTypeUnsafe()->getAsCXXRecordDecl())
1889 if (RD->isAnyDestructorNoReturn())
1906 assert(
hasDefinition() &&
"checking for interface-like without a definition");
1920 for (
const auto *
const Method :
methods())
1921 if (Method->isDefined() && !Method->isImplicit())
1925 const auto *Uuid = getAttr<UuidAttr>();
1932 Uuid->getGuid() ==
"00000000-0000-0000-C000-000000000046") ||
1934 Uuid->getGuid() ==
"00020400-0000-0000-C000-000000000046"))) {
1948 if (BaseSpec.isVirtual() || BaseSpec.getAccessSpecifier() !=
AS_public)
1950 const auto *
Base = BaseSpec.getType()->getAsCXXRecordDecl();
1951 if (
Base->isInterface() || !
Base->isInterfaceLike())
1967 if (!FinalOverriders) {
1969 FinalOverriders = &MyFinalOverriders;
1973 for (CXXFinalOverriderMap::iterator M = FinalOverriders->begin(),
1974 MEnd = FinalOverriders->end();
1975 M != MEnd && !Done; ++M) {
1977 SOEnd = M->second.end();
1978 SO != SOEnd && !Done; ++SO) {
1979 assert(SO->second.size() > 0 &&
1980 "All virtual functions have overriding virtual functions");
1986 if (SO->second.front().Method->isPure()) {
1987 data().Abstract =
true;
1998 I.setAccess((*I)->getAccess());
2002 if (data().Abstract ||
isInvalidDecl() || !data().Polymorphic ||
2006 for (
const auto &B :
bases()) {
2007 const auto *BaseDecl =
2008 cast<CXXRecordDecl>(B.getType()->castAs<
RecordType>()->getDecl());
2009 if (BaseDecl->isAbstract())
2020 if (Def->hasAttr<FinalAttr>())
2022 if (
const auto *Dtor = Def->getDestructor())
2023 if (Dtor->hasAttr<FinalAttr>())
2028 void CXXDeductionGuideDecl::anchor() {}
2046 switch (Function->getDeclKind()) {
2047 case Decl::Kind::CXXConstructor:
2048 return cast<CXXConstructorDecl>(Function)->getExplicitSpecifier();
2049 case Decl::Kind::CXXConversion:
2050 return cast<CXXConversionDecl>(Function)->getExplicitSpecifier();
2051 case Decl::Kind::CXXDeductionGuide:
2052 return cast<CXXDeductionGuideDecl>(Function)->getExplicitSpecifier();
2063 TInfo, EndLocation);
2083 void CXXMethodDecl::anchor() {}
2113 if (isa<CXXDestructorDecl>(
this)) {
2125 auto *MD = dyn_cast<CXXMethodDecl>(ND);
2153 FinalOverriders.erase(
2154 std::remove_if(FinalOverriders.begin(), FinalOverriders.end(),
2158 FinalOverriders.end());
2160 FinalOverriders.push_back(D);
2163 for (
const auto &I : RD->
bases()) {
2167 const auto *
Base = cast<CXXRecordDecl>(RT->
getDecl());
2169 AddFinalOverrider(D);
2172 return FinalOverriders.size() == 1 ? FinalOverriders.front() :
nullptr;
2182 Expr *TrailingRequiresClause) {
2184 CXXMethodDecl(CXXMethod,
C, RD, StartLoc, NameInfo, T, TInfo, SC,
2185 isInline, ConstexprKind, EndLocation,
2186 TrailingRequiresClause);
2198 assert(
isVirtual() &&
"this method is expected to be virtual");
2207 if (hasAttr<FinalAttr>())
2208 return isPure() ? nullptr :
this;
2216 Base =
Base->getBestDynamicClassTypeExpr();
2217 if (
Base->isRValue() &&
Base->getType()->isRecordType())
2222 if (!BestDynamicDecl)
2231 if (!DevirtualizedMethod)
2237 if (DevirtualizedMethod->
isPure())
2241 if (DevirtualizedMethod->
hasAttr<FinalAttr>())
2242 return DevirtualizedMethod;
2248 return DevirtualizedMethod;
2250 if (
const auto *DRE = dyn_cast<DeclRefExpr>(
Base)) {
2251 if (
const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
2252 if (VD->getType()->isRecordType())
2254 return DevirtualizedMethod;
2262 if (
const auto *ME = dyn_cast<MemberExpr>(
Base)) {
2263 const ValueDecl *VD = ME->getMemberDecl();
2269 if (
auto *BO = dyn_cast<BinaryOperator>(
Base)) {
2270 if (BO->isPtrMemOp()) {
2272 if (MPT->getPointeeType()->isRecordType())
2273 return DevirtualizedMethod;
2283 assert(PreventedBy.empty() &&
"PreventedBy is expected to be empty");
2300 unsigned UsualParams = 1;
2347 for (
const auto *D : R) {
2348 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
2349 if (FD->getNumParams() == 1) {
2350 PreventedBy.push_back(FD);
2390 if (!isa<RValueReferenceType>(ParamType))
2403 "Can't add an overridden method to a class template!");
2404 assert(MD->
isVirtual() &&
"Method is not virtual!");
2410 if (isa<CXXConstructorDecl>(
this))
return nullptr;
2415 if (isa<CXXConstructorDecl>(
this))
return nullptr;
2420 if (isa<CXXConstructorDecl>(
this))
return 0;
2426 if (isa<CXXConstructorDecl>(
this))
2441 return C.getPointerType(ObjectTy);
2456 assert(
isInstance() &&
"No 'this' for static methods!");
2463 assert(
isInstance() &&
"No 'this' for static methods!");
2491 : Initializee(TInfo), MemberOrEllipsisLocation(EllipsisLoc), Init(Init),
2492 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(IsVirtual),
2493 IsWritten(
false), SourceOrder(0) {}
2500 : Initializee(
Member), MemberOrEllipsisLocation(MemberLoc), Init(Init),
2501 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2502 IsWritten(
false), SourceOrder(0) {}
2509 : Initializee(
Member), MemberOrEllipsisLocation(MemberLoc), Init(Init),
2510 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2511 IsWritten(
false), SourceOrder(0) {}
2517 : Initializee(TInfo), Init(Init), LParenLoc(L), RParenLoc(R),
2518 IsDelegating(
true), IsVirtual(
false), IsWritten(
false), SourceOrder(0) {}
2534 return Initializee.get<
TypeSourceInfo*>()->getType().getTypePtr();
2547 return TSInfo->getTypeLoc().getLocalSourceRange().getBegin();
2556 return I->getSourceRange();
2563 CXXConstructorDecl::CXXConstructorDecl(
2568 Expr *TrailingRequiresClause)
2569 :
CXXMethodDecl(CXXConstructor,
C, RD, StartLoc, NameInfo, T, TInfo,
2571 TrailingRequiresClause) {
2572 setNumCtorInitializers(0);
2573 setInheritingConstructor(static_cast<bool>(Inherited));
2574 setImplicit(isImplicitlyDeclared);
2575 CXXConstructorDeclBits.HasTrailingExplicitSpecifier = ES.
getExpr() ? 1 : 0;
2577 *getTrailingObjects<InheritedConstructor>() = Inherited;
2578 setExplicitSpecifier(ES);
2581 void CXXConstructorDecl::anchor() {}
2586 bool hasTraillingExplicit = static_cast<bool>(
AllocKind & TAKHasTailExplicit);
2588 static_cast<bool>(
AllocKind & TAKInheritsConstructor);
2590 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2597 Result->CXXConstructorDeclBits.HasTrailingExplicitSpecifier =
2598 hasTraillingExplicit;
2608 Expr *TrailingRequiresClause) {
2611 "Name must refer to a constructor");
2613 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2614 Inherited ? 1 : 0, ES.
getExpr() ? 1 : 0);
2615 return new (
C, RD, Extra)
2617 isImplicitlyDeclared, ConstexprKind, Inherited,
2618 TrailingRequiresClause);
2628 if (
const auto *Construct = dyn_cast<CXXConstructExpr>(E))
2629 return Construct->getConstructor();
2729 void CXXDestructorDecl::anchor() {}
2742 Expr *TrailingRequiresClause) {
2745 "Name must refer to a destructor");
2748 isImplicitlyDeclared, ConstexprKind,
2749 TrailingRequiresClause);
2754 if (OD && !
First->OperatorDelete) {
2755 First->OperatorDelete = OD;
2756 First->OperatorDeleteThisArg = ThisArg;
2758 L->ResolvedOperatorDelete(
First, OD, ThisArg);
2762 void CXXConversionDecl::anchor() {}
2779 "Name must refer to a conversion function");
2782 ConstexprKind, EndLocation, TrailingRequiresClause);
2799 void LinkageSpecDecl::anchor() {}
2807 return new (
C, DC)
LinkageSpecDecl(DC, ExternLoc, LangLoc, Lang, HasBraces);
2816 void UsingDirectiveDecl::anchor() {}
2825 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(
Used))
2826 Used = NS->getOriginalNamespace();
2828 IdentLoc,
Used, CommonAncestor);
2840 if (
auto *NA = dyn_cast_or_null<NamespaceAliasDecl>(NominatedNamespace))
2841 return NA->getNamespace();
2842 return cast_or_null<NamespaceDecl>(NominatedNamespace);
2849 redeclarable_base(
C), LocStart(StartLoc),
2850 AnonOrFirstNamespaceAndInline(nullptr, Inline) {
2851 setPreviousDecl(PrevDecl);
2874 return AnonOrFirstNamespaceAndInline.getPointer();
2881 return AnonOrFirstNamespaceAndInline.getPointer();
2898 void NamespaceAliasDecl::anchor() {}
2920 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(Namespace))
2921 Namespace = NS->getOriginalNamespace();
2923 QualifierLoc, IdentLoc, Namespace);
2934 void LifetimeExtendedTemporaryDecl::anchor() {}
2943 if (isa<FieldDecl>(ExtendingDecl))
2947 if (isa<BindingDecl>(ExtendingDecl))
2950 return cast<VarDecl>(ExtendingDecl)->getStorageDuration();
2955 "don't need to cache the computed value for this temporary");
2956 if (MayCreate && !
Value) {
2960 assert(
Value &&
"may not be null");
2964 void UsingShadowDecl::anchor() {}
2987 while (
const auto *NextShadow =
2988 dyn_cast<UsingShadowDecl>(Shadow->UsingOrNextShadow))
2989 Shadow = NextShadow;
2990 return cast<UsingDecl>(Shadow->UsingOrNextShadow);
2993 void ConstructorUsingShadowDecl::anchor() {}
3012 void UsingDecl::anchor() {}
3016 "declaration already in set");
3017 assert(S->getUsingDecl() ==
this);
3019 if (FirstUsingShadow.getPointer())
3020 S->UsingOrNextShadow = FirstUsingShadow.getPointer();
3021 FirstUsingShadow.setPointer(S);
3026 "declaration not in set");
3027 assert(S->getUsingDecl() ==
this);
3031 if (FirstUsingShadow.getPointer() == S) {
3032 FirstUsingShadow.setPointer(
3033 dyn_cast<UsingShadowDecl>(S->UsingOrNextShadow));
3034 S->UsingOrNextShadow =
this;
3039 while (Prev->UsingOrNextShadow != S)
3040 Prev = cast<UsingShadowDecl>(Prev->UsingOrNextShadow);
3041 Prev->UsingOrNextShadow = S->UsingOrNextShadow;
3042 S->UsingOrNextShadow =
this;
3049 return new (
C, DC)
UsingDecl(DC, UL, QualifierLoc, NameInfo, HasTypename);
3064 void UsingPackDecl::anchor() {}
3069 size_t Extra = additionalSizeToAlloc<NamedDecl *>(UsingDecls.size());
3070 return new (
C, DC, Extra)
UsingPackDecl(DC, InstantiatedFrom, UsingDecls);
3074 unsigned NumExpansions) {
3075 size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
3077 Result->NumExpansions = NumExpansions;
3079 for (
unsigned I = 0; I != NumExpansions; ++I)
3084 void UnresolvedUsingValueDecl::anchor() {}
3093 QualifierLoc, NameInfo,
3112 void UnresolvedUsingTypenameDecl::anchor() {}
3123 DC, UsingLoc, TypenameLoc, QualifierLoc, TargetNameLoc,
3134 void StaticAssertDecl::anchor() {}
3152 void BindingDecl::anchor() {}
3166 return cast_or_null<ValueDecl>(Decomp.
get(Source));
3177 auto *VD = cast<VarDecl>(DRE->getDecl());
3178 assert(VD->isImplicit() &&
"holding var for binding decl not implicit");
3182 void DecompositionDecl::anchor() {}
3190 size_t Extra = additionalSizeToAlloc<BindingDecl *>(Bindings.size());
3191 return new (
C, DC, Extra)
3197 unsigned NumBindings) {
3198 size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
3203 Result->NumBindings = NumBindings;
3205 for (
unsigned I = 0; I != NumBindings; ++I)
3222 void MSPropertyDecl::anchor() {}
3230 return new (
C, DC)
MSPropertyDecl(DC, L, N, T, TInfo, StartL, Getter, Setter);
3240 void MSGuidDecl::anchor() {}
3244 PartVal(
P), APVal() {}
3256 OS << llvm::format(
"GUID{%08" PRIx32
"-%04" PRIx16
"-%04" PRIx16
"-",
3259 for (uint8_t Byte : PartVal.
Part4And5) {
3260 OS << llvm::format(
"%02" PRIx8, Byte);
3273 auto IsInt = [&Ctx](
unsigned N) {
3280 auto IsArray = [&Ctx](MatcherRef Elem,
unsigned N) {
3281 return [&Ctx, Elem, N](
QualType T) {
3287 auto IsStruct = [](std::initializer_list<MatcherRef> Fields) {
3295 if (
auto *CXXRD = dyn_cast<CXXRecordDecl>(RD))
3296 if (CXXRD->getNumBases())
3298 auto MatcherIt = Fields.begin();
3300 if (FD->isUnnamedBitfield())
continue;
3301 if (FD->isBitField() || MatcherIt == Fields.end() ||
3302 !(*MatcherIt)(FD->getType()))
3306 return MatcherIt == Fields.end();
3311 return IsStruct({IsInt(32), IsInt(16), IsInt(16), IsArray(IsInt(8), 8)})(T);
3324 for (
unsigned I = 0; I != 8; ++I) {
3339 llvm_unreachable(
"Invalid access specifier!");
3347 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.
bool isUsualDeallocationFunction(SmallVectorImpl< const FunctionDecl * > &PreventedBy) const
Determine whether this is a usual deallocation function (C++ [basic.stc.dynamic.deallocation]p2),...
A (possibly-)qualified type.
bool isBlockPointerType() const
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).
bool isUnsignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is unsigned or an enumeration types whose underlying ...
unsigned getNumBases() const
Retrieves the number of base classes of this class.
bool forallBases(ForallBasesCallback BaseMatches) const
Determines if the given callback holds for all the direct or indirect base classes of this type.
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.
FunctionType - C99 6.7.5.3 - Function Declarators.
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.
bool hasSimpleCopyAssignment() const
true if we know for sure that this class has a single, accessible, unambiguous copy assignment operat...
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
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,...
bool isRecordType() const
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)
shadow_iterator shadow_end() const
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,...
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]).
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
QualType getConversionType() const
Returns the type that this conversion function is converting to.
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...
static QualType getThisObjectType(ASTContext &C, const FunctionProtoType *FPT, const CXXRecordDecl *Decl)
QualType getElementType() const
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
CXXMethodDecl(Kind DK, ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInline, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
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>'.
APValue & getAsAPValue() const
Get the value of this MSGuidDecl as an APValue.
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
bool isStructuralType() const
Determine if this type is a structural type, per C++20 [temp.param]p7.
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.
DeclarationNameInfo getNameInfo() const
bool hasOneParamOrDefaultArgs() const
Determine whether this function has a single parameter, or multiple parameters where all but the firs...
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.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
static bool isValidStructGUID(ASTContext &Ctx, QualType T)
Determine if T is a valid 'struct _GUID' of the shape that we expect.
ValueDecl * getExtendingDecl()
LinkageSpecDeclBitfields LinkageSpecDeclBits
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.
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
field_range fields() const
NameKind getNameKind() const
Determine what kind of name this is.
Represents a member of a struct/union/class.
unsigned capture_size() const
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)
bool isDefined(const FunctionDecl *&Definition, bool CheckForPendingFriendDefinition=false) const
Returns true if the function has a definition that does not need to be instantiated.
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.
ArrayRef< BindingDecl * > bindings() const
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)
bool isDelegatingConstructor() const
Determine whether this constructor is a delegating constructor.
TagKind getTagKind() const
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 isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
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.
static CXXMethodDecl * getInvokerAsMethod(NamedDecl *ND)
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.
shadow_iterator shadow_begin() const
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)
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
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.
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
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...
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.
OverloadedOperatorKind getOverloadedOperator() const
getOverloadedOperator - Which C++ overloaded operator this function represents, if any.
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
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
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.
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...
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
This represents one expression.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Defines the clang::LangOptions interface.
bool isVariadic() const
Whether this function is variadic.
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)
DeclarationNameInfo getNameInfo() const
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...
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
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.
void addDestruction(T *Ptr) const
If T isn't trivially destructible, calls AddDeallocation to register it for destruction.
bool isIdentifier() const
Predicate functions for querying what type of name this is.
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
APValue & getStructField(unsigned i)
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,...
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....
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
CallingConv
CallingConv - Specifies the calling convention that a function uses.
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,...
FunctionDecl * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
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
APValue & getArrayInitializedElt(unsigned I)
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)
NamespaceDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
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.
static DecompositionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation LSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl * > Bindings)
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 OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > PL, ArrayRef< Expr * > IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
static DecompositionDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumBindings)
Represents a dependent using declaration which was not marked with typename.
const LangOptions & getLangOpts() const LLVM_READONLY
Helper to get the language options from the ASTContext.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set.
void printName(llvm::raw_ostream &OS) const override
Print this UUID in a human-readable format.
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.
llvm::iterator_range< llvm::TinyPtrVector< const CXXMethodDecl * >::const_iterator > overridden_method_range
const ConstantArrayType * getAsConstantArrayType(QualType T) const
void addOverriddenMethod(const CXXMethodDecl *MD)
const ParmVarDecl * getParamDecl(unsigned i) const
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
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)
static ConstructorUsingShadowDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, UsingDecl *Using, NamedDecl *Target, bool IsVirtual)
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to call this function.
This template specialization was formed from a template-id but has not yet been declared,...
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
bool isEffectivelyFinal() const
Determine whether it's impossible for a class to be derived from this class.
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.
void * Allocate(size_t Size, unsigned Align=8) const
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.
static bool isStaticOverloadedOperator(OverloadedOperatorKind OOK)
Returns true if the given operator is implicitly static in a record context.
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.
bool isExplicit() const
Return true if the declartion is already resolved to be explicit.
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...
FunctionDecl * getTemplateInstantiationPattern(bool ForDefinition=true) const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
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...
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
Represents a field injected from an anonymous union/struct into the parent scope.
SourceLocation getSourceLocation() const
Determine the source location of the initializer.
uint32_t Part1
{01234567-...
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)
static UsingPackDecl * Create(ASTContext &C, DeclContext *DC, NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl * > UsingDecls)
A pointer to member type per C++ 8.3.3 - Pointers to members.
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
bool isDestroyingOperatorDelete() const
Determine whether this is a destroying operator delete.
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.
T * get(ExternalASTSource *Source) const
Retrieve the pointer to the AST node that this lazy pointer points to.
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext,...
bool hasNonTrivialCopyAssignment() const
Determine whether this class has a non-trivial copy assignment operator (C++ [class....
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.
unsigned getIntWidth(QualType T) const
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...
void setCaptures(ASTContext &Context, ArrayRef< LambdaCapture > Captures)
Set the captures for this lambda closure type.
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.
const llvm::APInt & getSize() const
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.
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,...
NamespaceDecl * getNextRedeclaration() const
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 ...
bool isLValueReferenceType() const
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....
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
Pretty-print the unqualified name of this declaration.
base_class_iterator bases_end()
ASTImporterLookupTable & LT
uint8_t Part4And5[8]
...-0123-456789abcdef}
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.
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...
bool isOffset() const
Whether this pointer is currently stored as an offset.
uint16_t Part3
...-cdef-...
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.
NamedDecl * getMostRecentDecl()
bool isDeleted() const
Whether this function has been deleted.
Expr * getBinding() const
Get the expression to which this declaration is bound.
uint16_t Part2
...-89ab-...
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 DeclContext::lookup_result getLambdaStaticInvokers(const CXXRecordDecl &RD)
static BindingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
const LangOptions & getLangOpts() const
Represents the canonical version of C arrays with a specified constant size.
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>.
bool isInheritingConstructor() const
Determine whether this is an implicit constructor synthesized to model a call to a constructor inheri...
method_range methods() const