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,
131 R->setMayHaveOutOfDateDef(C.
getLangOpts().Modules);
134 if (!DelayTypeCreation)
142 bool Dependent,
bool IsGeneric,
146 R->setBeingDefined(
true);
148 new (
C)
struct LambdaDefinitionData(R, Info, Dependent, IsGeneric,
150 R->setMayHaveOutOfDateDef(
false);
151 R->setImplicit(
true);
161 R->setMayHaveOutOfDateDef(
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())
632 assert(
isLambda() &&
"not a lambda");
649 void CXXRecordDecl::addedMember(
Decl *D) {
651 !isa<FieldDecl>(D) &&
652 !isa<IndirectFieldDecl>(D) &&
653 (!isa<TagDecl>(D) || cast<TagDecl>(D)->getTagKind() ==
TTK_Class ||
655 data().HasOnlyCMembers =
false;
663 D = FunTmpl->getTemplatedDecl();
666 Decl *DUnderlying = D;
667 if (
auto *ND = dyn_cast<NamedDecl>(DUnderlying)) {
668 DUnderlying = ND->getUnderlyingDecl();
669 if (
auto *UnderlyingFunTmpl = dyn_cast<FunctionTemplateDecl>(DUnderlying))
670 DUnderlying = UnderlyingFunTmpl->getTemplatedDecl();
673 if (
const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
674 if (Method->isVirtual()) {
677 data().Aggregate =
false;
681 data().PlainOldData =
false;
685 data().Empty =
false;
690 data().Polymorphic =
true;
696 data().HasTrivialSpecialMembers &= SMF_Destructor;
697 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
702 data().IsStandardLayout =
false;
703 data().IsCXX11StandardLayout =
false;
711 L->AddedCXXImplicitMember(data().Definition, D);
717 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
718 if (!Constructor->isImplicit()) {
720 data().UserDeclaredConstructor =
true;
726 data().PlainOldData =
false;
729 if (Constructor->isDefaultConstructor()) {
730 SMKind |= SMF_DefaultConstructor;
732 if (Constructor->isUserProvided())
733 data().UserProvidedDefaultConstructor =
true;
734 if (Constructor->isConstexpr())
735 data().HasConstexprDefaultConstructor =
true;
736 if (Constructor->isDefaulted())
737 data().HasDefaultedDefaultConstructor =
true;
742 if (Constructor->isCopyConstructor(Quals)) {
743 SMKind |= SMF_CopyConstructor;
746 data().HasDeclaredCopyConstructorWithConstParam =
true;
747 }
else if (Constructor->isMoveConstructor())
748 SMKind |= SMF_MoveConstructor;
758 ? !Constructor->isImplicit()
759 : (Constructor->isUserProvided() || Constructor->isExplicit()))
760 data().Aggregate =
false;
764 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(DUnderlying)) {
771 if (Constructor->isConstexpr() && !Constructor->isCopyOrMoveConstructor())
772 data().HasConstexprNonCopyMoveConstructor =
true;
776 if (
const auto *DD = dyn_cast<CXXDestructorDecl>(D)) {
777 SMKind |= SMF_Destructor;
779 if (DD->isUserProvided())
780 data().HasIrrelevantDestructor =
false;
787 if (DD->isVirtual()) {
788 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
789 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
794 if (
const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
795 if (Method->isCopyAssignmentOperator()) {
796 SMKind |= SMF_CopyAssignment;
798 const auto *ParamTy =
800 if (!ParamTy || ParamTy->getPointeeType().isConstQualified())
801 data().HasDeclaredCopyAssignmentWithConstParam =
true;
804 if (Method->isMoveAssignmentOperator())
805 SMKind |= SMF_MoveAssignment;
808 if (
auto *Conversion = dyn_cast<CXXConversionDecl>(D)) {
817 if (Conversion->getPrimaryTemplate()) {
823 FunTmpl ? cast<NamedDecl>(FunTmpl) : cast<NamedDecl>(Conversion);
828 Conversions.
addDecl(Ctx, Primary, AS);
835 data().HasTrivialSpecialMembers &=
836 data().DeclaredSpecialMembers | ~SMKind;
837 data().HasTrivialSpecialMembersForCall &=
838 data().DeclaredSpecialMembers | ~SMKind;
840 if (!Method->isImplicit() && !Method->isUserProvided()) {
844 }
else if (Method->isTrivial()) {
845 data().HasTrivialSpecialMembers |= SMKind;
846 data().HasTrivialSpecialMembersForCall |= SMKind;
847 }
else if (Method->isTrivialForCall()) {
848 data().HasTrivialSpecialMembersForCall |= SMKind;
849 data().DeclaredNonTrivialSpecialMembers |= SMKind;
851 data().DeclaredNonTrivialSpecialMembers |= SMKind;
857 if (!Method->isUserProvided())
858 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
863 data().DeclaredSpecialMembers |= SMKind;
865 if (!Method->isImplicit()) {
866 data().UserDeclaredSpecialMembers |= SMKind;
879 data().PlainOldData =
false;
887 if (
const auto *Field = dyn_cast<FieldDecl>(D)) {
895 if (data().HasBasesWithFields)
896 data().IsStandardLayout =
false;
902 if (Field->isUnnamedBitfield()) {
906 if (data().Empty && !Field->isZeroLengthBitField(Context) &&
909 data().Empty =
false;
917 if (data().HasBasesWithNonStaticDataMembers)
918 data().IsCXX11StandardLayout =
false;
926 data().Aggregate =
false;
927 data().PlainOldData =
false;
932 bool IsFirstField = !data().HasPrivateFields &&
933 !data().HasProtectedFields && !data().HasPublicFields;
940 case AS_private: data().HasPrivateFields =
true;
break;
941 case AS_protected: data().HasProtectedFields =
true;
break;
942 case AS_public: data().HasPublicFields =
true;
break;
943 case AS_none: llvm_unreachable(
"Invalid access specifier");
945 if ((data().HasPrivateFields + data().HasProtectedFields +
946 data().HasPublicFields) > 1) {
947 data().IsStandardLayout =
false;
948 data().IsCXX11StandardLayout =
false;
952 if (Field->isMutable()) {
953 data().HasMutableFields =
true;
954 data().NeedOverloadResolutionForCopyConstructor =
true;
960 if (
isUnion() && !Field->isAnonymousStructOrUnion())
961 data().HasVariantMembers =
true;
980 struct DefinitionData &Data = data();
981 Data.PlainOldData =
false;
982 Data.HasTrivialSpecialMembers = 0;
988 data().HasTrivialSpecialMembersForCall = 0;
994 Data.HasIrrelevantDestructor =
false;
995 }
else if (!Context.
getLangOpts().ObjCAutoRefCount) {
999 data().PlainOldData =
false;
1002 if (!Field->hasInClassInitializer())
1003 data().HasUninitializedReferenceMember =
true;
1008 data().IsStandardLayout =
false;
1009 data().IsCXX11StandardLayout =
false;
1015 data().DefaultedCopyConstructorIsDeleted =
true;
1018 if (!Field->hasInClassInitializer() && !Field->isMutable()) {
1020 if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
1021 data().HasUninitializedFields =
true;
1023 data().HasUninitializedFields =
true;
1029 data().HasNonLiteralTypeFieldsOrBases =
true;
1031 if (Field->hasInClassInitializer() ||
1032 (Field->isAnonymousStructOrUnion() &&
1033 Field->getType()->getAsCXXRecordDecl()->hasInClassInitializer())) {
1034 data().HasInClassInitializer =
true;
1039 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1047 data().Aggregate =
false;
1051 data().PlainOldData =
false;
1059 data().DefaultedMoveAssignmentIsDeleted =
true;
1062 auto *FieldRec = cast<CXXRecordDecl>(RecordTy->getDecl());
1063 if (FieldRec->getDefinition()) {
1064 addedClassSubobject(FieldRec);
1072 data().NeedOverloadResolutionForCopyConstructor =
true;
1073 data().NeedOverloadResolutionForMoveConstructor =
true;
1074 data().NeedOverloadResolutionForMoveAssignment =
true;
1083 if (FieldRec->hasNonTrivialCopyConstructor())
1084 data().DefaultedCopyConstructorIsDeleted =
true;
1085 if (FieldRec->hasNonTrivialMoveConstructor())
1086 data().DefaultedMoveConstructorIsDeleted =
true;
1087 if (FieldRec->hasNonTrivialMoveAssignment())
1088 data().DefaultedMoveAssignmentIsDeleted =
true;
1089 if (FieldRec->hasNonTrivialDestructor())
1090 data().DefaultedDestructorIsDeleted =
true;
1095 if (Field->isAnonymousStructOrUnion()) {
1096 data().NeedOverloadResolutionForCopyConstructor |=
1097 FieldRec->data().NeedOverloadResolutionForCopyConstructor;
1098 data().NeedOverloadResolutionForMoveConstructor |=
1099 FieldRec->data().NeedOverloadResolutionForMoveConstructor;
1100 data().NeedOverloadResolutionForMoveAssignment |=
1101 FieldRec->data().NeedOverloadResolutionForMoveAssignment;
1102 data().NeedOverloadResolutionForDestructor |=
1103 FieldRec->data().NeedOverloadResolutionForDestructor;
1111 if (!FieldRec->hasTrivialDefaultConstructor())
1112 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1120 if (!FieldRec->hasTrivialCopyConstructor())
1121 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
1123 if (!FieldRec->hasTrivialCopyConstructorForCall())
1124 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
1129 if (!FieldRec->hasTrivialMoveConstructor())
1130 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
1132 if (!FieldRec->hasTrivialMoveConstructorForCall())
1133 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
1141 if (!FieldRec->hasTrivialCopyAssignment())
1142 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
1146 if (!FieldRec->hasTrivialMoveAssignment())
1147 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
1149 if (!FieldRec->hasTrivialDestructor())
1150 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1151 if (!FieldRec->hasTrivialDestructorForCall())
1152 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1153 if (!FieldRec->hasIrrelevantDestructor())
1154 data().HasIrrelevantDestructor =
false;
1155 if (FieldRec->hasObjectMember())
1157 if (FieldRec->hasVolatileMember())
1159 if (FieldRec->getArgPassingRestrictions() ==
1167 if (!FieldRec->isStandardLayout())
1168 data().IsStandardLayout =
false;
1169 if (!FieldRec->isCXX11StandardLayout())
1170 data().IsCXX11StandardLayout =
false;
1176 if (data().IsStandardLayout && (
isUnion() || IsFirstField) &&
1177 hasSubobjectAtOffsetZeroOfEmptyBaseType(Context, FieldRec))
1178 data().IsStandardLayout =
false;
1184 if (data().IsCXX11StandardLayout && IsFirstField) {
1187 for (
const auto &BI :
bases()) {
1189 data().IsCXX11StandardLayout =
false;
1196 if (FieldRec->hasMutableFields()) {
1197 data().HasMutableFields =
true;
1198 data().NeedOverloadResolutionForCopyConstructor =
true;
1208 if (!Field->hasInClassInitializer() &&
1209 !FieldRec->hasConstexprDefaultConstructor() && !
isUnion())
1212 data().DefaultedDefaultConstructorIsConstexpr =
false;
1219 if (!FieldRec->hasCopyConstructorWithConstParam())
1220 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
1228 if (!FieldRec->hasCopyAssignmentWithConstParam())
1229 data().ImplicitCopyAssignmentHasConstParam =
false;
1231 if (FieldRec->hasUninitializedReferenceMember() &&
1232 !Field->hasInClassInitializer())
1233 data().HasUninitializedReferenceMember =
true;
1238 if (FieldRec->hasVariantMembers() &&
1239 Field->isAnonymousStructOrUnion())
1240 data().HasVariantMembers =
true;
1245 (!Field->hasInClassInitializer() && !
isUnion()))
1246 data().DefaultedDefaultConstructorIsConstexpr =
false;
1254 data().DefaultedMoveAssignmentIsDeleted =
true;
1259 data().Empty =
false;
1263 if (
auto *Shadow = dyn_cast<UsingShadowDecl>(D)) {
1264 if (Shadow->getDeclName().getNameKind()
1267 data().Conversions.get(Ctx).addDecl(Ctx, Shadow, Shadow->getAccess());
1271 if (
const auto *Using = dyn_cast<UsingDecl>(D)) {
1272 if (Using->getDeclName().getNameKind() ==
1274 data().HasInheritedConstructor =
true;
1277 data().Aggregate =
false;
1280 if (Using->getDeclName().getCXXOverloadedOperator() == OO_Equal)
1281 data().HasInheritedAssignment =
true;
1289 unsigned SMKind = 0;
1291 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1292 if (Constructor->isDefaultConstructor()) {
1293 SMKind |= SMF_DefaultConstructor;
1294 if (Constructor->isConstexpr())
1295 data().HasConstexprDefaultConstructor =
true;
1297 if (Constructor->isCopyConstructor())
1298 SMKind |= SMF_CopyConstructor;
1299 else if (Constructor->isMoveConstructor())
1300 SMKind |= SMF_MoveConstructor;
1301 else if (Constructor->isConstexpr())
1303 data().HasConstexprNonCopyMoveConstructor =
true;
1304 }
else if (isa<CXXDestructorDecl>(D)) {
1305 SMKind |= SMF_Destructor;
1307 data().HasIrrelevantDestructor =
false;
1309 SMKind |= SMF_CopyAssignment;
1311 SMKind |= SMF_MoveAssignment;
1316 data().HasTrivialSpecialMembers |= SMKind;
1318 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1322 unsigned SMKind = 0;
1324 if (
const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1325 if (Constructor->isCopyConstructor())
1326 SMKind = SMF_CopyConstructor;
1327 else if (Constructor->isMoveConstructor())
1328 SMKind = SMF_MoveConstructor;
1329 }
else if (isa<CXXDestructorDecl>(D))
1330 SMKind = SMF_Destructor;
1333 data().HasTrivialSpecialMembersForCall |= SMKind;
1335 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1340 !TemplateOrInstantiation.isNull())
1345 return isPOD() && data().HasOnlyCMembers;
1350 return getLambdaData().IsGenericLambda;
1368 assert(!Calls.
empty() &&
"Missing lambda call operator!");
1370 "More than one lambda call operator!");
1373 if (
const auto *CallOpTmpl = dyn_cast<FunctionTemplateDecl>(CallOp))
1374 return cast<CXXMethodDecl>(CallOpTmpl->getTemplatedDecl());
1376 return cast<CXXMethodDecl>(CallOp);
1384 if (Invoker.
empty())
return nullptr;
1386 "More than one static invoker operator!");
1388 if (
const auto *InvokerTemplate = dyn_cast<FunctionTemplateDecl>(InvokerFun))
1389 return cast<CXXMethodDecl>(InvokerTemplate->getTemplatedDecl());
1391 return cast<CXXMethodDecl>(InvokerFun);
1395 llvm::DenseMap<const VarDecl *, FieldDecl *> &Captures,
1398 ThisCapture =
nullptr;
1400 LambdaDefinitionData &Lambda = getLambdaData();
1402 for (
const LambdaCapture *C = Lambda.Captures, *CEnd = C + Lambda.NumCaptures;
1403 C != CEnd; ++C, ++Field) {
1404 if (C->capturesThis())
1405 ThisCapture = *Field;
1406 else if (C->capturesVariable())
1407 Captures[C->getCapturedVar()] = *Field;
1417 return Tmpl->getTemplateParameters();
1422 assert(
isLambda() &&
"Not a lambda closure type!");
1424 return getLambdaData().ContextDecl.get(Source);
1430 ->getConversionType();
1450 const llvm::SmallPtrSet<CanQualType, 8> &ParentHiddenTypes,
1453 llvm::SmallPtrSet<NamedDecl*, 8> &HiddenVBaseCs) {
1457 const llvm::SmallPtrSet<CanQualType, 8> *HiddenTypes = &ParentHiddenTypes;
1458 llvm::SmallPtrSet<CanQualType, 8> HiddenTypesBuffer;
1464 if (ConvI != ConvE) {
1465 HiddenTypesBuffer = ParentHiddenTypes;
1466 HiddenTypes = &HiddenTypesBuffer;
1470 bool Hidden = ParentHiddenTypes.count(ConvType);
1472 HiddenTypesBuffer.insert(ConvType);
1476 if (Hidden && InVirtual)
1477 HiddenVBaseCs.insert(cast<NamedDecl>(I.getDecl()->getCanonicalDecl()));
1485 VOutput.
addDecl(I.getDecl(), IAccess);
1487 Output.
addDecl(Context, I.getDecl(), IAccess);
1493 for (
const auto &I : Record->
bases()) {
1499 bool BaseInVirtual = InVirtual || I.isVirtual();
1503 *HiddenTypes, Output, VOutput, HiddenVBaseCs);
1521 llvm::SmallPtrSet<NamedDecl*, 8> HiddenVBaseCs;
1524 llvm::SmallPtrSet<CanQualType, 8> HiddenTypes;
1530 Output.
append(Context, ConvI, ConvE);
1531 for (; ConvI != ConvE; ++ConvI)
1535 for (
const auto &I : Record->
bases()) {
1540 I.isVirtual(), I.getAccessSpecifier(),
1541 HiddenTypes, Output, VBaseCs, HiddenVBaseCs);
1547 if (!HiddenVBaseCs.count(cast<NamedDecl>(I.getDecl()->getCanonicalDecl())))
1548 Output.
addDecl(Context, I.getDecl(), I.getAccess());
1554 llvm::iterator_range<CXXRecordDecl::conversion_iterator>
1561 Set = &data().Conversions.get(Ctx);
1563 Set = &data().VisibleConversions.get(Ctx);
1565 if (!data().ComputedVisibleConversions) {
1567 data().ComputedVisibleConversions =
true;
1570 return llvm::make_range(Set->
begin(), Set->
end());
1586 for (
unsigned I = 0, E = Convs.
size(); I != E; ++I) {
1587 if (Convs[I].getDecl() == ConvDecl) {
1589 assert(std::find(Convs.
begin(), Convs.
end(), ConvDecl) == Convs.
end()
1590 &&
"conversion was found multiple times in unresolved set");
1595 llvm_unreachable(
"conversion not found in set!");
1600 return cast<CXXRecordDecl>(MSInfo->getInstantiatedFrom());
1612 assert(TemplateOrInstantiation.isNull() &&
1613 "Previous template or instantiation?");
1614 assert(!isa<ClassTemplatePartialSpecializationDecl>(
this));
1615 TemplateOrInstantiation
1624 TemplateOrInstantiation = Template;
1628 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this))
1629 return Spec->getSpecializationKind();
1632 return MSInfo->getTemplateSpecializationKind();
1639 if (
auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1640 Spec->setSpecializationKind(TSK);
1645 MSInfo->setTemplateSpecializationKind(TSK);
1649 llvm_unreachable(
"Not a class template or member class specialization");
1653 auto GetDefinitionOrSelf =
1655 if (
auto *Def = D->getDefinition())
1662 if (
auto *TD = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1663 auto From = TD->getInstantiatedFrom();
1665 while (
auto *NewCTD = CTD->getInstantiatedFromMemberTemplate()) {
1666 if (NewCTD->isMemberSpecialization())
1670 return GetDefinitionOrSelf(CTD->getTemplatedDecl());
1674 while (
auto *NewCTPSD = CTPSD->getInstantiatedFromMember()) {
1675 if (NewCTPSD->isMemberSpecialization())
1679 return GetDefinitionOrSelf(CTPSD);
1688 return GetDefinitionOrSelf(RD);
1693 "couldn't find pattern for class template instantiation");
1713 if (Destructor->isNoReturn())
1719 if (RD->isAnyDestructorNoReturn())
1723 for (
const auto *Field :
fields())
1725 Field->getType()->getBaseElementTypeUnsafe()->getAsCXXRecordDecl())
1726 if (RD->isAnyDestructorNoReturn())
1743 assert(
hasDefinition() &&
"checking for interface-like without a definition");
1757 for (
const auto *
const Method :
methods())
1758 if (Method->isDefined() && !Method->isImplicit())
1762 const auto *Uuid = getAttr<UuidAttr>();
1769 Uuid->getGuid() ==
"00000000-0000-0000-C000-000000000046") ||
1771 Uuid->getGuid() ==
"00020400-0000-0000-C000-000000000046"))) {
1785 if (BaseSpec.isVirtual() || BaseSpec.getAccessSpecifier() !=
AS_public)
1787 const auto *
Base = BaseSpec.getType()->getAsCXXRecordDecl();
1788 if (
Base->isInterface() || !
Base->isInterfaceLike())
1804 if (!FinalOverriders) {
1806 FinalOverriders = &MyFinalOverriders;
1810 for (CXXFinalOverriderMap::iterator M = FinalOverriders->begin(),
1811 MEnd = FinalOverriders->end();
1812 M != MEnd && !Done; ++M) {
1814 SOEnd = M->second.end();
1815 SO != SOEnd && !Done; ++SO) {
1816 assert(SO->second.size() > 0 &&
1817 "All virtual functions have overriding virtual functions");
1823 if (SO->second.front().Method->isPure()) {
1824 data().Abstract =
true;
1835 I.setAccess((*I)->getAccess());
1839 if (data().Abstract ||
isInvalidDecl() || !data().Polymorphic ||
1843 for (
const auto &B :
bases()) {
1844 const auto *BaseDecl =
1845 cast<CXXRecordDecl>(B.getType()->getAs<
RecordType>()->getDecl());
1846 if (BaseDecl->isAbstract())
1853 void CXXDeductionGuideDecl::anchor() {}
1860 NameInfo, T, TInfo, EndLocation);
1870 void CXXMethodDecl::anchor() {}
1879 return isStaticOverloadedOperator(OOK);
1900 if (isa<CXXDestructorDecl>(
this)) {
1921 for (
const auto &I : RD->
bases()) {
1925 const auto *
Base = cast<CXXRecordDecl>(RT->
getDecl());
1941 return new (
C, RD)
CXXMethodDecl(CXXMethod, C, RD, StartLoc, NameInfo,
1942 T, TInfo, SC, isInline, isConstexpr,
1954 assert(isVirtual() &&
"this method is expected to be virtual");
1963 if (hasAttr<FinalAttr>())
1964 return isPure() ? nullptr :
this;
1978 if (!BestDynamicDecl)
1983 getCorrespondingMethodInClass(BestDynamicDecl);
1988 if (DevirtualizedMethod->
isPure())
1992 if (DevirtualizedMethod->
hasAttr<FinalAttr>())
1993 return DevirtualizedMethod;
1997 if (BestDynamicDecl->
hasAttr<FinalAttr>())
1998 return DevirtualizedMethod;
2000 if (
const auto *DRE = dyn_cast<DeclRefExpr>(Base)) {
2001 if (
const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
2002 if (VD->getType()->isRecordType())
2004 return DevirtualizedMethod;
2012 if (
const auto *ME = dyn_cast<MemberExpr>(Base)) {
2013 const ValueDecl *VD = ME->getMemberDecl();
2019 if (
auto *BO = dyn_cast<BinaryOperator>(Base)) {
2020 if (BO->isPtrMemOp()) {
2022 if (MPT->getPointeeType()->isRecordType())
2023 return DevirtualizedMethod;
2033 assert(PreventedBy.empty() &&
"PreventedBy is expected to be empty");
2034 if (getOverloadedOperator() != OO_Delete &&
2035 getOverloadedOperator() != OO_Array_Delete)
2041 if (getPrimaryTemplate())
2048 if (getNumParams() == 1)
2050 unsigned UsualParams = 1;
2057 if (isDestroyingOperatorDelete())
2071 if (UsualParams < getNumParams() &&
2076 if (UsualParams < getNumParams() &&
2077 getParamDecl(UsualParams)->getType()->isAlignValT())
2080 if (UsualParams != getNumParams())
2092 for (
const auto *D : R) {
2093 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
2094 if (FD->getNumParams() == 1) {
2095 PreventedBy.push_back(FD);
2108 if (getOverloadedOperator() != OO_Equal ||
2110 getPrimaryTemplate() || getDescribedFunctionTemplate() ||
2111 getNumParams() != 1)
2114 QualType ParamType = getParamDecl(0)->getType();
2129 if (getOverloadedOperator() != OO_Equal || isStatic() ||
2130 getPrimaryTemplate() || getDescribedFunctionTemplate() ||
2131 getNumParams() != 1)
2134 QualType ParamType = getParamDecl(0)->getType();
2135 if (!isa<RValueReferenceType>(ParamType))
2148 "Can't add an overridden method to a class template!");
2149 assert(MD->
isVirtual() &&
"Method is not virtual!");
2155 if (isa<CXXConstructorDecl>(
this))
return nullptr;
2160 if (isa<CXXConstructorDecl>(
this))
return nullptr;
2165 if (isa<CXXConstructorDecl>(
this))
return 0;
2171 if (isa<CXXConstructorDecl>(
this))
2190 assert(isInstance() &&
"No 'this' for static methods!");
2212 if (StaticInvoker ==
this)
return true;
2214 return StaticInvoker == this->getPrimaryTemplate()->getTemplatedDecl();
2225 : Initializee(TInfo), MemberOrEllipsisLocation(EllipsisLoc), Init(Init),
2226 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(IsVirtual),
2227 IsWritten(
false), SourceOrder(0) {}
2234 : Initializee(Member), MemberOrEllipsisLocation(MemberLoc), Init(Init),
2235 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2236 IsWritten(
false), SourceOrder(0) {}
2243 : Initializee(Member), MemberOrEllipsisLocation(MemberLoc), Init(Init),
2244 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
2245 IsWritten(
false), SourceOrder(0) {}
2251 : Initializee(TInfo), Init(Init), LParenLoc(L), RParenLoc(R),
2252 IsDelegating(
true), IsVirtual(
false), IsWritten(
false), SourceOrder(0) {}
2268 return Initializee.get<
TypeSourceInfo*>()->getType().getTypePtr();
2281 return TSInfo->getTypeLoc().getLocalSourceRange().getBegin();
2290 return I->getSourceRange();
2297 CXXConstructorDecl::CXXConstructorDecl(
2300 bool isExplicitSpecified,
bool isInline,
bool isImplicitlyDeclared,
2302 :
CXXMethodDecl(CXXConstructor, C, RD, StartLoc, NameInfo, T, TInfo,
2304 setNumCtorInitializers(0);
2305 setInheritingConstructor(static_cast<bool>(Inherited));
2306 setImplicit(isImplicitlyDeclared);
2308 *getTrailingObjects<InheritedConstructor>() = Inherited;
2309 setExplicitSpecified(isExplicitSpecified);
2312 void CXXConstructorDecl::anchor() {}
2317 unsigned Extra = additionalSizeToAlloc<InheritedConstructor>(Inherited);
2330 bool isExplicit,
bool isInline,
2331 bool isImplicitlyDeclared,
bool isConstexpr,
2335 "Name must refer to a constructor");
2337 additionalSizeToAlloc<InheritedConstructor>(Inherited ? 1 : 0);
2339 C, RD, StartLoc, NameInfo, T, TInfo, isExplicit, isInline,
2340 isImplicitlyDeclared, isConstexpr, Inherited);
2344 return CtorInitializers.get(getASTContext().getExternalSource());
2348 assert(isDelegatingConstructor() &&
"Not a delegating constructor!");
2350 if (
const auto *Construct = dyn_cast<CXXConstructExpr>(E))
2351 return Construct->getConstructor();
2360 return (getNumParams() == 0) ||
2361 (getNumParams() > 0 && getParamDecl(0)->hasDefaultArg());
2366 return isCopyOrMoveConstructor(TypeQuals) &&
2367 getParamDecl(0)->getType()->isLValueReferenceType();
2371 return isCopyOrMoveConstructor(TypeQuals) &&
2372 getParamDecl(0)->getType()->isRValueReferenceType();
2387 if ((getNumParams() < 1) ||
2388 (getNumParams() > 1 && !getParamDecl(1)->hasDefaultArg()) ||
2389 (getPrimaryTemplate() !=
nullptr) ||
2390 (getDescribedFunctionTemplate() !=
nullptr))
2424 if (isExplicit() && !AllowExplicit)
2427 return (getNumParams() == 0 &&
2428 getType()->getAs<FunctionProtoType>()->isVariadic()) ||
2429 (getNumParams() == 1) ||
2430 (getNumParams() > 1 &&
2431 (getParamDecl(1)->hasDefaultArg() ||
2432 getParamDecl(1)->isParameterPack()));
2436 if ((getNumParams() < 1) ||
2437 (getNumParams() > 1 && !getParamDecl(1)->hasDefaultArg()) ||
2438 (getDescribedFunctionTemplate() !=
nullptr))
2455 void CXXDestructorDecl::anchor() {}
2461 QualType(),
nullptr,
false,
false);
2469 bool isInline,
bool isImplicitlyDeclared) {
2472 "Name must refer to a destructor");
2474 isInline, isImplicitlyDeclared);
2478 auto *
First = cast<CXXDestructorDecl>(getFirstDecl());
2479 if (OD && !
First->OperatorDelete) {
2480 First->OperatorDelete = OD;
2481 First->OperatorDeleteThisArg = ThisArg;
2482 if (
auto *L = getASTMutationListener())
2483 L->ResolvedOperatorDelete(
First, OD, ThisArg);
2487 void CXXConversionDecl::anchor() {}
2493 nullptr,
false,
false,
false,
2502 bool isInline,
bool isExplicit,
2506 "Name must refer to a conversion function");
2508 isInline, isExplicit, isConstexpr,
2513 return isImplicit() && getParent()->isLambda() &&
2514 getConversionType()->isBlockPointerType();
2523 LinkageSpecDeclBits.HasBraces = HasBraces;
2526 void LinkageSpecDecl::anchor() {}
2534 return new (
C, DC)
LinkageSpecDecl(DC, ExternLoc, LangLoc, Lang, HasBraces);
2543 void UsingDirectiveDecl::anchor() {}
2552 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(Used))
2553 Used = NS->getOriginalNamespace();
2555 IdentLoc, Used, CommonAncestor);
2567 if (
auto *NA = dyn_cast_or_null<NamespaceAliasDecl>(NominatedNamespace))
2568 return NA->getNamespace();
2569 return cast_or_null<NamespaceDecl>(NominatedNamespace);
2576 redeclarable_base(C), LocStart(StartLoc),
2577 AnonOrFirstNamespaceAndInline(
nullptr, Inline) {
2578 setPreviousDecl(PrevDecl);
2588 return new (
C, DC)
NamespaceDecl(C, DC, Inline, StartLoc, IdLoc, Id,
2601 return AnonOrFirstNamespaceAndInline.getPointer();
2608 return AnonOrFirstNamespaceAndInline.getPointer();
2614 return getNextRedeclaration();
2618 return getPreviousDecl();
2622 return getMostRecentDecl();
2625 void NamespaceAliasDecl::anchor() {}
2628 return getNextRedeclaration();
2632 return getPreviousDecl();
2636 return getMostRecentDecl();
2647 if (
auto *NS = dyn_cast_or_null<NamespaceDecl>(Namespace))
2648 Namespace = NS->getOriginalNamespace();
2650 QualifierLoc, IdentLoc, Namespace);
2661 void UsingShadowDecl::anchor() {}
2684 while (
const auto *NextShadow =
2685 dyn_cast<UsingShadowDecl>(Shadow->UsingOrNextShadow))
2686 Shadow = NextShadow;
2687 return cast<UsingDecl>(Shadow->UsingOrNextShadow);
2690 void ConstructorUsingShadowDecl::anchor() {}
2709 void UsingDecl::anchor() {}
2712 assert(std::find(shadow_begin(), shadow_end(), S) == shadow_end() &&
2713 "declaration already in set");
2716 if (FirstUsingShadow.getPointer())
2717 S->UsingOrNextShadow = FirstUsingShadow.getPointer();
2718 FirstUsingShadow.setPointer(S);
2722 assert(std::find(shadow_begin(), shadow_end(), S) != shadow_end() &&
2723 "declaration not in set");
2728 if (FirstUsingShadow.getPointer() == S) {
2729 FirstUsingShadow.setPointer(
2730 dyn_cast<UsingShadowDecl>(S->UsingOrNextShadow));
2731 S->UsingOrNextShadow =
this;
2736 while (Prev->UsingOrNextShadow != S)
2737 Prev = cast<UsingShadowDecl>(Prev->UsingOrNextShadow);
2738 Prev->UsingOrNextShadow = S->UsingOrNextShadow;
2739 S->UsingOrNextShadow =
this;
2746 return new (
C, DC)
UsingDecl(DC, UL, QualifierLoc, NameInfo, HasTypename);
2757 ? getQualifierLoc().getBeginLoc() : UsingLocation;
2761 void UsingPackDecl::anchor() {}
2766 size_t Extra = additionalSizeToAlloc<NamedDecl *>(UsingDecls.size());
2767 return new (
C, DC, Extra)
UsingPackDecl(DC, InstantiatedFrom, UsingDecls);
2771 unsigned NumExpansions) {
2772 size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
2774 Result->NumExpansions = NumExpansions;
2775 auto *Trail = Result->getTrailingObjects<
NamedDecl *>();
2776 for (
unsigned I = 0; I != NumExpansions; ++I)
2781 void UnresolvedUsingValueDecl::anchor() {}
2790 QualifierLoc, NameInfo,
2805 ? getQualifierLoc().getBeginLoc() : UsingLocation;
2809 void UnresolvedUsingTypenameDecl::anchor() {}
2820 DC, UsingLoc, TypenameLoc, QualifierLoc, TargetNameLoc,
2831 void StaticAssertDecl::anchor() {}
2849 void BindingDecl::anchor() {}
2861 Expr *B = getBinding();
2868 auto *VD = dyn_cast<
VarDecl>(DRE->getDecl());
2869 assert(VD->isImplicit() &&
"holding var for binding decl not implicit");
2873 void DecompositionDecl::anchor() {}
2881 size_t Extra = additionalSizeToAlloc<BindingDecl *>(Bindings.size());
2882 return new (
C, DC, Extra)
2888 unsigned NumBindings) {
2889 size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
2894 Result->NumBindings = NumBindings;
2895 auto *Trail = Result->getTrailingObjects<
BindingDecl *>();
2896 for (
unsigned I = 0; I != NumBindings; ++I)
2904 for (
const auto *B : bindings()) {
2913 void MSPropertyDecl::anchor() {}
2921 return new (
C, DC)
MSPropertyDecl(DC, L, N, T, TInfo, StartL, Getter, Setter);
2934 llvm_unreachable(
"Invalid access specifier!");
2942 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.
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)
void setInheritingConstructor(bool isIC=true)
State that this is an implicit constructor synthesized to model a call to a constructor inherited fro...
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.
QualType getThisType() const
Returns the type of the this pointer.
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.
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
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
static bool allLookupResultsAreTheSame(const DeclContext::lookup_result &R)
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getODRHash() const
bool isInterfaceLike() const
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
NameKind getNameKind() const
Determine what kind of name this is.
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.
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
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool isAnyMemberInitializer() const
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.
Qualifiers getTypeQuals() const
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...
Represents a prototype with parameter type info, e.g.
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
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 ...
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
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
static CanQualType GetConversionType(ASTContext &Context, NamedDecl *Conv)
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
static NamespaceAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
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...
bool isUsualDeallocationFunction(SmallVectorImpl< const FunctionDecl *> &PreventedBy) 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.
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)
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)
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...
llvm::BumpPtrAllocator & getAllocator() const
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.
Represents a C++ base or member initializer.
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...
LambdaCaptureDefault getLambdaCaptureDefault() const
void printName(raw_ostream &os) const override
base_class_iterator bases_end()
ASTImporterLookupTable & LT
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.
bool lambdaIsDefaultConstructibleAndAssignable() const
Determine whether this lambda should have an implicit default constructor and copy and move assignmen...
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
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.
int64_t getID(const ASTContext &Context) const
SourceLocation getLocation() const
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Represents a pack of using declarations that a single using-declarator pack-expanded into...
bool isBeingDefined() const
Return true if this decl is currently being defined.
Defines the LambdaCapture class.
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
method_range methods() const
QualType getType() const
Retrieves the type of the base class.