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), IsPFPType(
false),
113 IsLambda(
false), IsParsingBaseSpecifiers(
false),
117 return Bases.get(Definition->getASTContext().getExternalSource());
120CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getVBasesSlowCase()
const {
121 return VBases.get(
Definition->getASTContext().getExternalSource());
128 :
RecordDecl(K, TK,
C, DC, StartLoc, IdLoc, Id, PrevDecl),
129 DefinitionData(PrevDecl ? PrevDecl->DefinitionData
137 CXXRecordDecl(CXXRecord, TK,
C, DC, StartLoc, IdLoc, Id, PrevDecl);
143 unsigned DependencyKind,
bool IsGeneric,
146 Loc,
nullptr,
nullptr);
148 R->DefinitionData =
new (
C)
struct LambdaDefinitionData(
149 R, Info, DependencyKind, IsGeneric, CaptureDefault);
150 R->setImplicit(
true);
156 auto *R =
new (
C, ID)
168 while (!WorkList.empty()) {
173 if (
const CXXRecordDecl *B = BaseSpec.getType()->getAsCXXRecordDecl()) {
174 if (!SeenBaseTypes.insert(B).second)
176 WorkList.push_back(B);
188 if (!data().Bases.isOffset() && data().NumBases > 0)
189 C.Deallocate(data().getBases());
192 if (!
C.getLangOpts().CPlusPlus17) {
195 data().Aggregate =
false;
200 data().PlainOldData =
false;
210 data().NumBases = NumBases;
211 for (
unsigned i = 0; i < NumBases; ++i) {
212 data().getBases()[i] = *Bases[i];
217 if (BaseType->isDependentType())
219 auto *BaseClassDecl = BaseType->castAsCXXRecordDecl();
226 if (BaseClassDecl->data().HasBasesWithFields ||
227 !BaseClassDecl->field_empty()) {
228 if (data().HasBasesWithFields)
230 data().IsStandardLayout =
false;
231 data().HasBasesWithFields =
true;
238 if (BaseClassDecl->data().HasBasesWithNonStaticDataMembers ||
239 BaseClassDecl->hasDirectFields()) {
240 if (data().HasBasesWithNonStaticDataMembers)
241 data().IsCXX11StandardLayout =
false;
242 data().HasBasesWithNonStaticDataMembers =
true;
245 if (!BaseClassDecl->isEmpty()) {
249 data().Empty =
false;
255 data().Aggregate =
false;
260 data().StructuralIfLiteral =
false;
266 if (BaseClassDecl->isPolymorphic()) {
267 data().Polymorphic =
true;
270 data().Aggregate =
false;
276 if (!BaseClassDecl->isStandardLayout())
277 data().IsStandardLayout =
false;
278 if (!BaseClassDecl->isCXX11StandardLayout())
279 data().IsCXX11StandardLayout =
false;
283 data().HasNonLiteralTypeFieldsOrBases =
true;
286 for (
const auto &VBase : BaseClassDecl->vbases()) {
288 if (SeenVBaseTypes.insert(
C.getCanonicalType(VBase.getType())).second) {
289 VBases.push_back(&VBase);
296 if (
CXXRecordDecl *VBaseDecl = VBase.getType()->getAsCXXRecordDecl())
297 if (!VBaseDecl->hasCopyConstructorWithConstParam())
298 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
302 data().Aggregate =
false;
306 if (
Base->isVirtual()) {
308 if (SeenVBaseTypes.insert(
C.getCanonicalType(BaseType)).second)
309 VBases.push_back(
Base);
314 data().Empty =
false;
318 data().Aggregate =
false;
324 data().HasTrivialSpecialMembers &= SMF_Destructor;
325 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
330 data().IsStandardLayout =
false;
331 data().IsCXX11StandardLayout =
false;
337 data().DefaultedDefaultConstructorIsConstexpr =
false;
338 data().DefaultedDestructorIsConstexpr =
false;
345 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
346 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
352 if (!BaseClassDecl->hasTrivialDefaultConstructor())
353 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
360 if (!BaseClassDecl->hasTrivialCopyConstructor())
361 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
363 if (!BaseClassDecl->hasTrivialCopyConstructorForCall())
364 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
370 if (!BaseClassDecl->hasTrivialMoveConstructor())
371 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
373 if (!BaseClassDecl->hasTrivialMoveConstructorForCall())
374 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
381 if (!BaseClassDecl->hasTrivialCopyAssignment())
382 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
387 if (!BaseClassDecl->hasTrivialMoveAssignment())
388 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
394 if (!BaseClassDecl->hasConstexprDefaultConstructor())
395 data().DefaultedDefaultConstructorIsConstexpr =
396 C.getLangOpts().CPlusPlus23;
403 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
404 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
410 if (!BaseClassDecl->hasTrivialDestructor())
411 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
413 if (!BaseClassDecl->hasTrivialDestructorForCall())
414 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
416 if (!BaseClassDecl->hasIrrelevantDestructor())
417 data().HasIrrelevantDestructor =
false;
419 if (BaseClassDecl->isAnyDestructorNoReturn())
420 data().IsAnyDestructorNoReturn =
true;
422 if (BaseClassDecl->isHLSLIntangible())
423 data().IsHLSLIntangible =
true;
430 if (!BaseClassDecl->hasCopyAssignmentWithConstParam())
431 data().ImplicitCopyAssignmentHasConstParam =
false;
435 if (BaseClassDecl->hasObjectMember())
438 if (BaseClassDecl->hasVolatileMember())
441 if (BaseClassDecl->getArgPassingRestrictions() ==
446 if (BaseClassDecl->hasMutableFields())
447 data().HasMutableFields =
true;
449 if (BaseClassDecl->hasUninitializedExplicitInitFields() &&
450 BaseClassDecl->isAggregate())
453 if (BaseClassDecl->hasUninitializedReferenceMember())
454 data().HasUninitializedReferenceMember =
true;
456 if (!BaseClassDecl->allowConstDefaultInit())
457 data().HasUninitializedFields =
true;
459 if (BaseClassDecl->isPFPType())
460 data().IsPFPType =
true;
462 addedClassSubobject(BaseClassDecl);
473 data().IsStandardLayout =
false;
475 if (VBases.empty()) {
476 data().IsParsingBaseSpecifiers =
false;
482 data().NumVBases = VBases.size();
483 for (
int I = 0, E = VBases.size(); I != E; ++I) {
487 data().getVBases()[I] = *VBases[I];
490 data().IsParsingBaseSpecifiers =
false;
494 assert(
hasDefinition() &&
"ODRHash only for records with definitions");
497 if (DefinitionData->HasODRHash)
498 return DefinitionData->ODRHash;
503 DefinitionData->HasODRHash =
true;
506 return DefinitionData->ODRHash;
509void CXXRecordDecl::addedClassSubobject(
CXXRecordDecl *Subobj) {
517 data().NeedOverloadResolutionForCopyConstructor =
true;
519 data().NeedOverloadResolutionForMoveConstructor =
true;
528 data().NeedOverloadResolutionForCopyAssignment =
true;
530 data().NeedOverloadResolutionForMoveAssignment =
true;
540 data().NeedOverloadResolutionForCopyConstructor =
true;
541 data().NeedOverloadResolutionForMoveConstructor =
true;
542 data().NeedOverloadResolutionForDestructor =
true;
551 data().DefaultedDestructorIsConstexpr =
558 if (!Subobj->data().StructuralIfLiteral)
559 data().StructuralIfLiteral =
false;
565 "getStandardLayoutBaseWithFields called on a non-standard-layout type");
566#ifdef EXPENSIVE_CHECKS
568 unsigned NumberOfBasesWithFields = 0;
570 ++NumberOfBasesWithFields;
573 if (!
Base->field_empty())
574 ++NumberOfBasesWithFields;
576 UniqueBases.insert(
Base->getCanonicalDecl()).second &&
577 "Standard layout struct has multiple base classes of the same type");
580 assert(NumberOfBasesWithFields <= 1 &&
581 "Standard layout struct has fields declared in more than one class");
588 if (!
Base->field_empty()) {
640void CXXRecordDecl::markedVirtualFunctionPure() {
643 data().Abstract =
true;
646bool CXXRecordDecl::hasSubobjectAtOffsetZeroOfEmptyBaseType(
657 RD = RD->getCanonicalDecl();
665 if (!RD->data().HasBasesWithFields) {
684 if (M.insert(RD).second)
685 WorkList.push_back(RD);
692 while (!WorkList.empty()) {
702 bool IsFirstField =
true;
703 for (
auto *FD :
X->fields()) {
706 if (FD->isUnnamedBitField())
709 if (!IsFirstField && !FD->isZeroSize(Ctx))
712 if (FD->isInvalidDecl())
722 IsFirstField =
false;
730 assert(
isLambda() &&
"not a lambda");
747void CXXRecordDecl::addedMember(
Decl *D) {
752 data().HasOnlyCMembers =
false;
758 auto *FunTmpl = dyn_cast<FunctionTemplateDecl>(D);
760 D = FunTmpl->getTemplatedDecl();
763 Decl *DUnderlying = D;
764 if (
auto *ND = dyn_cast<NamedDecl>(DUnderlying)) {
765 DUnderlying = ND->getUnderlyingDecl();
766 if (
auto *UnderlyingFunTmpl = dyn_cast<FunctionTemplateDecl>(DUnderlying))
767 DUnderlying = UnderlyingFunTmpl->getTemplatedDecl();
770 if (
const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
771 if (Method->isVirtual()) {
774 data().Aggregate =
false;
778 data().PlainOldData =
false;
782 data().Empty =
false;
787 data().Polymorphic =
true;
793 data().HasTrivialSpecialMembers &= SMF_Destructor;
794 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
799 data().IsStandardLayout =
false;
800 data().IsCXX11StandardLayout =
false;
808 L->AddedCXXImplicitMember(data().
Definition, D);
814 if (
const auto *
Constructor = dyn_cast<CXXConstructorDecl>(D)) {
821 data().UserDeclaredConstructor =
true;
831 data().PlainOldData =
false;
836 SMKind |= SMF_DefaultConstructor;
839 data().UserProvidedDefaultConstructor =
true;
841 data().HasConstexprDefaultConstructor =
true;
843 data().HasDefaultedDefaultConstructor =
true;
849 SMKind |= SMF_CopyConstructor;
852 data().HasDeclaredCopyConstructorWithConstParam =
true;
854 SMKind |= SMF_MoveConstructor;
866 data().Aggregate =
false;
871 if (
const auto *
Constructor = dyn_cast<CXXConstructorDecl>(DUnderlying)) {
879 data().HasConstexprNonCopyMoveConstructor =
true;
881 data().HasInheritedDefaultConstructor =
true;
885 if (
const auto *
Method = dyn_cast<CXXMethodDecl>(D)) {
887 SMKind |= SMF_Destructor;
889 if (
Method->isCopyAssignmentOperator()) {
890 SMKind |= SMF_CopyAssignment;
892 const auto *ParamTy =
893 Method->getNonObjectParameter(0)->getType()->getAs<ReferenceType>();
894 if (!ParamTy || ParamTy->getPointeeType().isConstQualified())
895 data().HasDeclaredCopyAssignmentWithConstParam =
true;
898 if (
Method->isMoveAssignmentOperator())
899 SMKind |= SMF_MoveAssignment;
902 if (
auto *Conversion = dyn_cast<CXXConversionDecl>(D)) {
911 if (Conversion->getPrimaryTemplate()) {
915 ASTUnresolvedSet &Conversions = data().Conversions.get(Ctx);
922 Conversions.
addDecl(Ctx, Primary, AS);
929 data().HasTrivialSpecialMembers &=
930 data().DeclaredSpecialMembers | ~SMKind;
931 data().HasTrivialSpecialMembersForCall &=
932 data().DeclaredSpecialMembers | ~SMKind;
936 data().DeclaredSpecialMembers |= SMKind;
937 if (!
Method->isImplicit()) {
938 data().UserDeclaredSpecialMembers |= SMKind;
942 SMKind != SMF_MoveAssignment) ||
956 data().PlainOldData =
false;
964 if (!
Method->isIneligibleOrNotSelected()) {
973 if (
const auto *Field = dyn_cast<FieldDecl>(D)) {
981 if (data().HasBasesWithFields)
982 data().IsStandardLayout =
false;
988 if (
Field->isUnnamedBitField()) {
992 if (data().
Empty && !
Field->isZeroLengthBitField() &&
994 LangOptions::ClangABI::Ver6)
995 data().Empty =
false;
1003 if (data().HasBasesWithNonStaticDataMembers)
1004 data().IsCXX11StandardLayout =
false;
1012 data().Aggregate =
false;
1013 data().PlainOldData =
false;
1018 data().StructuralIfLiteral =
false;
1023 bool IsFirstField = !data().HasPrivateFields &&
1024 !data().HasProtectedFields && !data().HasPublicFields;
1031 case AS_private: data().HasPrivateFields =
true;
break;
1032 case AS_protected: data().HasProtectedFields =
true;
break;
1033 case AS_public: data().HasPublicFields =
true;
break;
1034 case AS_none: llvm_unreachable(
"Invalid access specifier");
1036 if ((data().HasPrivateFields + data().HasProtectedFields +
1037 data().HasPublicFields) > 1) {
1038 data().IsStandardLayout =
false;
1039 data().IsCXX11StandardLayout =
false;
1043 if (
Field->isMutable()) {
1044 data().HasMutableFields =
true;
1049 data().StructuralIfLiteral =
false;
1056 data().HasVariantMembers =
true;
1058 if (
isUnion() && IsFirstField)
1059 data().HasUninitializedFields =
true;
1078 struct DefinitionData &
Data = data();
1079 Data.PlainOldData =
false;
1080 Data.HasTrivialSpecialMembers = 0;
1086 data().HasTrivialSpecialMembersForCall = 0;
1092 Data.HasIrrelevantDestructor =
false;
1095 data().DefaultedCopyConstructorIsDeleted =
true;
1096 data().DefaultedMoveConstructorIsDeleted =
true;
1097 data().DefaultedCopyAssignmentIsDeleted =
true;
1098 data().DefaultedMoveAssignmentIsDeleted =
true;
1099 data().DefaultedDestructorIsDeleted =
true;
1100 data().NeedOverloadResolutionForCopyConstructor =
true;
1101 data().NeedOverloadResolutionForMoveConstructor =
true;
1102 data().NeedOverloadResolutionForCopyAssignment =
true;
1103 data().NeedOverloadResolutionForMoveAssignment =
true;
1104 data().NeedOverloadResolutionForDestructor =
true;
1106 }
else if (!Context.
getLangOpts().ObjCAutoRefCount) {
1110 data().PlainOldData =
false;
1116 if (Q.isAddressDiscriminated()) {
1117 struct DefinitionData &
Data = data();
1118 Data.PlainOldData =
false;
1119 Data.HasTrivialSpecialMembers &=
1120 ~(SMF_CopyConstructor | SMF_MoveConstructor | SMF_CopyAssignment |
1121 SMF_MoveAssignment);
1127 data().DefaultedCopyConstructorIsDeleted =
true;
1128 data().DefaultedMoveConstructorIsDeleted =
true;
1129 data().DefaultedCopyAssignmentIsDeleted =
true;
1130 data().DefaultedMoveAssignmentIsDeleted =
true;
1131 data().NeedOverloadResolutionForCopyConstructor =
true;
1132 data().NeedOverloadResolutionForMoveConstructor =
true;
1133 data().NeedOverloadResolutionForCopyAssignment =
true;
1134 data().NeedOverloadResolutionForMoveAssignment =
true;
1139 if (
Field->hasAttr<ExplicitInitAttr>())
1143 if (!
Field->hasInClassInitializer())
1144 data().HasUninitializedReferenceMember =
true;
1149 data().IsStandardLayout =
false;
1150 data().IsCXX11StandardLayout =
false;
1156 data().DefaultedCopyConstructorIsDeleted =
true;
1160 if (
Field->hasInClassInitializer())
1161 data().HasUninitializedFields =
false;
1162 }
else if (!
Field->hasInClassInitializer() && !
Field->isMutable()) {
1164 if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
1165 data().HasUninitializedFields =
true;
1167 data().HasUninitializedFields =
true;
1173 data().HasNonLiteralTypeFieldsOrBases =
true;
1175 if (
Field->hasInClassInitializer() ||
1176 (
Field->isAnonymousStructOrUnion() &&
1177 Field->getType()->getAsCXXRecordDecl()->hasInClassInitializer())) {
1178 data().HasInClassInitializer =
true;
1183 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1191 data().Aggregate =
false;
1195 data().PlainOldData =
false;
1203 data().DefaultedCopyAssignmentIsDeleted =
true;
1204 data().DefaultedMoveAssignmentIsDeleted =
true;
1209 bool IsZeroSize =
Field->isZeroSize(Context);
1212 if (FieldRec->isBeingDefined() || FieldRec->isCompleteDefinition()) {
1213 addedClassSubobject(FieldRec);
1221 data().NeedOverloadResolutionForCopyConstructor =
true;
1222 data().NeedOverloadResolutionForMoveConstructor =
true;
1223 data().NeedOverloadResolutionForCopyAssignment =
true;
1224 data().NeedOverloadResolutionForMoveAssignment =
true;
1233 if (FieldRec->hasNonTrivialCopyConstructor())
1234 data().DefaultedCopyConstructorIsDeleted =
true;
1235 if (FieldRec->hasNonTrivialMoveConstructor())
1236 data().DefaultedMoveConstructorIsDeleted =
true;
1237 if (FieldRec->hasNonTrivialCopyAssignment())
1238 data().DefaultedCopyAssignmentIsDeleted =
true;
1239 if (FieldRec->hasNonTrivialMoveAssignment())
1240 data().DefaultedMoveAssignmentIsDeleted =
true;
1241 if (FieldRec->hasNonTrivialDestructor()) {
1242 data().DefaultedDestructorIsDeleted =
true;
1246 data().DefaultedDestructorIsConstexpr =
true;
1252 if (
Field->isAnonymousStructOrUnion()) {
1253 data().NeedOverloadResolutionForCopyConstructor |=
1254 FieldRec->data().NeedOverloadResolutionForCopyConstructor;
1255 data().NeedOverloadResolutionForMoveConstructor |=
1256 FieldRec->data().NeedOverloadResolutionForMoveConstructor;
1257 data().NeedOverloadResolutionForCopyAssignment |=
1258 FieldRec->data().NeedOverloadResolutionForCopyAssignment;
1259 data().NeedOverloadResolutionForMoveAssignment |=
1260 FieldRec->data().NeedOverloadResolutionForMoveAssignment;
1261 data().NeedOverloadResolutionForDestructor |=
1262 FieldRec->data().NeedOverloadResolutionForDestructor;
1270 if (!FieldRec->hasTrivialDefaultConstructor())
1271 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1279 if (!FieldRec->hasTrivialCopyConstructor())
1280 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
1282 if (!FieldRec->hasTrivialCopyConstructorForCall())
1283 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
1288 if (!FieldRec->hasTrivialMoveConstructor())
1289 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
1291 if (!FieldRec->hasTrivialMoveConstructorForCall())
1292 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
1300 if (!FieldRec->hasTrivialCopyAssignment())
1301 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
1305 if (!FieldRec->hasTrivialMoveAssignment())
1306 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
1308 if (!FieldRec->hasTrivialDestructor())
1309 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1310 if (!FieldRec->hasTrivialDestructorForCall())
1311 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1312 if (!FieldRec->hasIrrelevantDestructor())
1313 data().HasIrrelevantDestructor =
false;
1314 if (FieldRec->isAnyDestructorNoReturn())
1315 data().IsAnyDestructorNoReturn =
true;
1316 if (FieldRec->hasObjectMember())
1318 if (FieldRec->hasVolatileMember())
1320 if (FieldRec->getArgPassingRestrictions() ==
1328 if (!FieldRec->isStandardLayout())
1329 data().IsStandardLayout =
false;
1330 if (!FieldRec->isCXX11StandardLayout())
1331 data().IsCXX11StandardLayout =
false;
1337 if (data().IsStandardLayout &&
1338 (
isUnion() || IsFirstField || IsZeroSize) &&
1339 hasSubobjectAtOffsetZeroOfEmptyBaseType(Context, FieldRec))
1340 data().IsStandardLayout =
false;
1346 if (data().IsCXX11StandardLayout && IsFirstField) {
1349 for (
const auto &BI :
bases()) {
1351 data().IsCXX11StandardLayout =
false;
1358 if (FieldRec->hasMutableFields())
1359 data().HasMutableFields =
true;
1361 if (
Field->isMutable()) {
1365 data().NeedOverloadResolutionForCopyConstructor =
true;
1366 data().NeedOverloadResolutionForCopyAssignment =
true;
1376 if (!
Field->hasInClassInitializer() &&
1377 !FieldRec->hasConstexprDefaultConstructor() && !
isUnion())
1380 data().DefaultedDefaultConstructorIsConstexpr =
1388 if (!FieldRec->hasCopyConstructorWithConstParam())
1389 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
1397 if (!FieldRec->hasCopyAssignmentWithConstParam())
1398 data().ImplicitCopyAssignmentHasConstParam =
false;
1400 if (FieldRec->hasUninitializedExplicitInitFields() &&
1401 FieldRec->isAggregate())
1404 if (FieldRec->hasUninitializedReferenceMember() &&
1405 !
Field->hasInClassInitializer())
1406 data().HasUninitializedReferenceMember =
true;
1411 if (FieldRec->hasVariantMembers() &&
1412 Field->isAnonymousStructOrUnion())
1413 data().HasVariantMembers =
true;
1415 if (FieldRec->isPFPType())
1416 data().IsPFPType =
true;
1423 data().DefaultedDefaultConstructorIsConstexpr =
false;
1431 data().DefaultedCopyAssignmentIsDeleted =
true;
1432 data().DefaultedMoveAssignmentIsDeleted =
true;
1441 data().StructuralIfLiteral =
false;
1448 data().HasTrivialSpecialMembers &=
1449 SMF_DefaultConstructor | SMF_Destructor;
1454 if (data().
Empty && !IsZeroSize)
1455 data().Empty =
false;
1458 const Type *Ty =
Field->getType()->getUnqualifiedDesugaredType();
1463 if (
const RecordType *RT = dyn_cast<RecordType>(Ty))
1472 if (
auto *Shadow = dyn_cast<UsingShadowDecl>(D)) {
1473 if (Shadow->getDeclName().getNameKind()
1476 data().Conversions.get(Ctx).addDecl(Ctx, Shadow, Shadow->getAccess());
1480 if (
const auto *Using = dyn_cast<UsingDecl>(D)) {
1481 if (
Using->getDeclName().getNameKind() ==
1483 data().HasInheritedConstructor =
true;
1486 data().Aggregate =
false;
1489 if (
Using->getDeclName().getCXXOverloadedOperator() == OO_Equal)
1490 data().HasInheritedAssignment =
true;
1503 data().Aggregate = data().UserDeclaredSpecialMembers == 0;
1518 bool HasAtLeastOneLiteralMember =
1523 if (!HasAtLeastOneLiteralMember)
1542 if (
const auto *DD = dyn_cast<CXXDestructorDecl>(MD)) {
1543 if (DD->isUserProvided())
1544 data().HasIrrelevantDestructor =
false;
1551 if (DD->isVirtual()) {
1552 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1553 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1556 if (DD->isNoReturn())
1557 data().IsAnyDestructorNoReturn =
true;
1565 data().HasTrivialSpecialMembers |= SMKind;
1566 data().HasTrivialSpecialMembersForCall |= SMKind;
1568 data().HasTrivialSpecialMembersForCall |= SMKind;
1569 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1571 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1578 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1586 unsigned SMKind = 0;
1588 if (
const auto *
Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1590 SMKind |= SMF_DefaultConstructor;
1592 data().HasConstexprDefaultConstructor =
true;
1595 SMKind |= SMF_CopyConstructor;
1597 SMKind |= SMF_MoveConstructor;
1600 data().HasConstexprNonCopyMoveConstructor =
true;
1602 SMKind |= SMF_Destructor;
1604 data().HasIrrelevantDestructor =
false;
1606 SMKind |= SMF_CopyAssignment;
1608 SMKind |= SMF_MoveAssignment;
1614 data().HasTrivialSpecialMembers |= SMKind;
1616 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1620void CXXRecordDecl::LambdaDefinitionData::AddCaptureList(
ASTContext &Ctx,
1622 Captures.push_back(CaptureList);
1623 if (Captures.size() == 2) {
1631 CXXRecordDecl::LambdaDefinitionData &
Data = getLambdaData();
1634 Data.NumCaptures = Captures.size();
1635 Data.NumExplicitCaptures = 0;
1638 Data.AddCaptureList(Context, ToCapture);
1641 ++
Data.NumExplicitCaptures;
1648 Data.DefaultedCopyAssignmentIsDeleted =
true;
1652 unsigned SMKind = 0;
1654 if (
const auto *
Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1656 SMKind = SMF_CopyConstructor;
1658 SMKind = SMF_MoveConstructor;
1660 SMKind = SMF_Destructor;
1663 data().HasTrivialSpecialMembersForCall |= SMKind;
1665 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1671 !TemplateOrInstantiation.isNull())
1676 return isPOD() && data().HasOnlyCMembers;
1681 return getLambdaData().IsGenericLambda;
1686 return llvm::all_of(R, [&](
NamedDecl *D) {
1693 if (!RD.
isLambda())
return nullptr;
1704 "More than one lambda call operator!");
1730 if (MD->getOwningModule() == M)
1734 llvm_unreachable(
"Couldn't find our call operator!");
1739 return dyn_cast_or_null<FunctionTemplateDecl>(CallOp);
1745 if (CallOp ==
nullptr)
1748 if (
const auto *CallOpTmpl = dyn_cast<FunctionTemplateDecl>(CallOp))
1756 assert(CallOp &&
"null call operator");
1763 assert(RD.
isLambda() &&
"Must be a lambda");
1770 if (
const auto *InvokerTemplate = dyn_cast<FunctionTemplateDecl>(ND))
1783 if (FTy->getCallConv() == CC)
1791 llvm::DenseMap<const ValueDecl *, FieldDecl *> &Captures,
1794 ThisCapture =
nullptr;
1796 LambdaDefinitionData &Lambda = getLambdaData();
1800 C != CEnd; ++
C, ++Field) {
1801 if (
C->capturesThis())
1802 ThisCapture = *Field;
1803 else if (
C->capturesVariable())
1804 Captures[
C->getCapturedVar()] = *Field;
1815 return Tmpl->getTemplateParameters();
1825 assert(std::is_partitioned(List->
begin(), List->
end(),
1826 [](
const NamedDecl *D) { return !D->isImplicit(); })
1827 &&
"Explicit template params should be ordered before implicit ones");
1829 const auto ExplicitEnd = llvm::partition_point(
1835 assert(
isLambda() &&
"Not a lambda closure type!");
1837 return getLambdaData().ContextDecl.get(Source);
1841 assert(
isLambda() &&
"Not a lambda closure type!");
1842 getLambdaData().ContextDecl = ContextDecl;
1846 assert(
isLambda() &&
"Not a lambda closure type!");
1856 assert(
isLambda() &&
"Not a lambda closure type!");
1857 return getASTContext().DeviceLambdaManglingNumbers.lookup(
this);
1863 ->getConversionType();
1864 return Context.getCanonicalType(T);
1895 if (ConvI != ConvE) {
1896 HiddenTypesBuffer = ParentHiddenTypes;
1897 HiddenTypes = &HiddenTypesBuffer;
1901 bool Hidden = ParentHiddenTypes.count(ConvType);
1903 HiddenTypesBuffer.insert(ConvType);
1907 if (Hidden && InVirtual)
1908 HiddenVBaseCs.insert(
cast<NamedDecl>(I.getDecl()->getCanonicalDecl()));
1916 VOutput.
addDecl(I.getDecl(), IAccess);
1918 Output.
addDecl(Context, I.getDecl(), IAccess);
1924 for (
const auto &I :
Record->bases()) {
1925 const auto *
Base = I.getType()->getAsCXXRecordDecl();
1931 bool BaseInVirtual = InVirtual || I.isVirtual();
1934 *HiddenTypes, Output, VOutput, HiddenVBaseCs);
1961 Output.
append(Context, ConvI, ConvE);
1962 for (; ConvI != ConvE; ++ConvI)
1966 for (
const auto &I :
Record->bases()) {
1967 const auto *
Base = I.getType()->getAsCXXRecordDecl();
1972 I.getAccessSpecifier(), HiddenTypes, Output,
1973 VBaseCs, HiddenVBaseCs);
1979 if (!HiddenVBaseCs.count(
cast<NamedDecl>(I.getDecl()->getCanonicalDecl())))
1980 Output.
addDecl(Context, I.getDecl(), I.getAccess());
1986llvm::iterator_range<CXXRecordDecl::conversion_iterator>
1991 if (
bases().empty()) {
1993 Set = &data().Conversions.get(Ctx);
1995 Set = &data().VisibleConversions.get(Ctx);
1997 if (!data().ComputedVisibleConversions) {
1999 data().ComputedVisibleConversions =
true;
2002 return llvm::make_range(
Set->begin(),
Set->end());
2018 for (
unsigned I = 0, E = Convs.
size(); I != E; ++I) {
2019 if (Convs[I].getDecl() == ConvDecl) {
2021 assert(!llvm::is_contained(Convs, ConvDecl) &&
2022 "conversion was found multiple times in unresolved set");
2027 llvm_unreachable(
"conversion not found in set!");
2038 return dyn_cast_if_present<MemberSpecializationInfo *>(
2039 TemplateOrInstantiation);
2045 assert(TemplateOrInstantiation.isNull() &&
2046 "Previous template or instantiation?");
2048 TemplateOrInstantiation
2053 return dyn_cast_if_present<ClassTemplateDecl *>(TemplateOrInstantiation);
2057 TemplateOrInstantiation =
Template;
2061 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this))
2062 return Spec->getSpecializationKind();
2065 return MSInfo->getTemplateSpecializationKind();
2072 if (
auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
2073 Spec->setSpecializationKind(TSK);
2078 MSInfo->setTemplateSpecializationKind(TSK);
2082 llvm_unreachable(
"Not a class template or member class specialization");
2086 auto GetDefinitionOrSelf =
2088 if (
auto *Def = D->getDefinition())
2095 if (
auto *TD = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
2096 auto From = TD->getInstantiatedFrom();
2097 if (
auto *CTD = dyn_cast_if_present<ClassTemplateDecl *>(From)) {
2098 while (
auto *NewCTD = CTD->getInstantiatedFromMemberTemplate()) {
2099 if (NewCTD->isMemberSpecialization())
2103 return GetDefinitionOrSelf(CTD->getTemplatedDecl());
2106 dyn_cast_if_present<ClassTemplatePartialSpecializationDecl *>(
2108 while (
auto *NewCTPSD = CTPSD->getInstantiatedFromMember()) {
2109 if (NewCTPSD->isMemberSpecialization())
2113 return GetDefinitionOrSelf(CTPSD);
2122 return GetDefinitionOrSelf(RD);
2127 "couldn't find pattern for class template instantiation");
2133 CanQualType ClassType = Context.getCanonicalTagType(
this);
2136 Context.DeclarationNames.getCXXDestructorName(ClassType);
2142 for (
auto *
Decl : R) {
2143 auto* DD = dyn_cast<CXXDestructorDecl>(
Decl);
2144 if (DD && !DD->isIneligibleOrNotSelected())
2152 return D->isDeleted();
2168 case Decl::ClassTemplatePartialSpecialization:
2170 case Decl::ClassTemplateSpecialization:
2172 case Decl::CXXRecord:
2175 llvm_unreachable(
"unexpected decl kind");
2181 if (
auto *RD = dyn_cast<ClassTemplatePartialSpecializationDecl>(
this))
2182 return RD->getCanonicalInjectedSpecializationType(Ctx);
2185 return TD->getCanonicalInjectedSpecializationType(Ctx);
2199 assert(
hasDefinition() &&
"checking for interface-like without a definition");
2225 Uuid->getGuid() ==
"00000000-0000-0000-C000-000000000046") ||
2227 Uuid->getGuid() ==
"00020400-0000-0000-C000-000000000046"))) {
2241 if (BaseSpec.isVirtual() || BaseSpec.getAccessSpecifier() !=
AS_public)
2243 const auto *
Base = BaseSpec.getType()->getAsCXXRecordDecl();
2244 if (
Base->isInterface() || !
Base->isInterfaceLike())
2255 if (!FinalOverriders) {
2261 for (
const CXXFinalOverriderMap::value_type &
2262 OverridingMethodsEntry : *FinalOverriders) {
2263 for (
const auto &[_, SubobjOverrides] : OverridingMethodsEntry.second) {
2264 assert(SubobjOverrides.size() > 0 &&
2265 "All virtual functions have overriding virtual functions");
2267 if (SubobjOverrides.front().Method->isPureVirtual())
2290 I.setAccess((*I)->getAccess());
2295 !Context.getLangOpts().CPlusPlus20) {
2298 if (
const auto *AT = FD->getAttr<ExplicitInitAttr>())
2299 Context.getDiagnostics().Report(
2301 diag::warn_cxx20_compat_requires_explicit_init_non_aggregate)
2302 << AT << FD << Context.getCanonicalTagType(
this);
2311 if (
const auto *AT = FD->getAttr<ExplicitInitAttr>())
2312 Context.getDiagnostics().Report(AT->getLocation(),
2313 diag::warn_attribute_needs_aggregate)
2314 << AT << Context.getCanonicalTagType(
this);
2320 data().IsPFPType =
true;
2322 data().IsPFPType =
true;
2323 data().IsStandardLayout =
false;
2324 data().IsCXX11StandardLayout =
false;
2329 if (data().Abstract ||
isInvalidDecl() || !data().Polymorphic ||
2333 for (
const auto &B :
bases()) {
2335 B.getType()->castAsCanonical<RecordType>()->getDecl());
2336 if (BaseDecl->isAbstract())
2347 if (Def->hasAttr<FinalAttr>())
2349 if (
const auto *Dtor = Def->getDestructor())
2350 if (Dtor->hasAttr<FinalAttr>())
2355void CXXDeductionGuideDecl::anchor() {}
2374 case Decl::Kind::CXXConstructor:
2376 case Decl::Kind::CXXConversion:
2378 case Decl::Kind::CXXDeductionGuide:
2390 const CXXDeductionGuideDecl *GeneratedFrom,
2392 return new (
C, DC) CXXDeductionGuideDecl(
2393 C, DC, StartLoc, ES, NameInfo, T, TInfo, EndLocation, Ctor, Kind,
2394 TrailingRequiresClause, GeneratedFrom, SourceKind);
2399 return new (
C, ID) CXXDeductionGuideDecl(
2409 return new (
C, DC) RequiresExprBodyDecl(
C, DC, StartLoc);
2417void CXXMethodDecl::anchor() {}
2459 auto *MD = dyn_cast<CXXMethodDecl>(ND);
2487 llvm::erase_if(FinalOverriders, [&](
CXXMethodDecl *OtherD) {
2491 FinalOverriders.push_back(D);
2494 for (
const auto &I : RD->
bases()) {
2495 const auto *
Base = I.getType()->getAsCXXRecordDecl();
2499 AddFinalOverrider(D);
2502 return FinalOverriders.size() == 1 ? FinalOverriders.front() :
nullptr;
2513 CXXMethod,
C, RD, StartLoc, NameInfo, T, TInfo, SC,
UsesFPIntrin,
2514 isInline, ConstexprKind, EndLocation, TrailingRequiresClause);
2528 assert(
isVirtual() &&
"this method is expected to be virtual");
2546 Base =
Base->getBestDynamicClassTypeExpr();
2547 if (
Base->isPRValue() &&
Base->getType()->isRecordType())
2552 if (!BestDynamicDecl)
2561 if (!DevirtualizedMethod)
2571 if (DevirtualizedMethod->
hasAttr<FinalAttr>())
2572 return DevirtualizedMethod;
2578 return DevirtualizedMethod;
2580 if (
const auto *DRE = dyn_cast<DeclRefExpr>(
Base)) {
2581 if (
const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
2582 if (VD->getType()->isRecordType())
2584 return DevirtualizedMethod;
2592 if (
const auto *ME = dyn_cast<MemberExpr>(
Base)) {
2593 const ValueDecl *VD = ME->getMemberDecl();
2599 if (
auto *BO = dyn_cast<BinaryOperator>(
Base)) {
2600 if (BO->isPtrMemOp()) {
2602 if (MPT->getPointeeType()->isRecordType())
2603 return DevirtualizedMethod;
2613 assert(PreventedBy.empty() &&
"PreventedBy is expected to be empty");
2629 if (!PrimaryTemplate)
2663 unsigned UsualParams = 1;
2686 Context.getSizeType()))
2701 if (Context.getLangOpts().CPlusPlus17 ||
2702 Context.getLangOpts().AlignedAllocation ||
2710 for (
const auto *D : R) {
2711 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
2712 if (FD->getNumParams() == 1) {
2713 PreventedBy.push_back(FD);
2750 return Context.hasSameUnqualifiedType(ClassType, ParamType);
2770 return Context.hasSameUnqualifiedType(ClassType, ParamType);
2775 assert(MD->
isVirtual() &&
"Method is not virtual!");
2819 ObjectTy =
C.getLangOpts().HLSL ?
C.getLValueReferenceType(ObjectTy)
2820 :
C.getPointerType(ObjectTy);
2833 assert(
isInstance() &&
"No 'this' for static methods!");
2847 return C.getRValueReferenceType(
Type);
2848 return C.getLValueReferenceType(
Type);
2874 : Initializee(TInfo), Init(Init), MemberOrEllipsisLocation(EllipsisLoc),
2875 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(IsVirtual),
2876 IsWritten(
false), SourceOrder(0) {}
2882 : Initializee(
Member), Init(Init), MemberOrEllipsisLocation(MemberLoc),
2883 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2884 IsWritten(
false), SourceOrder(0) {}
2891 : Initializee(
Member), Init(Init), MemberOrEllipsisLocation(MemberLoc),
2892 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2893 IsWritten(
false), SourceOrder(0) {}
2899 : Initializee(TInfo), Init(Init), LParenLoc(L), RParenLoc(R),
2900 IsDelegating(
true), IsVirtual(
false), IsWritten(
false), SourceOrder(0) {}
2903 return Context.getAllocator()
2929 return TSInfo->getTypeLoc().getBeginLoc();
2938 return I->getSourceRange();
2945CXXConstructorDecl::CXXConstructorDecl(
2952 :
CXXMethodDecl(CXXConstructor,
C, RD, StartLoc, NameInfo, T, TInfo,
2953 SC_None, UsesFPIntrin, isInline, ConstexprKind,
2955 setNumCtorInitializers(0);
2956 setInheritingConstructor(
static_cast<bool>(Inherited));
2957 setImplicit(isImplicitlyDeclared);
2958 CXXConstructorDeclBits.HasTrailingExplicitSpecifier = ES.
getExpr() ? 1 : 0;
2960 *getTrailingObjects<InheritedConstructor>() = Inherited;
2961 setExplicitSpecifier(ES);
2964void CXXConstructorDecl::anchor() {}
2968 uint64_t AllocKind) {
2969 bool hasTrailingExplicit =
static_cast<bool>(AllocKind & TAKHasTailExplicit);
2971 static_cast<bool>(AllocKind & TAKInheritsConstructor);
2973 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2980 Result->CXXConstructorDeclBits.HasTrailingExplicitSpecifier =
2981 hasTrailingExplicit;
2995 "Name must refer to a constructor");
2997 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2998 Inherited ? 1 : 0, ES.
getExpr() ? 1 : 0);
2999 return new (
C, RD,
Extra) CXXConstructorDecl(
3000 C, RD, StartLoc, NameInfo, T, TInfo, ES,
UsesFPIntrin, isInline,
3001 isImplicitlyDeclared, ConstexprKind, Inherited, TrailingRequiresClause);
3005 return CtorInitializers.get(
getASTContext().getExternalSource());
3011 if (
const auto *Construct = dyn_cast<CXXConstructExpr>(E))
3012 return Construct->getConstructor();
3055 const auto *ParamRefType = Param->getType()->getAs<
ReferenceType>();
3064 if (!Context.hasSameUnqualifiedType(PointeeType, ClassTy))
3099 CanQualType ParamType = Param->getType()->getCanonicalTypeUnqualified();
3103 return ParamType == ClassTy;
3106void CXXDestructorDecl::anchor() {}
3110 return new (
C, ID) CXXDestructorDecl(
3119 bool UsesFPIntrin,
bool isInline,
bool isImplicitlyDeclared,
3124 "Name must refer to a destructor");
3125 return new (
C, RD) CXXDestructorDecl(
3126 C, RD, StartLoc, NameInfo, T, TInfo,
UsesFPIntrin, isInline,
3127 isImplicitlyDeclared, ConstexprKind, TrailingRequiresClause);
3169 L->ResolvedOperatorArrayDelete(
3183 L->ResolvedOperatorGlobArrayDelete(
3221 if (!SelectedOperatorDelete)
3231void CXXConversionDecl::anchor() {}
3235 return new (
C, ID) CXXConversionDecl(
3249 "Name must refer to a conversion function");
3250 return new (
C, RD) CXXConversionDecl(
3251 C, RD, StartLoc, NameInfo, T, TInfo,
UsesFPIntrin, isInline, ES,
3252 ConstexprKind, EndLocation, TrailingRequiresClause);
3269void LinkageSpecDecl::anchor() {}
3276 return new (
C, DC) LinkageSpecDecl(DC, ExternLoc, LangLoc, Lang, HasBraces);
3286void UsingDirectiveDecl::anchor() {}
3295 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(Used))
3296 Used = NS->getFirstDecl();
3297 return new (
C, DC) UsingDirectiveDecl(DC, L, NamespaceLoc, QualifierLoc,
3298 IdentLoc, Used, CommonAncestor);
3310 if (
auto *Alias = dyn_cast<NamespaceAliasDecl>(
this))
3316 if (
auto *NA = dyn_cast_or_null<NamespaceAliasDecl>(NominatedNamespace))
3318 return cast_or_null<NamespaceDecl>(NominatedNamespace);
3326 redeclarable_base(
C), LocStart(StartLoc) {
3329 setPreviousDecl(PrevDecl);
3335 NamespaceDecl *PrevDecl,
bool Nested) {
3337 NamespaceDecl(
C, DC, Inline, StartLoc, IdLoc, Id, PrevDecl, Nested);
3358void NamespaceAliasDecl::anchor() {}
3378 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(Namespace))
3380 return new (
C, DC) NamespaceAliasDecl(
C, DC, UsingLoc, AliasLoc, Alias,
3381 QualifierLoc, IdentLoc, Namespace);
3392void LifetimeExtendedTemporaryDecl::anchor() {}
3406 return ExtendingDecl->getDeclContext()->isFunctionOrMethod() ?
SD_Automatic
3413 "don't need to cache the computed value for this temporary");
3414 if (MayCreate && !Value) {
3418 assert(Value &&
"may not be null");
3422void UsingShadowDecl::anchor() {}
3427 :
NamedDecl(K, DC, Loc, Name), redeclarable_base(
C),
3428 UsingOrNextShadow(Introducer) {
3438 redeclarable_base(
C) {}
3447 while (
const auto *NextShadow =
3448 dyn_cast<UsingShadowDecl>(Shadow->UsingOrNextShadow))
3449 Shadow = NextShadow;
3453void ConstructorUsingShadowDecl::anchor() {}
3459 return new (
C, DC) ConstructorUsingShadowDecl(
C, DC, Loc, Using,
Target,
3465 return new (
C, ID) ConstructorUsingShadowDecl(
C,
EmptyShell());
3472void BaseUsingDecl::anchor() {}
3475 assert(!llvm::is_contained(
shadows(), S) &&
"declaration already in set");
3478 if (FirstUsingShadow.getPointer())
3479 S->UsingOrNextShadow = FirstUsingShadow.getPointer();
3480 FirstUsingShadow.setPointer(S);
3484 assert(llvm::is_contained(
shadows(), S) &&
"declaration not in set");
3489 if (FirstUsingShadow.getPointer() == S) {
3490 FirstUsingShadow.setPointer(
3491 dyn_cast<UsingShadowDecl>(S->UsingOrNextShadow));
3492 S->UsingOrNextShadow =
this;
3497 while (Prev->UsingOrNextShadow != S)
3499 Prev->UsingOrNextShadow = S->UsingOrNextShadow;
3500 S->UsingOrNextShadow =
this;
3503void UsingDecl::anchor() {}
3509 return new (
C, DC) UsingDecl(DC, UL, QualifierLoc, NameInfo, HasTypename);
3524void UsingEnumDecl::anchor() {}
3531 UsingEnumDecl(DC, EnumType->getType()->castAsEnumDecl()->getDeclName(),
3532 UL, EL, NL, EnumType);
3543 return SourceRange(UsingLocation, EnumType->getTypeLoc().getEndLoc());
3546void UsingPackDecl::anchor() {}
3551 size_t Extra = additionalSizeToAlloc<NamedDecl *>(UsingDecls.size());
3552 return new (
C, DC,
Extra) UsingPackDecl(DC, InstantiatedFrom, UsingDecls);
3556 unsigned NumExpansions) {
3557 size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
3558 auto *
Result =
new (
C, ID,
Extra) UsingPackDecl(
nullptr,
nullptr, {});
3559 Result->NumExpansions = NumExpansions;
3560 auto *Trail =
Result->getTrailingObjects();
3561 std::uninitialized_fill_n(Trail, NumExpansions,
nullptr);
3565void UnresolvedUsingValueDecl::anchor() {}
3573 return new (
C, DC) UnresolvedUsingValueDecl(DC,
C.DependentTy, UsingLoc,
3574 QualifierLoc, NameInfo,
3580 return new (
C, ID) UnresolvedUsingValueDecl(
nullptr,
QualType(),
3593void UnresolvedUsingTypenameDecl::anchor() {}
3603 return new (
C, DC) UnresolvedUsingTypenameDecl(
3604 DC, UsingLoc, TypenameLoc, QualifierLoc, TargetNameLoc,
3611 return new (
C, ID) UnresolvedUsingTypenameDecl(
3619 return new (Ctx, DC) UnresolvedUsingIfExistsDecl(DC, Loc, Name);
3625 return new (Ctx, ID)
3629UnresolvedUsingIfExistsDecl::UnresolvedUsingIfExistsDecl(
DeclContext *DC,
3632 :
NamedDecl(
Decl::UnresolvedUsingIfExists, DC, Loc, Name) {}
3634void UnresolvedUsingIfExistsDecl::anchor() {}
3636void StaticAssertDecl::anchor() {}
3643 return new (
C, DC) StaticAssertDecl(DC, StaticAssertLoc, AssertExpr, Message,
3649 return new (
C, ID) StaticAssertDecl(
nullptr,
SourceLocation(),
nullptr,
3655 "expected a VarDecl or a BindingDecl");
3656 if (
auto *Var = llvm::dyn_cast<VarDecl>(
this))
3658 if (
auto *BD = llvm::dyn_cast<BindingDecl>(
this))
3659 return llvm::dyn_cast_if_present<VarDecl>(BD->getDecomposedDecl());
3663void BindingDecl::anchor() {}
3668 return new (
C, DC) BindingDecl(DC, IdLoc, Id, T);
3685 assert(VD->isImplicit() &&
"holding var for binding decl not implicit");
3690 assert(Binding &&
"expecting a pack expr");
3692 ValueDecl *
const *
First = FP->getNumExpansions() > 0 ? FP->begin() :
nullptr;
3695 FP->getNumExpansions());
3698void DecompositionDecl::anchor() {}
3706 size_t Extra = additionalSizeToAlloc<BindingDecl *>(
Bindings.size());
3707 return new (
C, DC,
Extra)
3708 DecompositionDecl(
C, DC, StartLoc, LSquareLoc, T, TInfo, SC,
Bindings);
3713 unsigned NumBindings) {
3714 size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
3719 Result->NumBindings = NumBindings;
3720 auto *Trail =
Result->getTrailingObjects();
3721 std::uninitialized_fill_n(Trail, NumBindings,
nullptr);
3732 B->printName(OS, Policy);
3738void MSPropertyDecl::anchor() {}
3746 return new (
C, DC) MSPropertyDecl(DC, L, N, T, TInfo, StartL, Getter, Setter);
3756void MSGuidDecl::anchor() {}
3764 return new (
C, DC) MSGuidDecl(DC, T, P);
3768 return new (
C,
ID) MSGuidDecl(
nullptr, QualType(),
Parts());
3773 OS << llvm::format(
"GUID{%08" PRIx32
"-%04" PRIx16
"-%04" PRIx16
"-",
3774 PartVal.Part1, PartVal.Part2, PartVal.Part3);
3776 for (uint8_t Byte : PartVal.Part4And5) {
3777 OS << llvm::format(
"%02" PRIx8, Byte);
3790 auto IsInt = [&Ctx](
unsigned N) {
3792 return T->isUnsignedIntegerOrEnumerationType() &&
3797 auto IsArray = [&Ctx](MatcherRef Elem,
unsigned N) {
3798 return [&Ctx, Elem, N](
QualType T) {
3804 auto IsStruct = [](std::initializer_list<MatcherRef> Fields) {
3812 if (
auto *CXXRD = dyn_cast<CXXRecordDecl>(RD))
3813 if (CXXRD->getNumBases())
3815 auto MatcherIt = Fields.begin();
3817 if (FD->isUnnamedBitField())
3819 if (FD->isBitField() || MatcherIt == Fields.end() ||
3820 !(*MatcherIt)(FD->getType()))
3824 return MatcherIt == Fields.end();
3829 return IsStruct({IsInt(32), IsInt(16), IsInt(16), IsArray(IsInt(8), 8)})(T);
3837 APVal.getStructField(0) =
APValue(
APSInt(APInt(32, PartVal.Part1),
true));
3838 APVal.getStructField(1) =
APValue(
APSInt(APInt(16, PartVal.Part2),
true));
3839 APVal.getStructField(2) =
APValue(
APSInt(APInt(16, PartVal.Part3),
true));
3842 for (
unsigned I = 0; I != 8; ++I) {
3854void UnnamedGlobalConstantDecl::anchor() {}
3856UnnamedGlobalConstantDecl::UnnamedGlobalConstantDecl(
const ASTContext &
C,
3865 if (
Value.needsCleanup())
3866 C.addDestruction(&
Value);
3873 return new (
C, DC) UnnamedGlobalConstantDecl(
C, DC, T, Value);
3879 UnnamedGlobalConstantDecl(
C,
nullptr, QualType(),
APValue());
3884 OS <<
"unnamed-global-constant";
3890 llvm_unreachable(
"Invalid access specifier!");
3898 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
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.
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.
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.
bool isExplicit() const
Return true if the declaration is already resolved to be explicit.
init_iterator init_begin()
Retrieve an iterator to the first initializer.
CXXConstructorDecl * getTargetConstructor() const
When this constructor delegates to another, retrieve the target.
static CXXConstructorDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, uint64_t AllocKind)
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
bool isDelegatingConstructor() const
Determine whether this constructor is a delegating constructor.
bool isSpecializationCopyingObject() const
Determine whether this is a member template specialization that would copy the object to itself.
bool isMoveConstructor() const
Determine whether this constructor is a move constructor (C++11 [class.copy]p3), which can be used to...
bool isCopyOrMoveConstructor() const
Determine whether this a copy or move constructor.
static CXXConstructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, ExplicitSpecifier ES, bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, InheritedConstructor Inherited=InheritedConstructor(), 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.
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 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 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 ...
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.
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, 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
const Expr * getExpr() const
ExplicitSpecifier()=default
static ExplicitSpecifier getFromDecl(FunctionDecl *Function)
bool isEquivalent(const ExplicitSpecifier Other) const
Check for equivalence of explicit specifiers.
This represents one expression.
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
Abstract interface for external sources of AST nodes.
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 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...
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)
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.
void setBeingDefined(bool V=true)
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.