39 #include "llvm/ADT/None.h" 40 #include "llvm/ADT/SmallPtrSet.h" 41 #include "llvm/ADT/SmallVector.h" 42 #include "llvm/ADT/iterator_range.h" 43 #include "llvm/Support/Casting.h" 44 #include "llvm/Support/ErrorHandling.h" 45 #include "llvm/Support/raw_ostream.h" 51 using namespace clang;
57 void AccessSpecDecl::anchor() {}
63 void LazyASTUnresolvedSet::getFromExternalSource(
ASTContext &
C)
const {
65 assert(Impl.Decls.isLazy() &&
"getFromExternalSource for non-lazy set");
66 assert(Source &&
"getFromExternalSource with no external source");
70 reinterpret_cast<uintptr_t>(I.getDecl()) >> 2)));
71 Impl.Decls.setLazy(
false);
74 CXXRecordDecl::DefinitionData::DefinitionData(
CXXRecordDecl *D)
75 : UserDeclaredConstructor(
false), UserDeclaredSpecialMembers(0),
76 Aggregate(
true), PlainOldData(
true), Empty(
true), Polymorphic(
false),
77 Abstract(
false), IsStandardLayout(
true), IsCXX11StandardLayout(
true),
78 HasBasesWithFields(
false), HasBasesWithNonStaticDataMembers(
false),
79 HasPrivateFields(
false), HasProtectedFields(
false),
80 HasPublicFields(
false), HasMutableFields(
false), HasVariantMembers(
false),
81 HasOnlyCMembers(
true), HasInClassInitializer(
false),
82 HasUninitializedReferenceMember(
false), HasUninitializedFields(
false),
83 HasInheritedConstructor(
false), HasInheritedAssignment(
false),
84 NeedOverloadResolutionForCopyConstructor(
false),
85 NeedOverloadResolutionForMoveConstructor(
false),
86 NeedOverloadResolutionForMoveAssignment(
false),
87 NeedOverloadResolutionForDestructor(
false),
88 DefaultedCopyConstructorIsDeleted(
false),
89 DefaultedMoveConstructorIsDeleted(
false),
90 DefaultedMoveAssignmentIsDeleted(
false),
91 DefaultedDestructorIsDeleted(
false), HasTrivialSpecialMembers(SMF_All),
92 HasTrivialSpecialMembersForCall(SMF_All),
93 DeclaredNonTrivialSpecialMembers(0),
94 DeclaredNonTrivialSpecialMembersForCall(0), HasIrrelevantDestructor(
true),
95 HasConstexprNonCopyMoveConstructor(
false),
96 HasDefaultedDefaultConstructor(
false),
97 DefaultedDefaultConstructorIsConstexpr(
true),
98 HasConstexprDefaultConstructor(
false),
99 HasNonLiteralTypeFieldsOrBases(
false), ComputedVisibleConversions(
false),
100 UserProvidedDefaultConstructor(
false), DeclaredSpecialMembers(0),
101 ImplicitCopyConstructorCanHaveConstParamForVBase(
true),
102 ImplicitCopyConstructorCanHaveConstParamForNonVBase(
true),
103 ImplicitCopyAssignmentHasConstParam(
true),
104 HasDeclaredCopyConstructorWithConstParam(
false),
105 HasDeclaredCopyAssignmentWithConstParam(
false), IsLambda(
false),
106 IsParsingBaseSpecifiers(
false), HasODRHash(
false), Definition(D) {}
109 return Bases.get(Definition->getASTContext().getExternalSource());
112 CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getVBasesSlowCase()
const {
113 return VBases.get(Definition->getASTContext().getExternalSource());
120 :
RecordDecl(K, TK, C, DC, StartLoc, IdLoc, Id, PrevDecl),
121 DefinitionData(PrevDecl ? PrevDecl->DefinitionData
128 bool DelayTypeCreation) {
129 auto *R =
new (
C, DC)
CXXRecordDecl(CXXRecord, TK, C, DC, StartLoc, IdLoc, Id,
134 if (!DelayTypeCreation)
142 bool Dependent,
bool IsGeneric,
146 R->IsBeingDefined =
true;
148 new (
C)
struct LambdaDefinitionData(R, Info, Dependent, IsGeneric,
150 R->MayHaveOutOfDateDef =
false;
151 R->setImplicit(
true);
161 R->MayHaveOutOfDateDef =
false;
169 llvm::SmallPtrSet<const CXXRecordDecl*, 8> SeenBaseTypes;
171 while (!WorkList.empty()) {
174 if (
const CXXRecordDecl *B = BaseSpec.getType()->getAsCXXRecordDecl()) {
175 if (!SeenBaseTypes.insert(B).second)
177 WorkList.push_back(B);
189 if (!data().Bases.isOffset() && data().NumBases > 0)
196 data().Aggregate =
false;
201 data().PlainOldData =
false;
205 llvm::SmallPtrSet<CanQualType, 8> SeenVBaseTypes;
211 data().NumBases = NumBases;
212 for (
unsigned i = 0; i < NumBases; ++i) {
213 data().getBases()[i] = *Bases[i];
220 auto *BaseClassDecl =
228 if (BaseClassDecl->data().HasBasesWithFields ||
229 !BaseClassDecl->field_empty()) {
230 if (data().HasBasesWithFields)
232 data().IsStandardLayout =
false;
233 data().HasBasesWithFields =
true;
240 if (BaseClassDecl->data().HasBasesWithNonStaticDataMembers ||
241 BaseClassDecl->hasDirectFields()) {
242 if (data().HasBasesWithNonStaticDataMembers)
243 data().IsCXX11StandardLayout =
false;
244 data().HasBasesWithNonStaticDataMembers =
true;
247 if (!BaseClassDecl->isEmpty()) {
251 data().Empty =
false;
257 data().Aggregate =
false;
262 if (BaseClassDecl->isPolymorphic()) {
263 data().Polymorphic =
true;
266 data().Aggregate =
false;
272 if (!BaseClassDecl->isStandardLayout())
273 data().IsStandardLayout =
false;
274 if (!BaseClassDecl->isCXX11StandardLayout())
275 data().IsCXX11StandardLayout =
false;
279 data().HasNonLiteralTypeFieldsOrBases =
true;
282 for (
const auto &VBase : BaseClassDecl->vbases()) {
285 VBases.push_back(&VBase);
292 if (
CXXRecordDecl *VBaseDecl = VBase.getType()->getAsCXXRecordDecl())
293 if (!VBaseDecl->hasCopyConstructorWithConstParam())
294 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
298 data().Aggregate =
false;
305 VBases.push_back(Base);
310 data().Empty =
false;
314 data().Aggregate =
false;
320 data().HasTrivialSpecialMembers &= SMF_Destructor;
321 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
326 data().IsStandardLayout =
false;
327 data().IsCXX11StandardLayout =
false;
332 data().DefaultedDefaultConstructorIsConstexpr =
false;
339 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
340 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
346 if (!BaseClassDecl->hasTrivialDefaultConstructor())
347 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
354 if (!BaseClassDecl->hasTrivialCopyConstructor())
355 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
357 if (!BaseClassDecl->hasTrivialCopyConstructorForCall())
358 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
364 if (!BaseClassDecl->hasTrivialMoveConstructor())
365 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
367 if (!BaseClassDecl->hasTrivialMoveConstructorForCall())
368 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
375 if (!BaseClassDecl->hasTrivialCopyAssignment())
376 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
381 if (!BaseClassDecl->hasTrivialMoveAssignment())
382 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
388 if (!BaseClassDecl->hasConstexprDefaultConstructor())
389 data().DefaultedDefaultConstructorIsConstexpr =
false;
396 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
397 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
403 if (!BaseClassDecl->hasTrivialDestructor())
404 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
406 if (!BaseClassDecl->hasTrivialDestructorForCall())
407 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
409 if (!BaseClassDecl->hasIrrelevantDestructor())
410 data().HasIrrelevantDestructor =
false;
417 if (!BaseClassDecl->hasCopyAssignmentWithConstParam())
418 data().ImplicitCopyAssignmentHasConstParam =
false;
422 if (BaseClassDecl->hasObjectMember())
425 if (BaseClassDecl->hasVolatileMember())
428 if (BaseClassDecl->getArgPassingRestrictions() ==
433 if (BaseClassDecl->hasMutableFields()) {
434 data().HasMutableFields =
true;
435 data().NeedOverloadResolutionForCopyConstructor =
true;
438 if (BaseClassDecl->hasUninitializedReferenceMember())
439 data().HasUninitializedReferenceMember =
true;
441 if (!BaseClassDecl->allowConstDefaultInit())
442 data().HasUninitializedFields =
true;
444 addedClassSubobject(BaseClassDecl);
455 data().IsStandardLayout =
false;
457 if (VBases.empty()) {
458 data().IsParsingBaseSpecifiers =
false;
464 data().NumVBases = VBases.size();
465 for (
int I = 0, E = VBases.size(); I != E; ++I) {
469 data().getVBases()[I] = *VBases[I];
472 data().IsParsingBaseSpecifiers =
false;
476 assert(
hasDefinition() &&
"ODRHash only for records with definitions");
479 if (DefinitionData->HasODRHash)
480 return DefinitionData->ODRHash;
485 DefinitionData->HasODRHash =
true;
488 return DefinitionData->ODRHash;
491 void CXXRecordDecl::addedClassSubobject(
CXXRecordDecl *Subobj) {
499 data().NeedOverloadResolutionForCopyConstructor =
true;
501 data().NeedOverloadResolutionForMoveConstructor =
true;
510 data().NeedOverloadResolutionForMoveAssignment =
true;
520 data().NeedOverloadResolutionForCopyConstructor =
true;
521 data().NeedOverloadResolutionForMoveConstructor =
true;
522 data().NeedOverloadResolutionForDestructor =
true;
550 void CXXRecordDecl::markedVirtualFunctionPure() {
553 data().Abstract =
true;
556 bool CXXRecordDecl::hasSubobjectAtOffsetZeroOfEmptyBaseType(
561 llvm::SmallPtrSet<const CXXRecordDecl*, 8> Bases;
562 llvm::SmallPtrSet<const CXXRecordDecl*, 8> M;
567 RD = RD->getCanonicalDecl();
575 if (!RD->data().HasBasesWithFields) {
594 if (M.insert(RD).second)
595 WorkList.push_back(RD);
602 while (!WorkList.empty()) {
611 for (
auto *FD : X->
fields()) {
614 if (FD->isUnnamedBitfield())
631 void CXXRecordDecl::addedMember(
Decl *D) {
633 !isa<FieldDecl>(D) &&
634 !isa<IndirectFieldDecl>(D) &&
635 (!isa<TagDecl>(D) || cast<TagDecl>(D)->getTagKind() ==
TTK_Class ||
637 data().HasOnlyCMembers =
false;
645 D = FunTmpl->getTemplatedDecl();
648 Decl *DUnderlying = D;
649 if (
auto *ND = dyn_cast<NamedDecl>(DUnderlying)) {
650 DUnderlying = ND->getUnderlyingDecl();
651 if (
auto *UnderlyingFunTmpl = dyn_cast<FunctionTemplateDecl>(DUnderlying))
652 DUnderlying = UnderlyingFunTmpl->getTemplatedDecl();
655 if (
const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
656 if (Method->isVirtual()) {
659 data().Aggregate =
false;
663 data().PlainOldData =
false;
667 data().Empty =
false;
672 data().Polymorphic =
true;
678 data().HasTrivialSpecialMembers &= SMF_Destructor;
679 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
684 data().IsStandardLayout =
false;
685 data().IsCXX11StandardLayout =
false;
693 L->AddedCXXImplicitMember(data().Definition, D);
699 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
700 if (!Constructor->isImplicit()) {
702 data().UserDeclaredConstructor =
true;
708 data().PlainOldData =
false;
711 if (Constructor->isDefaultConstructor()) {
712 SMKind |= SMF_DefaultConstructor;
714 if (Constructor->isUserProvided())
715 data().UserProvidedDefaultConstructor =
true;
716 if (Constructor->isConstexpr())
717 data().HasConstexprDefaultConstructor =
true;
718 if (Constructor->isDefaulted())
719 data().HasDefaultedDefaultConstructor =
true;
724 if (Constructor->isCopyConstructor(Quals)) {
725 SMKind |= SMF_CopyConstructor;
728 data().HasDeclaredCopyConstructorWithConstParam =
true;
729 }
else if (Constructor->isMoveConstructor())
730 SMKind |= SMF_MoveConstructor;
736 if (Constructor->isUserProvided() || Constructor->isExplicit())
737 data().Aggregate =
false;
741 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(DUnderlying)) {
748 if (Constructor->isConstexpr() && !Constructor->isCopyOrMoveConstructor())
749 data().HasConstexprNonCopyMoveConstructor =
true;
753 if (
const auto *DD = dyn_cast<CXXDestructorDecl>(D)) {
754 SMKind |= SMF_Destructor;
756 if (DD->isUserProvided())
757 data().HasIrrelevantDestructor =
false;
764 if (DD->isVirtual()) {
765 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
766 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
771 if (
const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
772 if (Method->isCopyAssignmentOperator()) {
773 SMKind |= SMF_CopyAssignment;
775 const auto *ParamTy =
777 if (!ParamTy || ParamTy->getPointeeType().isConstQualified())
778 data().HasDeclaredCopyAssignmentWithConstParam =
true;
781 if (Method->isMoveAssignmentOperator())
782 SMKind |= SMF_MoveAssignment;
785 if (
auto *Conversion = dyn_cast<CXXConversionDecl>(D)) {
794 if (Conversion->getPrimaryTemplate()) {
800 FunTmpl ? cast<NamedDecl>(FunTmpl) : cast<NamedDecl>(Conversion);
805 Conversions.
addDecl(Ctx, Primary, AS);
812 data().HasTrivialSpecialMembers &=
813 data().DeclaredSpecialMembers | ~SMKind;
814 data().HasTrivialSpecialMembersForCall &=
815 data().DeclaredSpecialMembers | ~SMKind;
817 if (!Method->isImplicit() && !Method->isUserProvided()) {
821 }
else if (Method->isTrivial()) {
822 data().HasTrivialSpecialMembers |= SMKind;
823 data().HasTrivialSpecialMembersForCall |= SMKind;
824 }
else if (Method->isTrivialForCall()) {
825 data().HasTrivialSpecialMembersForCall |= SMKind;
826 data().DeclaredNonTrivialSpecialMembers |= SMKind;
828 data().DeclaredNonTrivialSpecialMembers |= SMKind;
834 if (!Method->isUserProvided())
835 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
840 data().DeclaredSpecialMembers |= SMKind;
842 if (!Method->isImplicit()) {
843 data().UserDeclaredSpecialMembers |= SMKind;
856 data().PlainOldData =
false;
864 if (
const auto *Field = dyn_cast<FieldDecl>(D)) {
872 if (data().HasBasesWithFields)
873 data().IsStandardLayout =
false;
879 if (Field->isUnnamedBitfield()) {
883 if (data().Empty && !Field->isZeroLengthBitField(Context) &&
886 data().Empty =
false;
894 if (data().HasBasesWithNonStaticDataMembers)
895 data().IsCXX11StandardLayout =
false;
903 data().Aggregate =
false;
904 data().PlainOldData =
false;
909 bool IsFirstField = !data().HasPrivateFields &&
910 !data().HasProtectedFields && !data().HasPublicFields;
917 case AS_private: data().HasPrivateFields =
true;
break;
918 case AS_protected: data().HasProtectedFields =
true;
break;
919 case AS_public: data().HasPublicFields =
true;
break;
920 case AS_none: llvm_unreachable(
"Invalid access specifier");
922 if ((data().HasPrivateFields + data().HasProtectedFields +
923 data().HasPublicFields) > 1) {
924 data().IsStandardLayout =
false;
925 data().IsCXX11StandardLayout =
false;
929 if (Field->isMutable()) {
930 data().HasMutableFields =
true;
931 data().NeedOverloadResolutionForCopyConstructor =
true;
937 if (
isUnion() && !Field->isAnonymousStructOrUnion())
938 data().HasVariantMembers =
true;
957 struct DefinitionData &Data = data();
958 Data.PlainOldData =
false;
959 Data.HasTrivialSpecialMembers = 0;
965 data().HasTrivialSpecialMembersForCall = 0;
971 Data.HasIrrelevantDestructor =
false;
972 }
else if (!Context.
getLangOpts().ObjCAutoRefCount) {
976 data().PlainOldData =
false;
979 if (!Field->hasInClassInitializer())
980 data().HasUninitializedReferenceMember =
true;
985 data().IsStandardLayout =
false;
986 data().IsCXX11StandardLayout =
false;
992 data().DefaultedCopyConstructorIsDeleted =
true;
995 if (!Field->hasInClassInitializer() && !Field->isMutable()) {
997 if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
998 data().HasUninitializedFields =
true;
1000 data().HasUninitializedFields =
true;
1006 data().HasNonLiteralTypeFieldsOrBases =
true;
1008 if (Field->hasInClassInitializer() ||
1009 (Field->isAnonymousStructOrUnion() &&
1010 Field->getType()->getAsCXXRecordDecl()->hasInClassInitializer())) {
1011 data().HasInClassInitializer =
true;
1016 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1024 data().Aggregate =
false;
1028 data().PlainOldData =
false;
1036 data().DefaultedMoveAssignmentIsDeleted =
true;
1039 auto *FieldRec = cast<CXXRecordDecl>(RecordTy->getDecl());
1040 if (FieldRec->getDefinition()) {
1041 addedClassSubobject(FieldRec);
1049 data().NeedOverloadResolutionForCopyConstructor =
true;
1050 data().NeedOverloadResolutionForMoveConstructor =
true;
1051 data().NeedOverloadResolutionForMoveAssignment =
true;
1060 if (FieldRec->hasNonTrivialCopyConstructor())
1061 data().DefaultedCopyConstructorIsDeleted =
true;
1062 if (FieldRec->hasNonTrivialMoveConstructor())
1063 data().DefaultedMoveConstructorIsDeleted =
true;
1064 if (FieldRec->hasNonTrivialMoveAssignment())
1065 data().DefaultedMoveAssignmentIsDeleted =
true;
1066 if (FieldRec->hasNonTrivialDestructor())
1067 data().DefaultedDestructorIsDeleted =
true;
1072 if (Field->isAnonymousStructOrUnion()) {
1073 data().NeedOverloadResolutionForCopyConstructor |=
1074 FieldRec->data().NeedOverloadResolutionForCopyConstructor;
1075 data().NeedOverloadResolutionForMoveConstructor |=
1076 FieldRec->data().NeedOverloadResolutionForMoveConstructor;
1077 data().NeedOverloadResolutionForMoveAssignment |=
1078 FieldRec->data().NeedOverloadResolutionForMoveAssignment;
1079 data().NeedOverloadResolutionForDestructor |=
1080 FieldRec->data().NeedOverloadResolutionForDestructor;
1088 if (!FieldRec->hasTrivialDefaultConstructor())
1089 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1097 if (!FieldRec->hasTrivialCopyConstructor())
1098 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
1100 if (!FieldRec->hasTrivialCopyConstructorForCall())
1101 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
1106 if (!FieldRec->hasTrivialMoveConstructor())
1107 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
1109 if (!FieldRec->hasTrivialMoveConstructorForCall())
1110 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
1118 if (!FieldRec->hasTrivialCopyAssignment())
1119 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
1123 if (!FieldRec->hasTrivialMoveAssignment())
1124 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
1126 if (!FieldRec->hasTrivialDestructor())
1127 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1128 if (!FieldRec->hasTrivialDestructorForCall())
1129 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1130 if (!FieldRec->hasIrrelevantDestructor())
1131 data().HasIrrelevantDestructor =
false;
1132 if (FieldRec->hasObjectMember())
1134 if (FieldRec->hasVolatileMember())
1136 if (FieldRec->getArgPassingRestrictions() ==
1144 if (!FieldRec->isStandardLayout())
1145 data().IsStandardLayout =
false;
1146 if (!FieldRec->isCXX11StandardLayout())
1147 data().IsCXX11StandardLayout =
false;
1153 if (data().IsStandardLayout && (
isUnion() || IsFirstField) &&
1154 hasSubobjectAtOffsetZeroOfEmptyBaseType(Context, FieldRec))
1155 data().IsStandardLayout =
false;
1161 if (data().IsCXX11StandardLayout && IsFirstField) {
1164 for (
const auto &BI :
bases()) {
1166 data().IsCXX11StandardLayout =
false;
1173 if (FieldRec->hasMutableFields()) {
1174 data().HasMutableFields =
true;
1175 data().NeedOverloadResolutionForCopyConstructor =
true;
1185 if (!Field->hasInClassInitializer() &&
1186 !FieldRec->hasConstexprDefaultConstructor() && !
isUnion())
1189 data().DefaultedDefaultConstructorIsConstexpr =
false;
1196 if (!FieldRec->hasCopyConstructorWithConstParam())
1197 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
1205 if (!FieldRec->hasCopyAssignmentWithConstParam())
1206 data().ImplicitCopyAssignmentHasConstParam =
false;
1208 if (FieldRec->hasUninitializedReferenceMember() &&
1209 !Field->hasInClassInitializer())
1210 data().HasUninitializedReferenceMember =
true;
1215 if (FieldRec->hasVariantMembers() &&
1216 Field->isAnonymousStructOrUnion())
1217 data().HasVariantMembers =
true;
1222 (!Field->hasInClassInitializer() && !
isUnion()))
1223 data().DefaultedDefaultConstructorIsConstexpr =
false;
1231 data().DefaultedMoveAssignmentIsDeleted =
true;
1236 data().Empty =
false;
1240 if (
auto *Shadow = dyn_cast<UsingShadowDecl>(D)) {
1241 if (Shadow->getDeclName().getNameKind()
1244 data().Conversions.get(Ctx).addDecl(Ctx, Shadow, Shadow->getAccess());
1248 if (
const auto *Using = dyn_cast<UsingDecl>(D)) {
1249 if (Using->getDeclName().getNameKind() ==
1251 data().HasInheritedConstructor =
true;
1254 data().Aggregate =
false;
1257 if (Using->getDeclName().getCXXOverloadedOperator() == OO_Equal)
1258 data().HasInheritedAssignment =
true;
1266 unsigned SMKind = 0;
1268 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1269 if (Constructor->isDefaultConstructor()) {
1270 SMKind |= SMF_DefaultConstructor;
1271 if (Constructor->isConstexpr())
1272 data().HasConstexprDefaultConstructor =
true;
1274 if (Constructor->isCopyConstructor())
1275 SMKind |= SMF_CopyConstructor;
1276 else if (Constructor->isMoveConstructor())
1277 SMKind |= SMF_MoveConstructor;
1278 else if (Constructor->isConstexpr())
1280 data().HasConstexprNonCopyMoveConstructor =
true;
1281 }
else if (isa<CXXDestructorDecl>(D)) {
1282 SMKind |= SMF_Destructor;
1284 data().HasIrrelevantDestructor =
false;
1286 SMKind |= SMF_CopyAssignment;
1288 SMKind |= SMF_MoveAssignment;
1293 data().HasTrivialSpecialMembers |= SMKind;
1295 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1299 unsigned SMKind = 0;
1301 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1302 if (Constructor->isCopyConstructor())
1303 SMKind = SMF_CopyConstructor;
1304 else if (Constructor->isMoveConstructor())
1305 SMKind = SMF_MoveConstructor;
1306 }
else if (isa<CXXDestructorDecl>(D))
1307 SMKind = SMF_Destructor;
1310 data().HasTrivialSpecialMembersForCall |= SMKind;
1312 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1317 !TemplateOrInstantiation.isNull())
1322 return isPOD() && data().HasOnlyCMembers;
1327 return getLambdaData().IsGenericLambda;
1336 assert(!Calls.
empty() &&
"Missing lambda call operator!");
1337 assert(Calls.
size() == 1 &&
"More than one lambda call operator!");
1340 if (
const auto *CallOpTmpl = dyn_cast<FunctionTemplateDecl>(CallOp))
1341 return cast<CXXMethodDecl>(CallOpTmpl->getTemplatedDecl());
1343 return cast<CXXMethodDecl>(CallOp);
1351 if (Invoker.
empty())
return nullptr;
1352 assert(Invoker.
size() == 1 &&
"More than one static invoker operator!");
1354 if (
const auto *InvokerTemplate = dyn_cast<FunctionTemplateDecl>(InvokerFun))
1355 return cast<CXXMethodDecl>(InvokerTemplate->getTemplatedDecl());
1357 return cast<CXXMethodDecl>(InvokerFun);
1361 llvm::DenseMap<const VarDecl *, FieldDecl *> &Captures,
1364 ThisCapture =
nullptr;
1366 LambdaDefinitionData &Lambda = getLambdaData();
1368 for (
const LambdaCapture *C = Lambda.Captures, *CEnd = C + Lambda.NumCaptures;
1369 C != CEnd; ++C, ++Field) {
1370 if (C->capturesThis())
1371 ThisCapture = *Field;
1372 else if (C->capturesVariable())
1373 Captures[C->getCapturedVar()] = *Field;
1383 return Tmpl->getTemplateParameters();
1388 assert(
isLambda() &&
"Not a lambda closure type!");
1390 return getLambdaData().ContextDecl.get(Source);
1396 ->getConversionType();
1416 const llvm::SmallPtrSet<CanQualType, 8> &ParentHiddenTypes,
1419 llvm::SmallPtrSet<NamedDecl*, 8> &HiddenVBaseCs) {
1423 const llvm::SmallPtrSet<CanQualType, 8> *HiddenTypes = &ParentHiddenTypes;
1424 llvm::SmallPtrSet<CanQualType, 8> HiddenTypesBuffer;
1430 if (ConvI != ConvE) {
1431 HiddenTypesBuffer = ParentHiddenTypes;
1432 HiddenTypes = &HiddenTypesBuffer;
1436 bool Hidden = ParentHiddenTypes.count(ConvType);
1438 HiddenTypesBuffer.insert(ConvType);
1442 if (Hidden && InVirtual)
1443 HiddenVBaseCs.insert(cast<NamedDecl>(I.getDecl()->getCanonicalDecl()));
1451 VOutput.
addDecl(I.getDecl(), IAccess);
1453 Output.
addDecl(Context, I.getDecl(), IAccess);
1459 for (
const auto &I : Record->
bases()) {
1465 bool BaseInVirtual = InVirtual || I.isVirtual();
1469 *HiddenTypes, Output, VOutput, HiddenVBaseCs);
1487 llvm::SmallPtrSet<NamedDecl*, 8> HiddenVBaseCs;
1490 llvm::SmallPtrSet<CanQualType, 8> HiddenTypes;
1496 Output.
append(Context, ConvI, ConvE);
1497 for (; ConvI != ConvE; ++ConvI)
1501 for (
const auto &I : Record->
bases()) {
1506 I.isVirtual(), I.getAccessSpecifier(),
1507 HiddenTypes, Output, VBaseCs, HiddenVBaseCs);
1513 if (!HiddenVBaseCs.count(cast<NamedDecl>(I.getDecl()->getCanonicalDecl())))
1514 Output.
addDecl(Context, I.getDecl(), I.getAccess());
1520 llvm::iterator_range<CXXRecordDecl::conversion_iterator>
1527 Set = &data().Conversions.get(Ctx);
1529 Set = &data().VisibleConversions.get(Ctx);
1531 if (!data().ComputedVisibleConversions) {
1533 data().ComputedVisibleConversions =
true;
1536 return llvm::make_range(Set->
begin(), Set->
end());
1552 for (
unsigned I = 0, E = Convs.
size(); I != E; ++I) {
1553 if (Convs[I].getDecl() == ConvDecl) {
1555 assert(std::find(Convs.
begin(), Convs.
end(), ConvDecl) == Convs.
end()
1556 &&
"conversion was found multiple times in unresolved set");
1561 llvm_unreachable(
"conversion not found in set!");
1566 return cast<CXXRecordDecl>(MSInfo->getInstantiatedFrom());
1578 assert(TemplateOrInstantiation.isNull() &&
1579 "Previous template or instantiation?");
1580 assert(!isa<ClassTemplatePartialSpecializationDecl>(
this));
1581 TemplateOrInstantiation
1590 TemplateOrInstantiation = Template;
1594 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this))
1595 return Spec->getSpecializationKind();
1598 return MSInfo->getTemplateSpecializationKind();
1605 if (
auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1606 Spec->setSpecializationKind(TSK);
1611 MSInfo->setTemplateSpecializationKind(TSK);
1615 llvm_unreachable(
"Not a class template or member class specialization");
1619 auto GetDefinitionOrSelf =
1621 if (
auto *Def = D->getDefinition())
1628 if (
auto *TD = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1629 auto From = TD->getInstantiatedFrom();
1631 while (
auto *NewCTD = CTD->getInstantiatedFromMemberTemplate()) {
1632 if (NewCTD->isMemberSpecialization())
1636 return GetDefinitionOrSelf(CTD->getTemplatedDecl());
1640 while (
auto *NewCTPSD = CTPSD->getInstantiatedFromMember()) {
1641 if (NewCTPSD->isMemberSpecialization())
1645 return GetDefinitionOrSelf(CTPSD);
1654 return GetDefinitionOrSelf(RD);
1659 "couldn't find pattern for class template instantiation");
1679 if (Destructor->isNoReturn())
1685 if (RD->isAnyDestructorNoReturn())
1689 for (
const auto *Field :
fields())
1691 Field->getType()->getBaseElementTypeUnsafe()->getAsCXXRecordDecl())
1692 if (RD->isAnyDestructorNoReturn())
1709 assert(
hasDefinition() &&
"checking for interface-like without a definition");
1723 for (
const auto *
const Method :
methods())
1724 if (Method->isDefined() && !Method->isImplicit())
1728 const auto *Uuid = getAttr<UuidAttr>();
1735 Uuid->getGuid() ==
"00000000-0000-0000-C000-000000000046") ||
1737 Uuid->getGuid() ==
"00020400-0000-0000-C000-000000000046"))) {
1751 if (BaseSpec.isVirtual() || BaseSpec.getAccessSpecifier() !=
AS_public)
1753 const auto *
Base = BaseSpec.getType()->getAsCXXRecordDecl();
1754 if (
Base->isInterface() || !
Base->isInterfaceLike())
1770 if (!FinalOverriders) {
1772 FinalOverriders = &MyFinalOverriders;
1776 for (CXXFinalOverriderMap::iterator M = FinalOverriders->begin(),
1777 MEnd = FinalOverriders->end();
1778 M != MEnd && !Done; ++M) {
1780 SOEnd = M->second.end();
1781 SO != SOEnd && !Done; ++SO) {
1782 assert(SO->second.size() > 0 &&
1783 "All virtual functions have overriding virtual functions");
1789 if (SO->second.front().Method->isPure()) {
1790 data().Abstract =
true;
1801 I.setAccess((*I)->getAccess());
1805 if (data().Abstract ||
isInvalidDecl() || !data().Polymorphic ||
1809 for (
const auto &B :
bases()) {
1810 const auto *BaseDecl =
1811 cast<CXXRecordDecl>(B.getType()->getAs<
RecordType>()->getDecl());
1812 if (BaseDecl->isAbstract())
1819 void CXXDeductionGuideDecl::anchor() {}
1826 NameInfo, T, TInfo, EndLocation);
1836 void CXXMethodDecl::anchor() {}
1845 return isStaticOverloadedOperator(OOK);
1866 if (isa<CXXDestructorDecl>(
this)) {
1887 for (
const auto &I : RD->
bases()) {
1891 const auto *
Base = cast<CXXRecordDecl>(RT->
getDecl());
1907 return new (
C, RD)
CXXMethodDecl(CXXMethod, C, RD, StartLoc, NameInfo,
1908 T, TInfo, SC, isInline, isConstexpr,
1920 assert(isVirtual() &&
"this method is expected to be virtual");
1929 if (hasAttr<FinalAttr>())
1930 return isPure() ? nullptr :
this;
1944 if (!BestDynamicDecl)
1949 getCorrespondingMethodInClass(BestDynamicDecl);
1954 if (DevirtualizedMethod->
isPure())
1958 if (DevirtualizedMethod->
hasAttr<FinalAttr>())
1959 return DevirtualizedMethod;
1963 if (BestDynamicDecl->
hasAttr<FinalAttr>())
1964 return DevirtualizedMethod;
1966 if (
const auto *DRE = dyn_cast<DeclRefExpr>(Base)) {
1967 if (
const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
1968 if (VD->getType()->isRecordType())
1970 return DevirtualizedMethod;
1978 if (
const auto *ME = dyn_cast<MemberExpr>(Base)) {
1979 const ValueDecl *VD = ME->getMemberDecl();
1985 if (
auto *BO = dyn_cast<BinaryOperator>(Base)) {
1986 if (BO->isPtrMemOp()) {
1988 if (MPT->getPointeeType()->isRecordType())
1989 return DevirtualizedMethod;
1998 if (getOverloadedOperator() != OO_Delete &&
1999 getOverloadedOperator() != OO_Array_Delete)
2005 if (getPrimaryTemplate())
2012 if (getNumParams() == 1)
2014 unsigned UsualParams = 1;
2021 if (isDestroyingOperatorDelete())
2035 if (UsualParams < getNumParams() &&
2040 if (UsualParams < getNumParams() &&
2041 getParamDecl(UsualParams)->getType()->isAlignValT())
2044 if (UsualParams != getNumParams())
2057 if (
const auto *FD = dyn_cast<FunctionDecl>(*I))
2058 if (FD->getNumParams() == 1)
2070 if (getOverloadedOperator() != OO_Equal ||
2072 getPrimaryTemplate() || getDescribedFunctionTemplate() ||
2073 getNumParams() != 1)
2076 QualType ParamType = getParamDecl(0)->getType();
2091 if (getOverloadedOperator() != OO_Equal || isStatic() ||
2092 getPrimaryTemplate() || getDescribedFunctionTemplate() ||
2093 getNumParams() != 1)
2096 QualType ParamType = getParamDecl(0)->getType();
2097 if (!isa<RValueReferenceType>(ParamType))
2110 "Can't add an overridden method to a class template!");
2111 assert(MD->
isVirtual() &&
"Method is not virtual!");
2117 if (isa<CXXConstructorDecl>(
this))
return nullptr;
2122 if (isa<CXXConstructorDecl>(
this))
return nullptr;
2127 if (isa<CXXConstructorDecl>(
this))
return 0;
2133 if (isa<CXXConstructorDecl>(
this))
2145 assert(isInstance() &&
"No 'this' for static methods!");
2169 if (StaticInvoker ==
this)
return true;
2171 return StaticInvoker == this->getPrimaryTemplate()->getTemplatedDecl();
2182 : Initializee(TInfo), MemberOrEllipsisLocation(EllipsisLoc), Init(Init),
2183 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(IsVirtual),
2184 IsWritten(
false), SourceOrder(0) {}
2191 : Initializee(Member), MemberOrEllipsisLocation(MemberLoc), Init(Init),
2192 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2193 IsWritten(
false), SourceOrder(0) {}
2200 : Initializee(Member), MemberOrEllipsisLocation(MemberLoc), Init(Init),
2201 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2202 IsWritten(
false), SourceOrder(0) {}
2208 : Initializee(TInfo), Init(Init), LParenLoc(L), RParenLoc(R),
2209 IsDelegating(
true), IsVirtual(
false), IsWritten(
false), SourceOrder(0) {}
2220 return Initializee.get<
TypeSourceInfo*>()->getType().getTypePtr();
2233 return TSInfo->getTypeLoc().getLocalSourceRange().getBegin();
2242 return I->getSourceRange();
2249 void CXXConstructorDecl::anchor() {}
2254 unsigned Extra = additionalSizeToAlloc<InheritedConstructor>(Inherited);
2258 Result->IsInheritingConstructor = Inherited;
2267 bool isExplicit,
bool isInline,
2268 bool isImplicitlyDeclared,
bool isConstexpr,
2272 "Name must refer to a constructor");
2274 additionalSizeToAlloc<InheritedConstructor>(Inherited ? 1 : 0);
2276 C, RD, StartLoc, NameInfo, T, TInfo, isExplicit, isInline,
2277 isImplicitlyDeclared, isConstexpr, Inherited);
2281 return CtorInitializers.get(getASTContext().getExternalSource());
2285 assert(isDelegatingConstructor() &&
"Not a delegating constructor!");
2287 if (
const auto *Construct = dyn_cast<CXXConstructExpr>(E))
2288 return Construct->getConstructor();
2297 return (getNumParams() == 0) ||
2298 (getNumParams() > 0 && getParamDecl(0)->hasDefaultArg());
2303 return isCopyOrMoveConstructor(TypeQuals) &&
2304 getParamDecl(0)->getType()->isLValueReferenceType();
2308 return isCopyOrMoveConstructor(TypeQuals) &&
2309 getParamDecl(0)->getType()->isRValueReferenceType();
2324 if ((getNumParams() < 1) ||
2325 (getNumParams() > 1 && !getParamDecl(1)->hasDefaultArg()) ||
2326 (getPrimaryTemplate() !=
nullptr) ||
2327 (getDescribedFunctionTemplate() !=
nullptr))
2361 if (isExplicit() && !AllowExplicit)
2364 return (getNumParams() == 0 &&
2365 getType()->getAs<FunctionProtoType>()->isVariadic()) ||
2366 (getNumParams() == 1) ||
2367 (getNumParams() > 1 &&
2368 (getParamDecl(1)->hasDefaultArg() ||
2369 getParamDecl(1)->isParameterPack()));
2373 if ((getNumParams() < 1) ||
2374 (getNumParams() > 1 && !getParamDecl(1)->hasDefaultArg()) ||
2375 (getDescribedFunctionTemplate() !=
nullptr))
2392 void CXXDestructorDecl::anchor() {}
2398 QualType(),
nullptr,
false,
false);
2406 bool isInline,
bool isImplicitlyDeclared) {
2409 "Name must refer to a destructor");
2411 isInline, isImplicitlyDeclared);
2415 auto *
First = cast<CXXDestructorDecl>(getFirstDecl());
2416 if (OD && !
First->OperatorDelete) {
2417 First->OperatorDelete = OD;
2418 First->OperatorDeleteThisArg = ThisArg;
2419 if (
auto *L = getASTMutationListener())
2420 L->ResolvedOperatorDelete(
First, OD, ThisArg);
2424 void CXXConversionDecl::anchor() {}
2430 nullptr,
false,
false,
false,
2439 bool isInline,
bool isExplicit,
2443 "Name must refer to a conversion function");
2445 isInline, isExplicit, isConstexpr,
2450 return isImplicit() && getParent()->isLambda() &&
2451 getConversionType()->isBlockPointerType();
2454 void LinkageSpecDecl::anchor() {}
2462 return new (
C, DC)
LinkageSpecDecl(DC, ExternLoc, LangLoc, Lang, HasBraces);
2471 void UsingDirectiveDecl::anchor() {}
2480 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(Used))
2481 Used = NS->getOriginalNamespace();
2483 IdentLoc, Used, CommonAncestor);
2495 if (
auto *NA = dyn_cast_or_null<NamespaceAliasDecl>(NominatedNamespace))
2496 return NA->getNamespace();
2497 return cast_or_null<NamespaceDecl>(NominatedNamespace);
2504 redeclarable_base(C), LocStart(StartLoc),
2505 AnonOrFirstNamespaceAndInline(
nullptr, Inline) {
2506 setPreviousDecl(PrevDecl);
2516 return new (
C, DC)
NamespaceDecl(C, DC, Inline, StartLoc, IdLoc, Id,
2529 return AnonOrFirstNamespaceAndInline.getPointer();
2536 return AnonOrFirstNamespaceAndInline.getPointer();
2542 return getNextRedeclaration();
2546 return getPreviousDecl();
2550 return getMostRecentDecl();
2553 void NamespaceAliasDecl::anchor() {}
2556 return getNextRedeclaration();
2560 return getPreviousDecl();
2564 return getMostRecentDecl();
2575 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(Namespace))
2576 Namespace = NS->getOriginalNamespace();
2578 QualifierLoc, IdentLoc, Namespace);
2589 void UsingShadowDecl::anchor() {}
2612 while (
const auto *NextShadow =
2613 dyn_cast<UsingShadowDecl>(Shadow->UsingOrNextShadow))
2614 Shadow = NextShadow;
2615 return cast<UsingDecl>(Shadow->UsingOrNextShadow);
2618 void ConstructorUsingShadowDecl::anchor() {}
2637 void UsingDecl::anchor() {}
2640 assert(std::find(shadow_begin(), shadow_end(), S) == shadow_end() &&
2641 "declaration already in set");
2644 if (FirstUsingShadow.getPointer())
2645 S->UsingOrNextShadow = FirstUsingShadow.getPointer();
2646 FirstUsingShadow.setPointer(S);
2650 assert(std::find(shadow_begin(), shadow_end(), S) != shadow_end() &&
2651 "declaration not in set");
2656 if (FirstUsingShadow.getPointer() == S) {
2657 FirstUsingShadow.setPointer(
2658 dyn_cast<UsingShadowDecl>(S->UsingOrNextShadow));
2659 S->UsingOrNextShadow =
this;
2664 while (Prev->UsingOrNextShadow != S)
2665 Prev = cast<UsingShadowDecl>(Prev->UsingOrNextShadow);
2666 Prev->UsingOrNextShadow = S->UsingOrNextShadow;
2667 S->UsingOrNextShadow =
this;
2674 return new (
C, DC)
UsingDecl(DC, UL, QualifierLoc, NameInfo, HasTypename);
2685 ? getQualifierLoc().getBeginLoc() : UsingLocation;
2689 void UsingPackDecl::anchor() {}
2694 size_t Extra = additionalSizeToAlloc<NamedDecl *>(UsingDecls.size());
2695 return new (
C, DC, Extra)
UsingPackDecl(DC, InstantiatedFrom, UsingDecls);
2699 unsigned NumExpansions) {
2700 size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
2702 Result->NumExpansions = NumExpansions;
2703 auto *Trail = Result->getTrailingObjects<
NamedDecl *>();
2704 for (
unsigned I = 0; I != NumExpansions; ++I)
2709 void UnresolvedUsingValueDecl::anchor() {}
2718 QualifierLoc, NameInfo,
2733 ? getQualifierLoc().getBeginLoc() : UsingLocation;
2737 void UnresolvedUsingTypenameDecl::anchor() {}
2748 DC, UsingLoc, TypenameLoc, QualifierLoc, TargetNameLoc,
2759 void StaticAssertDecl::anchor() {}
2777 void BindingDecl::anchor() {}
2789 Expr *B = getBinding();
2796 auto *VD = dyn_cast<
VarDecl>(DRE->getDecl());
2797 assert(VD->isImplicit() &&
"holding var for binding decl not implicit");
2801 void DecompositionDecl::anchor() {}
2809 size_t Extra = additionalSizeToAlloc<BindingDecl *>(Bindings.size());
2810 return new (
C, DC, Extra)
2816 unsigned NumBindings) {
2817 size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
2822 Result->NumBindings = NumBindings;
2823 auto *Trail = Result->getTrailingObjects<
BindingDecl *>();
2824 for (
unsigned I = 0; I != NumBindings; ++I)
2832 for (
const auto *B : bindings()) {
2847 return new (
C, DC)
MSPropertyDecl(DC, L, N, T, TInfo, StartL, Getter, Setter);
2860 llvm_unreachable(
"Invalid access specifier!");
2868 llvm_unreachable(
"Invalid access specifier!");
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl)
Defines the clang::ASTContext interface.
static const char * getAccessName(AccessSpecifier AS)
void setImplicit(bool I=true)
Represents a function declaration or definition.
static Qualifiers fromCVRUMask(unsigned CVRU)
Expr * getInit() const
Get the initializer.
A (possibly-)qualified type.
virtual Decl * GetExternalDecl(uint32_t ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
bool replace(const NamedDecl *Old, NamedDecl *New, AccessSpecifier AS)
Replaces the given declaration with the new one, once.
const CXXMethodDecl *const * method_iterator
Attempt to be ABI-compatible with code generated by Clang 6.0.x (SVN r321711).
unsigned getNumBases() const
Retrieves the number of base classes of this class.
static UnresolvedUsingValueDecl * CreateDeserialized(ASTContext &C, unsigned ID)
This file contains the declaration of the ODRHash class, which calculates a hash based on AST nodes...
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
static UsingPackDecl * Create(ASTContext &C, DeclContext *DC, NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl *> UsingDecls)
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
bool isInClassMemberInitializer() const
Determine whether this initializer is an implicit initializer generated for a field with an initializ...
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a member function...
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
static bool hasRepeatedBaseClass(const CXXRecordDecl *StartRD)
Determine whether a class has a repeated base class.
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
static AccessSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
C Language Family Type Representation.
bool hasNonTrivialCopyConstructor() const
Determine whether this class has a non-trivial copy constructor (C++ [class.copy]p6, C++11 [class.copy]p12)
bool isRecordType() const
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
Decl - This represents one declaration (or definition), e.g.
void append(ASTContext &C, iterator I, iterator E)
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
void setArgPassingRestrictions(ArgPassingKind Kind)
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
bool isPOD() const
Whether this class is a POD-type (C++ [class]p4)
Defines the C++ template declaration subclasses.
llvm::iterator_range< conversion_iterator > getVisibleConversionFunctions()
Get all conversion functions visible in current class, including conversion function templates...
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
The base class of the type hierarchy.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
Represent a C++ namespace.
virtual void completeDefinition()
Note that the definition of this type is now complete.
SourceLocation getEndLoc() const LLVM_READONLY
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
A container of type source information.
bool isDefined(const FunctionDecl *&Definition) const
Returns true if the function has a definition that does not need to be instantiated.
bool hasFriends() const
Determines whether this record has any friends.
Describes the capture of a variable or of this, or of a C++1y init-capture.
Represents a C++ constructor within a class.
bool mayBeAbstract() const
Determine whether this class may end up being abstract, even though it is not yet known to be abstrac...
unsigned Access
Access - Used by C++ decls for the access specifier.
CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo, bool IsVirtual, SourceLocation L, Expr *Init, SourceLocation R, SourceLocation EllipsisLoc)
Creates a new base-class initializer.
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
This file provides some common utility functions for processing Lambda related AST Constructs...
Represents a variable declaration or definition.
ASTMutationListener * getASTMutationListener() const
static CXXConversionDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isExplicit, bool isConstexpr, SourceLocation EndLocation)
void finishedDefaultedOrDeletedMember(CXXMethodDecl *MD)
Indicates that the declaration of a defaulted or deleted special member function is now complete...
const T * getAs() const
Member-template getAs<specific type>'.
static MSPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL, IdentifierInfo *Getter, IdentifierInfo *Setter)
The "__interface" keyword.
bool isExternCContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
Expr * IgnoreImplicit() LLVM_READONLY
IgnoreImplicit - Skip past any implicit AST nodes which might surround this expression.
bool isInvalidDecl() const
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getODRHash() const
bool isInterfaceLike() const
bool hasDefinition() const
Represents a parameter to a function.
TemplateParameterList * getGenericLambdaTemplateParameterList() const
Retrieve the generic lambda's template parameter list.
Defines the clang::Expr interface and subclasses for C++ expressions.
SourceLocation getRParenLoc() const
VarDecl * getHoldingVar() const
Get the variable (if any) that holds the value of evaluating the binding.
CXXConstructorDecl * getTargetConstructor() const
When this constructor delegates to another, retrieve the target.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the kind of specialization or template instantiation this is.
Base wrapper for a particular "section" of type source info.
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
Represents a struct/union/class.
Description of a constructor that was inherited from a base class.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
One of these records is kept for each identifier that is lexed.
const Expr * getBestDynamicClassTypeExpr() const
Get the inner expression that determines the best dynamic class.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
The results of name lookup within a DeclContext.
field_range fields() const
static DecompositionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation LSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl *> Bindings)
Represents a member of a struct/union/class.
static CXXRecordDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
conversion_iterator conversion_end() const
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isCopyOrMoveConstructor() const
Determine whether this a copy or move constructor.
bool isReferenceType() const
The iterator over UnresolvedSets.
static UnresolvedUsingTypenameDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation TypenameLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TargetNameLoc, DeclarationName TargetName, SourceLocation EllipsisLoc)
bool hasUserDeclaredDestructor() const
Determine whether this class has a user-declared destructor.
static CXXDeductionGuideDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, bool IsExplicit, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation)
Represents an access specifier followed by colon ':'.
void addShadowDecl(UsingShadowDecl *S)
static StaticAssertDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static CXXRecordDecl * CreateLambda(const ASTContext &C, DeclContext *DC, TypeSourceInfo *Info, SourceLocation Loc, bool DependentLambda, bool IsGeneric, LambdaCaptureDefault CaptureDefault)
static NamespaceDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Represents a C++ using-declaration.
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
QualType getThisType(ASTContext &C) const
Returns the type of the this pointer.
void completeDefinition() override
Indicates that the definition of this class is now complete.
bool hasNonLiteralTypeFieldsOrBases() const
Determine whether this class has a non-literal or/ volatile type non-static data member or base class...
void addDecl(ASTContext &C, NamedDecl *D, AccessSpecifier AS)
TagKind getTagKind() const
AccessSpecifier getAccessSpecifier() const
Returns the access specifier for this base specifier.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
static UnresolvedUsingTypenameDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setHasObjectMember(bool val)
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
A set of unresolved declarations.
bool isRValueReferenceType() const
The argument of this type cannot be passed directly in registers.
Defines the Diagnostic-related interfaces.
bool isLambda() const
Determine whether this class describes a lambda function object.
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
field_iterator field_begin() const
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool isAnyMemberInitializer() const
base_class_iterator bases_begin()
FieldDecl * getAnyMember() const
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Namespace)
bool hasSimpleCopyConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous copy constructor that ...
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
Represents a linkage specification.
StringRef getLambdaStaticInvokerName()
A binding in a decomposition declaration.
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
init_iterator init_begin()
Retrieve an iterator to the first initializer.
CXXMethodDecl * getCorrespondingMethodInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find the method in RD that corresponds to this one.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
CXXRecordDecl(Kind K, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl)
bool isLambdaStaticInvoker() const
Determine whether this is a lambda closure type's static member function that is used for the result ...
static CXXDeductionGuideDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setBases(CXXBaseSpecifier const *const *Bases, unsigned NumBases)
Sets the base classes of this struct or class.
bool isTriviallyCopyable() const
Determine whether this class is considered trivially copyable per (C++11 [class]p6).
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
A little helper class used to produce diagnostics.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
method_iterator end_overridden_methods() const
DeclarationNameTable DeclarationNames
OverloadedOperatorKind getCXXOverloadedOperator() const
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e...
static StaticAssertDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *Message, SourceLocation RParenLoc, bool Failed)
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
static CXXDestructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isImplicitlyDeclared)
bool isCLike() const
True if this class is C-like, without C++-specific features, e.g.
static bool recursivelyOverrides(const CXXMethodDecl *DerivedMD, const CXXMethodDecl *BaseMD)
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
bool isObjCGCStrong() const
true when Type is objc's strong.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Expr - This represents one expression.
Defines the clang::LangOptions interface.
static LinkageSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
const T * castAs() const
Member-template castAs<specific type>.
void getFinalOverriders(CXXFinalOverriderMap &FinaOverriders) const
Retrieve the final overriders for each virtual member function in the class hierarchy where this clas...
bool isObjCRetainableType() const
static UnresolvedUsingValueDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, SourceLocation EllipsisLoc)
Represents a C++ destructor within a class.
bool isCopyConstructor() const
Whether this constructor is a copy constructor (C++ [class.copy]p2, which can be used to copy the cla...
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
const CXXRecordDecl * getTemplateInstantiationPattern() const
Retrieve the record declaration from which this record could be instantiated.
Defines an enumeration for C++ overloaded operators.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
field_iterator field_end() const
overridden_method_range overridden_methods() const
ObjCLifetime getObjCLifetime() const
DeclContext * getDeclContext()
CXXRecordDecl * getDefinition() const
bool hasAnyDependentBases() const
Determine whether this class has any dependent base classes which are not the current instantiation...
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Defines the clang::TypeLoc interface and its subclasses.
IdentifierInfo * getAsIdentifierInfo() const
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn't a simple identifier.
static CanQualType GetConversionType(ASTContext &Context, NamedDecl *Conv)
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
static NamespaceAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static CXXConstructorDecl * CreateDeserialized(ASTContext &C, unsigned ID, bool InheritsConstructor)
unsigned getCVRQualifiers() const
Retrieve the const/volatile/restrict qualifiers.
StorageClass
Storage classes.
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
DeclContext * getParent()
getParent - Returns the containing DeclContext.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization, retrieves the member specialization information.
An lvalue reference type, per C++11 [dcl.ref].
bool isLambdaToBlockPointerConversion() const
Determine whether this conversion function is a conversion from a lambda closure type to a block poin...
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
bool hasSimpleMoveConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous move constructor that ...
void setOperatorDelete(FunctionDecl *OD, Expr *ThisArg)
Represents a C++ deduction guide declaration.
void setDescribedClassTemplate(ClassTemplateDecl *Template)
Represents a C++ conversion function within a class.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
The result type of a method or function.
static UsingDirectiveDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
bool hasNonTrivialMoveAssignment() const
Determine whether this class has a non-trivial move assignment operator (C++11 [class.copy]p25)
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
bool hasNonTrivialMoveConstructor() const
Determine whether this class has a non-trivial move constructor (C++11 [class.copy]p12) ...
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so...
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
bool isConstQualified() const
Determine whether this type is const-qualified.
RecordDecl * getDecl() const
Abstract interface for external sources of AST nodes.
unsigned size_overridden_methods() const
Assigning into this object requires the old value to be released and the new value to be retained...
static UsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
SourceRange getSourceRange() const LLVM_READONLY
Determine the source range covering the entire initializer.
static CXXDestructorDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Encodes a location in the source.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
bool isPure() const
Whether this virtual function is pure, i.e.
void setTrivialForCallFlags(CXXMethodDecl *MD)
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
DeclarationName getName() const
getName - Returns the embedded declaration name.
ASTContext & getASTContext() const LLVM_READONLY
static DecompositionDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumBindings)
Represents a dependent using declaration which was not marked with typename.
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set...
void removeShadowDecl(UsingShadowDecl *S)
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
Represents a static or instance method of a struct/union/class.
void addOverriddenMethod(const CXXMethodDecl *MD)
bool isUsualDeallocationFunction() const
Determine whether this is a usual deallocation function (C++ [basic.stc.dynamic.deallocation]p2), which is an overloaded delete or delete[] operator with a particular signature.
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
bool isGenericLambda() const
Determine whether this class describes a generic lambda function object (i.e.
void addDecl(NamedDecl *D)
static MSPropertyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static ConstructorUsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static bool isDeclContextInNamespace(const DeclContext *DC)
bool forallBases(ForallBasesCallback BaseMatches, bool AllowShortCircuit=true) const
Determines if the given callback holds for all the direct or indirect base classes of this type...
static ConstructorUsingShadowDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, UsingDecl *Using, NamedDecl *Target, bool IsVirtual)
const CXXRecordDecl * getBestDynamicClassType() const
For an expression of class type or pointer to class type, return the most derived class decl the expr...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
SourceLocation getMemberLocation() const
Represents a C++11 static_assert declaration.
bool isTrivialForCall() const
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
NamedDecl * getDecl() const
TypeLoc getBaseClassLoc() const
If this is a base class initializer, returns the type of the base class with location information...
Defines various enumerations that describe declaration and type specifiers.
bool hasSimpleDestructor() const
true if we know for sure that this class has an accessible destructor that is not deleted...
TagTypeKind
The kind of a tag type.
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
static LinkageSpecDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation ExternLoc, SourceLocation LangLoc, LanguageIDs Lang, bool HasBraces)
Dataflow Directional Tag Classes.
static CXXConversionDecl * CreateDeserialized(ASTContext &C, unsigned ID)
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
void setHasVolatileMember(bool val)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
method_iterator begin_overridden_methods() const
bool isCXX98PODType(const ASTContext &Context) const
Return true if this is a POD type according to the rules of the C++98 standard, regardless of the cur...
Represents a field injected from an anonymous union/struct into the parent scope. ...
SourceLocation getSourceLocation() const
Determine the source location of the initializer.
AccessSpecifier getAccess() const
void removeConversion(const NamedDecl *Old)
Removes a conversion function from this class.
A decomposition declaration.
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
MapType::iterator iterator
bool hasInlineBody() const
bool hasUserDeclaredConstructor() const
Determine whether this class has any user-declared constructors.
Represents a dependent using declaration which was marked with typename.
conversion_iterator conversion_begin() const
void AddCXXRecordDecl(const CXXRecordDecl *Record)
static UsingDirectiveDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation NamespaceLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Nominated, DeclContext *CommonAncestor)
DeclarationName - The name of a declaration.
const CXXRecordDecl * getParent() const
Returns the parent of this method declaration, which is the class in which this method is defined...
bool isSpecializationCopyingObject() const
Determine whether this is a member template specialization that would copy the object to itself...
bool isAnyDestructorNoReturn() const
Returns true if the class destructor, or any implicitly invoked destructors are marked noreturn...
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
U cast(CodeGen::Address addr)
A mapping from each virtual member function to its set of final overriders.
UsingShadowDecl(Kind K, ASTContext &C, DeclContext *DC, SourceLocation Loc, UsingDecl *Using, NamedDecl *Target)
A pointer to member type per C++ 8.3.3 - Pointers to members.
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext, providing only those that are of type SpecificDecl (or a class derived from it).
bool hasNonTrivialCopyAssignment() const
Determine whether this class has a non-trivial copy assignment operator (C++ [class.copy]p11, C++11 [class.copy]p25)
bool isMoveConstructor() const
Determine whether this constructor is a move constructor (C++11 [class.copy]p3), which can be used to...
UsingDecl * getUsingDecl() const
Gets the using declaration to which this declaration is tied.
static AccessSpecifier MergeAccess(AccessSpecifier PathAccess, AccessSpecifier DeclAccess)
Calculates the access of a decl that is reached along a path.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
CXXMethodDecl * getDevirtualizedMethod(const Expr *Base, bool IsAppleKext)
If it's possible to devirtualize a call to this method, return the called function.
LanguageIDs
Represents the language in a linkage specification.
bool hasNonTrivialObjCLifetime() const
An UnresolvedSet-like class which uses the ASTContext's allocator.
static CXXMethodDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Base for LValueReferenceType and RValueReferenceType.
static CXXMethodDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInline, bool isConstexpr, SourceLocation EndLocation)
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
Represents a base class of a C++ class.
void getCaptureFields(llvm::DenseMap< const VarDecl *, FieldDecl *> &Captures, FieldDecl *&ThisCapture) const
For a closure type, retrieve the mapping from captured variables and this to the non-static data memb...
CXXMethodDecl * getLambdaStaticInvoker() const
Retrieve the lambda static invoker, the address of which is returned by the conversion operator...
static BindingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id)
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
Reading or writing from this object requires a barrier call.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
void Deallocate(void *Ptr) const
Defines the clang::SourceLocation class and associated facilities.
Represents a C++ struct/union/class.
bool hasSimpleMoveAssignment() const
true if we know for sure that this class has a single, accessible, unambiguous move assignment operat...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Provides information a specialization of a member of a class template, which may be a member function...
void printName(raw_ostream &os) const override
base_class_iterator bases_end()
static UsingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
Declaration of a class template.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
StringLiteral - This represents a string literal expression, e.g.
ASTContext & getParentASTContext() const
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Kind
Lists the kind of concrete classes of Decl.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
static UsingPackDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumExpansions)
bool isConvertingConstructor(bool AllowExplicit) const
Whether this constructor is a converting constructor (C++ [class.conv.ctor]), which can be used for u...
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
A reference to a declared variable, function, enum, etc.
bool isDeleted() const
Whether this function has been deleted.
ASTContext::overridden_method_range overridden_method_range
An instance of this class represents the declaration of a property member.
A trivial tuple used to represent a source range.
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
This represents a decl that may have a name.
bool isTranslationUnit() const
Represents a C++ namespace alias.
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
static UsingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static void CollectVisibleConversions(ASTContext &Context, CXXRecordDecl *Record, bool InVirtual, AccessSpecifier Access, const llvm::SmallPtrSet< CanQualType, 8 > &ParentHiddenTypes, ASTUnresolvedSet &Output, UnresolvedSetImpl &VOutput, llvm::SmallPtrSet< NamedDecl *, 8 > &HiddenVBaseCs)
Collect the visible conversions of a base class.
Represents C++ using-directive.
static BindingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static CXXConstructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isExplicit, bool isInline, bool isImplicitlyDeclared, bool isConstexpr, InheritedConstructor Inherited=InheritedConstructor())
const LangOptions & getLangOpts() const
Declaration of a template function.
void setTargetDecl(NamedDecl *ND)
Sets the underlying declaration which has been brought into the local scope.
SourceLocation getLocation() const
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Represents a pack of using declarations that a single using-declarator pack-expanded into...
bool isBeingDefined() const
Return true if this decl is currently being defined.
Defines the LambdaCapture class.
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
method_range methods() const
QualType getType() const
Retrieves the type of the base class.