15#ifndef LLVM_CLANG_AST_DECLCXX_H
16#define LLVM_CLANG_AST_DECLCXX_H
37#include "llvm/ADT/ArrayRef.h"
38#include "llvm/ADT/DenseMap.h"
39#include "llvm/ADT/PointerIntPair.h"
40#include "llvm/ADT/PointerUnion.h"
41#include "llvm/ADT/STLExtras.h"
42#include "llvm/ADT/TinyPtrVector.h"
43#include "llvm/ADT/iterator_range.h"
44#include "llvm/Support/Casting.h"
45#include "llvm/Support/Compiler.h"
46#include "llvm/Support/PointerLikeTypeTraits.h"
47#include "llvm/Support/TrailingObjects.h"
57class ClassTemplateDecl;
58class ConstructorUsingShadowDecl;
61class CXXConstructorDecl;
62class CXXDestructorDecl;
63class CXXFinalOverriderMap;
64class CXXIndirectPrimaryBaseSet;
66class DecompositionDecl;
68class FunctionTemplateDecl;
70class MemberSpecializationInfo;
73class TemplateParameterList;
92 :
Decl(AccessSpec, DC, ASLoc), ColonLoc(ColonLoc) {
98 virtual void anchor();
157 unsigned Virtual : 1;
163 unsigned BaseOfClass : 1;
173 unsigned InheritConstructors : 1;
185 : Range(R), EllipsisLoc(EllipsisLoc), Virtual(
V), BaseOfClass(BC),
186 Access(A), InheritConstructors(
false), BaseTypeInfo(TInfo) {}
213 InheritConstructors = Inherit;
269 enum SpecialMemberFlags {
270 SMF_DefaultConstructor = 0x1,
271 SMF_CopyConstructor = 0x2,
272 SMF_MoveConstructor = 0x4,
273 SMF_CopyAssignment = 0x8,
274 SMF_MoveAssignment = 0x10,
275 SMF_Destructor = 0x20,
287 struct DefinitionData {
288 #define FIELD(Name, Width, Merge) \
289 unsigned Name : Width;
290 #include "CXXRecordDeclDefinitionBits.def"
293 unsigned IsLambda : 1;
296 unsigned IsParsingBaseSpecifiers : 1;
300 unsigned ComputedVisibleConversions : 1;
302 unsigned HasODRHash : 1;
305 unsigned ODRHash = 0;
308 unsigned NumBases = 0;
311 unsigned NumVBases = 0;
325 LazyASTUnresolvedSet Conversions;
332 LazyASTUnresolvedSet VisibleConversions;
335 CXXRecordDecl *Definition;
343 DefinitionData(CXXRecordDecl *D);
346 CXXBaseSpecifier *getBases()
const {
347 if (!Bases.isOffset())
348 return Bases.get(
nullptr);
349 return getBasesSlowCase();
353 CXXBaseSpecifier *getVBases()
const {
354 if (!VBases.isOffset())
355 return VBases.get(
nullptr);
356 return getVBasesSlowCase();
359 ArrayRef<CXXBaseSpecifier> bases()
const {
363 ArrayRef<CXXBaseSpecifier> vbases()
const {
368 CXXBaseSpecifier *getBasesSlowCase()
const;
369 CXXBaseSpecifier *getVBasesSlowCase()
const;
372 struct DefinitionData *DefinitionData;
375 struct LambdaDefinitionData :
public DefinitionData {
376 using Capture = LambdaCapture;
386 unsigned DependencyKind : 2;
389 unsigned IsGenericLambda : 1;
392 unsigned CaptureDefault : 2;
395 unsigned NumCaptures : 15;
398 unsigned NumExplicitCaptures : 13;
401 unsigned HasKnownInternalLinkage : 1;
405 unsigned ManglingNumber : 31;
417 llvm::TinyPtrVector<Capture*> Captures;
420 TypeSourceInfo *MethodTyInfo;
422 LambdaDefinitionData(CXXRecordDecl *D, TypeSourceInfo *Info,
unsigned DK,
424 : DefinitionData(D), DependencyKind(DK), IsGenericLambda(IsGeneric),
425 CaptureDefault(CaptureDefault), NumCaptures(0),
426 NumExplicitCaptures(0), HasKnownInternalLinkage(0), ManglingNumber(0),
433 PlainOldData =
false;
437 void AddCaptureList(ASTContext &Ctx, Capture *CaptureList);
440 struct DefinitionData *dataPtr()
const {
443 return DefinitionData;
446 struct DefinitionData &data()
const {
447 auto *DD = dataPtr();
448 assert(DD &&
"queried property of class with no definition");
452 struct LambdaDefinitionData &getLambdaData()
const {
455 auto *DD = DefinitionData;
456 assert(DD && DD->IsLambda &&
"queried lambda property of non-lambda class");
457 return static_cast<LambdaDefinitionData&
>(*DD);
469 llvm::PointerUnion<ClassTemplateDecl *, MemberSpecializationInfo *>
470 TemplateOrInstantiation;
474 void addedClassSubobject(CXXRecordDecl *
Base);
481 void addedMember(Decl *D);
483 void markedVirtualFunctionPure();
487 FriendDecl *getFirstFriend()
const;
492 bool hasSubobjectAtOffsetZeroOfEmptyBaseType(ASTContext &Ctx,
493 const CXXRecordDecl *
X);
497 SourceLocation StartLoc, SourceLocation IdLoc,
498 IdentifierInfo *
Id, CXXRecordDecl *PrevDecl);
516 return cast_or_null<CXXRecordDecl>(
525 return cast<CXXRecordDecl>(
551 auto *DD = DefinitionData ? DefinitionData : dataPtr();
552 return DD ? DD->Definition :
nullptr;
561 bool DelayTypeCreation =
false);
564 unsigned DependencyKind,
bool IsGeneric,
569 return data().Polymorphic || data().NumVBases != 0;
587 return data().IsParsingBaseSpecifiers;
600 llvm::iterator_range<base_class_const_iterator>;
642 llvm::iterator_range<specific_decl_iterator<CXXMethodDecl>>;
662 llvm::iterator_range<specific_decl_iterator<CXXConstructorDecl>>;
676 class friend_iterator;
686 return data().FirstFriend.isValid();
693 (data().DeclaredSpecialMembers & SMF_CopyConstructor)) &&
694 "this property has not yet been computed by Sema");
695 return data().DefaultedCopyConstructorIsDeleted;
702 (data().DeclaredSpecialMembers & SMF_MoveConstructor)) &&
703 "this property has not yet been computed by Sema");
704 return data().DefaultedMoveConstructorIsDeleted;
710 (data().DeclaredSpecialMembers & SMF_Destructor)) &&
711 "this property has not yet been computed by Sema");
712 return data().DefaultedDestructorIsDeleted;
719 !data().DefaultedCopyConstructorIsDeleted;
726 !data().DefaultedMoveConstructorIsDeleted;
733 !data().DefaultedCopyAssignmentIsDeleted;
740 !data().DefaultedMoveAssignmentIsDeleted;
747 !data().DefaultedDestructorIsDeleted;
752 return (data().DeclaredSpecialMembers & SMF_DefaultConstructor) ||
761 return (!data().UserDeclaredConstructor &&
762 !(data().DeclaredSpecialMembers & SMF_DefaultConstructor) &&
767 (data().HasInheritedDefaultConstructor &&
768 !(data().DeclaredSpecialMembers & SMF_DefaultConstructor));
775 return data().UserDeclaredConstructor;
781 return data().UserProvidedDefaultConstructor;
788 return data().UserDeclaredSpecialMembers & SMF_CopyConstructor;
794 return !(data().DeclaredSpecialMembers & SMF_CopyConstructor);
806 if (data().UserDeclaredSpecialMembers &
807 (SMF_MoveConstructor | SMF_MoveAssignment))
809 return data().NeedOverloadResolutionForCopyConstructor;
815 return data().ImplicitCopyConstructorCanHaveConstParamForNonVBase &&
817 data().ImplicitCopyConstructorCanHaveConstParamForVBase);
823 return data().HasDeclaredCopyConstructorWithConstParam ||
834 return data().UserDeclaredSpecialMembers &
835 (SMF_MoveConstructor | SMF_MoveAssignment);
841 return data().UserDeclaredSpecialMembers & SMF_MoveConstructor;
846 return (data().DeclaredSpecialMembers & SMF_MoveConstructor) ||
853 assert((data().DefaultedCopyConstructorIsDeleted ||
855 "Copy constructor should not be deleted");
856 data().DefaultedCopyConstructorIsDeleted =
true;
862 assert((data().DefaultedMoveConstructorIsDeleted ||
864 "move constructor should not be deleted");
865 data().DefaultedMoveConstructorIsDeleted =
true;
871 assert((data().DefaultedDestructorIsDeleted ||
873 "destructor should not be deleted");
874 data().DefaultedDestructorIsDeleted =
true;
880 return !(data().DeclaredSpecialMembers & SMF_MoveConstructor) &&
890 return data().NeedOverloadResolutionForMoveConstructor;
898 return data().UserDeclaredSpecialMembers & SMF_CopyAssignment;
904 assert((data().DefaultedCopyAssignmentIsDeleted ||
906 "copy assignment should not be deleted");
907 data().DefaultedCopyAssignmentIsDeleted =
true;
913 return !(data().DeclaredSpecialMembers & SMF_CopyAssignment);
925 if (data().UserDeclaredSpecialMembers &
926 (SMF_MoveConstructor | SMF_MoveAssignment))
928 return data().NeedOverloadResolutionForCopyAssignment;
934 return data().ImplicitCopyAssignmentHasConstParam;
941 return data().HasDeclaredCopyAssignmentWithConstParam ||
949 return data().UserDeclaredSpecialMembers & SMF_MoveAssignment;
954 return (data().DeclaredSpecialMembers & SMF_MoveAssignment) ||
961 assert((data().DefaultedMoveAssignmentIsDeleted ||
963 "move assignment should not be deleted");
964 data().DefaultedMoveAssignmentIsDeleted =
true;
971 return !(data().DeclaredSpecialMembers & SMF_MoveAssignment) &&
982 return data().NeedOverloadResolutionForMoveAssignment;
989 return data().UserDeclaredSpecialMembers & SMF_Destructor;
995 return !(data().DeclaredSpecialMembers & SMF_Destructor);
1001 return data().NeedOverloadResolutionForDestructor;
1007 auto *DD = DefinitionData;
1008 return DD && DD->IsLambda;
1084 LambdaDefinitionData &LambdaData = getLambdaData();
1085 return LambdaData.Captures.empty() ? nullptr : LambdaData.Captures.front();
1117 llvm::iterator_range<conversion_iterator>
1141 data().HasUninitializedReferenceMember;
1152 bool isPOD()
const {
return data().PlainOldData; }
1177 return data().HasPrivateFields;
1181 return data().HasProtectedFields;
1187 return D.HasPublicFields || D.HasProtectedFields || D.HasPrivateFields;
1220 (data().HasTrivialSpecialMembers & SMF_DefaultConstructor);
1226 return (data().DeclaredNonTrivialSpecialMembers & SMF_DefaultConstructor) ||
1228 !(data().HasTrivialSpecialMembers & SMF_DefaultConstructor));
1234 return data().HasConstexprNonCopyMoveConstructor ||
1242 return data().DefaultedDefaultConstructorIsConstexpr &&
1249 return data().HasConstexprDefaultConstructor ||
1257 return data().HasTrivialSpecialMembers & SMF_CopyConstructor;
1261 return data().HasTrivialSpecialMembersForCall & SMF_CopyConstructor;
1267 return data().DeclaredNonTrivialSpecialMembers & SMF_CopyConstructor ||
1272 return (data().DeclaredNonTrivialSpecialMembersForCall &
1273 SMF_CopyConstructor) ||
1281 (data().HasTrivialSpecialMembers & SMF_MoveConstructor);
1286 (data().HasTrivialSpecialMembersForCall & SMF_MoveConstructor);
1292 return (data().DeclaredNonTrivialSpecialMembers & SMF_MoveConstructor) ||
1294 !(data().HasTrivialSpecialMembers & SMF_MoveConstructor));
1298 return (data().DeclaredNonTrivialSpecialMembersForCall &
1299 SMF_MoveConstructor) ||
1301 !(data().HasTrivialSpecialMembersForCall & SMF_MoveConstructor));
1307 return data().HasTrivialSpecialMembers & SMF_CopyAssignment;
1313 return data().DeclaredNonTrivialSpecialMembers & SMF_CopyAssignment ||
1321 (data().HasTrivialSpecialMembers & SMF_MoveAssignment);
1327 return (data().DeclaredNonTrivialSpecialMembers & SMF_MoveAssignment) ||
1329 !(data().HasTrivialSpecialMembers & SMF_MoveAssignment));
1335 return data().DefaultedDestructorIsConstexpr &&
1345 return data().HasTrivialSpecialMembers & SMF_Destructor;
1349 return data().HasTrivialSpecialMembersForCall & SMF_Destructor;
1355 return !(data().HasTrivialSpecialMembers & SMF_Destructor);
1359 return !(data().HasTrivialSpecialMembersForCall & SMF_Destructor);
1363 data().HasTrivialSpecialMembersForCall =
1364 (SMF_CopyConstructor | SMF_MoveConstructor | SMF_Destructor);
1370 return !data().HasUninitializedFields ||
1371 !(data().HasDefaultedDefaultConstructor ||
1381 return data().HasIrrelevantDestructor;
1387 return data().HasNonLiteralTypeFieldsOrBases;
1393 return data().HasInheritedConstructor;
1399 return data().HasInheritedAssignment;
1436 (!
isLambda() || LangOpts.CPlusPlus17) &&
1445 return isLiteral() && data().StructuralIfLiteral;
1535 return RD->isLocalClass();
1652 bool LookupInDependent =
false)
const;
1697 std::vector<const NamedDecl *>
1699 llvm::function_ref<
bool(
const NamedDecl *ND)> Filter);
1710 assert(DeclAccess !=
AS_none);
1712 return (PathAccess > DeclAccess ? PathAccess : DeclAccess);
1753 assert(
isLambda() &&
"Not a lambda closure type!");
1754 return getLambdaData().ManglingNumber;
1760 assert(
isLambda() &&
"Not a lambda closure type!");
1761 return getLambdaData().HasKnownInternalLinkage;
1778 bool HasKnownInternalLinkage =
false) {
1779 assert(
isLambda() &&
"Not a lambda closure type!");
1780 getLambdaData().ManglingNumber = ManglingNumber;
1781 getLambdaData().ContextDecl = ContextDecl;
1782 getLambdaData().HasKnownInternalLinkage = HasKnownInternalLinkage;
1831 return getLambdaData().DependencyKind;
1835 return getLambdaData().MethodTyInfo;
1839 assert(DefinitionData && DefinitionData->IsLambda &&
1840 "setting lambda property of non-lambda class");
1841 auto &DL =
static_cast<LambdaDefinitionData &
>(*DefinitionData);
1842 DL.MethodTyInfo = TS;
1846 assert(DefinitionData && DefinitionData->IsLambda &&
1847 "setting lambda property of non-lambda class");
1848 auto &DL =
static_cast<LambdaDefinitionData &
>(*DefinitionData);
1849 DL.IsGenericLambda = IsGeneric;
1858 return K >= firstCXXRecord && K <= lastCXXRecord;
1866 llvm::PointerIntPair<Expr *, 2, ExplicitSpecKind> ExplicitSpec{
1880 ExplicitSpec.getPointer();
1896 !ExplicitSpec.getPointer();
1921 void anchor()
override;
1929 :
FunctionDecl(CXXDeductionGuide,
C, DC, StartLoc, NameInfo, T, TInfo,
1931 Ctor(Ctor), ExplicitSpec(ES) {
1998 :
Decl(RequiresExprBody, DC, StartLoc),
DeclContext(RequiresExprBody) {}
2019 void anchor()
override;
2027 Expr *TrailingRequiresClause =
nullptr)
2029 isInline, ConstexprKind, TrailingRequiresClause) {
2040 Expr *TrailingRequiresClause =
nullptr);
2055 return OOK == OO_New || OOK == OO_Array_New || OOK == OO_Delete ||
2056 OOK == OO_Array_Delete;
2081 bool IsAppleKext)
const {
2111 return cast<CXXMethodDecl>(
2127 llvm::TinyPtrVector<const CXXMethodDecl *>::const_iterator>;
2200 bool MayBeBase =
false);
2204 bool MayBeBase =
false)
const {
2212 bool MayBeBase =
false);
2215 bool MayBeBase =
false)
const {
2223 return K >= firstCXXMethod && K <= lastCXXMethod;
2246 llvm::PointerUnion<TypeSourceInfo *, FieldDecl *, IndirectFieldDecl *>
2269 unsigned IsDelegating : 1;
2273 unsigned IsVirtual : 1;
2277 unsigned IsWritten : 1;
2281 unsigned SourceOrder : 13;
2334 return Init->getStmtClass() == Stmt::CXXDefaultInitExprClass;
2352 return MemberOrEllipsisLocation;
2400 return MemberOrEllipsisLocation;
2416 return IsWritten ?
static_cast<int>(SourceOrder) : -1;
2427 assert(!IsWritten &&
2428 "setSourceOrder() used on implicit initializer");
2429 assert(SourceOrder == 0 &&
2430 "calling twice setSourceOrder() on the same initializer");
2432 "setSourceOrder() used to make an initializer implicit");
2434 SourceOrder =
static_cast<unsigned>(Pos);
2453 : Shadow(Shadow), BaseCtor(BaseCtor) {}
2455 explicit operator bool()
const {
return Shadow; }
2473 private llvm::TrailingObjects<CXXConstructorDecl, InheritedConstructor,
2474 ExplicitSpecifier> {
2489 Expr *TrailingRequiresClause);
2491 void anchor()
override;
2493 size_t numTrailingObjects(OverloadToken<InheritedConstructor>)
const {
2496 size_t numTrailingObjects(OverloadToken<ExplicitSpecifier>)
const {
2502 return *getTrailingObjects<ExplicitSpecifier>();
2509 enum TrailingAllocKind {
2510 TAKInheritsConstructor = 1,
2511 TAKHasTailExplicit = 1 << 1,
2514 uint64_t getTrailingAllocKind()
const {
2515 return numTrailingObjects(OverloadToken<InheritedConstructor>()) |
2516 (numTrailingObjects(OverloadToken<ExplicitSpecifier>()) << 1);
2525 uint64_t AllocKind);
2532 Expr *TrailingRequiresClause =
nullptr);
2537 "cannot set this explicit specifier. no trail-allocated space for "
2571 const auto *ConstThis =
this;
2590 std::reverse_iterator<init_const_iterator>;
2618 numCtorInitializers &&
"NumCtorInitializers overflow!");
2622 CtorInitializers = Initializers;
2658 unsigned TypeQuals = 0;
2672 unsigned TypeQuals = 0;
2745 Expr *OperatorDeleteThisArg =
nullptr;
2751 Expr *TrailingRequiresClause =
nullptr)
2752 :
CXXMethodDecl(CXXDestructor,
C, RD, StartLoc, NameInfo, T, TInfo,
2758 void anchor()
override;
2764 bool UsesFPIntrin,
bool isInline,
bool isImplicitlyDeclared,
2766 Expr *TrailingRequiresClause =
nullptr);
2807 Expr *TrailingRequiresClause =
nullptr)
2808 :
CXXMethodDecl(CXXConversion,
C, RD, StartLoc, NameInfo, T, TInfo,
2810 EndLocation, TrailingRequiresClause),
2812 void anchor()
override;
2825 Expr *TrailingRequiresClause =
nullptr);
2868 virtual void anchor();
2975 :
NamedDecl(UsingDirective, DC, IdentLoc, getName()), UsingLoc(UsingLoc),
2976 NamespaceLoc(NamespcLoc), QualifierLoc(QualifierLoc),
2977 NominatedNamespace(Nominated), CommonAncestor(CommonAncestor) {}
2987 void anchor()
override;
3007 return NominatedNamespace;
3080 NamespaceLoc(NamespaceLoc), IdentLoc(IdentLoc),
3081 QualifierLoc(QualifierLoc), Namespace(Namespace) {}
3083 void anchor()
override;
3130 if (
auto *AD = dyn_cast<NamespaceAliasDecl>(Namespace))
3131 return AD->getNamespace();
3133 return cast<NamespaceDecl>(Namespace);
3166 public Mergeable<LifetimeExtendedTemporaryDecl> {
3170 Stmt *ExprWithTemporary =
nullptr;
3175 unsigned ManglingNumber;
3179 virtual void anchor();
3184 ExprWithTemporary(Temp), ExtendingDecl(EDecl),
3185 ManglingNumber(Mangling) {}
3188 :
Decl(
Decl::LifetimeExtendedTemporary, EmptyShell{}) {}
3192 unsigned Mangling) {
3234 return K == Decl::LifetimeExtendedTemporary;
3267 void anchor()
override;
3279 UsingShadowDecl *getMostRecentDeclImpl()
override {
3326 assert(ND &&
"Target decl is null!");
3342 return dyn_cast_or_null<UsingShadowDecl>(UsingOrNextShadow);
3347 return K == Decl::UsingShadow || K == Decl::ConstructorUsingShadow;
3360 llvm::PointerIntPair<UsingShadowDecl *, 1, bool> FirstUsingShadow;
3367 void anchor()
override;
3400 Current = Current->getNextUsingShadowDecl();
3411 return x.Current == y.Current;
3414 return x.Current != y.Current;
3464 UsingLocation(UL), QualifierLoc(QualifierLoc),
3469 void anchor()
override;
3507 bool HasTypenameKeyword);
3550 unsigned IsVirtual : 1;
3554 bool TargetInVirtualBase)
3556 Using->getDeclName(), Using,
3557 Target->getUnderlyingDecl()),
3558 NominatedBaseClassShadowDecl(
3559 dyn_cast<ConstructorUsingShadowDecl>(
Target)),
3560 ConstructedBaseClassShadowDecl(NominatedBaseClassShadowDecl),
3561 IsVirtual(TargetInVirtualBase) {
3565 if (NominatedBaseClassShadowDecl &&
3566 NominatedBaseClassShadowDecl->constructsVirtualBase()) {
3567 ConstructedBaseClassShadowDecl =
3568 NominatedBaseClassShadowDecl->ConstructedBaseClassShadowDecl;
3576 void anchor()
override;
3610 return NominatedBaseClassShadowDecl;
3616 return ConstructedBaseClassShadowDecl;
3626 return cast<CXXRecordDecl>((ConstructedBaseClassShadowDecl
3627 ? ConstructedBaseClassShadowDecl
3659 :
BaseUsingDecl(UsingEnum, DC, NL, DN), UsingLocation(UL), EnumLocation(EL),
3662 void anchor()
override;
3680 return ETL.getQualifierLoc();
3730 private llvm::TrailingObjects<UsingPackDecl, NamedDecl *> {
3736 unsigned NumExpansions;
3741 InstantiatedFrom ? InstantiatedFrom->getLocation()
3743 InstantiatedFrom ? InstantiatedFrom->getDeclName()
3745 InstantiatedFrom(InstantiatedFrom), NumExpansions(UsingDecls.size()) {
3746 std::uninitialized_copy(UsingDecls.begin(), UsingDecls.end(),
3747 getTrailingObjects<NamedDecl *>());
3750 void anchor()
override;
3765 return llvm::ArrayRef(getTrailingObjects<NamedDecl *>(), NumExpansions);
3773 unsigned NumExpansions);
3776 return InstantiatedFrom->getSourceRange();
3798 public Mergeable<UnresolvedUsingValueDecl> {
3819 UsingLocation(UsingLoc), EllipsisLoc(EllipsisLoc),
3820 QualifierLoc(QualifierLoc), DNLoc(NameInfo.
getInfo()) {}
3822 void anchor()
override;
3895 public Mergeable<UnresolvedUsingTypenameDecl> {
3913 :
TypeDecl(UnresolvedUsingTypename, DC, TargetNameLoc, TargetName,
3915 TypenameLocation(TypenameLoc), EllipsisLoc(EllipsisLoc),
3916 QualifierLoc(QualifierLoc) {}
3918 void anchor()
override;
3980 void anchor()
override;
3995 llvm::PointerIntPair<Expr *, 1, bool> AssertExprAndFailed;
4002 :
Decl(StaticAssert, DC, StaticAssertLoc),
4003 AssertExprAndFailed(AssertExpr, Failed), Message(Message),
4004 RParenLoc(RParenLoc) {}
4006 virtual void anchor();
4023 bool isFailed()
const {
return AssertExprAndFailed.getInt(); }
4050 Expr *Binding =
nullptr;
4055 void anchor()
override;
4082 this->Binding = Binding;
4102 private llvm::TrailingObjects<DecompositionDecl, BindingDecl *> {
4104 unsigned NumBindings;
4110 :
VarDecl(Decomposition,
C, DC, StartLoc, LSquareLoc,
nullptr, T, TInfo,
4114 getTrailingObjects<BindingDecl *>());
4116 B->setDecomposedDecl(
this);
4119 void anchor()
override;
4132 unsigned NumBindings);
4135 return llvm::ArrayRef(getTrailingObjects<BindingDecl *>(), NumBindings);
4178 GetterId(Getter), SetterId(Setter) {}
4180 void anchor()
override;
4225 public llvm::FoldingSetNode {
4237 void anchor()
override;
4263 ID.AddInteger(
P.Part1);
4264 ID.AddInteger(
P.Part2);
4265 ID.AddInteger(
P.Part3);
4266 ID.AddInteger(
P.getPart4And5AsUint64());
4281 public Mergeable<UnnamedGlobalConstantDecl>,
4282 public llvm::FoldingSetNode {
4287 void anchor()
override;
4325const StreamingDiagnostic &
operator<<(
const StreamingDiagnostic &DB,
static CompilationDatabasePluginRegistry::Add< FixedCompilationDatabasePlugin > X("fixed-compilation-database", "Reads plain-text flags file")
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the LambdaCapture class.
Defines several types used to describe C++ lambda expressions that are shared between the parser and ...
Defines the clang::LangOptions interface.
Defines an enumeration for C++ overloaded operators.
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
const NestedNameSpecifier * Specifier
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
void Profile(llvm::FoldingSetNodeID &ID) const
profile this value.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Reads an AST files chain containing the contents of a translation unit.
An object for streaming information to a record.
Writes an AST file containing the contents of a translation unit.
Represents an access specifier followed by colon ':'.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static AccessSpecDecl * Create(ASTContext &C, AccessSpecifier AS, DeclContext *DC, SourceLocation ASLoc, SourceLocation ColonLoc)
SourceLocation getColonLoc() const
The location of the colon following the access specifier.
static AccessSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static bool classof(const Decl *D)
static bool classofKind(Kind K)
SourceLocation getAccessSpecifierLoc() const
The location of the access specifier.
void setAccessSpecifierLoc(SourceLocation ASLoc)
Sets the location of the access specifier.
void setColonLoc(SourceLocation CLoc)
Sets the location of the colon.
Iterates through the using shadow declarations associated with this using declaration.
shadow_iterator()=default
reference operator*() const
pointer operator->() const
shadow_iterator & operator++()
std::forward_iterator_tag iterator_category
shadow_iterator(UsingShadowDecl *C)
friend bool operator==(shadow_iterator x, shadow_iterator y)
shadow_iterator operator++(int)
friend bool operator!=(shadow_iterator x, shadow_iterator y)
std::ptrdiff_t difference_type
Represents a C++ declaration that introduces decls from somewhere else.
llvm::iterator_range< shadow_iterator > shadow_range
bool getShadowFlag() const
A bool flag for use by a derived type.
unsigned shadow_size() const
Return the number of shadowed declarations associated with this using declaration.
void addShadowDecl(UsingShadowDecl *S)
shadow_range shadows() const
shadow_iterator shadow_end() const
static bool classofKind(Kind K)
BaseUsingDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N)
shadow_iterator shadow_begin() const
void setShadowFlag(bool V)
A bool flag a derived type may set.
void removeShadowDecl(UsingShadowDecl *S)
static bool classof(const Decl *D)
A binding in a decomposition declaration.
static BindingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
VarDecl * getHoldingVar() const
Get the variable (if any) that holds the value of evaluating the binding.
ValueDecl * getDecomposedDecl() const
Get the decomposition declaration that this binding represents a decomposition of.
Expr * getBinding() const
Get the expression to which this declaration is bound.
static bool classof(const Decl *D)
void setBinding(QualType DeclaredType, Expr *Binding)
Set the binding for this BindingDecl, along with its declared type (which should be a possibly-cv-qua...
void setDecomposedDecl(ValueDecl *Decomposed)
Set the decomposed variable for this BindingDecl.
static bool classofKind(Kind K)
static BindingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id)
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
Represents a base class of a C++ class.
void setInheritConstructors(bool Inherit=true)
Set that this base class's constructors should be inherited.
SourceLocation getBeginLoc() const LLVM_READONLY
AccessSpecifier getAccessSpecifierAsWritten() const
Retrieves the access specifier as written in the source code (which may mean that no access specifier...
CXXBaseSpecifier(SourceRange R, bool V, bool BC, AccessSpecifier A, TypeSourceInfo *TInfo, SourceLocation EllipsisLoc)
SourceLocation getEllipsisLoc() const
For a pack expansion, determine the location of the ellipsis.
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
QualType getType() const
Retrieves the type of the base class.
TypeSourceInfo * getTypeSourceInfo() const
Retrieves the type and source location of the base class.
CXXBaseSpecifier()=default
bool getInheritConstructors() const
Determine whether this base class's constructors get inherited.
bool isPackExpansion() const
Determine whether this base specifier is a pack expansion.
SourceLocation getBaseTypeLoc() const LLVM_READONLY
Get the location at which the base class type was written.
SourceLocation getEndLoc() const LLVM_READONLY
bool isBaseOfClass() const
Determine whether this base class is a base of a class declared with the 'class' keyword (vs.
SourceRange getSourceRange() const LLVM_READONLY
Retrieves the source range that contains the entire base specifier.
AccessSpecifier getAccessSpecifier() const
Returns the access specifier for this base specifier.
Represents a C++ constructor within a class.
init_const_iterator init_end() const
Retrieve an iterator past the last initializer.
init_iterator init_end()
Retrieve an iterator past the last initializer.
std::reverse_iterator< init_iterator > init_reverse_iterator
std::reverse_iterator< init_const_iterator > init_const_reverse_iterator
init_reverse_iterator init_rbegin()
CXXConstructorDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
void setInheritingConstructor(bool isIC=true)
State that this is an implicit constructor synthesized to model a call to a constructor inherited fro...
bool isExplicit() const
Return true if the declaration is already resolved to be explicit.
ExplicitSpecifier getExplicitSpecifier()
init_iterator init_begin()
Retrieve an iterator to the first initializer.
CXXConstructorDecl * getTargetConstructor() const
When this constructor delegates to another, retrieve the target.
static bool classofKind(Kind K)
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
bool isDelegatingConstructor() const
Determine whether this constructor is a delegating constructor.
bool isSpecializationCopyingObject() const
Determine whether this is a member template specialization that would copy the object to itself.
InheritedConstructor getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
bool isMoveConstructor() const
Determine whether this constructor is a move constructor (C++11 [class.copy]p3), which can be used to...
init_const_reverse_iterator init_rbegin() const
void setNumCtorInitializers(unsigned numCtorInitializers)
void setExplicitSpecifier(ExplicitSpecifier ES)
init_const_range inits() const
bool isCopyOrMoveConstructor() const
Determine whether this a copy or move constructor.
static CXXConstructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, ExplicitSpecifier ES, bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, InheritedConstructor Inherited=InheritedConstructor(), Expr *TrailingRequiresClause=nullptr)
init_const_reverse_iterator init_rend() const
bool isInheritingConstructor() const
Determine whether this is an implicit constructor synthesized to model a call to a constructor inheri...
init_reverse_iterator init_rend()
llvm::iterator_range< init_iterator > init_range
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
const ExplicitSpecifier getExplicitSpecifier() const
unsigned getNumCtorInitializers() const
Determine the number of arguments used to initialize the member or base.
llvm::iterator_range< init_const_iterator > init_const_range
bool isConvertingConstructor(bool AllowExplicit) const
Whether this constructor is a converting constructor (C++ [class.conv.ctor]), which can be used for u...
const CXXConstructorDecl * getCanonicalDecl() const
static bool classof(const Decl *D)
void setCtorInitializers(CXXCtorInitializer **Initializers)
bool isCopyConstructor() const
Whether this constructor is a copy constructor (C++ [class.copy]p2, which can be used to copy the cla...
static CXXConstructorDecl * CreateDeserialized(ASTContext &C, unsigned ID, uint64_t AllocKind)
Represents a C++ conversion function within a class.
bool isLambdaToBlockPointerConversion() const
Determine whether this conversion function is a conversion from a lambda closure type to a block poin...
bool isExplicit() const
Return true if the declaration is already resolved to be explicit.
static CXXConversionDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool UsesFPIntrin, bool isInline, ExplicitSpecifier ES, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
static bool classof(const Decl *D)
static bool classofKind(Kind K)
ExplicitSpecifier getExplicitSpecifier()
QualType getConversionType() const
Returns the type that this conversion function is converting to.
void setExplicitSpecifier(ExplicitSpecifier ES)
const CXXConversionDecl * getCanonicalDecl() const
static CXXConversionDecl * CreateDeserialized(ASTContext &C, unsigned ID)
CXXConversionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
const ExplicitSpecifier getExplicitSpecifier() const
Represents a C++ base or member initializer.
FieldDecl * getMember() const
If this is a member initializer, returns the declaration of the non-static data member being initiali...
bool isDelegatingInitializer() const
Determine whether this initializer is creating a delegating constructor.
bool isWritten() const
Determine whether this initializer is explicitly written in the source code.
Expr * getInit() const
Get the initializer.
SourceLocation getRParenLoc() const
SourceLocation getEllipsisLoc() const
SourceLocation getLParenLoc() const
SourceRange getSourceRange() const LLVM_READONLY
Determine the source range covering the entire initializer.
int getSourceOrder() const
Return the source position of the initializer, counting from 0.
SourceLocation getSourceLocation() const
Determine the source location of the initializer.
bool isAnyMemberInitializer() const
bool isPackExpansion() const
Determine whether this initializer is a pack expansion.
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
bool isMemberInitializer() const
Determine whether this initializer is initializing a non-static data member.
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
void setSourceOrder(int Pos)
Set the source order of this initializer.
bool isIndirectMemberInitializer() const
int64_t getID(const ASTContext &Context) const
bool isInClassMemberInitializer() const
Determine whether this initializer is an implicit initializer generated for a field with an initializ...
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
SourceLocation getMemberLocation() const
FieldDecl * getAnyMember() const
IndirectFieldDecl * getIndirectMember() const
TypeLoc getBaseClassLoc() const
If this is a base class initializer, returns the type of the base class with location information.
bool isBaseVirtual() const
Returns whether the base is virtual or not.
Represents a C++ deduction guide declaration.
bool isExplicit() const
Return true if the declaration is already resolved to be explicit.
CXXConstructorDecl * getCorrespondingConstructor() const
Get the constructor from which this deduction guide was generated, if this is an implicit deduction g...
void setIsCopyDeductionCandidate(bool isCDC=true)
ExplicitSpecifier getExplicitSpecifier()