40#include "llvm/ADT/SmallPtrSet.h"
41#include "llvm/ADT/SmallVector.h"
42#include "llvm/ADT/iterator_range.h"
43#include "llvm/Support/Casting.h"
44#include "llvm/Support/ErrorHandling.h"
45#include "llvm/Support/Format.h"
46#include "llvm/Support/raw_ostream.h"
58void AccessSpecDecl::anchor() {}
65void LazyASTUnresolvedSet::getFromExternalSource(
ASTContext &
C)
const {
67 assert(Impl.Decls.isLazy() &&
"getFromExternalSource for non-lazy set");
68 assert(Source &&
"getFromExternalSource with no external source");
73 Impl.Decls.setLazy(
false);
77 : UserDeclaredConstructor(
false), UserDeclaredSpecialMembers(0),
79 Abstract(
false), IsStandardLayout(
true), IsCXX11StandardLayout(
true),
80 HasBasesWithFields(
false), HasBasesWithNonStaticDataMembers(
false),
81 HasPrivateFields(
false), HasProtectedFields(
false),
82 HasPublicFields(
false), HasMutableFields(
false), HasVariantMembers(
false),
83 HasOnlyCMembers(
true), HasInitMethod(
false), HasInClassInitializer(
false),
84 HasUninitializedReferenceMember(
false), HasUninitializedFields(
false),
85 HasInheritedConstructor(
false), HasInheritedDefaultConstructor(
false),
86 HasInheritedAssignment(
false),
87 NeedOverloadResolutionForCopyConstructor(
false),
88 NeedOverloadResolutionForMoveConstructor(
false),
89 NeedOverloadResolutionForCopyAssignment(
false),
90 NeedOverloadResolutionForMoveAssignment(
false),
91 NeedOverloadResolutionForDestructor(
false),
92 DefaultedCopyConstructorIsDeleted(
false),
93 DefaultedMoveConstructorIsDeleted(
false),
94 DefaultedCopyAssignmentIsDeleted(
false),
95 DefaultedMoveAssignmentIsDeleted(
false),
96 DefaultedDestructorIsDeleted(
false), HasTrivialSpecialMembers(SMF_All),
97 HasTrivialSpecialMembersForCall(SMF_All),
98 DeclaredNonTrivialSpecialMembers(0),
99 DeclaredNonTrivialSpecialMembersForCall(0), HasIrrelevantDestructor(
true),
100 HasConstexprNonCopyMoveConstructor(
false),
101 HasDefaultedDefaultConstructor(
false),
102 DefaultedDefaultConstructorIsConstexpr(
true),
103 HasConstexprDefaultConstructor(
false),
104 DefaultedDestructorIsConstexpr(
true),
105 HasNonLiteralTypeFieldsOrBases(
false), StructuralIfLiteral(
true),
106 UserProvidedDefaultConstructor(
false), DeclaredSpecialMembers(0),
107 ImplicitCopyConstructorCanHaveConstParamForVBase(
true),
108 ImplicitCopyConstructorCanHaveConstParamForNonVBase(
true),
109 ImplicitCopyAssignmentHasConstParam(
true),
110 HasDeclaredCopyConstructorWithConstParam(
false),
111 HasDeclaredCopyAssignmentWithConstParam(
false),
112 IsAnyDestructorNoReturn(
false), IsLambda(
false),
113 IsParsingBaseSpecifiers(
false), ComputedVisibleConversions(
false),
117 return Bases.get(
Definition->getASTContext().getExternalSource());
121 return VBases.get(
Definition->getASTContext().getExternalSource());
129 DefinitionData(PrevDecl ? PrevDecl->DefinitionData
136 bool DelayTypeCreation) {
142 if (!DelayTypeCreation)
143 C.getTypeDeclType(R, PrevDecl);
150 unsigned DependencyKind,
bool IsGeneric,
153 Loc,
nullptr,
nullptr);
155 R->DefinitionData =
new (
C)
struct LambdaDefinitionData(
156 R, Info, DependencyKind, IsGeneric, CaptureDefault);
157 R->setMayHaveOutOfDateDef(
false);
158 R->setImplicit(
true);
160 C.getTypeDeclType(R,
nullptr);
166 auto *R =
new (
C, ID)
179 while (!WorkList.empty()) {
184 if (
const CXXRecordDecl *B = BaseSpec.getType()->getAsCXXRecordDecl()) {
185 if (!SeenBaseTypes.insert(B).second)
187 WorkList.push_back(B);
199 if (!data().Bases.isOffset() && data().NumBases > 0)
200 C.Deallocate(data().getBases());
203 if (!
C.getLangOpts().CPlusPlus17) {
206 data().Aggregate =
false;
211 data().PlainOldData =
false;
221 data().NumBases = NumBases;
222 for (
unsigned i = 0; i < NumBases; ++i) {
223 data().getBases()[i] = *Bases[i];
230 auto *BaseClassDecl =
238 if (BaseClassDecl->data().HasBasesWithFields ||
239 !BaseClassDecl->field_empty()) {
240 if (data().HasBasesWithFields)
242 data().IsStandardLayout =
false;
243 data().HasBasesWithFields =
true;
250 if (BaseClassDecl->data().HasBasesWithNonStaticDataMembers ||
251 BaseClassDecl->hasDirectFields()) {
252 if (data().HasBasesWithNonStaticDataMembers)
253 data().IsCXX11StandardLayout =
false;
254 data().HasBasesWithNonStaticDataMembers =
true;
257 if (!BaseClassDecl->isEmpty()) {
261 data().Empty =
false;
267 data().Aggregate =
false;
272 data().StructuralIfLiteral =
false;
278 if (BaseClassDecl->isPolymorphic()) {
279 data().Polymorphic =
true;
282 data().Aggregate =
false;
288 if (!BaseClassDecl->isStandardLayout())
289 data().IsStandardLayout =
false;
290 if (!BaseClassDecl->isCXX11StandardLayout())
291 data().IsCXX11StandardLayout =
false;
295 data().HasNonLiteralTypeFieldsOrBases =
true;
298 for (
const auto &VBase : BaseClassDecl->vbases()) {
300 if (SeenVBaseTypes.insert(
C.getCanonicalType(VBase.getType())).second) {
301 VBases.push_back(&VBase);
308 if (
CXXRecordDecl *VBaseDecl = VBase.getType()->getAsCXXRecordDecl())
309 if (!VBaseDecl->hasCopyConstructorWithConstParam())
310 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
314 data().Aggregate =
false;
318 if (
Base->isVirtual()) {
320 if (SeenVBaseTypes.insert(
C.getCanonicalType(BaseType)).second)
321 VBases.push_back(
Base);
326 data().Empty =
false;
330 data().Aggregate =
false;
336 data().HasTrivialSpecialMembers &= SMF_Destructor;
337 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
342 data().IsStandardLayout =
false;
343 data().IsCXX11StandardLayout =
false;
349 data().DefaultedDefaultConstructorIsConstexpr =
false;
350 data().DefaultedDestructorIsConstexpr =
false;
357 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
358 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
364 if (!BaseClassDecl->hasTrivialDefaultConstructor())
365 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
372 if (!BaseClassDecl->hasTrivialCopyConstructor())
373 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
375 if (!BaseClassDecl->hasTrivialCopyConstructorForCall())
376 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
382 if (!BaseClassDecl->hasTrivialMoveConstructor())
383 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
385 if (!BaseClassDecl->hasTrivialMoveConstructorForCall())
386 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
393 if (!BaseClassDecl->hasTrivialCopyAssignment())
394 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
399 if (!BaseClassDecl->hasTrivialMoveAssignment())
400 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
406 if (!BaseClassDecl->hasConstexprDefaultConstructor())
407 data().DefaultedDefaultConstructorIsConstexpr =
408 C.getLangOpts().CPlusPlus23;
415 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
416 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
422 if (!BaseClassDecl->hasTrivialDestructor())
423 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
425 if (!BaseClassDecl->hasTrivialDestructorForCall())
426 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
428 if (!BaseClassDecl->hasIrrelevantDestructor())
429 data().HasIrrelevantDestructor =
false;
431 if (BaseClassDecl->isAnyDestructorNoReturn())
432 data().IsAnyDestructorNoReturn =
true;
439 if (!BaseClassDecl->hasCopyAssignmentWithConstParam())
440 data().ImplicitCopyAssignmentHasConstParam =
false;
444 if (BaseClassDecl->hasObjectMember())
447 if (BaseClassDecl->hasVolatileMember())
450 if (BaseClassDecl->getArgPassingRestrictions() ==
455 if (BaseClassDecl->hasMutableFields())
456 data().HasMutableFields =
true;
458 if (BaseClassDecl->hasUninitializedReferenceMember())
459 data().HasUninitializedReferenceMember =
true;
461 if (!BaseClassDecl->allowConstDefaultInit())
462 data().HasUninitializedFields =
true;
464 addedClassSubobject(BaseClassDecl);
475 data().IsStandardLayout =
false;
477 if (VBases.empty()) {
478 data().IsParsingBaseSpecifiers =
false;
484 data().NumVBases = VBases.size();
485 for (
int I = 0,
E = VBases.size(); I !=
E; ++I) {
489 data().getVBases()[I] = *VBases[I];
492 data().IsParsingBaseSpecifiers =
false;
496 assert(
hasDefinition() &&
"ODRHash only for records with definitions");
499 if (DefinitionData->HasODRHash)
500 return DefinitionData->ODRHash;
505 DefinitionData->HasODRHash =
true;
508 return DefinitionData->ODRHash;
511void CXXRecordDecl::addedClassSubobject(
CXXRecordDecl *Subobj) {
519 data().NeedOverloadResolutionForCopyConstructor =
true;
521 data().NeedOverloadResolutionForMoveConstructor =
true;
530 data().NeedOverloadResolutionForCopyAssignment =
true;
532 data().NeedOverloadResolutionForMoveAssignment =
true;
542 data().NeedOverloadResolutionForCopyConstructor =
true;
543 data().NeedOverloadResolutionForMoveConstructor =
true;
544 data().NeedOverloadResolutionForDestructor =
true;
553 data().DefaultedDestructorIsConstexpr =
560 if (!Subobj->data().StructuralIfLiteral)
561 data().StructuralIfLiteral =
false;
606void CXXRecordDecl::markedVirtualFunctionPure() {
609 data().Abstract =
true;
612bool CXXRecordDecl::hasSubobjectAtOffsetZeroOfEmptyBaseType(
623 RD = RD->getCanonicalDecl();
631 if (!RD->data().HasBasesWithFields) {
650 if (M.insert(RD).second)
651 WorkList.push_back(RD);
658 while (!WorkList.empty()) {
668 bool IsFirstField =
true;
669 for (
auto *FD :
X->fields()) {
672 if (FD->isUnnamedBitField())
675 if (!IsFirstField && !FD->isZeroSize(Ctx))
678 if (FD->isInvalidDecl())
688 IsFirstField =
false;
696 assert(
isLambda() &&
"not a lambda");
713void CXXRecordDecl::addedMember(
Decl *
D) {
714 if (!
D->
isImplicit() && !isa<FieldDecl>(
D) && !isa<IndirectFieldDecl>(
D) &&
718 data().HasOnlyCMembers =
false;
724 auto *FunTmpl = dyn_cast<FunctionTemplateDecl>(
D);
726 D = FunTmpl->getTemplatedDecl();
729 Decl *DUnderlying =
D;
730 if (
auto *ND = dyn_cast<NamedDecl>(DUnderlying)) {
731 DUnderlying = ND->getUnderlyingDecl();
732 if (
auto *UnderlyingFunTmpl = dyn_cast<FunctionTemplateDecl>(DUnderlying))
733 DUnderlying = UnderlyingFunTmpl->getTemplatedDecl();
736 if (
const auto *Method = dyn_cast<CXXMethodDecl>(
D)) {
737 if (Method->isVirtual()) {
740 data().Aggregate =
false;
744 data().PlainOldData =
false;
748 data().Empty =
false;
753 data().Polymorphic =
true;
759 data().HasTrivialSpecialMembers &= SMF_Destructor;
760 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
765 data().IsStandardLayout =
false;
766 data().IsCXX11StandardLayout =
false;
780 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(
D)) {
787 data().UserDeclaredConstructor =
true;
797 data().PlainOldData =
false;
802 SMKind |= SMF_DefaultConstructor;
805 data().UserProvidedDefaultConstructor =
true;
807 data().HasConstexprDefaultConstructor =
true;
809 data().HasDefaultedDefaultConstructor =
true;
815 SMKind |= SMF_CopyConstructor;
818 data().HasDeclaredCopyConstructorWithConstParam =
true;
820 SMKind |= SMF_MoveConstructor;
832 data().Aggregate =
false;
837 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(DUnderlying)) {
845 data().HasConstexprNonCopyMoveConstructor =
true;
846 if (!isa<CXXConstructorDecl>(
D) &&
Constructor->isDefaultConstructor())
847 data().HasInheritedDefaultConstructor =
true;
851 if (
const auto *Method = dyn_cast<CXXMethodDecl>(
D)) {
852 if (isa<CXXDestructorDecl>(
D))
853 SMKind |= SMF_Destructor;
855 if (Method->isCopyAssignmentOperator()) {
856 SMKind |= SMF_CopyAssignment;
858 const auto *ParamTy =
859 Method->getNonObjectParameter(0)->getType()->getAs<
ReferenceType>();
860 if (!ParamTy || ParamTy->getPointeeType().isConstQualified())
861 data().HasDeclaredCopyAssignmentWithConstParam =
true;
864 if (Method->isMoveAssignmentOperator())
865 SMKind |= SMF_MoveAssignment;
868 if (
auto *Conversion = dyn_cast<CXXConversionDecl>(
D)) {
877 if (Conversion->getPrimaryTemplate()) {
883 FunTmpl ? cast<NamedDecl>(FunTmpl) :
cast<
NamedDecl>(Conversion);
888 Conversions.
addDecl(Ctx, Primary, AS);
895 data().HasTrivialSpecialMembers &=
896 data().DeclaredSpecialMembers | ~SMKind;
897 data().HasTrivialSpecialMembersForCall &=
898 data().DeclaredSpecialMembers | ~SMKind;
902 data().DeclaredSpecialMembers |= SMKind;
903 if (!Method->isImplicit()) {
904 data().UserDeclaredSpecialMembers |= SMKind;
907 if ((!Method->isDeleted() && !Method->isDefaulted() &&
908 SMKind != SMF_MoveAssignment) ||
922 data().PlainOldData =
false;
930 if (!Method->isIneligibleOrNotSelected()) {
939 if (
const auto *Field = dyn_cast<FieldDecl>(
D)) {
947 if (data().HasBasesWithFields)
948 data().IsStandardLayout =
false;
954 if (
Field->isUnnamedBitField()) {
958 if (data().
Empty && !
Field->isZeroLengthBitField(Context) &&
961 data().Empty =
false;
969 if (data().HasBasesWithNonStaticDataMembers)
970 data().IsCXX11StandardLayout =
false;
978 data().Aggregate =
false;
979 data().PlainOldData =
false;
984 data().StructuralIfLiteral =
false;
989 bool IsFirstField = !data().HasPrivateFields &&
990 !data().HasProtectedFields && !data().HasPublicFields;
997 case AS_private: data().HasPrivateFields =
true;
break;
998 case AS_protected: data().HasProtectedFields =
true;
break;
999 case AS_public: data().HasPublicFields =
true;
break;
1000 case AS_none: llvm_unreachable(
"Invalid access specifier");
1002 if ((data().HasPrivateFields + data().HasProtectedFields +
1003 data().HasPublicFields) > 1) {
1004 data().IsStandardLayout =
false;
1005 data().IsCXX11StandardLayout =
false;
1009 if (
Field->isMutable()) {
1010 data().HasMutableFields =
true;
1015 data().StructuralIfLiteral =
false;
1022 data().HasVariantMembers =
true;
1033 if (
T.hasNonTrivialObjCLifetime()) {
1041 struct DefinitionData &
Data = data();
1042 Data.PlainOldData =
false;
1043 Data.HasTrivialSpecialMembers = 0;
1049 data().HasTrivialSpecialMembersForCall = 0;
1055 Data.HasIrrelevantDestructor =
false;
1058 data().DefaultedCopyConstructorIsDeleted =
true;
1059 data().DefaultedMoveConstructorIsDeleted =
true;
1060 data().DefaultedCopyAssignmentIsDeleted =
true;
1061 data().DefaultedMoveAssignmentIsDeleted =
true;
1062 data().DefaultedDestructorIsDeleted =
true;
1063 data().NeedOverloadResolutionForCopyConstructor =
true;
1064 data().NeedOverloadResolutionForMoveConstructor =
true;
1065 data().NeedOverloadResolutionForCopyAssignment =
true;
1066 data().NeedOverloadResolutionForMoveAssignment =
true;
1067 data().NeedOverloadResolutionForDestructor =
true;
1069 }
else if (!Context.
getLangOpts().ObjCAutoRefCount) {
1072 }
else if (!
T.isCXX98PODType(Context))
1073 data().PlainOldData =
false;
1076 if (!
Field->hasInClassInitializer())
1077 data().HasUninitializedReferenceMember =
true;
1082 data().IsStandardLayout =
false;
1083 data().IsCXX11StandardLayout =
false;
1089 data().DefaultedCopyConstructorIsDeleted =
true;
1092 if (!
Field->hasInClassInitializer() && !
Field->isMutable()) {
1094 if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
1095 data().HasUninitializedFields =
true;
1097 data().HasUninitializedFields =
true;
1103 data().HasNonLiteralTypeFieldsOrBases =
true;
1105 if (
Field->hasInClassInitializer() ||
1106 (
Field->isAnonymousStructOrUnion() &&
1107 Field->getType()->getAsCXXRecordDecl()->hasInClassInitializer())) {
1108 data().HasInClassInitializer =
true;
1113 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1121 data().Aggregate =
false;
1125 data().PlainOldData =
false;
1133 data().DefaultedCopyAssignmentIsDeleted =
true;
1134 data().DefaultedMoveAssignmentIsDeleted =
true;
1139 bool IsZeroSize =
Field->isZeroSize(Context);
1142 auto *FieldRec = cast<CXXRecordDecl>(RecordTy->getDecl());
1143 if (FieldRec->getDefinition()) {
1144 addedClassSubobject(FieldRec);
1152 data().NeedOverloadResolutionForCopyConstructor =
true;
1153 data().NeedOverloadResolutionForMoveConstructor =
true;
1154 data().NeedOverloadResolutionForCopyAssignment =
true;
1155 data().NeedOverloadResolutionForMoveAssignment =
true;
1164 if (FieldRec->hasNonTrivialCopyConstructor())
1165 data().DefaultedCopyConstructorIsDeleted =
true;
1166 if (FieldRec->hasNonTrivialMoveConstructor())
1167 data().DefaultedMoveConstructorIsDeleted =
true;
1168 if (FieldRec->hasNonTrivialCopyAssignment())
1169 data().DefaultedCopyAssignmentIsDeleted =
true;
1170 if (FieldRec->hasNonTrivialMoveAssignment())
1171 data().DefaultedMoveAssignmentIsDeleted =
true;
1172 if (FieldRec->hasNonTrivialDestructor())
1173 data().DefaultedDestructorIsDeleted =
true;
1178 if (
Field->isAnonymousStructOrUnion()) {
1179 data().NeedOverloadResolutionForCopyConstructor |=
1180 FieldRec->data().NeedOverloadResolutionForCopyConstructor;
1181 data().NeedOverloadResolutionForMoveConstructor |=
1182 FieldRec->data().NeedOverloadResolutionForMoveConstructor;
1183 data().NeedOverloadResolutionForCopyAssignment |=
1184 FieldRec->data().NeedOverloadResolutionForCopyAssignment;
1185 data().NeedOverloadResolutionForMoveAssignment |=
1186 FieldRec->data().NeedOverloadResolutionForMoveAssignment;
1187 data().NeedOverloadResolutionForDestructor |=
1188 FieldRec->data().NeedOverloadResolutionForDestructor;
1196 if (!FieldRec->hasTrivialDefaultConstructor())
1197 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1205 if (!FieldRec->hasTrivialCopyConstructor())
1206 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
1208 if (!FieldRec->hasTrivialCopyConstructorForCall())
1209 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
1214 if (!FieldRec->hasTrivialMoveConstructor())
1215 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
1217 if (!FieldRec->hasTrivialMoveConstructorForCall())
1218 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
1226 if (!FieldRec->hasTrivialCopyAssignment())
1227 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
1231 if (!FieldRec->hasTrivialMoveAssignment())
1232 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
1234 if (!FieldRec->hasTrivialDestructor())
1235 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1236 if (!FieldRec->hasTrivialDestructorForCall())
1237 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1238 if (!FieldRec->hasIrrelevantDestructor())
1239 data().HasIrrelevantDestructor =
false;
1240 if (FieldRec->isAnyDestructorNoReturn())
1241 data().IsAnyDestructorNoReturn =
true;
1242 if (FieldRec->hasObjectMember())
1244 if (FieldRec->hasVolatileMember())
1246 if (FieldRec->getArgPassingRestrictions() ==
1254 if (!FieldRec->isStandardLayout())
1255 data().IsStandardLayout =
false;
1256 if (!FieldRec->isCXX11StandardLayout())
1257 data().IsCXX11StandardLayout =
false;
1263 if (data().IsStandardLayout &&
1264 (
isUnion() || IsFirstField || IsZeroSize) &&
1265 hasSubobjectAtOffsetZeroOfEmptyBaseType(Context, FieldRec))
1266 data().IsStandardLayout =
false;
1272 if (data().IsCXX11StandardLayout && IsFirstField) {
1275 for (
const auto &BI :
bases()) {
1277 data().IsCXX11StandardLayout =
false;
1284 if (FieldRec->hasMutableFields())
1285 data().HasMutableFields =
true;
1287 if (
Field->isMutable()) {
1291 data().NeedOverloadResolutionForCopyConstructor =
true;
1292 data().NeedOverloadResolutionForCopyAssignment =
true;
1302 if (!
Field->hasInClassInitializer() &&
1303 !FieldRec->hasConstexprDefaultConstructor() && !
isUnion())
1306 data().DefaultedDefaultConstructorIsConstexpr =
1314 if (!FieldRec->hasCopyConstructorWithConstParam())
1315 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
1323 if (!FieldRec->hasCopyAssignmentWithConstParam())
1324 data().ImplicitCopyAssignmentHasConstParam =
false;
1326 if (FieldRec->hasUninitializedReferenceMember() &&
1327 !
Field->hasInClassInitializer())
1328 data().HasUninitializedReferenceMember =
true;
1333 if (FieldRec->hasVariantMembers() &&
1334 Field->isAnonymousStructOrUnion())
1335 data().HasVariantMembers =
true;
1342 data().DefaultedDefaultConstructorIsConstexpr =
false;
1349 if (
T.isConstQualified()) {
1350 data().DefaultedCopyAssignmentIsDeleted =
true;
1351 data().DefaultedMoveAssignmentIsDeleted =
true;
1360 data().StructuralIfLiteral =
false;
1366 if (data().
Empty && !IsZeroSize)
1367 data().Empty =
false;
1371 if (
auto *Shadow = dyn_cast<UsingShadowDecl>(
D)) {
1372 if (Shadow->getDeclName().getNameKind()
1375 data().Conversions.get(Ctx).addDecl(Ctx, Shadow, Shadow->getAccess());
1379 if (
const auto *Using = dyn_cast<UsingDecl>(
D)) {
1380 if (
Using->getDeclName().getNameKind() ==
1382 data().HasInheritedConstructor =
true;
1385 data().Aggregate =
false;
1388 if (
Using->getDeclName().getCXXOverloadedOperator() == OO_Equal)
1389 data().HasInheritedAssignment =
true;
1405 bool HasAtLeastOneLiteralMember =
1407 return !
D->getType().isVolatileQualified() &&
1410 if (!HasAtLeastOneLiteralMember)
1429 if (
const auto *DD = dyn_cast<CXXDestructorDecl>(MD)) {
1430 if (DD->isUserProvided())
1431 data().HasIrrelevantDestructor =
false;
1438 if (DD->isVirtual()) {
1439 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1440 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1443 if (DD->isNoReturn())
1444 data().IsAnyDestructorNoReturn =
true;
1453 data().HasTrivialSpecialMembers |= SMKind;
1454 data().HasTrivialSpecialMembersForCall |= SMKind;
1456 data().HasTrivialSpecialMembersForCall |= SMKind;
1457 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1459 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1466 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1474 unsigned SMKind = 0;
1476 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(
D)) {
1477 if (Constructor->isDefaultConstructor()) {
1478 SMKind |= SMF_DefaultConstructor;
1479 if (Constructor->isConstexpr())
1480 data().HasConstexprDefaultConstructor =
true;
1482 if (Constructor->isCopyConstructor())
1483 SMKind |= SMF_CopyConstructor;
1484 else if (Constructor->isMoveConstructor())
1485 SMKind |= SMF_MoveConstructor;
1486 else if (Constructor->isConstexpr())
1488 data().HasConstexprNonCopyMoveConstructor =
true;
1489 }
else if (isa<CXXDestructorDecl>(
D)) {
1490 SMKind |= SMF_Destructor;
1492 data().HasIrrelevantDestructor =
false;
1493 }
else if (
D->isCopyAssignmentOperator())
1494 SMKind |= SMF_CopyAssignment;
1495 else if (
D->isMoveAssignmentOperator())
1496 SMKind |= SMF_MoveAssignment;
1500 if (!
D->isIneligibleOrNotSelected()) {
1502 data().HasTrivialSpecialMembers |= SMKind;
1504 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1508void CXXRecordDecl::LambdaDefinitionData::AddCaptureList(
ASTContext &Ctx,
1510 Captures.push_back(CaptureList);
1511 if (Captures.size() == 2) {
1519 CXXRecordDecl::LambdaDefinitionData &
Data = getLambdaData();
1522 Data.NumCaptures = Captures.size();
1523 Data.NumExplicitCaptures = 0;
1526 Data.AddCaptureList(Context, ToCapture);
1529 ++
Data.NumExplicitCaptures;
1536 Data.DefaultedCopyAssignmentIsDeleted =
true;
1540 unsigned SMKind = 0;
1542 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(
D)) {
1543 if (Constructor->isCopyConstructor())
1544 SMKind = SMF_CopyConstructor;
1545 else if (Constructor->isMoveConstructor())
1546 SMKind = SMF_MoveConstructor;
1547 }
else if (isa<CXXDestructorDecl>(
D))
1548 SMKind = SMF_Destructor;
1550 if (
D->isTrivialForCall())
1551 data().HasTrivialSpecialMembersForCall |= SMKind;
1553 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1559 !TemplateOrInstantiation.isNull())
1564 return isPOD() && data().HasOnlyCMembers;
1569 return getLambdaData().IsGenericLambda;
1581 if (!RD.
isLambda())
return nullptr;
1586 assert(!Calls.
empty() &&
"Missing lambda call operator!");
1588 "More than one lambda call operator!");
1589 return Calls.
front();
1594 return dyn_cast_or_null<FunctionTemplateDecl>(CallOp);
1600 if (CallOp ==
nullptr)
1603 if (
const auto *CallOpTmpl = dyn_cast<FunctionTemplateDecl>(CallOp))
1604 return cast<CXXMethodDecl>(CallOpTmpl->getTemplatedDecl());
1606 return cast<CXXMethodDecl>(CallOp);
1617 assert(RD.
isLambda() &&
"Must be a lambda");
1624 if (
const auto *InvokerTemplate = dyn_cast<FunctionTemplateDecl>(ND))
1625 return cast<CXXMethodDecl>(InvokerTemplate->getTemplatedDecl());
1626 return cast<CXXMethodDecl>(ND);
1636 cast<ValueDecl>(ND->getAsFunction())->getType()->castAs<
FunctionType>();
1637 if (FTy->getCallConv() == CC)
1645 llvm::DenseMap<const ValueDecl *, FieldDecl *> &Captures,
1648 ThisCapture =
nullptr;
1650 LambdaDefinitionData &Lambda = getLambdaData();
1654 C != CEnd; ++
C, ++Field) {
1655 if (
C->capturesThis())
1656 ThisCapture = *Field;
1657 else if (
C->capturesVariable())
1658 Captures[
C->getCapturedVar()] = *Field;
1669 return Tmpl->getTemplateParameters();
1679 assert(std::is_partitioned(List->begin(), List->end(),
1680 [](
const NamedDecl *
D) { return !D->isImplicit(); })
1681 &&
"Explicit template params should be ordered before implicit ones");
1683 const auto ExplicitEnd = llvm::partition_point(
1689 assert(
isLambda() &&
"Not a lambda closure type!");
1691 return getLambdaData().ContextDecl.get(Source);
1695 assert(
isLambda() &&
"Not a lambda closure type!");
1701 getLambdaData().ContextDecl = Numbering.
ContextDecl;
1706 assert(
isLambda() &&
"Not a lambda closure type!");
1707 return getASTContext().DeviceLambdaManglingNumbers.lookup(
this);
1713 ->getConversionType();
1745 if (ConvI != ConvE) {
1746 HiddenTypesBuffer = ParentHiddenTypes;
1747 HiddenTypes = &HiddenTypesBuffer;
1751 bool Hidden = ParentHiddenTypes.count(ConvType);
1753 HiddenTypesBuffer.insert(ConvType);
1757 if (Hidden && InVirtual)
1758 HiddenVBaseCs.insert(cast<NamedDecl>(I.getDecl()->getCanonicalDecl()));
1766 VOutput.
addDecl(I.getDecl(), IAccess);
1768 Output.
addDecl(Context, I.getDecl(), IAccess);
1774 for (
const auto &I :
Record->bases()) {
1775 const auto *RT = I.getType()->getAs<
RecordType>();
1780 bool BaseInVirtual = InVirtual || I.isVirtual();
1782 auto *
Base = cast<CXXRecordDecl>(RT->getDecl());
1784 *HiddenTypes, Output, VOutput, HiddenVBaseCs);
1811 Output.
append(Context, ConvI, ConvE);
1812 for (; ConvI != ConvE; ++ConvI)
1816 for (
const auto &I :
Record->bases()) {
1817 const auto *RT = I.getType()->getAs<
RecordType>();
1821 I.isVirtual(), I.getAccessSpecifier(),
1822 HiddenTypes, Output, VBaseCs, HiddenVBaseCs);
1828 if (!HiddenVBaseCs.count(cast<NamedDecl>(I.getDecl()->getCanonicalDecl())))
1829 Output.
addDecl(Context, I.getDecl(), I.getAccess());
1835llvm::iterator_range<CXXRecordDecl::conversion_iterator>
1842 Set = &data().Conversions.get(Ctx);
1844 Set = &data().VisibleConversions.get(Ctx);
1846 if (!data().ComputedVisibleConversions) {
1848 data().ComputedVisibleConversions =
true;
1851 return llvm::make_range(
Set->begin(),
Set->end());
1867 for (
unsigned I = 0,
E = Convs.
size(); I !=
E; ++I) {
1868 if (Convs[I].getDecl() == ConvDecl) {
1870 assert(!llvm::is_contained(Convs, ConvDecl) &&
1871 "conversion was found multiple times in unresolved set");
1876 llvm_unreachable(
"conversion not found in set!");
1881 return cast<CXXRecordDecl>(MSInfo->getInstantiatedFrom());
1893 assert(TemplateOrInstantiation.isNull() &&
1894 "Previous template or instantiation?");
1895 assert(!isa<ClassTemplatePartialSpecializationDecl>(
this));
1896 TemplateOrInstantiation
1905 TemplateOrInstantiation = Template;
1909 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this))
1910 return Spec->getSpecializationKind();
1913 return MSInfo->getTemplateSpecializationKind();
1920 if (
auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1921 Spec->setSpecializationKind(TSK);
1926 MSInfo->setTemplateSpecializationKind(TSK);
1930 llvm_unreachable(
"Not a class template or member class specialization");
1934 auto GetDefinitionOrSelf =
1936 if (
auto *Def =
D->getDefinition())
1943 if (
auto *TD = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1944 auto From = TD->getInstantiatedFrom();
1946 while (
auto *NewCTD = CTD->getInstantiatedFromMemberTemplate()) {
1947 if (NewCTD->isMemberSpecialization())
1951 return GetDefinitionOrSelf(CTD->getTemplatedDecl());
1955 while (
auto *NewCTPSD = CTPSD->getInstantiatedFromMember()) {
1956 if (NewCTPSD->isMemberSpecialization())
1960 return GetDefinitionOrSelf(CTPSD);
1969 return GetDefinitionOrSelf(RD);
1974 "couldn't find pattern for class template instantiation");
1990 for (
auto *
Decl : R) {
1991 auto* DD = dyn_cast<CXXDestructorDecl>(
Decl);
1992 if (DD && !DD->isIneligibleOrNotSelected())
2008 assert(
hasDefinition() &&
"checking for interface-like without a definition");
2022 for (
const auto *
const Method :
methods())
2023 if (Method->isDefined() && !Method->isImplicit())
2027 const auto *Uuid = getAttr<UuidAttr>();
2034 Uuid->getGuid() ==
"00000000-0000-0000-C000-000000000046") ||
2036 Uuid->getGuid() ==
"00020400-0000-0000-C000-000000000046"))) {
2050 if (BaseSpec.isVirtual() || BaseSpec.getAccessSpecifier() !=
AS_public)
2052 const auto *
Base = BaseSpec.getType()->getAsCXXRecordDecl();
2053 if (
Base->isInterface() || !
Base->isInterfaceLike())
2064 if (!FinalOverriders) {
2070 for (
const CXXFinalOverriderMap::value_type &
2071 OverridingMethodsEntry : *FinalOverriders) {
2072 for (
const auto &[_, SubobjOverrides] : OverridingMethodsEntry.second) {
2073 assert(SubobjOverrides.size() > 0 &&
2074 "All virtual functions have overriding virtual functions");
2076 if (SubobjOverrides.front().Method->isPureVirtual())
2099 I.setAccess((*I)->getAccess());
2103 if (data().Abstract ||
isInvalidDecl() || !data().Polymorphic ||
2107 for (
const auto &B :
bases()) {
2108 const auto *BaseDecl =
2110 if (BaseDecl->isAbstract())
2121 if (Def->hasAttr<FinalAttr>())
2123 if (
const auto *Dtor = Def->getDestructor())
2124 if (Dtor->hasAttr<FinalAttr>())
2129void CXXDeductionGuideDecl::anchor() {}
2148 case Decl::Kind::CXXConstructor:
2149 return cast<CXXConstructorDecl>(
Function)->getExplicitSpecifier();
2150 case Decl::Kind::CXXConversion:
2151 return cast<CXXConversionDecl>(
Function)->getExplicitSpecifier();
2152 case Decl::Kind::CXXDeductionGuide:
2153 return cast<CXXDeductionGuideDecl>(
Function)->getExplicitSpecifier();
2165 TInfo, EndLocation, Ctor,
Kind);
2186void CXXMethodDecl::anchor() {}
2216 if (isa<CXXDestructorDecl>(
this)) {
2228 auto *MD = dyn_cast<CXXMethodDecl>(ND);
2256 llvm::erase_if(FinalOverriders, [&](
CXXMethodDecl *OtherD) {
2260 FinalOverriders.push_back(
D);
2263 for (
const auto &I : RD->
bases()) {
2267 const auto *
Base = cast<CXXRecordDecl>(RT->
getDecl());
2269 AddFinalOverrider(
D);
2272 return FinalOverriders.size() == 1 ? FinalOverriders.front() :
nullptr;
2281 Expr *TrailingRequiresClause) {
2283 CXXMethod,
C, RD, StartLoc, NameInfo,
T, TInfo, SC,
UsesFPIntrin,
2284 isInline, ConstexprKind, EndLocation, TrailingRequiresClause);
2297 assert(
isVirtual() &&
"this method is expected to be virtual");
2306 if (hasAttr<FinalAttr>())
2315 Base =
Base->getBestDynamicClassTypeExpr();
2316 if (
Base->isPRValue() &&
Base->getType()->isRecordType())
2321 if (!BestDynamicDecl)
2330 if (!DevirtualizedMethod)
2340 if (DevirtualizedMethod->
hasAttr<FinalAttr>())
2341 return DevirtualizedMethod;
2347 return DevirtualizedMethod;
2349 if (
const auto *DRE = dyn_cast<DeclRefExpr>(
Base)) {
2350 if (
const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
2351 if (VD->getType()->isRecordType())
2353 return DevirtualizedMethod;
2361 if (
const auto *ME = dyn_cast<MemberExpr>(
Base)) {
2362 const ValueDecl *VD = ME->getMemberDecl();
2368 if (
auto *BO = dyn_cast<BinaryOperator>(
Base)) {
2369 if (BO->isPtrMemOp()) {
2371 if (MPT->getPointeeType()->isRecordType())
2372 return DevirtualizedMethod;
2382 assert(PreventedBy.empty() &&
"PreventedBy is expected to be empty");
2399 unsigned UsualParams = 1;
2446 for (
const auto *
D : R) {
2447 if (
const auto *FD = dyn_cast<FunctionDecl>(
D)) {
2448 if (FD->getNumParams() == 1) {
2449 PreventedBy.push_back(FD);
2514 "Can't add an overridden method to a class template!");
2515 assert(MD->
isVirtual() &&
"Method is not virtual!");
2521 if (isa<CXXConstructorDecl>(
this))
return nullptr;
2526 if (isa<CXXConstructorDecl>(
this))
return nullptr;
2531 if (isa<CXXConstructorDecl>(
this))
return 0;
2537 if (isa<CXXConstructorDecl>(
this))
2559 ObjectTy =
C.getLangOpts().HLSL ?
C.getLValueReferenceType(ObjectTy)
2560 :
C.getPointerType(ObjectTy);
2573 assert(
isInstance() &&
"No 'this' for static methods!");
2587 return C.getRValueReferenceType(
Type);
2588 return C.getLValueReferenceType(
Type);
2614 : Initializee(TInfo),
Init(
Init), MemberOrEllipsisLocation(EllipsisLoc),
2615 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(IsVirtual),
2616 IsWritten(
false), SourceOrder(0) {}
2622 : Initializee(
Member),
Init(
Init), MemberOrEllipsisLocation(MemberLoc),
2623 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2624 IsWritten(
false), SourceOrder(0) {}
2631 : Initializee(
Member),
Init(
Init), MemberOrEllipsisLocation(MemberLoc),
2632 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2633 IsWritten(
false), SourceOrder(0) {}
2639 : Initializee(TInfo),
Init(
Init), LParenLoc(L), RParenLoc(R),
2640 IsDelegating(
true), IsVirtual(
false), IsWritten(
false), SourceOrder(0) {}
2656 return Initializee.get<
TypeSourceInfo*>()->getType().getTypePtr();
2669 return TSInfo->getTypeLoc().getBeginLoc();
2677 if (
Expr *I =
D->getInClassInitializer())
2678 return I->getSourceRange();
2685CXXConstructorDecl::CXXConstructorDecl(
2692 SC_None, UsesFPIntrin, isInline, ConstexprKind,
2694 setNumCtorInitializers(0);
2695 setInheritingConstructor(
static_cast<bool>(Inherited));
2696 setImplicit(isImplicitlyDeclared);
2697 CXXConstructorDeclBits.HasTrailingExplicitSpecifier = ES.
getExpr() ? 1 : 0;
2699 *getTrailingObjects<InheritedConstructor>() = Inherited;
2700 setExplicitSpecifier(ES);
2703void CXXConstructorDecl::anchor() {}
2707 uint64_t AllocKind) {
2708 bool hasTrailingExplicit =
static_cast<bool>(AllocKind & TAKHasTailExplicit);
2710 static_cast<bool>(AllocKind & TAKInheritsConstructor);
2712 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2719 Result->CXXConstructorDeclBits.HasTrailingExplicitSpecifier =
2720 hasTrailingExplicit;
2733 "Name must refer to a constructor");
2735 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2736 Inherited ? 1 : 0, ES.
getExpr() ? 1 : 0);
2739 isImplicitlyDeclared, ConstexprKind, Inherited, TrailingRequiresClause);
2749 if (
const auto *Construct = dyn_cast<CXXConstructExpr>(
E))
2750 return Construct->getConstructor();
2850void CXXDestructorDecl::anchor() {}
2862 bool UsesFPIntrin,
bool isInline,
bool isImplicitlyDeclared,
2866 "Name must refer to a destructor");
2869 isImplicitlyDeclared, ConstexprKind, TrailingRequiresClause);
2874 if (OD && !
First->OperatorDelete) {
2875 First->OperatorDelete = OD;
2876 First->OperatorDeleteThisArg = ThisArg;
2878 L->ResolvedOperatorDelete(
First, OD, ThisArg);
2882void CXXConversionDecl::anchor() {}
2897 Expr *TrailingRequiresClause) {
2900 "Name must refer to a conversion function");
2903 ConstexprKind, EndLocation, TrailingRequiresClause);
2920void LinkageSpecDecl::anchor() {}
2927 return new (
C, DC)
LinkageSpecDecl(DC, ExternLoc, LangLoc, Lang, HasBraces);
2937void UsingDirectiveDecl::anchor() {}
2946 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(
Used))
2947 Used = NS->getFirstDecl();
2949 IdentLoc,
Used, CommonAncestor);
2961 if (
auto *NA = dyn_cast_or_null<NamespaceAliasDecl>(NominatedNamespace))
2962 return NA->getNamespace();
2963 return cast_or_null<NamespaceDecl>(NominatedNamespace);
2971 redeclarable_base(
C), LocStart(StartLoc) {
2974 setPreviousDecl(PrevDecl);
3003void NamespaceAliasDecl::anchor() {}
3025 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(Namespace))
3026 Namespace = NS->getFirstDecl();
3028 QualifierLoc, IdentLoc, Namespace);
3039void LifetimeExtendedTemporaryDecl::anchor() {}
3048 if (isa<FieldDecl>(ExtendingDecl))
3052 if (isa<BindingDecl>(ExtendingDecl))
3055 return cast<VarDecl>(ExtendingDecl)->getStorageDuration();
3060 "don't need to cache the computed value for this temporary");
3061 if (MayCreate && !
Value) {
3065 assert(
Value &&
"may not be null");
3069void UsingShadowDecl::anchor() {}
3075 UsingOrNextShadow(Introducer) {
3077 assert(!isa<UsingShadowDecl>(
Target));
3094 while (
const auto *NextShadow =
3095 dyn_cast<UsingShadowDecl>(Shadow->UsingOrNextShadow))
3096 Shadow = NextShadow;
3097 return cast<BaseUsingDecl>(Shadow->UsingOrNextShadow);
3100void ConstructorUsingShadowDecl::anchor() {}
3119void BaseUsingDecl::anchor() {}
3122 assert(!llvm::is_contained(
shadows(), S) &&
"declaration already in set");
3123 assert(S->getIntroducer() ==
this);
3125 if (FirstUsingShadow.getPointer())
3126 S->UsingOrNextShadow = FirstUsingShadow.getPointer();
3127 FirstUsingShadow.setPointer(S);
3131 assert(llvm::is_contained(
shadows(), S) &&
"declaration not in set");
3132 assert(S->getIntroducer() ==
this);
3136 if (FirstUsingShadow.getPointer() == S) {
3137 FirstUsingShadow.setPointer(
3138 dyn_cast<UsingShadowDecl>(S->UsingOrNextShadow));
3139 S->UsingOrNextShadow =
this;
3144 while (Prev->UsingOrNextShadow != S)
3145 Prev = cast<UsingShadowDecl>(Prev->UsingOrNextShadow);
3146 Prev->UsingOrNextShadow = S->UsingOrNextShadow;
3147 S->UsingOrNextShadow =
this;
3150void UsingDecl::anchor() {}
3156 return new (
C, DC)
UsingDecl(DC, UL, QualifierLoc, NameInfo, HasTypename);
3171void UsingEnumDecl::anchor() {}
3194void UsingPackDecl::anchor() {}
3199 size_t Extra = additionalSizeToAlloc<NamedDecl *>(UsingDecls.size());
3200 return new (
C, DC, Extra)
UsingPackDecl(DC, InstantiatedFrom, UsingDecls);
3204 unsigned NumExpansions) {
3205 size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
3208 Result->NumExpansions = NumExpansions;
3210 for (
unsigned I = 0; I != NumExpansions; ++I)
3215void UnresolvedUsingValueDecl::anchor() {}
3224 QualifierLoc, NameInfo,
3243void UnresolvedUsingTypenameDecl::anchor() {}
3254 DC, UsingLoc, TypenameLoc, QualifierLoc, TargetNameLoc,
3275 return new (Ctx,
ID)
3279UnresolvedUsingIfExistsDecl::UnresolvedUsingIfExistsDecl(
DeclContext *DC,
3284void UnresolvedUsingIfExistsDecl::anchor() {}
3286void StaticAssertDecl::anchor() {}
3304 assert((isa<VarDecl, BindingDecl>(
this)) &&
3305 "expected a VarDecl or a BindingDecl");
3306 if (
auto *Var = llvm::dyn_cast<VarDecl>(
this))
3308 if (
auto *BD = llvm::dyn_cast<BindingDecl>(
this))
3309 return llvm::dyn_cast<VarDecl>(BD->getDecomposedDecl());
3313void BindingDecl::anchor() {}
3332 auto *VD = cast<VarDecl>(DRE->getDecl());
3333 assert(VD->isImplicit() &&
"holding var for binding decl not implicit");
3337void DecompositionDecl::anchor() {}
3345 size_t Extra = additionalSizeToAlloc<BindingDecl *>(
Bindings.size());
3346 return new (
C, DC, Extra)
3352 unsigned NumBindings) {
3353 size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
3358 Result->NumBindings = NumBindings;
3360 for (
unsigned I = 0; I != NumBindings; ++I)
3372 B->printName(OS, Policy);
3378void MSPropertyDecl::anchor() {}
3386 return new (
C, DC)
MSPropertyDecl(DC, L, N,
T, TInfo, StartL, Getter, Setter);
3396void MSGuidDecl::anchor() {}
3413 OS << llvm::format(
"GUID{%08" PRIx32
"-%04" PRIx16
"-%04" PRIx16
"-",
3416 for (uint8_t Byte : PartVal.
Part4And5) {
3417 OS << llvm::format(
"%02" PRIx8, Byte);
3430 auto IsInt = [&Ctx](
unsigned N) {
3437 auto IsArray = [&Ctx](MatcherRef Elem,
unsigned N) {
3444 auto IsStruct = [](std::initializer_list<MatcherRef> Fields) {
3452 if (
auto *CXXRD = dyn_cast<CXXRecordDecl>(RD))
3453 if (CXXRD->getNumBases())
3455 auto MatcherIt = Fields.begin();
3457 if (FD->isUnnamedBitField())
3459 if (FD->isBitField() || MatcherIt == Fields.end() ||
3460 !(*MatcherIt)(FD->getType()))
3464 return MatcherIt == Fields.end();
3469 return IsStruct({IsInt(32), IsInt(16), IsInt(16), IsArray(IsInt(8), 8)})(
T);
3482 for (
unsigned I = 0; I != 8; ++I) {
3494void UnnamedGlobalConstantDecl::anchor() {}
3496UnnamedGlobalConstantDecl::UnnamedGlobalConstantDecl(
const ASTContext &
C,
3505 if (
Value.needsCleanup())
3506 C.addDestruction(&
Value);
3524 OS <<
"unnamed-global-constant";
3530 llvm_unreachable(
"Invalid access specifier!");
3538 llvm_unreachable(
"Invalid access specifier!");
Defines the clang::ASTContext interface.
ASTImporterLookupTable & LT
This file provides some common utility functions for processing Lambda related AST Constructs.
Defines the Diagnostic-related interfaces.
enum clang::sema::@1651::IndirectLocalPathEntry::EntryKind Kind
static void CollectVisibleConversions(ASTContext &Context, const CXXRecordDecl *Record, bool InVirtual, AccessSpecifier Access, const llvm::SmallPtrSet< CanQualType, 8 > &ParentHiddenTypes, ASTUnresolvedSet &Output, UnresolvedSetImpl &VOutput, llvm::SmallPtrSet< NamedDecl *, 8 > &HiddenVBaseCs)
Collect the visible conversions of a base class.
static const char * getAccessName(AccessSpecifier AS)
static bool recursivelyOverrides(const CXXMethodDecl *DerivedMD, const CXXMethodDecl *BaseMD)
static bool isValidStructGUID(ASTContext &Ctx, QualType T)
Determine if T is a valid 'struct _GUID' of the shape that we expect.
static DeclContext::lookup_result getLambdaStaticInvokers(const CXXRecordDecl &RD)
static NamedDecl * getLambdaCallOperatorHelper(const CXXRecordDecl &RD)
static QualType getThisObjectType(ASTContext &C, const FunctionProtoType *FPT, const CXXRecordDecl *Decl)
static bool hasPureVirtualFinalOverrider(const CXXRecordDecl &RD, const CXXFinalOverriderMap *FinalOverriders)
static bool allLookupResultsAreTheSame(const DeclContext::lookup_result &R)
static bool isDeclContextInNamespace(const DeclContext *DC)
static bool hasRepeatedBaseClass(const CXXRecordDecl *StartRD)
Determine whether a class has a repeated base class.
static CanQualType GetConversionType(ASTContext &Context, NamedDecl *Conv)
static CXXMethodDecl * getInvokerAsMethod(NamedDecl *ND)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the LambdaCapture class.
Defines the clang::LangOptions interface.
llvm::MachO::Target Target
llvm::MachO::Record Record
This file contains the declaration of the ODRHash class, which calculates a hash based on AST nodes,...
Defines an enumeration for C++ overloaded operators.
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream.
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
APValue & getArrayInitializedElt(unsigned I)
APValue & getStructField(unsigned i)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const ConstantArrayType * getAsConstantArrayType(QualType T) const
unsigned getIntWidth(QualType T) const
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl.
DeclarationNameTable DeclarationNames
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
const LangOptions & getLangOpts() const
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
llvm::BumpPtrAllocator & getAllocator() const
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
void * Allocate(size_t Size, unsigned Align=8) const
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
const TargetInfo & getTargetInfo() const
void addDestruction(T *Ptr) const
If T isn't trivially destructible, calls AddDeallocation to register it for destruction.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
An UnresolvedSet-like class which uses the ASTContext's allocator.
void append(ASTContext &C, iterator I, iterator E)
bool replace(const NamedDecl *Old, NamedDecl *New, AccessSpecifier AS)
Replaces the given declaration with the new one, once.
void addDecl(ASTContext &C, NamedDecl *D, AccessSpecifier AS)
Represents an access specifier followed by colon ':'.
static AccessSpecDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
QualType getElementType() const
Represents a C++ declaration that introduces decls from somewhere else.
void addShadowDecl(UsingShadowDecl *S)
shadow_range shadows() const
void removeShadowDecl(UsingShadowDecl *S)
A binding in a decomposition declaration.
VarDecl * getHoldingVar() const
Get the variable (if any) that holds the value of evaluating the binding.
Expr * getBinding() const
Get the expression to which this declaration is bound.
static BindingDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
static BindingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id)
Represents a base class of a C++ class.
Represents a C++ constructor within a class.
bool isExplicit() const
Return true if the declaration is already resolved to be explicit.
init_iterator init_begin()
Retrieve an iterator to the first initializer.
CXXConstructorDecl * getTargetConstructor() const
When this constructor delegates to another, retrieve the target.
static CXXConstructorDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, uint64_t AllocKind)
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
bool isDelegatingConstructor() const
Determine whether this constructor is a delegating constructor.
bool isSpecializationCopyingObject() const
Determine whether this is a member template specialization that would copy the object to itself.
bool isMoveConstructor() const
Determine whether this constructor is a move constructor (C++11 [class.copy]p3), which can be used to...
bool isCopyOrMoveConstructor() const
Determine whether this a copy or move constructor.
static CXXConstructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, ExplicitSpecifier ES, bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, InheritedConstructor Inherited=InheritedConstructor(), Expr *TrailingRequiresClause=nullptr)
bool isInheritingConstructor() const
Determine whether this is an implicit constructor synthesized to model a call to a constructor inheri...
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
bool isConvertingConstructor(bool AllowExplicit) const
Whether this constructor is a converting constructor (C++ [class.conv.ctor]), which can be used for u...
bool isCopyConstructor() const
Whether this constructor is a copy constructor (C++ [class.copy]p2, which can be used to copy the cla...
Represents a C++ conversion function within a class.
bool isLambdaToBlockPointerConversion() const
Determine whether this conversion function is a conversion from a lambda closure type to a block poin...
static CXXConversionDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool UsesFPIntrin, bool isInline, ExplicitSpecifier ES, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
QualType getConversionType() const
Returns the type that this conversion function is converting to.
static CXXConversionDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Represents a C++ base or member initializer.
SourceLocation getRParenLoc() const
SourceRange getSourceRange() const LLVM_READONLY
Determine the source range covering the entire initializer.
SourceLocation getSourceLocation() const
Determine the source location of the initializer.
bool isAnyMemberInitializer() const
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
int64_t getID(const ASTContext &Context) const
bool isInClassMemberInitializer() const
Determine whether this initializer is an implicit initializer generated for a field with an initializ...
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
SourceLocation getMemberLocation() const
FieldDecl * getAnyMember() const
TypeLoc getBaseClassLoc() const
If this is a base class initializer, returns the type of the base class with location information.
CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo, bool IsVirtual, SourceLocation L, Expr *Init, SourceLocation R, SourceLocation EllipsisLoc)
Creates a new base-class initializer.
Represents a C++ deduction guide declaration.
static CXXDeductionGuideDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, ExplicitSpecifier ES, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation, CXXConstructorDecl *Ctor=nullptr, DeductionCandidate Kind=DeductionCandidate::Normal)
static CXXDeductionGuideDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Represents a C++ destructor within a class.
static CXXDestructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, Expr *TrailingRequiresClause=nullptr)
static CXXDestructorDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
void setOperatorDelete(FunctionDecl *OD, Expr *ThisArg)
A mapping from each virtual member function to its set of final overriders.
Represents a static or instance method of a struct/union/class.
bool isExplicitObjectMemberFunction() const
[C++2b][dcl.fct]/p7 An explicit object member function is a non-static member function with an explic...
CXXMethodDecl * getCorrespondingMethodDeclaredInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find if RD declares a function that overrides this function, and if so, return it.
bool isImplicitObjectMemberFunction() const
[C++2b][dcl.fct]/p7 An implicit object member function is a non-static member function without an exp...
void addOverriddenMethod(const CXXMethodDecl *MD)
bool hasInlineBody() const
bool isUsualDeallocationFunction(SmallVectorImpl< const FunctionDecl * > &PreventedBy) const
Determine whether this is a usual deallocation function (C++ [basic.stc.dynamic.deallocation]p2),...
unsigned getNumExplicitParams() const
overridden_method_range overridden_methods() const
unsigned size_overridden_methods() const
const CXXMethodDecl *const * method_iterator
QualType getFunctionObjectParameterReferenceType() const
Return the type of the object pointed by this.
method_iterator begin_overridden_methods() const
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
QualType getThisType() const
Return the type of the this pointer.
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
static CXXMethodDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin, bool isInline, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
CXXMethodDecl * getDevirtualizedMethod(const Expr *Base, bool IsAppleKext)
If it's possible to devirtualize a call to this method, return the called function.
static bool isStaticOverloadedOperator(OverloadedOperatorKind OOK)
Returns true if the given operator is implicitly static in a record context.
CXXMethodDecl * getCorrespondingMethodInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find the method in RD that corresponds to this one.
llvm::iterator_range< llvm::TinyPtrVector< const CXXMethodDecl * >::const_iterator > overridden_method_range
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
static CXXMethodDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
method_iterator end_overridden_methods() const
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isLambdaStaticInvoker() const
Determine whether this is a lambda closure type's static member function that is used for the result ...
Represents a C++ struct/union/class.
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
bool mayBeAbstract() const
Determine whether this class may end up being abstract, even though it is not yet known to be abstrac...
bool isTriviallyCopyable() const
Determine whether this class is considered trivially copyable per (C++11 [class]p6).
bool hasNonTrivialCopyAssignment() const
Determine whether this class has a non-trivial copy assignment operator (C++ [class....
TemplateParameterList * getGenericLambdaTemplateParameterList() const
Retrieve the generic lambda's template parameter list.
bool isEffectivelyFinal() const
Determine whether it's impossible for a class to be derived from this class.
bool hasSimpleMoveConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous move constructor that ...
bool isAggregate() const
Determine whether this class is an aggregate (C++ [dcl.init.aggr]), which is a class with no user-dec...
bool hasTrivialDefaultConstructor() const
Determine whether this class has a trivial default constructor (C++11 [class.ctor]p5).
void setBases(CXXBaseSpecifier const *const *Bases, unsigned NumBases)
Sets the base classes of this struct or class.
bool isGenericLambda() const
Determine whether this class describes a generic lambda function object (i.e.
base_class_iterator bases_end()
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
bool hasUserDeclaredDestructor() const
Determine whether this class has a user-declared destructor.
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
void completeDefinition() override
Indicates that the definition of this class is now complete.
bool isLiteral() const
Determine whether this class is a literal type.
bool defaultedDestructorIsConstexpr() const
Determine whether a defaulted default constructor for this class would be constexpr.
void setCaptures(ASTContext &Context, ArrayRef< LambdaCapture > Captures)
Set the captures for this lambda closure type.
unsigned getDeviceLambdaManglingNumber() const
Retrieve the device side mangling number.
bool hasAnyDependentBases() const
Determine whether this class has any dependent base classes which are not the current instantiation.
void setTrivialForCallFlags(CXXMethodDecl *MD)
bool isLambda() const
Determine whether this class describes a lambda function object.
void addedSelectedDestructor(CXXDestructorDecl *DD)
Notify the class that this destructor is now selected.
bool hasFriends() const
Determines whether this record has any friends.
method_range methods() const
CXXRecordDecl * getDefinition() const
static AccessSpecifier MergeAccess(AccessSpecifier PathAccess, AccessSpecifier DeclAccess)
Calculates the access of a decl that is reached along a path.
void getCaptureFields(llvm::DenseMap< const ValueDecl *, FieldDecl * > &Captures, FieldDecl *&ThisCapture) const
For a closure type, retrieve the mapping from captured variables and this to the non-static data memb...
bool hasConstexprNonCopyMoveConstructor() const
Determine whether this class has at least one constexpr constructor other than the copy or move const...
static CXXRecordDecl * CreateLambda(const ASTContext &C, DeclContext *DC, TypeSourceInfo *Info, SourceLocation Loc, unsigned DependencyKind, bool IsGeneric, LambdaCaptureDefault CaptureDefault)
llvm::iterator_range< conversion_iterator > getVisibleConversionFunctions() const
Get all conversion functions visible in current class, including conversion function templates.
bool hasConstexprDestructor() const
Determine whether this class has a constexpr destructor.
unsigned getNumBases() const
Retrieves the number of base classes of this class.
bool hasNonLiteralTypeFieldsOrBases() const
Determine whether this class has a non-literal or/ volatile type non-static data member or base class...
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
bool isTriviallyCopyConstructible() const
Determine whether this class is considered trivially copyable per.
bool isCapturelessLambda() const
const CXXRecordDecl * getTemplateInstantiationPattern() const
Retrieve the record declaration from which this record could be instantiated.
bool lambdaIsDefaultConstructibleAndAssignable() const
Determine whether this lambda should have an implicit default constructor and copy and move assignmen...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
base_class_iterator bases_begin()
FunctionTemplateDecl * getDependentLambdaCallOperator() const
Retrieve the dependent lambda call operator of the closure type if this is a templated closure type.
void addedEligibleSpecialMemberFunction(const CXXMethodDecl *MD, unsigned SMKind)
Notify the class that an eligible SMF has been added.
conversion_iterator conversion_end() const
void finishedDefaultedOrDeletedMember(CXXMethodDecl *MD)
Indicates that the declaration of a defaulted or deleted special member function is now complete.
CXXRecordDecl(Kind K, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl)
bool isCLike() const
True if this class is C-like, without C++-specific features, e.g.
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
static CXXRecordDecl * CreateDeserialized(const ASTContext &C, GlobalDeclID ID)
bool hasSimpleMoveAssignment() const
true if we know for sure that this class has a single, accessible, unambiguous move assignment operat...
bool hasNonTrivialMoveConstructor() const
Determine whether this class has a non-trivial move constructor (C++11 [class.copy]p12)
bool hasUserDeclaredConstructor() const
Determine whether this class has any user-declared constructors.
unsigned getODRHash() const
bool hasDefinition() const
ArrayRef< NamedDecl * > getLambdaExplicitTemplateParameters() const
Retrieve the lambda template parameters that were specified explicitly.
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
bool isPOD() const
Whether this class is a POD-type (C++ [class]p4)
void getFinalOverriders(CXXFinalOverriderMap &FinaOverriders) const
Retrieve the final overriders for each virtual member function in the class hierarchy where this clas...
void removeConversion(const NamedDecl *Old)
Removes a conversion function from this class.
bool hasSimpleCopyConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous copy constructor that ...
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
bool hasNonTrivialMoveAssignment() const
Determine whether this class has a non-trivial move assignment operator (C++11 [class....
CXXMethodDecl * getLambdaStaticInvoker() const
Retrieve the lambda static invoker, the address of which is returned by the conversion operator,...
bool hasSimpleDestructor() const
true if we know for sure that this class has an accessible destructor that is not deleted.
void setDescribedClassTemplate(ClassTemplateDecl *Template)
bool isInterfaceLike() const
void setLambdaNumbering(LambdaNumbering Numbering)
Set the mangling numbers and context declaration for a lambda class.
bool forallBases(ForallBasesCallback BaseMatches) const
Determines if the given callback holds for all the direct or indirect base classes of this type.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization,...
bool hasNonTrivialCopyConstructor() const
Determine whether this class has a non-trivial copy constructor (C++ [class.copy]p6,...
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
bool hasSimpleCopyAssignment() const
true if we know for sure that this class has a single, accessible, unambiguous copy assignment operat...
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the kind of specialization or template instantiation this is.
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
conversion_iterator conversion_begin() const
unsigned getCVRQualifiers() const
Retrieve the const/volatile/restrict qualifiers.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
Declaration of a class template.
Represents the canonical version of C arrays with a specified constant size.
llvm::APInt getSize() const
Return the constant array size as an APInt.
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
static ConstructorUsingShadowDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
UsingDecl * getIntroducer() const
Override the UsingShadowDecl's getIntroducer, returning the UsingDecl that introduced this.
static ConstructorUsingShadowDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, UsingDecl *Using, NamedDecl *Target, bool IsVirtual)
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
The results of name lookup within a DeclContext.
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext,...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
ASTContext & getParentASTContext() const
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
bool isTranslationUnit() const
bool isFunctionOrMethod() const
bool isExternCContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
LinkageSpecDeclBitfields LinkageSpecDeclBits
Decl - This represents one declaration (or definition), e.g.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
SourceLocation getEndLoc() const LLVM_READONLY
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
ASTContext & getASTContext() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
ASTMutationListener * getASTMutationListener() const
Kind
Lists the kind of concrete classes of Decl.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
bool isInvalidDecl() const
SourceLocation getLocation() const
void setImplicit(bool I=true)
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
const LangOptions & getLangOpts() const LLVM_READONLY
Helper to get the language options from the ASTContext.
The name of a declaration.
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
@ CXXConversionFunctionName
NameKind getNameKind() const
Determine what kind of name this is.
bool isIdentifier() const
Predicate functions for querying what type of name this is.
A decomposition declaration.
void printName(raw_ostream &OS, const PrintingPolicy &Policy) const override
Pretty-print the unqualified name of this declaration.
ArrayRef< BindingDecl * > bindings() const
static DecompositionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation LSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl * > Bindings)
static DecompositionDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NumBindings)
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
Store information needed for an explicit specifier.
ExplicitSpecKind getKind() const
const Expr * getExpr() const
static ExplicitSpecifier getFromDecl(FunctionDecl *Function)
bool isEquivalent(const ExplicitSpecifier Other) const
Check for equivalence of explicit specifiers.
This represents one expression.
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
Abstract interface for external sources of AST nodes.
virtual Decl * GetExternalDecl(GlobalDeclID ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
Represents a member of a struct/union/class.
Represents a function declaration or definition.
const ParmVarDecl * getParamDecl(unsigned i) const
bool isTrivialForCall() const
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to call this function.
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
bool isDestroyingOperatorDelete() const
Determine whether this is a destroying operator delete.
bool hasCXXExplicitFunctionObjectParameter() const
bool UsesFPIntrin() const
Determine whether the function was declared in source context that requires constrained FP intrinsics...
ArrayRef< ParmVarDecl * > parameters() const
FunctionDecl * getTemplateInstantiationPattern(bool ForDefinition=true) const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
const ParmVarDecl * getNonObjectParameter(unsigned I) const
bool isVariadic() const
Whether this function is variadic.
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a member function.
bool isPureVirtual() const
Whether this virtual function is pure, i.e.
void setIneligibleOrNotSelected(bool II)
OverloadedOperatorKind getOverloadedOperator() const
getOverloadedOperator - Which C++ overloaded operator this function represents, if any.
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration.
bool hasOneParamOrDefaultArgs() const
Determine whether this function has a single parameter, or multiple parameters where all but the firs...
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
bool isDefined(const FunctionDecl *&Definition, bool CheckForPendingFriendDefinition=false) const
Returns true if the function has a definition that does not need to be instantiated.
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
Represents a prototype with parameter type info, e.g.
Qualifiers getMethodQuals() const
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
Declaration of a template function.
FunctionType - C99 6.7.5.3 - Function Declarators.
One of these records is kept for each identifier that is lexed.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Represents a field injected from an anonymous union/struct into the parent scope.
Description of a constructor that was inherited from a base class.
An lvalue reference type, per C++11 [dcl.ref].
Describes the capture of a variable or of this, or of a C++1y init-capture.
@ Ver6
Attempt to be ABI-compatible with code generated by Clang 6.0.x (SVN r321711).
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
APValue * getOrCreateValue(bool MayCreate) const
Get the storage for the constant value of a materialized temporary of static storage duration.
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
ValueDecl * getExtendingDecl()
Represents a linkage specification.
static LinkageSpecDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation ExternLoc, SourceLocation LangLoc, LinkageSpecLanguageIDs Lang, bool HasBraces)
static LinkageSpecDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
APValue & getAsAPValue() const
Get the value of this MSGuidDecl as an APValue.
void printName(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const override
Print this UUID in a human-readable format.
An instance of this class represents the declaration of a property member.
static MSPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL, IdentifierInfo *Getter, IdentifierInfo *Setter)
static MSPropertyDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
A pointer to member type per C++ 8.3.3 - Pointers to members.
Provides information a specialization of a member of a class template, which may be a member function...
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
NamedDecl * getMostRecentDecl()
Represents a C++ namespace alias.
static NamespaceAliasDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Namespace)
Represent a C++ namespace.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl, bool Nested)
static NamespaceDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
A C++ nested-name-specifier augmented with source location information.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
void AddStmt(const Stmt *S)
void AddCXXRecordDecl(const CXXRecordDecl *Record)
Represents a parameter to a function.
A (possibly-)qualified type.
void addRestrict()
Add the restrict qualifier to this QualType.
void removeLocalRestrict()
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
Represents a struct/union/class.
void setArgPassingRestrictions(RecordArgPassingKind Kind)
field_iterator field_end() const
field_range fields() const
void setHasObjectMember(bool val)
void setHasVolatileMember(bool val)
virtual void completeDefinition()
Note that the definition of this type is now complete.
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
field_iterator field_begin() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
FunctionDecl * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
NamespaceDecl * getNextRedeclaration() const
NamespaceDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Base for LValueReferenceType and RValueReferenceType.
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
static RequiresExprBodyDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Encodes a location in the source.
A trivial tuple used to represent a source range.
Represents a C++11 static_assert declaration.
static StaticAssertDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *Message, SourceLocation RParenLoc, bool Failed)
static StaticAssertDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
bool isBeingDefined() const
Return true if this decl is currently being defined.
void setMayHaveOutOfDateDef(bool V=true)
Indicates whether it is possible for declarations of this kind to have an out-of-date definition.
void setBeingDefined(bool V=true)
True if this decl is currently being defined.
TagKind getTagKind() const
Exposes information about the current target.
virtual bool areDefaultedSMFStillPOD(const LangOptions &) const
Controls whether explicitly defaulted (= default) special member functions disqualify something from ...
Stores a list of template parameters for a TemplateDecl and its derived classes.
const Type * getTypeForDecl() const
Base wrapper for a particular "section" of type source info.
A container of type source information.
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBlockPointerType() const
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
bool isUnsignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is unsigned or an enumeration types whose underlying ...
bool isRValueReferenceType() const
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isLValueReferenceType() const
bool isStructuralType() const
Determine if this type is a structural type, per C++20 [temp.param]p7.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
const T * getAs() const
Member-template getAs<specific type>'.
bool isRecordType() const
bool isObjCRetainableType() const
TagDecl * getAsTagDecl() const
Retrieves the TagDecl that this type refers to, either because the type is a TagType or because it is...
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
void printName(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const override
Print this in a human-readable format.
A set of unresolved declarations.
void addDecl(NamedDecl *D)
The iterator over UnresolvedSets.
NamedDecl * getDecl() const
A set of unresolved declarations.
This node is generated when a using-declaration that was annotated with attribute((using_if_exists)) ...
static UnresolvedUsingIfExistsDecl * CreateDeserialized(ASTContext &Ctx, GlobalDeclID ID)
static UnresolvedUsingIfExistsDecl * Create(ASTContext &Ctx, DeclContext *DC, SourceLocation Loc, DeclarationName Name)
Represents a dependent using declaration which was marked with typename.
static UnresolvedUsingTypenameDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation TypenameLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TargetNameLoc, DeclarationName TargetName, SourceLocation EllipsisLoc)
static UnresolvedUsingTypenameDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Represents a dependent using declaration which was not marked with typename.
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
DeclarationNameInfo getNameInfo() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static UnresolvedUsingValueDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, SourceLocation EllipsisLoc)
static UnresolvedUsingValueDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Represents a C++ using-declaration.
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
static UsingDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
DeclarationNameInfo getNameInfo() const
static UsingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Represents C++ using-directive.
static UsingDirectiveDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
static UsingDirectiveDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation NamespaceLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Nominated, DeclContext *CommonAncestor)
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Represents a C++ using-enum-declaration.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static UsingEnumDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
static UsingEnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, SourceLocation EnumL, SourceLocation NameL, TypeSourceInfo *EnumType)
Represents a pack of using declarations that a single using-declarator pack-expanded into.
static UsingPackDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NumExpansions)
static UsingPackDecl * Create(ASTContext &C, DeclContext *DC, NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl * > UsingDecls)
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
void setTargetDecl(NamedDecl *ND)
Sets the underlying declaration which has been brought into the local scope.
UsingShadowDecl(Kind K, ASTContext &C, DeclContext *DC, SourceLocation Loc, DeclarationName Name, BaseUsingDecl *Introducer, NamedDecl *Target)
static UsingShadowDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
BaseUsingDecl * getIntroducer() const
Gets the (written or instantiated) using declaration that introduced this declaration.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
VarDecl * getPotentiallyDecomposedVarDecl()
Represents a variable declaration or definition.
Defines the clang::TargetInfo interface.
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
ConstexprSpecKind
Define the kind of constexpr specifier.
LinkageSpecLanguageIDs
Represents the language in a linkage specification.
RefQualifierKind
The kind of C++11 ref-qualifier associated with a function type.
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
StorageClass
Storage classes.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
StorageDuration
The storage duration for an object (per C++ [basic.stc]).
@ SD_Static
Static storage duration.
@ SD_FullExpression
Full-expression storage duration (for temporaries).
@ SD_Automatic
Automatic storage duration (most local variables).
@ Result
The result type of a method or function.
TagTypeKind
The kind of a tag type.
@ Interface
The "__interface" keyword.
@ Struct
The "struct" keyword.
@ Class
The "class" keyword.
@ CanNeverPassInRegs
The argument of this type cannot be passed directly in registers.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
StringRef getLambdaStaticInvokerName()
const FunctionProtoType * T
DeductionCandidate
Only used by CXXDeductionGuideDecl.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
CallingConv
CallingConv - Specifies the calling convention that a function uses.
U cast(CodeGen::Address addr)
@ Other
Other implicit parameter.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Information about how a lambda is numbered within its context.
unsigned DeviceManglingNumber
bool HasKnownInternalLinkage
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
DeclarationName getName() const
getName - Returns the embedded declaration name.
T * get(ExternalASTSource *Source) const
Retrieve the pointer to the AST node that this lazy pointer points to.
uint16_t Part2
...-89ab-...
uint32_t Part1
{01234567-...
uint16_t Part3
...-cdef-...
uint8_t Part4And5[8]
...-0123-456789abcdef}
Describes how types, statements, expressions, and declarations should be printed.