24 #include "llvm/ADT/STLExtras.h"
25 #include "llvm/ADT/SmallPtrSet.h"
26 using namespace clang;
32 void AccessSpecDecl::anchor() { }
38 void LazyASTUnresolvedSet::getFromExternalSource(
ASTContext &C)
const {
40 assert(Impl.Decls.isLazy() &&
"getFromExternalSource for non-lazy set");
41 assert(Source &&
"getFromExternalSource with no external source");
45 reinterpret_cast<uintptr_t>(
I.getDecl()) >> 2)));
46 Impl.Decls.setLazy(
false);
49 CXXRecordDecl::DefinitionData::DefinitionData(
CXXRecordDecl *D)
50 : UserDeclaredConstructor(
false), UserDeclaredSpecialMembers(0),
52 Abstract(
false), IsStandardLayout(
true), HasNoNonEmptyBases(
true),
53 HasPrivateFields(
false), HasProtectedFields(
false),
54 HasPublicFields(
false), HasMutableFields(
false), HasVariantMembers(
false),
55 HasOnlyCMembers(
true), HasInClassInitializer(
false),
56 HasUninitializedReferenceMember(
false), HasUninitializedFields(
false),
57 HasInheritedConstructor(
false), HasInheritedAssignment(
false),
58 NeedOverloadResolutionForCopyConstructor(
false),
59 NeedOverloadResolutionForMoveConstructor(
false),
60 NeedOverloadResolutionForMoveAssignment(
false),
61 NeedOverloadResolutionForDestructor(
false),
62 DefaultedCopyConstructorIsDeleted(
false),
63 DefaultedMoveConstructorIsDeleted(
false),
64 DefaultedMoveAssignmentIsDeleted(
false),
65 DefaultedDestructorIsDeleted(
false), HasTrivialSpecialMembers(SMF_All),
66 DeclaredNonTrivialSpecialMembers(0), HasIrrelevantDestructor(
true),
67 HasConstexprNonCopyMoveConstructor(
false),
68 HasDefaultedDefaultConstructor(
false),
69 CanPassInRegisters(
true),
70 DefaultedDefaultConstructorIsConstexpr(
true),
71 HasConstexprDefaultConstructor(
false),
72 HasNonLiteralTypeFieldsOrBases(
false), ComputedVisibleConversions(
false),
73 UserProvidedDefaultConstructor(
false), DeclaredSpecialMembers(0),
74 ImplicitCopyConstructorCanHaveConstParamForVBase(
true),
75 ImplicitCopyConstructorCanHaveConstParamForNonVBase(
true),
76 ImplicitCopyAssignmentHasConstParam(
true),
77 HasDeclaredCopyConstructorWithConstParam(
false),
78 HasDeclaredCopyAssignmentWithConstParam(
false), IsLambda(
false),
80 NumBases(0), NumVBases(0), Bases(), VBases(), Definition(D),
84 return Bases.get(
Definition->getASTContext().getExternalSource());
88 return VBases.get(
Definition->getASTContext().getExternalSource());
95 :
RecordDecl(K, TK, C, DC, StartLoc, IdLoc, Id, PrevDecl),
96 DefinitionData(PrevDecl ? PrevDecl->DefinitionData
98 TemplateOrInstantiation() {}
104 bool DelayTypeCreation) {
106 IdLoc, Id, PrevDecl);
110 if (!DelayTypeCreation)
118 bool Dependent,
bool IsGeneric,
125 new (C)
struct LambdaDefinitionData(R, Info, Dependent, IsGeneric,
147 if (!data().Bases.isOffset() && data().NumBases > 0)
154 data().Aggregate =
false;
159 data().PlainOldData =
false;
163 llvm::SmallPtrSet<CanQualType, 8> SeenVBaseTypes;
169 data().NumBases = NumBases;
170 for (
unsigned i = 0; i < NumBases; ++i) {
171 data().getBases()[i] = *Bases[i];
181 if (!BaseClassDecl->
isEmpty()) {
191 data().IsStandardLayout =
false;
197 data().Empty =
false;
198 data().HasNoNonEmptyBases =
false;
204 data().Aggregate =
false;
210 data().Polymorphic =
true;
216 data().IsStandardLayout =
false;
220 data().HasNonLiteralTypeFieldsOrBases =
true;
223 for (
const auto &VBase : BaseClassDecl->
vbases()) {
226 VBases.push_back(&VBase);
233 if (
CXXRecordDecl *VBaseDecl = VBase.getType()->getAsCXXRecordDecl())
234 if (!VBaseDecl->hasCopyConstructorWithConstParam())
235 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
239 data().Aggregate =
false;
246 VBases.push_back(Base);
251 data().Empty =
false;
255 data().Aggregate =
false;
261 data().HasTrivialSpecialMembers &= SMF_Destructor;
266 data().IsStandardLayout =
false;
271 data().DefaultedDefaultConstructorIsConstexpr =
false;
279 data().ImplicitCopyConstructorCanHaveConstParamForVBase =
false;
286 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
294 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
300 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
308 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
314 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
321 data().DefaultedDefaultConstructorIsConstexpr =
false;
329 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
336 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
339 data().HasIrrelevantDestructor =
false;
347 data().ImplicitCopyAssignmentHasConstParam =
false;
359 data().HasMutableFields =
true;
360 data().NeedOverloadResolutionForCopyConstructor =
true;
364 data().HasUninitializedReferenceMember =
true;
367 data().HasUninitializedFields =
true;
369 addedClassSubobject(BaseClassDecl);
372 if (VBases.empty()) {
373 data().IsParsingBaseSpecifiers =
false;
379 data().NumVBases = VBases.size();
380 for (
int I = 0,
E = VBases.size();
I !=
E; ++
I) {
384 data().getVBases()[
I] = *VBases[
I];
387 data().IsParsingBaseSpecifiers =
false;
391 assert(
hasDefinition() &&
"ODRHash only for records with definitions");
394 if (DefinitionData->HasODRHash)
395 return DefinitionData->ODRHash;
400 DefinitionData->HasODRHash =
true;
403 return DefinitionData->ODRHash;
407 void CXXRecordDecl::addedClassSubobject(
CXXRecordDecl *Subobj) {
415 data().NeedOverloadResolutionForCopyConstructor =
true;
417 data().NeedOverloadResolutionForMoveConstructor =
true;
426 data().NeedOverloadResolutionForMoveAssignment =
true;
436 data().NeedOverloadResolutionForCopyConstructor =
true;
437 data().NeedOverloadResolutionForMoveConstructor =
true;
438 data().NeedOverloadResolutionForDestructor =
true;
466 void CXXRecordDecl::markedVirtualFunctionPure() {
469 data().Abstract =
true;
472 void CXXRecordDecl::addedMember(
Decl *D) {
474 !isa<FieldDecl>(D) &&
475 !isa<IndirectFieldDecl>(D) &&
476 (!isa<TagDecl>(D) || cast<TagDecl>(D)->getTagKind() ==
TTK_Class ||
478 data().HasOnlyCMembers =
false;
489 Decl *DUnderlying = D;
490 if (
auto *ND = dyn_cast<NamedDecl>(DUnderlying)) {
491 DUnderlying = ND->getUnderlyingDecl();
493 dyn_cast<FunctionTemplateDecl>(DUnderlying))
494 DUnderlying = UnderlyingFunTmpl->getTemplatedDecl();
498 if (Method->isVirtual()) {
501 data().Aggregate =
false;
505 data().PlainOldData =
false;
509 data().Empty =
false;
514 data().Polymorphic =
true;
520 data().HasTrivialSpecialMembers &= SMF_Destructor;
525 data().IsStandardLayout =
false;
533 L->AddedCXXImplicitMember(data().Definition, D);
542 data().UserDeclaredConstructor =
true;
548 data().PlainOldData =
false;
552 SMKind |= SMF_DefaultConstructor;
555 data().UserProvidedDefaultConstructor =
true;
557 data().HasConstexprDefaultConstructor =
true;
559 data().HasDefaultedDefaultConstructor =
true;
565 SMKind |= SMF_CopyConstructor;
568 data().HasDeclaredCopyConstructorWithConstParam =
true;
570 SMKind |= SMF_MoveConstructor;
577 data().Aggregate =
false;
582 dyn_cast<CXXConstructorDecl>(DUnderlying)) {
590 data().HasConstexprNonCopyMoveConstructor =
true;
595 SMKind |= SMF_Destructor;
597 if (DD->isUserProvided())
598 data().HasIrrelevantDestructor =
false;
606 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
611 if (Method->isCopyAssignmentOperator()) {
612 SMKind |= SMF_CopyAssignment;
617 data().HasDeclaredCopyAssignmentWithConstParam =
true;
620 if (Method->isMoveAssignmentOperator())
621 SMKind |= SMF_MoveAssignment;
633 if (Conversion->getPrimaryTemplate()) {
639 FunTmpl ? cast<NamedDecl>(FunTmpl) : cast<NamedDecl>(Conversion);
644 Conversions.
addDecl(Ctx, Primary, AS);
651 data().HasTrivialSpecialMembers &=
652 data().DeclaredSpecialMembers | ~SMKind;
654 if (!Method->isImplicit() && !Method->isUserProvided()) {
658 }
else if (Method->isTrivial())
659 data().HasTrivialSpecialMembers |= SMKind;
661 data().DeclaredNonTrivialSpecialMembers |= SMKind;
665 data().DeclaredSpecialMembers |= SMKind;
667 if (!Method->isImplicit()) {
668 data().UserDeclaredSpecialMembers |= SMKind;
681 data().PlainOldData =
false;
689 if (
FieldDecl *Field = dyn_cast<FieldDecl>(D)) {
694 if (
Field->isUnnamedBitfield())
703 data().Aggregate =
false;
704 data().PlainOldData =
false;
712 case AS_private: data().HasPrivateFields =
true;
break;
713 case AS_protected: data().HasProtectedFields =
true;
break;
714 case AS_public: data().HasPublicFields =
true;
break;
715 case AS_none: llvm_unreachable(
"Invalid access specifier");
717 if ((data().HasPrivateFields + data().HasProtectedFields +
718 data().HasPublicFields) > 1)
719 data().IsStandardLayout =
false;
722 if (
Field->isMutable()) {
723 data().HasMutableFields =
true;
724 data().NeedOverloadResolutionForCopyConstructor =
true;
731 data().HasVariantMembers =
true;
751 struct DefinitionData &Data = data();
752 Data.PlainOldData =
false;
753 Data.HasTrivialSpecialMembers = 0;
754 Data.HasIrrelevantDestructor =
false;
755 }
else if (!Context.
getLangOpts().ObjCAutoRefCount) {
759 data().PlainOldData =
false;
762 if (!
Field->hasInClassInitializer())
763 data().HasUninitializedReferenceMember =
true;
768 data().IsStandardLayout =
false;
774 data().DefaultedCopyConstructorIsDeleted =
true;
777 if (!
Field->hasInClassInitializer() && !
Field->isMutable()) {
779 if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
780 data().HasUninitializedFields =
true;
782 data().HasUninitializedFields =
true;
788 data().HasNonLiteralTypeFieldsOrBases =
true;
790 if (
Field->hasInClassInitializer() ||
791 (
Field->isAnonymousStructOrUnion() &&
792 Field->getType()->getAsCXXRecordDecl()->hasInClassInitializer())) {
793 data().HasInClassInitializer =
true;
798 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
806 data().Aggregate =
false;
810 data().PlainOldData =
false;
818 data().DefaultedMoveAssignmentIsDeleted =
true;
821 CXXRecordDecl* FieldRec = cast<CXXRecordDecl>(RecordTy->getDecl());
823 addedClassSubobject(FieldRec);
831 data().NeedOverloadResolutionForCopyConstructor =
true;
832 data().NeedOverloadResolutionForMoveConstructor =
true;
833 data().NeedOverloadResolutionForMoveAssignment =
true;
843 data().DefaultedCopyConstructorIsDeleted =
true;
845 data().DefaultedMoveConstructorIsDeleted =
true;
847 data().DefaultedMoveAssignmentIsDeleted =
true;
849 data().DefaultedDestructorIsDeleted =
true;
854 if (
Field->isAnonymousStructOrUnion()) {
855 data().NeedOverloadResolutionForCopyConstructor |=
856 FieldRec->data().NeedOverloadResolutionForCopyConstructor;
857 data().NeedOverloadResolutionForMoveConstructor |=
858 FieldRec->data().NeedOverloadResolutionForMoveConstructor;
859 data().NeedOverloadResolutionForMoveAssignment |=
860 FieldRec->data().NeedOverloadResolutionForMoveAssignment;
861 data().NeedOverloadResolutionForDestructor |=
862 FieldRec->data().NeedOverloadResolutionForDestructor;
871 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
880 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
885 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
894 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
899 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
902 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
904 data().HasIrrelevantDestructor =
false;
915 data().IsStandardLayout =
false;
932 if (data().IsStandardLayout && data().Empty) {
933 for (
const auto &BI :
bases()) {
935 data().IsStandardLayout =
false;
943 data().HasMutableFields =
true;
944 data().NeedOverloadResolutionForCopyConstructor =
true;
954 if (!
Field->hasInClassInitializer() &&
958 data().DefaultedDefaultConstructorIsConstexpr =
false;
966 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase =
false;
975 data().ImplicitCopyAssignmentHasConstParam =
false;
978 !
Field->hasInClassInitializer())
979 data().HasUninitializedReferenceMember =
true;
985 Field->isAnonymousStructOrUnion())
986 data().HasVariantMembers =
true;
992 data().DefaultedDefaultConstructorIsConstexpr =
false;
1000 data().DefaultedMoveAssignmentIsDeleted =
true;
1011 if (!data().HasNoNonEmptyBases)
1012 data().IsStandardLayout =
false;
1018 if (!
Field->isBitField() ||
1019 (!
Field->getBitWidth()->isTypeDependent() &&
1020 !
Field->getBitWidth()->isValueDependent() &&
1021 Field->getBitWidthValue(Context) != 0))
1022 data().Empty =
false;
1028 if (Shadow->getDeclName().getNameKind()
1031 data().Conversions.get(Ctx).addDecl(Ctx, Shadow, Shadow->getAccess());
1035 if (
UsingDecl *Using = dyn_cast<UsingDecl>(D)) {
1036 if (Using->getDeclName().getNameKind() ==
1038 data().HasInheritedConstructor =
true;
1041 data().Aggregate =
false;
1044 if (Using->getDeclName().getCXXOverloadedOperator() == OO_Equal)
1045 data().HasInheritedAssignment =
true;
1053 unsigned SMKind = 0;
1056 if (Constructor->isDefaultConstructor()) {
1057 SMKind |= SMF_DefaultConstructor;
1058 if (Constructor->isConstexpr())
1059 data().HasConstexprDefaultConstructor =
true;
1061 if (Constructor->isCopyConstructor())
1062 SMKind |= SMF_CopyConstructor;
1063 else if (Constructor->isMoveConstructor())
1064 SMKind |= SMF_MoveConstructor;
1065 else if (Constructor->isConstexpr())
1067 data().HasConstexprNonCopyMoveConstructor =
true;
1068 }
else if (isa<CXXDestructorDecl>(D)) {
1069 SMKind |= SMF_Destructor;
1071 data().HasIrrelevantDestructor =
false;
1073 SMKind |= SMF_CopyAssignment;
1075 SMKind |= SMF_MoveAssignment;
1080 data().HasTrivialSpecialMembers |= SMKind;
1082 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1087 !TemplateOrInstantiation.isNull())
1092 return isPOD() && data().HasOnlyCMembers;
1097 return getLambdaData().IsGenericLambda;
1106 assert(!Calls.
empty() &&
"Missing lambda call operator!");
1107 assert(Calls.
size() == 1 &&
"More than one lambda call operator!");
1111 dyn_cast<FunctionTemplateDecl>(CallOp))
1112 return cast<CXXMethodDecl>(CallOpTmpl->getTemplatedDecl());
1114 return cast<CXXMethodDecl>(CallOp);
1122 if (Invoker.
empty())
return nullptr;
1123 assert(Invoker.
size() == 1 &&
"More than one static invoker operator!");
1126 dyn_cast<FunctionTemplateDecl>(InvokerFun))
1127 return cast<CXXMethodDecl>(InvokerTemplate->getTemplatedDecl());
1129 return cast<CXXMethodDecl>(InvokerFun);
1133 llvm::DenseMap<const VarDecl *, FieldDecl *> &Captures,
1136 ThisCapture =
nullptr;
1138 LambdaDefinitionData &Lambda = getLambdaData();
1140 for (
const LambdaCapture *C = Lambda.Captures, *CEnd = C + Lambda.NumCaptures;
1141 C != CEnd; ++C, ++Field) {
1142 if (C->capturesThis())
1143 ThisCapture = *Field;
1144 else if (C->capturesVariable())
1145 Captures[C->getCapturedVar()] = *Field;
1155 return Tmpl->getTemplateParameters();
1160 assert(
isLambda() &&
"Not a lambda closure type!");
1162 return getLambdaData().ContextDecl.get(Source);
1168 ->getConversionType();
1188 const llvm::SmallPtrSet<CanQualType, 8> &ParentHiddenTypes,
1191 llvm::SmallPtrSet<NamedDecl*, 8> &HiddenVBaseCs) {
1195 const llvm::SmallPtrSet<CanQualType, 8> *HiddenTypes = &ParentHiddenTypes;
1196 llvm::SmallPtrSet<CanQualType, 8> HiddenTypesBuffer;
1202 if (ConvI != ConvE) {
1203 HiddenTypesBuffer = ParentHiddenTypes;
1204 HiddenTypes = &HiddenTypesBuffer;
1208 bool Hidden = ParentHiddenTypes.count(ConvType);
1210 HiddenTypesBuffer.insert(ConvType);
1214 if (Hidden && InVirtual)
1215 HiddenVBaseCs.insert(cast<NamedDecl>(
I.getDecl()->getCanonicalDecl()));
1223 VOutput.
addDecl(
I.getDecl(), IAccess);
1225 Output.
addDecl(Context,
I.getDecl(), IAccess);
1231 for (
const auto &
I : Record->
bases()) {
1237 bool BaseInVirtual = InVirtual ||
I.isVirtual();
1241 *HiddenTypes, Output, VOutput, HiddenVBaseCs);
1259 llvm::SmallPtrSet<NamedDecl*, 8> HiddenVBaseCs;
1262 llvm::SmallPtrSet<CanQualType, 8> HiddenTypes;
1268 Output.
append(Context, ConvI, ConvE);
1269 for (; ConvI != ConvE; ++ConvI)
1273 for (
const auto &
I : Record->
bases()) {
1278 I.isVirtual(),
I.getAccessSpecifier(),
1279 HiddenTypes, Output, VBaseCs, HiddenVBaseCs);
1285 if (!HiddenVBaseCs.count(cast<NamedDecl>(
I.getDecl()->getCanonicalDecl())))
1286 Output.
addDecl(Context,
I.getDecl(),
I.getAccess());
1292 llvm::iterator_range<CXXRecordDecl::conversion_iterator>
1299 Set = &data().Conversions.get(Ctx);
1301 Set = &data().VisibleConversions.get(Ctx);
1303 if (!data().ComputedVisibleConversions) {
1305 data().ComputedVisibleConversions =
true;
1308 return llvm::make_range(Set->
begin(), Set->
end());
1324 for (
unsigned I = 0,
E = Convs.
size();
I !=
E; ++
I) {
1325 if (Convs[
I].getDecl() == ConvDecl) {
1327 assert(std::find(Convs.
begin(), Convs.
end(), ConvDecl) == Convs.
end()
1328 &&
"conversion was found multiple times in unresolved set");
1333 llvm_unreachable(
"conversion not found in set!");
1338 return cast<CXXRecordDecl>(MSInfo->getInstantiatedFrom());
1350 assert(TemplateOrInstantiation.isNull() &&
1351 "Previous template or instantiation?");
1352 assert(!isa<ClassTemplatePartialSpecializationDecl>(
this));
1353 TemplateOrInstantiation
1362 TemplateOrInstantiation = Template;
1367 = dyn_cast<ClassTemplateSpecializationDecl>(
this))
1368 return Spec->getSpecializationKind();
1371 return MSInfo->getTemplateSpecializationKind();
1379 = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1380 Spec->setSpecializationKind(TSK);
1385 MSInfo->setTemplateSpecializationKind(TSK);
1389 llvm_unreachable(
"Not a class template or member class specialization");
1393 auto GetDefinitionOrSelf =
1395 if (
auto *Def = D->getDefinition())
1402 if (
auto *TD = dyn_cast<ClassTemplateSpecializationDecl>(
this)) {
1403 auto From = TD->getInstantiatedFrom();
1405 while (
auto *NewCTD = CTD->getInstantiatedFromMemberTemplate()) {
1406 if (NewCTD->isMemberSpecialization())
1410 return GetDefinitionOrSelf(CTD->getTemplatedDecl());
1414 while (
auto *NewCTPSD = CTPSD->getInstantiatedFromMember()) {
1415 if (NewCTPSD->isMemberSpecialization())
1419 return GetDefinitionOrSelf(CTPSD);
1428 return GetDefinitionOrSelf(RD);
1433 "couldn't find pattern for class template instantiation");
1453 if (Destructor->isNoReturn())
1459 if (RD->isAnyDestructorNoReturn())
1463 for (
const auto *Field :
fields())
1465 Field->getType()->getBaseElementTypeUnsafe()->getAsCXXRecordDecl())
1466 if (RD->isAnyDestructorNoReturn())
1484 if (!FinalOverriders) {
1486 FinalOverriders = &MyFinalOverriders;
1490 for (CXXFinalOverriderMap::iterator M = FinalOverriders->begin(),
1491 MEnd = FinalOverriders->end();
1492 M != MEnd && !Done; ++M) {
1494 SOEnd = M->second.end();
1495 SO != SOEnd && !Done; ++SO) {
1496 assert(SO->second.size() > 0 &&
1497 "All virtual functions have overridding virtual functions");
1503 if (SO->second.front().Method->isPure()) {
1504 data().Abstract =
true;
1515 I.setAccess((*I)->getAccess());
1519 if (data().Abstract ||
isInvalidDecl() || !data().Polymorphic ||
1523 for (
const auto &B :
bases()) {
1525 = cast<CXXRecordDecl>(B.getType()->getAs<
RecordType>()->getDecl());
1533 void CXXDeductionGuideDecl::anchor() { }
1540 NameInfo, T, TInfo, EndLocation);
1550 void CXXMethodDecl::anchor() { }
1582 if (isa<CXXDestructorDecl>(
this)) {
1603 for (
const auto &
I : RD->
bases()) {
1623 return new (
C, RD)
CXXMethodDecl(CXXMethod, C, RD, StartLoc, NameInfo,
1624 T, TInfo, SC, isInline, isConstexpr,
1636 assert(
isVirtual() &&
"this method is expected to be virtual");
1645 if (hasAttr<FinalAttr>())
1646 return isPure() ?
nullptr :
this;
1660 if (!BestDynamicDecl)
1670 if (DevirtualizedMethod->
isPure())
1674 if (DevirtualizedMethod->
hasAttr<FinalAttr>())
1675 return DevirtualizedMethod;
1679 if (BestDynamicDecl->
hasAttr<FinalAttr>())
1680 return DevirtualizedMethod;
1682 if (
const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Base)) {
1683 if (
const VarDecl *VD = dyn_cast<VarDecl>(DRE->getDecl()))
1684 if (VD->getType()->isRecordType())
1686 return DevirtualizedMethod;
1694 if (
const MemberExpr *ME = dyn_cast<MemberExpr>(Base))
1695 if (
const ValueDecl *VD = dyn_cast<ValueDecl>(ME->getMemberDecl()))
1700 if (
auto *BO = dyn_cast<BinaryOperator>(Base)) {
1701 if (BO->isPtrMemOp()) {
1703 if (MPT->getPointeeType()->isRecordType())
1704 return DevirtualizedMethod;
1729 unsigned UsualParams = 1;
1765 if (FD->getNumParams() == 1)
1804 if (!isa<RValueReferenceType>(ParamType))
1817 "Can't add an overridden method to a class template!");
1818 assert(MD->
isVirtual() &&
"Method is not virtual!");
1824 if (isa<CXXConstructorDecl>(
this))
return nullptr;
1829 if (isa<CXXConstructorDecl>(
this))
return nullptr;
1834 if (isa<CXXConstructorDecl>(
this))
return 0;
1840 if (isa<CXXConstructorDecl>(
this))
1852 assert(
isInstance() &&
"No 'this' for static methods!");
1876 if (StaticInvoker ==
this)
return true;
1889 : Initializee(TInfo), MemberOrEllipsisLocation(EllipsisLoc), Init(Init),
1890 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(IsVirtual),
1891 IsWritten(
false), SourceOrder(0)
1900 : Initializee(Member), MemberOrEllipsisLocation(MemberLoc), Init(Init),
1901 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
1902 IsWritten(
false), SourceOrder(0)
1911 : Initializee(Member), MemberOrEllipsisLocation(MemberLoc), Init(Init),
1912 LParenLoc(L), RParenLoc(R), IsDelegating(
false), IsVirtual(
false),
1913 IsWritten(
false), SourceOrder(0)
1921 : Initializee(TInfo), MemberOrEllipsisLocation(), Init(Init),
1922 LParenLoc(L), RParenLoc(R), IsDelegating(
true), IsVirtual(
false),
1923 IsWritten(
false), SourceOrder(0)
1936 return Initializee.get<
TypeSourceInfo*>()->getType().getTypePtr();
1949 return TSInfo->getTypeLoc().getLocalSourceRange().getBegin();
1958 return I->getSourceRange();
1965 void CXXConstructorDecl::anchor() { }
1970 unsigned Extra = additionalSizeToAlloc<InheritedConstructor>(Inherited);
1974 Result->IsInheritingConstructor = Inherited;
1983 bool isExplicit,
bool isInline,
1984 bool isImplicitlyDeclared,
bool isConstexpr,
1988 "Name must refer to a constructor");
1990 additionalSizeToAlloc<InheritedConstructor>(Inherited ? 1 : 0);
1992 C, RD, StartLoc, NameInfo, T, TInfo, isExplicit, isInline,
1993 isImplicitlyDeclared, isConstexpr, Inherited);
2004 return Construct->getConstructor();
2108 void CXXDestructorDecl::anchor() { }
2114 QualType(),
nullptr,
false,
false);
2122 bool isInline,
bool isImplicitlyDeclared) {
2125 "Name must refer to a destructor");
2127 isInline, isImplicitlyDeclared);
2132 if (OD && !
First->OperatorDelete) {
2133 First->OperatorDelete = OD;
2135 L->ResolvedOperatorDelete(
First, OD);
2139 void CXXConversionDecl::anchor() { }
2145 nullptr,
false,
false,
false,
2154 bool isInline,
bool isExplicit,
2158 "Name must refer to a conversion function");
2160 isInline, isExplicit, isConstexpr,
2169 void LinkageSpecDecl::anchor() { }
2177 return new (
C, DC)
LinkageSpecDecl(DC, ExternLoc, LangLoc, Lang, HasBraces);
2186 void UsingDirectiveDecl::anchor() { }
2195 if (
NamespaceDecl *NS = dyn_cast_or_null<NamespaceDecl>(Used))
2196 Used = NS->getOriginalNamespace();
2198 IdentLoc, Used, CommonAncestor);
2211 dyn_cast_or_null<NamespaceAliasDecl>(NominatedNamespace))
2212 return NA->getNamespace();
2213 return cast_or_null<NamespaceDecl>(NominatedNamespace);
2220 redeclarable_base(C), LocStart(StartLoc), RBraceLoc(),
2221 AnonOrFirstNamespaceAndInline(nullptr, Inline) {
2222 setPreviousDecl(PrevDecl);
2232 return new (
C, DC)
NamespaceDecl(C, DC, Inline, StartLoc, IdLoc, Id,
2245 return AnonOrFirstNamespaceAndInline.getPointer();
2252 return AnonOrFirstNamespaceAndInline.getPointer();
2267 void NamespaceAliasDecl::anchor() { }
2287 if (
NamespaceDecl *NS = dyn_cast_or_null<NamespaceDecl>(Namespace))
2288 Namespace = NS->getOriginalNamespace();
2290 QualifierLoc, IdentLoc, Namespace);
2301 void UsingShadowDecl::anchor() { }
2326 dyn_cast<UsingShadowDecl>(Shadow->UsingOrNextShadow))
2327 Shadow = NextShadow;
2328 return cast<UsingDecl>(Shadow->UsingOrNextShadow);
2331 void ConstructorUsingShadowDecl::anchor() { }
2350 void UsingDecl::anchor() { }
2354 "declaration already in set");
2357 if (FirstUsingShadow.getPointer())
2358 S->UsingOrNextShadow = FirstUsingShadow.getPointer();
2359 FirstUsingShadow.setPointer(S);
2364 "declaration not in set");
2369 if (FirstUsingShadow.getPointer() ==
S) {
2370 FirstUsingShadow.setPointer(
2371 dyn_cast<UsingShadowDecl>(S->UsingOrNextShadow));
2372 S->UsingOrNextShadow =
this;
2377 while (Prev->UsingOrNextShadow != S)
2378 Prev = cast<UsingShadowDecl>(Prev->UsingOrNextShadow);
2379 Prev->UsingOrNextShadow = S->UsingOrNextShadow;
2380 S->UsingOrNextShadow =
this;
2387 return new (
C, DC)
UsingDecl(DC, UL, QualifierLoc, NameInfo, HasTypename);
2402 void UsingPackDecl::anchor() { }
2407 size_t Extra = additionalSizeToAlloc<NamedDecl *>(UsingDecls.size());
2408 return new (
C, DC, Extra)
UsingPackDecl(DC, InstantiatedFrom, UsingDecls);
2412 unsigned NumExpansions) {
2413 size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
2415 Result->NumExpansions = NumExpansions;
2416 auto *Trail = Result->getTrailingObjects<
NamedDecl *>();
2417 for (
unsigned I = 0;
I != NumExpansions; ++
I)
2422 void UnresolvedUsingValueDecl::anchor() { }
2431 QualifierLoc, NameInfo,
2450 void UnresolvedUsingTypenameDecl::anchor() { }
2461 DC, UsingLoc, TypenameLoc, QualifierLoc, TargetNameLoc,
2472 void StaticAssertDecl::anchor() { }
2490 void BindingDecl::anchor() {}
2509 auto *VD = dyn_cast<
VarDecl>(DRE->getDecl());
2510 assert(VD->isImplicit() &&
"holding var for binding decl not implicit");
2514 void DecompositionDecl::anchor() {}
2522 size_t Extra = additionalSizeToAlloc<BindingDecl *>(Bindings.size());
2523 return new (
C, DC, Extra)
2529 unsigned NumBindings) {
2530 size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
2535 Result->NumBindings = NumBindings;
2536 auto *Trail = Result->getTrailingObjects<
BindingDecl *>();
2537 for (
unsigned I = 0;
I != NumBindings; ++
I)
2560 return new (
C, DC)
MSPropertyDecl(DC, L, N, T, TInfo, StartL, Getter, Setter);
2573 llvm_unreachable(
"Invalid access specifier!");
2581 llvm_unreachable(
"Invalid access specifier!");
VarDecl * getHoldingVar() const
Get the variable (if any) that holds the value of evaluating the binding.
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)
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
static Qualifiers fromCVRUMask(unsigned CVRU)
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization, retrieves the member specialization information.
A (possibly-)qualified type.
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
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.
QualType getConversionType() const
Returns the type that this conversion function is converting to.
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
QualType getType() const
Retrieves the type of the base 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...
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
bool allowConstDefaultInit() const
Determine whether declaring a const variable with this type is ok per core issue 253.
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration...
bool hasDefaultArg() const
hasDefaultArg - Determines whether this parameter has a default argument, either parsed or not...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a member function...
static AccessSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isInClassMemberInitializer() const
Determine whether this initializer is an implicit initializer generated for a field with an initializ...
bool isRecordType() const
Decl - This represents one declaration (or definition), e.g.
bool isSpecializationCopyingObject() const
Determine whether this is a member template specialization that would copy the object to itself...
void append(ASTContext &C, iterator I, iterator E)
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
Defines the C++ template declaration subclasses.
bool hasNonTrivialDestructor() const
Determine whether this class has a non-trivial destructor (C++ [class.dtor]p3)
unsigned getCVRQualifiers() const
Retrieve the const/volatile/restrict qualifiers.
llvm::iterator_range< conversion_iterator > getVisibleConversionFunctions()
Get all conversion functions visible in current class, including conversion function templates...
unsigned getODRHash() const
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
bool hasDefinition() const
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
IdentifierInfo * getAsIdentifierInfo() const
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn't a simple identifier.
The base class of the type hierarchy.
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
MapType::iterator iterator
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...
SourceLocation getRParenLoc() const
NamespaceDecl - Represent a C++ namespace.
Represents a call to a C++ constructor.
virtual void completeDefinition()
completeDefinition - Notes that the definition of this type is now complete.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
A container of type source information.
bool isBlockPointerType() const
Expr * getBinding() const
Get the expression to which this declaration is bound.
Describes the capture of a variable or of this, or of a C++1y init-capture.
Represents a C++ constructor within a class.
Expr * getInClassInitializer() const
getInClassInitializer - Get the C++11 in-class initializer for this member, or null if one has not be...
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo, bool IsVirtual, SourceLocation L, Expr *Init, SourceLocation R, SourceLocation EllipsisLoc)
Creates a new base-class initializer.
This file provides some common utility functions for processing Lambda related AST Constructs...
VarDecl - An instance of this class is created to represent a variable declaration or definition...
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...
AccessSpecifier getAccess() const
field_iterator field_begin() const
bool isCLike() const
True if this class is C-like, without C++-specific features, e.g.
static MSPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL, IdentifierInfo *Getter, IdentifierInfo *Setter)
The "__interface" keyword.
QualType getThisType(ASTContext &C) const
Returns the type of the this pointer.
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.
Stores a list of template parameters for a TemplateDecl and its derived classes.
bool hasNonTrivialMoveAssignment() const
Determine whether this class has a non-trivial move assignment operator (C++11 [class.copy]p25)
ParmVarDecl - Represents a parameter to a function.
bool isObjCRetainableType() const
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
Defines the clang::Expr interface and subclasses for C++ expressions.
bool hasMutableFields() const
Determine whether this class, or any of its class subobjects, contains a mutable field.
const CXXRecordDecl * getTemplateInstantiationPattern() const
Retrieve the record declaration from which this record could be instantiated.
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
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.
bool hasTrivialCopyConstructor() const
Determine whether this class has a trivial copy constructor (C++ [class.copy]p6, C++11 [class...
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the kind of specialization or template instantiation this is.
Base wrapper for a particular "section" of type source info.
RecordDecl - Represents a struct/union/class.
ASTMutationListener * getASTMutationListener() const
bool isFunctionTemplateSpecialization() const
Determine whether this function is a function template specialization.
Description of a constructor that was inherited from a base class.
DeclarationName getName() const
getName - Returns the embedded declaration name.
Represents a class template specialization, which refers to a class template with a given set of temp...
One of these records is kept for each identifier that is lexed.
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
method_iterator end_overridden_methods() const
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.
bool isDelegatingConstructor() const
Determine whether this constructor is a delegating constructor.
bool hasNonTrivialCopyConstructor() const
Determine whether this class has a non-trivial copy constructor (C++ [class.copy]p6, C++11 [class.copy]p12)
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
bool isReferenceType() const
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
CXXConstructorDecl * getTargetConstructor() const
When this constructor delegates to another, retrieve the target.
static CXXRecordDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
bool isPure() const
Whether this virtual function is pure, i.e.
void Deallocate(void *Ptr) const
unsigned getIdentifierNamespace() const
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
CXXRecordDecl * getDefinition() const
TagKind getTagKind() const
The iterator over UnresolvedSets.
static UnresolvedUsingTypenameDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation TypenameLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TargetNameLoc, DeclarationName TargetName, SourceLocation EllipsisLoc)
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)
bool isAnyDestructorNoReturn() const
Returns true if the class destructor, or any implicitly invoked destructors are marked noreturn...
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
static NamespaceDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Represents a C++ using-declaration.
NamespaceDecl * getNextRedeclaration() const
void completeDefinition() override
Indicates that the definition of this class is now complete.
void addDecl(ASTContext &C, NamedDecl *D, AccessSpecifier AS)
const LangOptions & getLangOpts() const
CXXMethodDecl(Kind DK, ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInline, bool isConstexpr, SourceLocation EndLocation)
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
const CXXRecordDecl * getParent() const
Returns the parent of this method declaration, which is the class in which this method is defined...
shadow_iterator shadow_begin() const
field_range fields() const
static UnresolvedUsingTypenameDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool hasCopyAssignmentWithConstParam() const
Determine whether this class has a copy assignment operator with a parameter type which is a referenc...
bool hasNonLiteralTypeFieldsOrBases() const
Determine whether this class has a non-literal or/ volatile type non-static data member or base class...
void setHasObjectMember(bool val)
A set of unresolved declarations.
RecordDecl * getDecl() const
FunctionDecl * getTemplateInstantiationPattern() const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
bool isVariadic() const
Whether this function is variadic.
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
base_class_iterator bases_begin()
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Namespace)
ArrayRef< BindingDecl * > bindings() const
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
Represents a linkage specification.
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
StringRef getLambdaStaticInvokerName()
detail::InMemoryDirectory::const_iterator I
NamedDecl * getDecl() const
A binding in a decomposition declaration.
bool isLambdaToBlockPointerConversion() const
Determine whether this conversion function is a conversion from a lambda closure type to a block poin...
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.
shadow_iterator shadow_end() const
bool isDefined(const FunctionDecl *&Definition) const
isDefined - Returns true if the function is defined at all, including a deleted definition.
bool isAbstract() const
Determine whether this class has a pure virtual function.
field_iterator field_end() const
CXXRecordDecl(Kind K, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl)
static CXXDeductionGuideDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setBases(CXXBaseSpecifier const *const *Bases, unsigned NumBases)
Sets the base classes of this struct or class.
TypeLoc getBaseClassLoc() const
If this is a base class initializer, returns the type of the base class with location information...
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
bool hasCopyConstructorWithConstParam() const
Determine whether this class has a copy constructor with a parameter type which is a reference to a c...
A little helper class used to produce diagnostics.
bool hasIrrelevantDestructor() const
Determine whether this class has a destructor which has no semantic effect.
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
bool isParameterPack() const
Determine whether this parameter is actually a function parameter pack.
DeclarationNameTable DeclarationNames
bool isGenericLambda() const
Determine whether this class describes a generic lambda function object (i.e.
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
static StaticAssertDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *Message, SourceLocation RParenLoc, bool Failed)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
const CXXMethodDecl *const * method_iterator
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
static CXXDestructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isImplicitlyDeclared)
static bool recursivelyOverrides(const CXXMethodDecl *DerivedMD, const CXXMethodDecl *BaseMD)
bool isMoveConstructor() const
Determine whether this constructor is a move constructor (C++11 [class.copy]p3), which can be used to...
bool isDeleted() const
Whether this function has been deleted.
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
unsigned getTypeQualifiers() const
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
static LinkageSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
ASTContext & getParentASTContext() const
conversion_iterator conversion_end() const
static UnresolvedUsingValueDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, SourceLocation EllipsisLoc)
Represents a C++ destructor within a class.
const ParmVarDecl * getParamDecl(unsigned i) const
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
DeclContext * getDeclContext()
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
Defines the clang::TypeLoc interface and its subclasses.
static CanQualType GetConversionType(ASTContext &Context, NamedDecl *Conv)
SourceLocation getMemberLocation() const
bool isExplicit() const
Whether this function is explicit.
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)
StorageClass
Storage classes.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isCopyConstructor() const
Whether this constructor is a copy constructor (C++ [class.copy]p2, which can be used to copy the cla...
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
An lvalue reference type, per C++11 [dcl.ref].
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
Represents a C++ deduction guide declaration.
void setDescribedClassTemplate(ClassTemplateDecl *Template)
Represents a C++ conversion function within a class.
The result type of a method or function.
static UsingDirectiveDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
bool hasNonTrivialCopyAssignment() const
Determine whether this class has a non-trivial copy assignment operator (C++ [class.copy]p11, C++11 [class.copy]p25)
bool hasUninitializedReferenceMember() const
Whether this class or any of its subobjects has any members of reference type which would make value-...
FunctionDecl * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
DeclarationNameInfo getNameInfo() const
Abstract interface for external sources of AST nodes.
bool doesThisDeclarationHaveABody() const
doesThisDeclarationHaveABody - Returns whether this specific declaration of the function has a body -...
static UsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
NamespaceDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
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.
void setOperatorDelete(FunctionDecl *OD)
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
unsigned getNumParams() const
getNumParams - Return the number of parameters this function must have based on its FunctionType...
static DecompositionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation LSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl * > Bindings)
method_iterator begin_overridden_methods() const
FieldDecl * getAnyMember() const
OverloadedOperatorKind getCXXOverloadedOperator() const
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e...
bool hasSimpleMoveConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous move constructor that ...
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
ASTContext & getASTContext() const LLVM_READONLY
unsigned size_overridden_methods() const
static DecompositionDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumBindings)
Represents a dependent using declaration which was not marked with typename.
bool mayBeAbstract() const
Determine whether this class may end up being abstract, even though it is not yet known to be abstrac...
bool hasSimpleCopyConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous copy constructor that ...
void removeShadowDecl(UsingShadowDecl *S)
std::vector< const UsingDecl * > UsingDecls
Represents a static or instance method of a struct/union/class.
SourceLocation getSourceLocation() const
Determine the source location of the initializer.
const CXXRecordDecl * getBestDynamicClassType() const
For an expression of class type or pointer to class type, return the most derived class decl the expr...
void addOverriddenMethod(const CXXMethodDecl *MD)
bool isCopyOrMoveConstructor() const
Determine whether this a copy or move constructor.
bool hasInlineBody() 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...
ASTContext::overridden_method_range overridden_method_range
void addDecl(NamedDecl *D)
static MSPropertyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static ConstructorUsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool hasVolatileMember() const
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
static ConstructorUsingShadowDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, UsingDecl *Using, NamedDecl *Target, bool IsVirtual)
const T * castAs() const
Member-template castAs<specific type>.
T * get(ExternalASTSource *Source) const
Retrieve the pointer to the AST node that this lazy pointer.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
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...
Represents a C++11 static_assert declaration.
bool hasObjectMember() const
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
CXXMethodDecl * getLambdaStaticInvoker() const
Retrieve the lambda static invoker, the address of which is returned by the conversion operator...
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
bool hasTrivialCopyAssignment() const
Determine whether this class has a trivial copy assignment operator (C++ [class.copy]p11, C++11 [class.copy]p25)
bool hasSimpleDestructor() const
true if we know for sure that this class has an accessible destructor that is not deleted...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
TagTypeKind
The kind of a tag type.
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
static bool isStaticOverloadedOperator(OverloadedOperatorKind OOK)
Returns true if the given operator is implicitly static in a record context.
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)
static CXXConversionDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setHasVolatileMember(bool val)
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
AccessSpecifier getAccessSpecifier() const
Returns the access specifier for this base specifier.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
bool hasSimpleMoveAssignment() const
true if we know for sure that this class has a single, accessible, unambiguous move assignment operat...
bool hasVariantMembers() const
Determine whether this class has any variant members.
bool isInvalidDecl() const
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
void removeConversion(const NamedDecl *Old)
Removes a conversion function from this class.
A decomposition declaration.
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
IdentifierNamespace
IdentifierNamespace - The different namespaces in which declarations may appear.
Represents a dependent using declaration which was marked with typename.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
void AddCXXRecordDecl(const CXXRecordDecl *Record)
static UsingDirectiveDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation NamespaceLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Nominated, DeclContext *CommonAncestor)
bool hasTrivialDefaultConstructor() const
Determine whether this class has a trivial default constructor (C++11 [class.ctor]p5).
DeclarationName - The name of a declaration.
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)
bool hasTrivialMoveConstructor() const
Determine whether this class has a trivial move constructor (C++11 [class.copy]p12) ...
detail::InMemoryDirectory::const_iterator E
static UsingPackDecl * Create(ASTContext &C, DeclContext *DC, NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl * > UsingDecls)
A pointer to member type per C++ 8.3.3 - Pointers to members.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool isLValueReferenceType() const
bool hasAnyDependentBases() const
Determine whether this class has any dependent base classes which are not the current instantiation...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
bool isLambda() const
Determine whether this class describes a lambda function object.
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 isRValueReferenceType() const
unsigned MayHaveOutOfDateDef
Indicates whether it is possible for declarations of this kind to have an out-of-date definition...
static AccessSpecifier MergeAccess(AccessSpecifier PathAccess, AccessSpecifier DeclAccess)
Calculates the access of a decl that is reached along a path.
bool hasTrivialMoveAssignment() const
Determine whether this class has a trivial move assignment operator (C++11 [class.copy]p25)
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
const T * getAs() const
Member-template getAs<specific type>'.
CXXMethodDecl * getDevirtualizedMethod(const Expr *Base, bool IsAppleKext)
If it's possible to devirtualize a call to this method, return the called function.
UsingDecl * getUsingDecl() const
Gets the using declaration to which this declaration is tied.
LanguageIDs
Represents the language in a linkage specification.
bool isConvertingConstructor(bool AllowExplicit) const
Whether this constructor is a converting constructor (C++ [class.conv.ctor]), which can be used for u...
An UnresolvedSet-like class which uses the ASTContext's allocator.
static CXXMethodDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isLambdaStaticInvoker() const
Determine whether this is a lambda closure type's static member function that is used for the result ...
Base for LValueReferenceType and RValueReferenceType.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so...
static CXXMethodDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInline, bool isConstexpr, SourceLocation EndLocation)
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
Represents a base class of a C++ class.
unsigned IsBeingDefined
IsBeingDefined - True if this is currently being defined.
bool isAnyMemberInitializer() const
QualType getPointeeType() const
TemplateParameterList * getGenericLambdaTemplateParameterList() const
Retrieve the generic lambda's template parameter list.
static BindingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id)
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
bool hasNonTrivialObjCLifetime() const
bool isObjCGCStrong() const
true when Type is objc's strong.
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
bool hasNonTrivialMoveConstructor() const
Determine whether this class has a non-trivial move constructor (C++11 [class.copy]p12) ...
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Represents a C++ struct/union/class.
bool isTriviallyCopyable() const
Determine whether this class is considered trivially copyable per (C++11 [class]p6).
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()
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
static UsingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
Declaration of a class template.
StringLiteral - This represents a string literal expression, e.g.
Kind
Lists the kind of concrete classes of Decl.
const Expr * getBestDynamicClassTypeExpr() const
Get the inner expression that determines the best dynamic class.
static UsingPackDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumExpansions)
bool isStandardLayout() const
Determine whether this class has standard layout per (C++ [class]p7)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
conversion_iterator conversion_begin() const
A reference to a declared variable, function, enum, etc.
NamedDecl * getMostRecentDecl()
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
An instance of this class represents the declaration of a property member.
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
NamedDecl - This represents a decl with a name.
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.
void getFinalOverriders(CXXFinalOverriderMap &FinaOverriders) const
Retrieve the final overriders for each virtual member function in the class hierarchy where this clas...
bool isConstQualified() const
Determine whether this type is const-qualified.
Represents C++ using-directive.
bool hasConstexprDefaultConstructor() const
Determine whether this class has a constexpr default constructor.
bool isPolymorphic() const
Whether this class is polymorphic (C++ [class.virtual]), which means that the class contains or inher...
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())
bool isBeingDefined() const
isBeingDefined - Return true if this decl is currently being defined.
base_class_range vbases()
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
overridden_method_range overridden_methods() const
Declaration of a template function.
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...
DeclarationNameInfo getNameInfo() const
bool isPOD() const
Whether this class is a POD-type (C++ [class]p4)
OverloadedOperatorKind getOverloadedOperator() const
getOverloadedOperator - Which C++ overloaded operator this function represents, if any...