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);
76CXXRecordDecl::DefinitionData::DefinitionData(
CXXRecordDecl *D)
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), IsHLSLIntangible(
false),
114 IsParsingBaseSpecifiers(
false), ComputedVisibleConversions(
false),
118 return Bases.get(Definition->getASTContext().getExternalSource());
121CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getVBasesSlowCase()
const {
122 return VBases.get(
Definition->getASTContext().getExternalSource());
129 :
RecordDecl(K, TK,
C, DC, StartLoc, IdLoc, Id, PrevDecl),
130 DefinitionData(PrevDecl ? PrevDecl->DefinitionData
138 CXXRecordDecl(CXXRecord, TK,
C, DC, StartLoc, IdLoc, Id, PrevDecl);
144 unsigned DependencyKind,
bool IsGeneric,
147 Loc,
nullptr,
nullptr);
148 R->setBeingDefined(
true);
149 R->DefinitionData =
new (
C)
struct LambdaDefinitionData(
150 R, Info, DependencyKind, IsGeneric, CaptureDefault);
151 R->setImplicit(
true);
157 auto *R =
new (
C, ID)
169 while (!WorkList.empty()) {
174 if (
const CXXRecordDecl *B = BaseSpec.getType()->getAsCXXRecordDecl()) {
175 if (!SeenBaseTypes.insert(B).second)
177 WorkList.push_back(B);
189 if (!data().Bases.isOffset() && data().NumBases > 0)
190 C.Deallocate(data().getBases());
193 if (!
C.getLangOpts().CPlusPlus17) {
196 data().Aggregate =
false;
201 data().PlainOldData =
false;
211 data().NumBases = NumBases;
212 for (
unsigned i = 0; i < NumBases; ++i) {
213 data().getBases()[i] = *Bases[i];
218 if (BaseType->isDependentType())
220 auto *BaseClassDecl = BaseType->castAsCXXRecordDecl();
227 if (BaseClassDecl->data().HasBasesWithFields ||
228 !BaseClassDecl->field_empty()) {
229 if (data().HasBasesWithFields)
231 data().IsStandardLayout =
false;
232 data().HasBasesWithFields =
true;
239 if (BaseClassDecl->data().HasBasesWithNonStaticDataMembers ||
240 BaseClassDecl->hasDirectFields()) {
241 if (data().HasBasesWithNonStaticDataMembers)
242 data().IsCXX11StandardLayout =
false;
243 data().HasBasesWithNonStaticDataMembers =
true;
246 if (!BaseClassDecl->isEmpty()) {
250 data().Empty =
false;
256 data().Aggregate =
false;
261 data().StructuralIfLiteral =
false;
267 if (BaseClassDecl->isPolymorphic()) {
268 data().Polymorphic =
true;
271 data().Aggregate =
false;
277 if (!BaseClassDecl->isStandardLayout())
278 data().IsStandardLayout =
false;
279 if (!BaseClassDecl->isCXX11StandardLayout())
280 data().IsCXX11StandardLayout =
false;
284 data().HasNonLiteralTypeFieldsOrBases =
true;
287 for (
const auto &VBase : BaseClassDecl->vbases()) {
289 if (SeenVBaseTypes.insert(
C.getCanonicalType(VBase.getType())).second) {
290 VBases.push_back(&VBase);
297 if (
CXXRecordDecl *VBaseDecl = VBase.getType()->getAsCXXRecordDecl())
298 if (!VBaseDecl->hasCopyConstructorWithConstParam())
299 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
303 data().Aggregate =
false;
307 if (
Base->isVirtual()) {
309 if (SeenVBaseTypes.insert(
C.getCanonicalType(BaseType)).second)
310 VBases.push_back(
Base);
315 data().Empty =
false;
319 data().Aggregate =
false;
325 data().HasTrivialSpecialMembers &= SMF_Destructor;
326 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
331 data().IsStandardLayout =
false;
332 data().IsCXX11StandardLayout =
false;
338 if (!
C.getLangOpts().CPlusPlus26) {
339 data().DefaultedDefaultConstructorIsConstexpr =
false;
340 data().DefaultedDestructorIsConstexpr =
false;
348 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
349 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
355 if (!BaseClassDecl->hasTrivialDefaultConstructor())
356 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
363 if (!BaseClassDecl->hasTrivialCopyConstructor())
364 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
366 if (!BaseClassDecl->hasTrivialCopyConstructorForCall())
367 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
373 if (!BaseClassDecl->hasTrivialMoveConstructor())
374 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
376 if (!BaseClassDecl->hasTrivialMoveConstructorForCall())
377 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
384 if (!BaseClassDecl->hasTrivialCopyAssignment())
385 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
390 if (!BaseClassDecl->hasTrivialMoveAssignment())
391 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
397 if (!BaseClassDecl->hasConstexprDefaultConstructor())
398 data().DefaultedDefaultConstructorIsConstexpr =
399 C.getLangOpts().CPlusPlus23;
406 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
407 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
413 if (!BaseClassDecl->hasTrivialDestructor())
414 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
416 if (!BaseClassDecl->hasTrivialDestructorForCall())
417 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
419 if (!BaseClassDecl->hasIrrelevantDestructor())
420 data().HasIrrelevantDestructor =
false;
422 if (BaseClassDecl->isAnyDestructorNoReturn())
423 data().IsAnyDestructorNoReturn =
true;
425 if (BaseClassDecl->isHLSLIntangible())
426 data().IsHLSLIntangible =
true;
433 if (!BaseClassDecl->hasCopyAssignmentWithConstParam())
434 data().ImplicitCopyAssignmentHasConstParam =
false;
438 if (BaseClassDecl->hasObjectMember())
441 if (BaseClassDecl->hasVolatileMember())
444 if (BaseClassDecl->getArgPassingRestrictions() ==
449 if (BaseClassDecl->hasMutableFields())
450 data().HasMutableFields =
true;
452 if (BaseClassDecl->hasUninitializedExplicitInitFields() &&
453 BaseClassDecl->isAggregate())
456 if (BaseClassDecl->hasUninitializedReferenceMember())
457 data().HasUninitializedReferenceMember =
true;
459 if (!BaseClassDecl->allowConstDefaultInit())
460 data().HasUninitializedFields =
true;
462 if (BaseClassDecl->isPFPType())
463 data().IsPFPType =
true;
465 addedClassSubobject(BaseClassDecl);
476 data().IsStandardLayout =
false;
478 if (VBases.empty()) {
479 data().IsParsingBaseSpecifiers =
false;
485 data().NumVBases = VBases.size();
486 for (
int I = 0, E = VBases.size(); I != E; ++I) {
490 data().getVBases()[I] = *VBases[I];
493 data().IsParsingBaseSpecifiers =
false;
497 assert(
hasDefinition() &&
"ODRHash only for records with definitions");
500 if (DefinitionData->HasODRHash)
501 return DefinitionData->ODRHash;
506 DefinitionData->HasODRHash =
true;
509 return DefinitionData->ODRHash;
512void CXXRecordDecl::addedClassSubobject(
CXXRecordDecl *Subobj) {
520 data().NeedOverloadResolutionForCopyConstructor =
true;
522 data().NeedOverloadResolutionForMoveConstructor =
true;
531 data().NeedOverloadResolutionForCopyAssignment =
true;
533 data().NeedOverloadResolutionForMoveAssignment =
true;
543 data().NeedOverloadResolutionForCopyConstructor =
true;
544 data().NeedOverloadResolutionForMoveConstructor =
true;
545 data().NeedOverloadResolutionForDestructor =
true;
554 data().DefaultedDestructorIsConstexpr =
561 if (!Subobj->data().StructuralIfLiteral)
562 data().StructuralIfLiteral =
false;
568 "getStandardLayoutBaseWithFields called on a non-standard-layout type");
569#ifdef EXPENSIVE_CHECKS
571 unsigned NumberOfBasesWithFields = 0;
573 ++NumberOfBasesWithFields;
576 if (!
Base->field_empty())
577 ++NumberOfBasesWithFields;
579 UniqueBases.insert(
Base->getCanonicalDecl()).second &&
580 "Standard layout struct has multiple base classes of the same type");
583 assert(NumberOfBasesWithFields <= 1 &&
584 "Standard layout struct has fields declared in more than one class");
591 if (!
Base->field_empty()) {
643void CXXRecordDecl::markedVirtualFunctionPure() {
646 data().Abstract =
true;
649bool CXXRecordDecl::hasSubobjectAtOffsetZeroOfEmptyBaseType(
660 RD = RD->getCanonicalDecl();
668 if (!RD->data().HasBasesWithFields) {
687 if (M.insert(RD).second)
688 WorkList.push_back(RD);
695 while (!WorkList.empty()) {
705 bool IsFirstField =
true;
706 for (
auto *FD :
X->fields()) {
709 if (FD->isUnnamedBitField())
712 if (!IsFirstField && !FD->isZeroSize(Ctx))
715 if (FD->isInvalidDecl())
725 IsFirstField =
false;
733 assert(
isLambda() &&
"not a lambda");
750void CXXRecordDecl::addedMember(
Decl *D) {
755 data().HasOnlyCMembers =
false;
761 auto *FunTmpl = dyn_cast<FunctionTemplateDecl>(D);
763 D = FunTmpl->getTemplatedDecl();
766 Decl *DUnderlying = D;
767 if (
auto *ND = dyn_cast<NamedDecl>(DUnderlying)) {
768 DUnderlying = ND->getUnderlyingDecl();
769 if (
auto *UnderlyingFunTmpl = dyn_cast<FunctionTemplateDecl>(DUnderlying))
770 DUnderlying = UnderlyingFunTmpl->getTemplatedDecl();
773 if (
const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
774 if (Method->isVirtual()) {
777 data().Aggregate =
false;
781 data().PlainOldData =
false;
785 data().Empty =
false;
790 data().Polymorphic =
true;
796 data().HasTrivialSpecialMembers &= SMF_Destructor;
797 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
802 data().IsStandardLayout =
false;
803 data().IsCXX11StandardLayout =
false;
811 L->AddedCXXImplicitMember(data().
Definition, D);
817 if (
const auto *
Constructor = dyn_cast<CXXConstructorDecl>(D)) {
824 data().UserDeclaredConstructor =
true;
834 data().PlainOldData =
false;
839 SMKind |= SMF_DefaultConstructor;
842 data().UserProvidedDefaultConstructor =
true;
844 data().HasConstexprDefaultConstructor =
true;
846 data().HasDefaultedDefaultConstructor =
true;
852 SMKind |= SMF_CopyConstructor;
855 data().HasDeclaredCopyConstructorWithConstParam =
true;
857 SMKind |= SMF_MoveConstructor;
869 data().Aggregate =
false;
874 if (
const auto *
Constructor = dyn_cast<CXXConstructorDecl>(DUnderlying)) {
882 data().HasConstexprNonCopyMoveConstructor =
true;
884 data().HasInheritedDefaultConstructor =
true;
888 if (
const auto *
Method = dyn_cast<CXXMethodDecl>(D)) {
890 SMKind |= SMF_Destructor;
892 if (
Method->isCopyAssignmentOperator()) {
893 SMKind |= SMF_CopyAssignment;
895 const auto *ParamTy =
896 Method->getNonObjectParameter(0)->getType()->getAs<ReferenceType>();
897 if (!ParamTy || ParamTy->getPointeeType().isConstQualified())
898 data().HasDeclaredCopyAssignmentWithConstParam =
true;
901 if (
Method->isMoveAssignmentOperator())
902 SMKind |= SMF_MoveAssignment;
905 if (
auto *Conversion = dyn_cast<CXXConversionDecl>(D)) {
914 if (Conversion->getPrimaryTemplate()) {
918 ASTUnresolvedSet &Conversions = data().Conversions.get(Ctx);
925 Conversions.
addDecl(Ctx, Primary, AS);
932 data().HasTrivialSpecialMembers &=
933 data().DeclaredSpecialMembers | ~SMKind;
934 data().HasTrivialSpecialMembersForCall &=
935 data().DeclaredSpecialMembers | ~SMKind;
939 data().DeclaredSpecialMembers |= SMKind;
940 if (!
Method->isImplicit()) {
941 data().UserDeclaredSpecialMembers |= SMKind;
945 SMKind != SMF_MoveAssignment) ||
959 data().PlainOldData =
false;
967 if (!
Method->isIneligibleOrNotSelected()) {
976 if (
const auto *Field = dyn_cast<FieldDecl>(D)) {
984 if (data().HasBasesWithFields)
985 data().IsStandardLayout =
false;
991 if (
Field->isUnnamedBitField()) {
995 if (data().
Empty && !
Field->isZeroLengthBitField() &&
997 data().Empty =
false;
1005 if (data().HasBasesWithNonStaticDataMembers)
1006 data().IsCXX11StandardLayout =
false;
1014 data().Aggregate =
false;
1015 data().PlainOldData =
false;
1020 data().StructuralIfLiteral =
false;
1025 bool IsFirstField = !data().HasPrivateFields &&
1026 !data().HasProtectedFields && !data().HasPublicFields;
1033 case AS_private: data().HasPrivateFields =
true;
break;
1034 case AS_protected: data().HasProtectedFields =
true;
break;
1035 case AS_public: data().HasPublicFields =
true;
break;
1036 case AS_none: llvm_unreachable(
"Invalid access specifier");
1038 if ((data().HasPrivateFields + data().HasProtectedFields +
1039 data().HasPublicFields) > 1) {
1040 data().IsStandardLayout =
false;
1041 data().IsCXX11StandardLayout =
false;
1045 if (
Field->isMutable()) {
1046 data().HasMutableFields =
true;
1051 data().StructuralIfLiteral =
false;
1058 data().HasVariantMembers =
true;
1060 if (
isUnion() && IsFirstField)
1061 data().HasUninitializedFields =
true;
1080 struct DefinitionData &
Data = data();
1081 Data.PlainOldData =
false;
1082 Data.HasTrivialSpecialMembers = 0;
1088 data().HasTrivialSpecialMembersForCall = 0;
1094 Data.HasIrrelevantDestructor =
false;
1097 data().DefaultedCopyConstructorIsDeleted =
true;
1098 data().DefaultedMoveConstructorIsDeleted =
true;
1099 data().DefaultedCopyAssignmentIsDeleted =
true;
1100 data().DefaultedMoveAssignmentIsDeleted =
true;
1101 data().DefaultedDestructorIsDeleted =
true;
1102 data().NeedOverloadResolutionForCopyConstructor =
true;
1103 data().NeedOverloadResolutionForMoveConstructor =
true;
1104 data().NeedOverloadResolutionForCopyAssignment =
true;
1105 data().NeedOverloadResolutionForMoveAssignment =
true;
1106 data().NeedOverloadResolutionForDestructor =
true;
1108 }
else if (!Context.
getLangOpts().ObjCAutoRefCount) {
1112 data().PlainOldData =
false;
1118 if (Q.isAddressDiscriminated()) {
1119 struct DefinitionData &
Data = data();
1120 Data.PlainOldData =
false;
1121 Data.HasTrivialSpecialMembers &=
1122 ~(SMF_CopyConstructor | SMF_MoveConstructor | SMF_CopyAssignment |
1123 SMF_MoveAssignment);
1129 data().DefaultedCopyConstructorIsDeleted =
true;
1130 data().DefaultedMoveConstructorIsDeleted =
true;
1131 data().DefaultedCopyAssignmentIsDeleted =
true;
1132 data().DefaultedMoveAssignmentIsDeleted =
true;
1133 data().NeedOverloadResolutionForCopyConstructor =
true;
1134 data().NeedOverloadResolutionForMoveConstructor =
true;
1135 data().NeedOverloadResolutionForCopyAssignment =
true;
1136 data().NeedOverloadResolutionForMoveAssignment =
true;
1141 if (
Field->hasAttr<ExplicitInitAttr>())
1145 if (!
Field->hasInClassInitializer())
1146 data().HasUninitializedReferenceMember =
true;
1151 data().IsStandardLayout =
false;
1152 data().IsCXX11StandardLayout =
false;
1158 data().DefaultedCopyConstructorIsDeleted =
true;
1162 if (
Field->hasInClassInitializer())
1163 data().HasUninitializedFields =
false;
1164 }
else if (!
Field->hasInClassInitializer() && !
Field->isMutable()) {
1166 if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
1167 data().HasUninitializedFields =
true;
1169 data().HasUninitializedFields =
true;
1175 data().HasNonLiteralTypeFieldsOrBases =
true;
1177 if (
Field->hasInClassInitializer() ||
1178 (
Field->isAnonymousStructOrUnion() &&
1179 Field->getType()->getAsCXXRecordDecl()->hasInClassInitializer())) {
1180 data().HasInClassInitializer =
true;
1185 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1193 data().Aggregate =
false;
1197 data().PlainOldData =
false;
1205 data().DefaultedCopyAssignmentIsDeleted =
true;
1206 data().DefaultedMoveAssignmentIsDeleted =
true;
1211 bool IsZeroSize =
Field->isZeroSize(Context);
1214 if (FieldRec->isBeingDefined() || FieldRec->isCompleteDefinition()) {
1215 addedClassSubobject(FieldRec);
1223 data().NeedOverloadResolutionForCopyConstructor =
true;
1224 data().NeedOverloadResolutionForMoveConstructor =
true;
1225 data().NeedOverloadResolutionForCopyAssignment =
true;
1226 data().NeedOverloadResolutionForMoveAssignment =
true;
1235 if (FieldRec->hasNonTrivialCopyConstructor())
1236 data().DefaultedCopyConstructorIsDeleted =
true;
1237 if (FieldRec->hasNonTrivialMoveConstructor())
1238 data().DefaultedMoveConstructorIsDeleted =
true;
1239 if (FieldRec->hasNonTrivialCopyAssignment())
1240 data().DefaultedCopyAssignmentIsDeleted =
true;
1241 if (FieldRec->hasNonTrivialMoveAssignment())
1242 data().DefaultedMoveAssignmentIsDeleted =
true;
1243 if (FieldRec->hasNonTrivialDestructor()) {
1244 data().DefaultedDestructorIsDeleted =
true;
1248 data().DefaultedDestructorIsConstexpr =
true;
1254 if (
Field->isAnonymousStructOrUnion()) {
1255 data().NeedOverloadResolutionForCopyConstructor |=
1256 FieldRec->data().NeedOverloadResolutionForCopyConstructor;
1257 data().NeedOverloadResolutionForMoveConstructor |=
1258 FieldRec->data().NeedOverloadResolutionForMoveConstructor;
1259 data().NeedOverloadResolutionForCopyAssignment |=
1260 FieldRec->data().NeedOverloadResolutionForCopyAssignment;
1261 data().NeedOverloadResolutionForMoveAssignment |=
1262 FieldRec->data().NeedOverloadResolutionForMoveAssignment;
1263 data().NeedOverloadResolutionForDestructor |=
1264 FieldRec->data().NeedOverloadResolutionForDestructor;
1272 if (!FieldRec->hasTrivialDefaultConstructor())
1273 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1281 if (!FieldRec->hasTrivialCopyConstructor())
1282 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
1284 if (!FieldRec->hasTrivialCopyConstructorForCall())
1285 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
1290 if (!FieldRec->hasTrivialMoveConstructor())
1291 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
1293 if (!FieldRec->hasTrivialMoveConstructorForCall())
1294 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
1302 if (!FieldRec->hasTrivialCopyAssignment())
1303 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
1307 if (!FieldRec->hasTrivialMoveAssignment())
1308 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
1310 if (!FieldRec->hasTrivialDestructor())
1311 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1312 if (!FieldRec->hasTrivialDestructorForCall())
1313 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1314 if (!FieldRec->hasIrrelevantDestructor())
1315 data().HasIrrelevantDestructor =
false;
1316 if (FieldRec->isAnyDestructorNoReturn())
1317 data().IsAnyDestructorNoReturn =
true;
1318 if (FieldRec->hasObjectMember())
1320 if (FieldRec->hasVolatileMember())
1322 if (FieldRec->getArgPassingRestrictions() ==
1330 if (!FieldRec->isStandardLayout())
1331 data().IsStandardLayout =
false;
1332 if (!FieldRec->isCXX11StandardLayout())
1333 data().IsCXX11StandardLayout =
false;
1339 if (data().IsStandardLayout &&
1340 (
isUnion() || IsFirstField || IsZeroSize) &&
1341 hasSubobjectAtOffsetZeroOfEmptyBaseType(Context, FieldRec))
1342 data().IsStandardLayout =
false;
1348 if (data().IsCXX11StandardLayout && IsFirstField) {
1351 for (
const auto &BI :
bases()) {
1353 data().IsCXX11StandardLayout =
false;
1360 if (FieldRec->hasMutableFields())
1361 data().HasMutableFields =
true;
1363 if (
Field->isMutable()) {
1367 data().NeedOverloadResolutionForCopyConstructor =
true;
1368 data().NeedOverloadResolutionForCopyAssignment =
true;
1378 if (!
Field->hasInClassInitializer() &&
1379 !FieldRec->hasConstexprDefaultConstructor() && !
isUnion())
1382 data().DefaultedDefaultConstructorIsConstexpr =
1390 if (!FieldRec->hasCopyConstructorWithConstParam())
1391 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
1399 if (!FieldRec->hasCopyAssignmentWithConstParam())
1400 data().ImplicitCopyAssignmentHasConstParam =
false;
1402 if (FieldRec->hasUninitializedExplicitInitFields() &&
1403 FieldRec->isAggregate())
1406 if (FieldRec->hasUninitializedReferenceMember() &&
1407 !
Field->hasInClassInitializer())
1408 data().HasUninitializedReferenceMember =
true;
1413 if (FieldRec->hasVariantMembers() &&
1414 Field->isAnonymousStructOrUnion())
1415 data().HasVariantMembers =
true;
1417 if (FieldRec->isPFPType())
1418 data().IsPFPType =
true;
1425 data().DefaultedDefaultConstructorIsConstexpr =
false;
1433 data().DefaultedCopyAssignmentIsDeleted =
true;
1434 data().DefaultedMoveAssignmentIsDeleted =
true;
1443 data().StructuralIfLiteral =
false;
1450 data().HasTrivialSpecialMembers &=
1451 SMF_DefaultConstructor | SMF_Destructor;
1456 if (data().
Empty && !IsZeroSize)
1457 data().Empty =
false;
1460 const Type *Ty =
Field->getType()->getUnqualifiedDesugaredType();
1465 if (
const RecordType *RT = dyn_cast<RecordType>(Ty))
1474 if (
auto *Shadow = dyn_cast<UsingShadowDecl>(D)) {
1475 if (Shadow->getDeclName().getNameKind()
1478 data().Conversions.get(Ctx).addDecl(Ctx, Shadow, Shadow->getAccess());
1482 if (
const auto *Using = dyn_cast<UsingDecl>(D)) {
1483 if (
Using->getDeclName().getNameKind() ==
1485 data().HasInheritedConstructor =
true;
1488 data().Aggregate =
false;
1491 if (
Using->getDeclName().getCXXOverloadedOperator() == OO_Equal)
1492 data().HasInheritedAssignment =
true;
1505 data().Aggregate = data().UserDeclaredSpecialMembers == 0;
1520 bool HasAtLeastOneLiteralMember =
1525 if (!HasAtLeastOneLiteralMember)
1544 if (
const auto *DD = dyn_cast<CXXDestructorDecl>(MD)) {
1545 if (DD->isUserProvided())
1546 data().HasIrrelevantDestructor =
false;
1553 if (DD->isVirtual()) {
1554 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1555 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1558 if (DD->isNoReturn())
1559 data().IsAnyDestructorNoReturn =
true;
1567 data().HasTrivialSpecialMembers |= SMKind;
1568 data().HasTrivialSpecialMembersForCall |= SMKind;
1570 data().HasTrivialSpecialMembersForCall |= SMKind;
1571 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1573 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1580 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1588 unsigned SMKind = 0;
1590 if (
const auto *
Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1592 SMKind |= SMF_DefaultConstructor;
1594 data().HasConstexprDefaultConstructor =
true;
1597 SMKind |= SMF_CopyConstructor;
1599 SMKind |= SMF_MoveConstructor;
1602 data().HasConstexprNonCopyMoveConstructor =
true;
1604 SMKind |= SMF_Destructor;
1606 data().HasIrrelevantDestructor =
false;
1608 SMKind |= SMF_CopyAssignment;
1610 SMKind |= SMF_MoveAssignment;
1616 data().HasTrivialSpecialMembers |= SMKind;
1618 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1622void CXXRecordDecl::LambdaDefinitionData::AddCaptureList(
ASTContext &Ctx,
1624 Captures.push_back(CaptureList);
1625 if (Captures.size() == 2) {
1633 CXXRecordDecl::LambdaDefinitionData &
Data = getLambdaData();
1636 Data.NumCaptures = Captures.size();
1637 Data.NumExplicitCaptures = 0;
1640 Data.AddCaptureList(Context, ToCapture);
1643 ++
Data.NumExplicitCaptures;
1650 Data.DefaultedCopyAssignmentIsDeleted =
true;
1654 unsigned SMKind = 0;
1656 if (
const auto *
Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1658 SMKind = SMF_CopyConstructor;
1660 SMKind = SMF_MoveConstructor;
1662 SMKind = SMF_Destructor;
1665 data().HasTrivialSpecialMembersForCall |= SMKind;
1667 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1673 !TemplateOrInstantiation.isNull())
1678 return isPOD() && data().HasOnlyCMembers;
1683 return getLambdaData().IsGenericLambda;
1688 return llvm::all_of(R, [&](
NamedDecl *D) {
1695 if (!RD.
isLambda())
return nullptr;
1706 "More than one lambda call operator!");
1732 if (MD->getOwningModule() == M)
1736 llvm_unreachable(
"Couldn't find our call operator!");
1741 return dyn_cast_or_null<FunctionTemplateDecl>(CallOp);
1747 if (CallOp ==
nullptr)
1750 if (
const auto *CallOpTmpl = dyn_cast<FunctionTemplateDecl>(CallOp))
1758 assert(CallOp &&
"null call operator");
1765 assert(RD.
isLambda() &&
"Must be a lambda");
1772 if (
const auto *InvokerTemplate = dyn_cast<FunctionTemplateDecl>(ND))
1785 if (FTy->getCallConv() == CC)
1793 llvm::DenseMap<const ValueDecl *, FieldDecl *> &Captures,
1796 ThisCapture =
nullptr;
1798 LambdaDefinitionData &Lambda = getLambdaData();
1802 C != CEnd; ++
C, ++Field) {
1803 if (
C->capturesThis())
1804 ThisCapture = *Field;
1805 else if (
C->capturesVariable())
1806 Captures[
C->getCapturedVar()] = *Field;
1817 return Tmpl->getTemplateParameters();
1827 assert(std::is_partitioned(List->
begin(), List->
end(),
1828 [](
const NamedDecl *D) { return !D->isImplicit(); })
1829 &&
"Explicit template params should be ordered before implicit ones");
1831 const auto ExplicitEnd = llvm::partition_point(
1837 assert(
isLambda() &&
"Not a lambda closure type!");
1839 return getLambdaData().ContextDecl.get(Source);
1843 assert(
isLambda() &&
"Not a lambda closure type!");
1844 getLambdaData().ContextDecl = ContextDecl;
1848 assert(
isLambda() &&
"Not a lambda closure type!");
1858 assert(
isLambda() &&
"Not a lambda closure type!");
1859 return getASTContext().DeviceLambdaManglingNumbers.lookup(
this);
1865 ->getConversionType();
1866 return Context.getCanonicalType(T);
1897 if (ConvI != ConvE) {
1898 HiddenTypesBuffer = ParentHiddenTypes;
1899 HiddenTypes = &HiddenTypesBuffer;
1903 bool Hidden = ParentHiddenTypes.count(ConvType);
1905 HiddenTypesBuffer.insert(ConvType);
1909 if (Hidden && InVirtual)
1910 HiddenVBaseCs.insert(
cast<NamedDecl>(I.getDecl()->getCanonicalDecl()));
1918 VOutput.
addDecl(I.getDecl(), IAccess);
1920 Output.
addDecl(Context, I.getDecl(), IAccess);
1926 for (
const auto &I :
Record->bases()) {
1927 const auto *
Base = I.getType()->getAsCXXRecordDecl();
1933 bool BaseInVirtual = InVirtual || I.isVirtual();
1936 *HiddenTypes, Output, VOutput, HiddenVBaseCs);
1963 Output.
append(Context, ConvI, ConvE);
1964 for (; ConvI != ConvE; ++ConvI)
1968 for (
const auto &I :
Record->bases()) {
1969 const auto *
Base = I.getType()->getAsCXXRecordDecl();
1974 I.getAccessSpecifier(), HiddenTypes, Output,
1975 VBaseCs, HiddenVBaseCs);
1981 if (!HiddenVBaseCs.count(
cast<NamedDecl>(I.getDecl()->getCanonicalDecl())))
1982 Output.
addDecl(Context, I.getDecl(), I.getAccess());
1988llvm::iterator_range<CXXRecordDecl::conversion_iterator>
1993 if (
bases().empty()) {
1995 Set = &data().Conversions.get(Ctx);
1997 Set = &data().VisibleConversions.get(Ctx);
1999 if (!data().ComputedVisibleConversions) {
2001 data().ComputedVisibleConversions =
true;
2004 return llvm::make_range(
Set->begin(),
Set->end());
2020 for (
unsigned I = 0, E = Convs.
size(); I != E; ++I) {
2021 if (Convs[I].getDecl() == ConvDecl) {
2023 assert(!llvm::is_contained(Convs, ConvDecl) &&
2024 "conversion was found multiple times in unresolved set");
2029 llvm_unreachable(
"conversion not found in set!");
2040 return dyn_cast_if_present<MemberSpecializationInfo *>(
2041 TemplateOrInstantiation);
2047 assert(TemplateOrInstantiation.isNull() &&
2048 "Previous template or instantiation?");
2050 TemplateOrInstantiation
2055 return dyn_cast_if_present<ClassTemplateDecl *>(TemplateOrInstantiation);
2059 TemplateOrInstantiation =
Template;
2063 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this))
2064 return Spec->getSpecializationKind();
2067 return MSInfo->getTemplateSpecializationKind();
2074 if (
auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
2075 Spec->setSpecializationKind(TSK);
2080 MSInfo->setTemplateSpecializationKind(TSK);
2084 llvm_unreachable(
"Not a class template or member class specialization");
2090 if (
auto *TD = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
2091 auto From = TD->getInstantiatedFrom();
2092 if (
auto *CTD = dyn_cast_if_present<ClassTemplateDecl *>(From)) {
2093 while (!CTD->isMemberSpecialization()) {
2099 return CTD->getTemplatedDecl();
2102 dyn_cast_if_present<ClassTemplatePartialSpecializationDecl *>(
2104 while (!CTPSD->isMemberSpecialization()) {
2106 CTPSD->getInstantiatedFromMember();
2125 "couldn't find pattern for class template instantiation");
2131 CanQualType ClassType = Context.getCanonicalTagType(
this);
2134 Context.DeclarationNames.getCXXDestructorName(ClassType);
2140 for (
auto *
Decl : R) {
2141 auto* DD = dyn_cast<CXXDestructorDecl>(
Decl);
2142 if (DD && !DD->isIneligibleOrNotSelected())
2150 return D->isDeleted();
2166 case Decl::ClassTemplatePartialSpecialization:
2168 case Decl::ClassTemplateSpecialization:
2170 case Decl::CXXRecord:
2173 llvm_unreachable(
"unexpected decl kind");
2179 if (
auto *RD = dyn_cast<ClassTemplatePartialSpecializationDecl>(
this))
2180 return RD->getCanonicalInjectedSpecializationType(Ctx);
2183 return TD->getCanonicalInjectedSpecializationType(Ctx);
2197 assert(
hasDefinition() &&
"checking for interface-like without a definition");
2223 Uuid->getGuid() ==
"00000000-0000-0000-C000-000000000046") ||
2225 Uuid->getGuid() ==
"00020400-0000-0000-C000-000000000046"))) {
2239 if (BaseSpec.isVirtual() || BaseSpec.getAccessSpecifier() !=
AS_public)
2241 const auto *
Base = BaseSpec.getType()->getAsCXXRecordDecl();
2242 if (
Base->isInterface() || !
Base->isInterfaceLike())
2253 if (!FinalOverriders) {
2259 for (
const CXXFinalOverriderMap::value_type &
2260 OverridingMethodsEntry : *FinalOverriders) {
2261 for (
const auto &[_, SubobjOverrides] : OverridingMethodsEntry.second) {
2262 assert(SubobjOverrides.size() > 0 &&
2263 "All virtual functions have overriding virtual functions");
2265 if (SubobjOverrides.front().Method->isPureVirtual())
2288 I.setAccess((*I)->getAccess());
2293 !Context.getLangOpts().CPlusPlus20) {
2296 if (
const auto *AT = FD->getAttr<ExplicitInitAttr>())
2297 Context.getDiagnostics().Report(
2299 diag::warn_cxx20_compat_requires_explicit_init_non_aggregate)
2300 << AT << FD << Context.getCanonicalTagType(
this);
2309 if (
const auto *AT = FD->getAttr<ExplicitInitAttr>())
2310 Context.getDiagnostics().Report(AT->getLocation(),
2311 diag::warn_attribute_needs_aggregate)
2312 << AT << Context.getCanonicalTagType(
this);
2318 data().IsPFPType =
true;
2320 data().IsPFPType =
true;
2321 data().IsStandardLayout =
false;
2322 data().IsCXX11StandardLayout =
false;
2327 if (data().Abstract ||
isInvalidDecl() || !data().Polymorphic ||
2331 for (
const auto &B :
bases()) {
2333 B.getType()->castAsCanonical<RecordType>()->getDecl());
2334 if (BaseDecl->isAbstract())
2345 if (Def->hasAttr<FinalAttr>())
2347 if (
const auto *Dtor = Def->getDestructor())
2348 if (Dtor->hasAttr<FinalAttr>())
2353void CXXDeductionGuideDecl::anchor() {}
2372 case Decl::Kind::CXXConstructor:
2374 case Decl::Kind::CXXConversion:
2376 case Decl::Kind::CXXDeductionGuide:
2388 const CXXDeductionGuideDecl *GeneratedFrom,
2390 return new (
C, DC) CXXDeductionGuideDecl(
2391 C, DC, StartLoc, ES, NameInfo, T, TInfo, EndLocation, Ctor, Kind,
2392 TrailingRequiresClause, GeneratedFrom, SourceKind);
2397 return new (
C, ID) CXXDeductionGuideDecl(
2407 return new (
C, DC) RequiresExprBodyDecl(
C, DC, StartLoc);
2415void CXXMethodDecl::anchor() {}
2457 auto *MD = dyn_cast<CXXMethodDecl>(ND);
2485 llvm::erase_if(FinalOverriders, [&](
CXXMethodDecl *OtherD) {
2489 FinalOverriders.push_back(D);
2492 for (
const auto &I : RD->
bases()) {
2493 const auto *
Base = I.getType()->getAsCXXRecordDecl();
2497 AddFinalOverrider(D);
2500 return FinalOverriders.size() == 1 ? FinalOverriders.front() :
nullptr;
2511 CXXMethod,
C, RD, StartLoc, NameInfo, T, TInfo, SC,
UsesFPIntrin,
2512 isInline, ConstexprKind, EndLocation, TrailingRequiresClause);
2526 assert(
isVirtual() &&
"this method is expected to be virtual");
2544 Base =
Base->getBestDynamicClassTypeExpr();
2545 if (
Base->isPRValue() &&
Base->getType()->isRecordType())
2550 if (!BestDynamicDecl)
2559 if (!DevirtualizedMethod)
2569 if (DevirtualizedMethod->
hasAttr<FinalAttr>())
2570 return DevirtualizedMethod;
2576 return DevirtualizedMethod;
2578 if (
const auto *DRE = dyn_cast<DeclRefExpr>(
Base)) {
2579 if (
const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
2580 if (VD->getType()->isRecordType())
2582 return DevirtualizedMethod;
2590 if (
const auto *ME = dyn_cast<MemberExpr>(
Base)) {
2591 const ValueDecl *VD = ME->getMemberDecl();
2597 if (
auto *BO = dyn_cast<BinaryOperator>(
Base)) {
2598 if (BO->isPtrMemOp()) {
2600 if (MPT->getPointeeType()->isRecordType())
2601 return DevirtualizedMethod;
2611 assert(PreventedBy.empty() &&
"PreventedBy is expected to be empty");
2627 if (!PrimaryTemplate)
2661 unsigned UsualParams = 1;
2684 Context.getSizeType()))
2699 if (Context.getLangOpts().CPlusPlus17 ||
2700 Context.getLangOpts().AlignedAllocation ||
2708 for (
const auto *D : R) {
2709 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
2710 if (FD->getNumParams() == 1) {
2711 PreventedBy.push_back(FD);
2748 return Context.hasSameUnqualifiedType(ClassType, ParamType);
2768 return Context.hasSameUnqualifiedType(ClassType, ParamType);
2772 if (
const auto *Ctor = dyn_cast<CXXConstructorDecl>(
this))
2773 return Ctor->isCopyOrMoveConstructor();
2807 assert(MD->
isVirtual() &&
"Method is not virtual!");
2851 ObjectTy =
C.getLangOpts().HLSL ?
C.getLValueReferenceType(ObjectTy)
2852 :
C.getPointerType(ObjectTy);
2865 assert(
isInstance() &&
"No 'this' for static methods!");
2879 return C.getRValueReferenceType(
Type);
2880 return C.getLValueReferenceType(
Type);
2906 : Initializee(TInfo), Init(Init), MemberOrEllipsisLocation(EllipsisLoc),
2907 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(IsVirtual),
2908 IsWritten(
false), SourceOrder(0) {}
2914 : Initializee(
Member), Init(Init), MemberOrEllipsisLocation(MemberLoc),
2915 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2916 IsWritten(
false), SourceOrder(0) {}
2923 : Initializee(
Member), Init(Init), MemberOrEllipsisLocation(MemberLoc),
2924 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2925 IsWritten(
false), SourceOrder(0) {}
2931 : Initializee(TInfo), Init(Init), LParenLoc(L), RParenLoc(R),
2932 IsDelegating(
true), IsVirtual(
false), IsWritten(
false), SourceOrder(0) {}
2935 return Context.getAllocator()
2961 return TSInfo->getTypeLoc().getBeginLoc();
2970 return I->getSourceRange();
2977CXXConstructorDecl::CXXConstructorDecl(
2984 :
CXXMethodDecl(CXXConstructor,
C, RD, StartLoc, NameInfo, T, TInfo,
2985 SC_None, UsesFPIntrin, isInline, ConstexprKind,
2987 setNumCtorInitializers(0);
2988 setInheritingConstructor(
static_cast<bool>(Inherited));
2989 setImplicit(isImplicitlyDeclared);
2990 CXXConstructorDeclBits.HasTrailingExplicitSpecifier = ES.
getExpr() ? 1 : 0;
2992 *getTrailingObjects<InheritedConstructor>() = Inherited;
2993 setExplicitSpecifier(ES);
2996void CXXConstructorDecl::anchor() {}
3000 uint64_t AllocKind) {
3001 bool hasTrailingExplicit =
static_cast<bool>(AllocKind & TAKHasTailExplicit);
3003 static_cast<bool>(AllocKind & TAKInheritsConstructor);
3005 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
3012 Result->CXXConstructorDeclBits.HasTrailingExplicitSpecifier =
3013 hasTrailingExplicit;
3027 "Name must refer to a constructor");
3029 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
3030 Inherited ? 1 : 0, ES.
getExpr() ? 1 : 0);
3031 return new (
C, RD,
Extra) CXXConstructorDecl(
3032 C, RD, StartLoc, NameInfo, T, TInfo, ES,
UsesFPIntrin, isInline,
3033 isImplicitlyDeclared, ConstexprKind, Inherited, TrailingRequiresClause);
3037 return CtorInitializers.get(
getASTContext().getExternalSource());
3043 if (
const auto *Construct = dyn_cast<CXXConstructExpr>(E))
3044 return Construct->getConstructor();
3087 const auto *ParamRefType = Param->getType()->getAs<
ReferenceType>();
3096 if (!Context.hasSameUnqualifiedType(PointeeType, ClassTy))
3131 CanQualType ParamType = Param->getType()->getCanonicalTypeUnqualified();
3135 return ParamType == ClassTy;
3148void CXXDestructorDecl::anchor() {}
3152 return new (
C, ID) CXXDestructorDecl(
3161 bool UsesFPIntrin,
bool isInline,
bool isImplicitlyDeclared,
3166 "Name must refer to a destructor");
3167 return new (
C, RD) CXXDestructorDecl(
3168 C, RD, StartLoc, NameInfo, T, TInfo,
UsesFPIntrin, isInline,
3169 isImplicitlyDeclared, ConstexprKind, TrailingRequiresClause);
3211 L->ResolvedOperatorArrayDelete(
3225 L->ResolvedOperatorGlobArrayDelete(
3263 if (!SelectedOperatorDelete)
3273void CXXConversionDecl::anchor() {}
3277 return new (
C, ID) CXXConversionDecl(
3291 "Name must refer to a conversion function");
3292 return new (
C, RD) CXXConversionDecl(
3293 C, RD, StartLoc, NameInfo, T, TInfo,
UsesFPIntrin, isInline, ES,
3294 ConstexprKind, EndLocation, TrailingRequiresClause);
3311void LinkageSpecDecl::anchor() {}
3318 return new (
C, DC) LinkageSpecDecl(DC, ExternLoc, LangLoc, Lang, HasBraces);
3328void UsingDirectiveDecl::anchor() {}
3337 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(Used))
3338 Used = NS->getFirstDecl();
3339 return new (
C, DC) UsingDirectiveDecl(DC, L, NamespaceLoc, QualifierLoc,
3340 IdentLoc, Used, CommonAncestor);
3352 if (
auto *Alias = dyn_cast<NamespaceAliasDecl>(
this))
3358 if (
auto *NA = dyn_cast_or_null<NamespaceAliasDecl>(NominatedNamespace))
3360 return cast_or_null<NamespaceDecl>(NominatedNamespace);
3368 redeclarable_base(
C), LocStart(StartLoc) {
3371 setPreviousDecl(PrevDecl);
3377 NamespaceDecl *PrevDecl,
bool Nested) {
3379 NamespaceDecl(
C, DC, Inline, StartLoc, IdLoc, Id, PrevDecl, Nested);
3400void NamespaceAliasDecl::anchor() {}
3420 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(Namespace))
3422 return new (
C, DC) NamespaceAliasDecl(
C, DC, UsingLoc, AliasLoc, Alias,
3423 QualifierLoc, IdentLoc, Namespace);
3434void LifetimeExtendedTemporaryDecl::anchor() {}
3448 return ExtendingDecl->getDeclContext()->isFunctionOrMethod() ?
SD_Automatic
3455 "don't need to cache the computed value for this temporary");
3456 if (MayCreate && !Value) {
3460 assert(Value &&
"may not be null");
3464void UsingShadowDecl::anchor() {}
3469 :
NamedDecl(K, DC, Loc, Name), redeclarable_base(
C),
3470 UsingOrNextShadow(Introducer) {
3480 redeclarable_base(
C) {}
3489 while (
const auto *NextShadow =
3490 dyn_cast<UsingShadowDecl>(Shadow->UsingOrNextShadow))
3491 Shadow = NextShadow;
3495void ConstructorUsingShadowDecl::anchor() {}
3501 return new (
C, DC) ConstructorUsingShadowDecl(
C, DC, Loc, Using,
Target,
3507 return new (
C, ID) ConstructorUsingShadowDecl(
C,
EmptyShell());
3514void BaseUsingDecl::anchor() {}
3517 assert(!llvm::is_contained(
shadows(), S) &&
"declaration already in set");
3520 if (FirstUsingShadow.getPointer())
3521 S->UsingOrNextShadow = FirstUsingShadow.getPointer();
3522 FirstUsingShadow.setPointer(S);
3526 assert(llvm::is_contained(
shadows(), S) &&
"declaration not in set");
3531 if (FirstUsingShadow.getPointer() == S) {
3532 FirstUsingShadow.setPointer(
3533 dyn_cast<UsingShadowDecl>(S->UsingOrNextShadow));
3534 S->UsingOrNextShadow =
this;
3539 while (Prev->UsingOrNextShadow != S)
3541 Prev->UsingOrNextShadow = S->UsingOrNextShadow;
3542 S->UsingOrNextShadow =
this;
3545void UsingDecl::anchor() {}
3551 return new (
C, DC) UsingDecl(DC, UL, QualifierLoc, NameInfo, HasTypename);
3566void UsingEnumDecl::anchor() {}
3573 UsingEnumDecl(DC, EnumType->getType()->castAsEnumDecl()->getDeclName(),
3574 UL, EL, NL, EnumType);
3585 return SourceRange(UsingLocation, EnumType->getTypeLoc().getEndLoc());
3588void UsingPackDecl::anchor() {}
3593 size_t Extra = additionalSizeToAlloc<NamedDecl *>(UsingDecls.size());
3594 return new (
C, DC,
Extra) UsingPackDecl(DC, InstantiatedFrom, UsingDecls);
3598 unsigned NumExpansions) {
3599 size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
3600 auto *
Result =
new (
C, ID,
Extra) UsingPackDecl(
nullptr,
nullptr, {});
3601 Result->NumExpansions = NumExpansions;
3602 auto *Trail =
Result->getTrailingObjects();
3603 std::uninitialized_fill_n(Trail, NumExpansions,
nullptr);
3607void UnresolvedUsingValueDecl::anchor() {}
3615 return new (
C, DC) UnresolvedUsingValueDecl(DC,
C.DependentTy, UsingLoc,
3616 QualifierLoc, NameInfo,
3622 return new (
C, ID) UnresolvedUsingValueDecl(
nullptr,
QualType(),
3635void UnresolvedUsingTypenameDecl::anchor() {}
3645 return new (
C, DC) UnresolvedUsingTypenameDecl(
3646 DC, UsingLoc, TypenameLoc, QualifierLoc, TargetNameLoc,
3653 return new (
C, ID) UnresolvedUsingTypenameDecl(
3661 return new (Ctx, DC) UnresolvedUsingIfExistsDecl(DC, Loc, Name);
3667 return new (Ctx, ID)
3671UnresolvedUsingIfExistsDecl::UnresolvedUsingIfExistsDecl(
DeclContext *DC,
3674 :
NamedDecl(
Decl::UnresolvedUsingIfExists, DC, Loc, Name) {}
3676void UnresolvedUsingIfExistsDecl::anchor() {}
3678void StaticAssertDecl::anchor() {}
3685 return new (
C, DC) StaticAssertDecl(DC, StaticAssertLoc, AssertExpr, Message,
3691 return new (
C, ID) StaticAssertDecl(
nullptr,
SourceLocation(),
nullptr,
3697 "expected a VarDecl or a BindingDecl");
3698 if (
auto *Var = llvm::dyn_cast<VarDecl>(
this))
3700 if (
auto *BD = llvm::dyn_cast<BindingDecl>(
this))
3701 return llvm::dyn_cast_if_present<VarDecl>(BD->getDecomposedDecl());
3705void BindingDecl::anchor() {}
3710 return new (
C, DC) BindingDecl(DC, IdLoc, Id, T);
3727 assert(VD->isImplicit() &&
"holding var for binding decl not implicit");
3732 assert(Binding &&
"expecting a pack expr");
3734 ValueDecl *
const *
First = FP->getNumExpansions() > 0 ? FP->begin() :
nullptr;
3737 FP->getNumExpansions());
3740void DecompositionDecl::anchor() {}
3746 size_t Extra = additionalSizeToAlloc<BindingDecl *>(
Bindings.size());
3747 return new (
C, DC,
Extra) DecompositionDecl(
3748 C, DC, StartLoc, LSquareLoc, RSquareLoc, T, TInfo, SC,
Bindings);
3753 unsigned NumBindings) {
3754 size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
3759 Result->NumBindings = NumBindings;
3760 auto *Trail =
Result->getTrailingObjects();
3761 std::uninitialized_fill_n(Trail, NumBindings,
nullptr);
3772 B->printName(OS, Policy);
3778void MSPropertyDecl::anchor() {}
3786 return new (
C, DC) MSPropertyDecl(DC, L, N, T, TInfo, StartL, Getter, Setter);
3796void MSGuidDecl::anchor() {}
3804 return new (
C, DC) MSGuidDecl(DC, T, P);
3808 return new (
C,
ID) MSGuidDecl(
nullptr, QualType(),
Parts());
3813 OS << llvm::format(
"GUID{%08" PRIx32
"-%04" PRIx16
"-%04" PRIx16
"-",
3814 PartVal.Part1, PartVal.Part2, PartVal.Part3);
3816 for (uint8_t Byte : PartVal.Part4And5) {
3817 OS << llvm::format(
"%02" PRIx8, Byte);
3830 auto IsInt = [&Ctx](
unsigned N) {
3832 return T->isUnsignedIntegerOrEnumerationType() &&
3837 auto IsArray = [&Ctx](MatcherRef Elem,
unsigned N) {
3838 return [&Ctx, Elem, N](
QualType T) {
3844 auto IsStruct = [](std::initializer_list<MatcherRef> Fields) {
3852 if (
auto *CXXRD = dyn_cast<CXXRecordDecl>(RD))
3853 if (CXXRD->getNumBases())
3855 auto MatcherIt = Fields.begin();
3857 if (FD->isUnnamedBitField())
3859 if (FD->isBitField() || MatcherIt == Fields.end() ||
3860 !(*MatcherIt)(FD->getType()))
3864 return MatcherIt == Fields.end();
3869 return IsStruct({IsInt(32), IsInt(16), IsInt(16), IsArray(IsInt(8), 8)})(T);
3877 APVal.getStructField(0) =
APValue(
APSInt(APInt(32, PartVal.Part1),
true));
3878 APVal.getStructField(1) =
APValue(
APSInt(APInt(16, PartVal.Part2),
true));
3879 APVal.getStructField(2) =
APValue(
APSInt(APInt(16, PartVal.Part3),
true));
3882 for (
unsigned I = 0; I != 8; ++I) {
3894void UnnamedGlobalConstantDecl::anchor() {}
3896UnnamedGlobalConstantDecl::UnnamedGlobalConstantDecl(
const ASTContext &
C,
3905 if (
Value.needsCleanup())
3906 C.addDestruction(&
Value);
3913 return new (
C, DC) UnnamedGlobalConstantDecl(
C, DC, T, Value);
3919 UnnamedGlobalConstantDecl(
C,
nullptr, QualType(),
APValue());
3924 OS <<
"unnamed-global-constant";
3930 llvm_unreachable(
"Invalid access specifier!");
3938 llvm_unreachable(
"Invalid access specifier!");
Defines the clang::ASTContext interface.
This file provides some common utility functions for processing Lambda related AST Constructs.
Defines the Diagnostic-related interfaces.
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::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.
llvm::SmallVector< std::pair< const MemRegion *, SVal >, 4 > Bindings
static bool hasAttr(const Decl *D, bool IgnoreImplicitAttr)
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
Expr * getExpr()
Get 'expr' part of the associated expression/statement.
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
DeclarationNameTable DeclarationNames
ArrayRef< CXXDefaultArgExpr * > getCtorClosureDefaultArgs(const CXXConstructorDecl *CD)
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
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
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
bool arePFPFieldsTriviallyCopyable(const RecordDecl *RD) const
Returns whether this record's PFP fields (if any) are trivially copyable (i.e.
bool hasPFPFields(QualType Ty) const
void setCtorClosureDefaultArgs(const CXXConstructorDecl *CD, ArrayRef< CXXDefaultArgExpr * > Args)
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
FunctionDecl * getOperatorDeleteForVDtor(const CXXDestructorDecl *Dtor, OperatorDeleteKind K) 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.
CanQualType getCanonicalTagType(const TagDecl *TD) const
static bool hasSameUnqualifiedType(QualType T1, QualType T2)
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
void addOperatorDeleteForVDtor(const CXXDestructorDecl *Dtor, FunctionDecl *OperatorDelete, OperatorDeleteKind K) const
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.
UnresolvedSetIterator iterator
void addDecl(ASTContext &C, NamedDecl *D, AccessSpecifier AS)
static AccessSpecDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
QualType getElementType() const
void addShadowDecl(UsingShadowDecl *S)
shadow_range shadows() const
void removeShadowDecl(UsingShadowDecl *S)
VarDecl * getHoldingVar() const
Get the variable (if any) that holds the value of evaluating the binding.
static BindingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType T)
Expr * getBinding() const
Get the expression to which this declaration is bound.
ArrayRef< BindingDecl * > getBindingPackDecls() const
static BindingDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Represents a base class of a C++ class.
Represents a C++ constructor within a class.
CXXConstructorDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
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.
void setCtorClosureDefaultArgs(ArrayRef< CXXDefaultArgExpr * > Args)
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(), const AssociatedConstraint &TrailingRequiresClause={})
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.
ArrayRef< CXXDefaultArgExpr * > getCtorClosureDefaultArgs() const
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...
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, const AssociatedConstraint &TrailingRequiresClause={})
QualType getConversionType() const
Returns the type that this conversion function is converting to.
static CXXConversionDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
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, const AssociatedConstraint &TrailingRequiresClause={}, const CXXDeductionGuideDecl *SourceDG=nullptr, SourceDeductionGuideKind SK=SourceDeductionGuideKind::None)
static CXXDeductionGuideDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Represents a C++ destructor within a class.
void setGlobalOperatorArrayDelete(FunctionDecl *OD)
static CXXDestructorDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
CXXDestructorDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
const FunctionDecl * getOperatorGlobalDelete() const
const FunctionDecl * getGlobalArrayOperatorDelete() const
static CXXDestructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, const AssociatedConstraint &TrailingRequiresClause={})
const FunctionDecl * getOperatorDelete() const
void setOperatorDelete(FunctionDecl *OD, Expr *ThisArg)
bool isCalledByDelete(const FunctionDecl *OpDel=nullptr) const
Will this destructor ever be called when considering which deallocation function is associated with t...
void setOperatorArrayDelete(FunctionDecl *OD)
const FunctionDecl * getArrayOperatorDelete() const
void setOperatorGlobalDelete(FunctionDecl *OD)
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
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, const AssociatedConstraint &TrailingRequiresClause={})
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 isCopyOrMoveConstructorOrAssignment() const
Determine whether this is a copy or move constructor or a copy or move assignment operator.
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
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.
bool isMemcpyEquivalentSpecialMember(const ASTContext &Ctx) const
Returns whether this is a copy/move constructor or assignment operator that can be implemented as a m...
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
CXXMethodDecl(Kind DK, ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin, bool isInline, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, const AssociatedConstraint &TrailingRequiresClause={})
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 ...
bool isCopyOrMoveConstructor() const
Determine whether this is a copy or move constructor.
llvm::iterator_range< llvm::TinyPtrVector< const CXXMethodDecl * >::const_iterator > overridden_method_range
Represents a C++ struct/union/class.
bool isHLSLIntangible() const
Returns true if the class contains HLSL intangible type, either as a field or in base 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...
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr)
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.
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...
bool hasInjectedClassType() const
Determines whether this declaration has is canonically of an injected class type.
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 hasDeletedDestructor() const
Returns the destructor decl for this class.
bool defaultedDestructorIsConstexpr() const
Determine whether a defaulted default constructor for this class would be constexpr.
bool isStandardLayout() const
Determine whether this class is standard-layout per C++ [class]p7.
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...
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)
CanQualType getCanonicalTemplateSpecializationType(const ASTContext &Ctx) const
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 ...
bool isInjectedClassName() const
Determines whether this declaration represents the injected class name.
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....
void setLambdaContextDecl(Decl *ContextDecl)
Set the context declaration for a lambda class.
UnresolvedSetIterator conversion_iterator
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 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.
const CXXRecordDecl * getStandardLayoutBaseWithFields() const
If this is a standard-layout class or union, any and all data members will be declared in the same ty...
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.
bool isTrivial() const
Determine whether this class is considered trivial.
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
conversion_iterator conversion_begin() const
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.
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.
DeclContextLookupResult lookup_result
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
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
DeclContext(Decl::Kind K)
bool isExternCContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
LinkageSpecDeclBitfields LinkageSpecDeclBits
Decl::Kind getDeclKind() const
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.
virtual Decl * getPreviousDeclImpl()
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain.
ASTMutationListener * getASTMutationListener() const
Kind
Lists the kind of concrete classes of Decl.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
bool isInvalidDecl() const
virtual Decl * getNextRedeclarationImpl()
Returns the next redeclaration or itself if this is the only decl.
SourceLocation getLocation() const
void setImplicit(bool I=true)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
unsigned Access
Access - Used by C++ decls for the access specifier.
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
virtual Decl * getMostRecentDeclImpl()
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chai...
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.
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, SourceLocation RSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl * > Bindings)
static DecompositionDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NumBindings)
Store information needed for an explicit specifier.
ExplicitSpecKind getKind() const
bool isEquivalent(ExplicitSpecifier Other) const
Check for equivalence of explicit specifiers.
const Expr * getExpr() const
ExplicitSpecifier()=default
static ExplicitSpecifier getFromDecl(const FunctionDecl *Function)
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.
Represents a member of a struct/union/class.
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set.
Represents a function declaration or definition.
static constexpr unsigned RequiredTypeAwareDeleteParameterCount
Count of mandatory parameters for type aware operator delete.
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
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.
bool isDeleted() const
Whether this function has been deleted.
FunctionDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass S, bool UsesFPIntrin, bool isInlineSpecified, ConstexprSpecKind ConstexprKind, const AssociatedConstraint &TrailingRequiresClause)
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.
bool isTypeAwareOperatorNewOrDelete() const
Determine whether this is a type aware operator new or delete.
bool isDefaulted() const
Whether this function is defaulted.
bool isIneligibleOrNotSelected() const
void setIneligibleOrNotSelected(bool II)
OverloadedOperatorKind getOverloadedOperator() const
getOverloadedOperator - Which C++ overloaded operator this function represents, if any.
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration.
bool hasOneParamOrDefaultArgs() const
Determine whether this function has a single parameter, or multiple parameters where all but the firs...
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
bool isDefined(const FunctionDecl *&Definition, bool CheckForPendingFriendDefinition=false) const
Returns true if the function has a definition that does not need to be instantiated.
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
Represents a prototype with parameter type info, e.g.
Qualifiers getMethodQuals() const
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
Declaration of a template function.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
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.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
bool isCompatibleWith(ClangABI Version) const
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()
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.
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...
Describes a module or submodule.
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
NamedDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N)
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.
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, NamespaceBaseDecl *Namespace)
NamespaceAliasDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
NamespaceAliasDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
Represents C++ namespaces and their aliases.
NamespaceDecl * getNamespace()
Represent a C++ namespace.
NamespaceDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
NamespaceDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
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, or null.
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.
bool hasAddressDiscriminatedPointerAuth() const
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
PointerAuthQualifier getPointerAuth() const
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
bool isCXX98PODType(const ASTContext &Context) const
Return true if this is a POD type according to the rules of the C++98 standard, regardless of the cur...
bool isObjCGCStrong() const
true when Type is objc's strong.
void removeLocalRestrict()
bool isConstQualified() const
Determine whether this type is const-qualified.
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
bool hasNonTrivialObjCLifetime() const
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
ObjCLifetime getObjCLifetime() const
Represents a struct/union/class.
RecordDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl)
void setArgPassingRestrictions(RecordArgPassingKind Kind)
field_iterator field_end() const
field_range fields() const
void setHasObjectMember(bool val)
void setHasVolatileMember(bool val)
bool mayInsertExtraPadding(bool EmitRemark=false) const
Whether we are allowed to insert extra padding between fields.
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.
bool hasUninitializedExplicitInitFields() const
specific_decl_iterator< FieldDecl > field_iterator
void setHasUninitializedExplicitInitFields(bool V)
field_iterator field_begin() const
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
NamespaceDecl * getNextRedeclaration() const
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.
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.
TagKind getTagKind() const
bool isDependentType() const
Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on temp...
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.
Base wrapper for a particular "section" of type source info.
A container of type source information.
The base class of the type hierarchy.
bool isBlockPointerType() const
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
bool isRValueReferenceType() const
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isHLSLBuiltinIntangibleType() const
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
const Type * getArrayElementTypeNoTypeQual() const
If this is an array type, return the element type of the array, potentially with type qualifiers miss...
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...
bool isHLSLAttributedResourceType() const
const T * getAs() const
Member-template getAs<specific type>'.
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs,...
bool isRecordType() const
bool isObjCRetainableType() const
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.
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
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)
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.
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)
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)
friend class BaseUsingDecl
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 ...
ValueDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T)
VarDecl * getPotentiallyDecomposedVarDecl()
Represents a variable declaration or definition.
Defines the clang::TargetInfo interface.
bool LT(InterpState &S, CodePtr OpPC)
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isa(CodeGen::Address addr)
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 (&&).
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
StorageClass
Storage classes.
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.
@ Template
We are parsing a template declaration.
@ Interface
The "__interface" keyword.
@ Struct
The "struct" keyword.
@ Class
The "class" keyword.
@ Type
The name was classified as a type.
@ 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()
DeductionCandidate
Only used by CXXDeductionGuideDecl.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ConceptReference *C)
Insertion operator for diagnostics.
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.
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.
Describes how types, statements, expressions, and declarations should be printed.