Lines Matching +full:dc +full:- +full:id

1 //===- Decl.h - Classes for representing declarations -----------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
128 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
133 static TranslationUnitDecl *castFromDeclContext(const DeclContext *DC) { in castFromDeclContext() argument
134 return static_cast<TranslationUnitDecl *>(const_cast<DeclContext*>(DC)); in castFromDeclContext()
156 static PragmaCommentDecl *Create(const ASTContext &C, TranslationUnitDecl *DC,
160 static PragmaCommentDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID,
168 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
191 TranslationUnitDecl *DC,
195 CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NameValueSize);
201 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
234 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
239 static ExternCContextDecl *castFromDeclContext(const DeclContext *DC) { in castFromDeclContext() argument
240 return static_cast<ExternCContextDecl *>(const_cast<DeclContext*>(DC)); in castFromDeclContext()
252 /// constructor, Objective-C selector, etc.)
261 NamedDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N) in NamedDecl() argument
262 : Decl(DK, DC, L), Name(N) {} in NamedDecl()
269 /// Objective-C selector, etc.).
278 return getIdentifier() ? getIdentifier()->getName() : ""; in getName()
281 /// Get a human-readable name for the declaration, even if it is one of the
282 /// special kinds of names (C++ constructor, Objective-C selector, etc).
294 /// Pretty-print the unqualified name of this declaration. Can be overloaded
295 /// by derived classes to provide a more user-friendly name when appropriate.
303 /// Note that generally in diagnostics, the non-null \p NamedDecl* itself
313 /// the template arguments if any, and to provide a user-friendly name for
320 /// Returns a human-readable qualified name for this declaration, like
331 /// Print only the nested name specifier part of a fully-qualified name,
342 /// Appends a human-readable name for this declaration into the given stream.
352 /// Determine whether this declaration, if known to be well-formed within
361 /// than \p OldD (for instance, if this declaration is newly-created).
373 const DeclContext *DC = getDeclContext(); in isCXXClassMember() local
378 if (isa<EnumDecl>(DC)) in isCXXClassMember()
379 DC = DC->getRedeclContext(); in isCXXClassMember()
381 return DC->isRecord(); in isCXXClassMember()
433 /// Do an LV computation for, ultimately, a non-type declaration.
463 // Fast-path the common case. in getUnderlyingDecl()
464 if (this->getKind() != UsingShadow && in getUnderlyingDecl()
465 this->getKind() != ConstructorUsingShadow && in getUnderlyingDecl()
466 this->getKind() != ObjCCompatibleAlias && in getUnderlyingDecl()
467 this->getKind() != NamespaceAlias) in getUnderlyingDecl()
473 return const_cast<NamedDecl*>(this)->getUnderlyingDecl(); in getUnderlyingDecl()
477 return cast<NamedDecl>(static_cast<Decl *>(this)->getMostRecentDecl()); in getMostRecentDecl()
480 return const_cast<NamedDecl*>(this)->getMostRecentDecl(); in getMostRecentDecl()
485 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
509 LabelDecl(DeclContext *DC, SourceLocation IdentL, IdentifierInfo *II, in LabelDecl() argument
511 : NamedDecl(Label, DC, IdentL, II), TheStmt(S), LocStart(StartL) {} in LabelDecl()
516 static LabelDecl *Create(ASTContext &C, DeclContext *DC,
518 static LabelDecl *Create(ASTContext &C, DeclContext *DC,
521 static LabelDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
540 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
558 NamespaceDecl(ASTContext &C, DeclContext *DC, bool Inline,
560 IdentifierInfo *Id, NamespaceDecl *PrevDecl, bool Nested);
572 static NamespaceDecl *Create(ASTContext &C, DeclContext *DC, bool Inline,
574 IdentifierInfo *Id, NamespaceDecl *PrevDecl,
577 static NamespaceDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
623 // non-transparent parent context. in isRedundantInlineQualifierFor()
624 auto Y = getParent()->getNonTransparentContext()->lookup(Name); in isRedundantInlineQualifierFor()
631 return getFirstDecl()->AnonymousNamespace; in getAnonymousNamespace()
635 getFirstDecl()->AnonymousNamespace = D; in setAnonymousNamespace()
652 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
657 static NamespaceDecl *castFromDeclContext(const DeclContext *DC) { in castFromDeclContext() argument
658 return static_cast<NamespaceDecl *>(const_cast<DeclContext*>(DC)); in castFromDeclContext()
673 ValueDecl(Kind DK, DeclContext *DC, SourceLocation L, in ValueDecl() argument
675 : NamedDecl(DK, DC, L, N), DeclType(T) {} in ValueDecl()
681 /// Determine whether this symbol is weakly-imported,
682 /// or declared with the weak or weak-ref attr.
685 /// Whether this variable is the implicit variable for a lambda init-capture.
694 return const_cast<ValueDecl *>(this)->getPotentiallyDecomposedVarDecl(); in getPotentiallyDecomposedVarDecl()
698 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
703 /// name qualifier, to be used for the case of out-of-line declarations.
709 /// against the template-ids occurring into the NNS and possibly (in the
713 /// A new-allocated array of size NumTemplParamLists,
716 /// against the template-ids occurring into the NNS and possibly (in the
732 // A struct representing a TInfo, a trailing requires-clause and a syntactic
733 // qualifier, to be used for the (uncommon) case of out-of-line declarations
751 DeclaratorDecl(Kind DK, DeclContext *DC, SourceLocation L, in DeclaratorDecl() argument
754 : ValueDecl(DK, DC, L, N, T), DeclInfo(TInfo), InnerLocStart(StartL) {} in DeclaratorDecl()
762 ? getExtInfo()->TInfo in getTypeSourceInfo()
768 getExtInfo()->TInfo = TI; in setTypeSourceInfo()
787 /// Retrieve the nested-name-specifier that qualifies the name of this
790 return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier() in getQualifier()
794 /// Retrieve the nested-name-specifier (with source-location
798 return hasExtInfo() ? getExtInfo()->QualifierLoc in getQualifierLoc()
804 /// \brief Get the constraint-expression introduced by the trailing
805 /// requires-clause in the function/member declaration, or null if no
806 /// requires-clause was provided.
808 return hasExtInfo() ? getExtInfo()->TrailingRequiresClause in getTrailingRequiresClause()
813 return hasExtInfo() ? getExtInfo()->TrailingRequiresClause in getTrailingRequiresClause()
820 return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0; in getNumTemplateParameterLists()
825 return getExtInfo()->TemplParamLists[index]; in getTemplateParameterList()
835 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
858 /// whether running the destructor on the initial value is a side-effect
861 /// non-trivial.
883 /// C-style initialization with assignment
886 /// Call-style initialization (C++98)
889 /// Direct list-initialization (C++11)
892 /// Parenthesized list-initialization (C++20)
896 /// Kinds of thread-local storage.
901 /// TLS with a known-constant initializer.
943 /// Whether this variable is an ARC pseudo-__strong variable; see
1015 /// or an Objective-C @catch statement.
1025 /// Whether this variable is the for-range-declaration in a C++0x
1026 /// for-range statement.
1030 /// Whether this variable is the for-in loop declaration in Objective-C.
1047 /// init-capture.
1076 VarDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
1077 SourceLocation IdLoc, const IdentifierInfo *Id, QualType T,
1105 static VarDecl *Create(ASTContext &C, DeclContext *DC,
1107 const IdentifierInfo *Id, QualType T,
1110 static VarDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
1130 /// Returns true if a variable with function scope is a non-static local
1136 // accessed inside a kernel(s) as read-only variables. As such, variables in hasLocalStorage()
1204 if (const DeclContext *DC = getLexicalDeclContext()) in isLocalVarDecl() local
1205 return DC->getRedeclContext()->isFunctionOrMethod(); in isLocalVarDecl()
1218 const DeclContext *DC = getLexicalDeclContext()->getRedeclContext(); in isFunctionOrMethodVarDecl() local
1219 return DC->isFunctionOrMethod() && DC->getDeclKind() != Decl::Block; in isFunctionOrMethodVarDecl()
1233 return getKind() != Decl::ParmVar && getDeclContext()->isRecord(); in isStaticDataMember()
1238 return const_cast<VarDecl*>(this)->getCanonicalDecl(); in getCanonicalDecl()
1270 return const_cast<VarDecl*>(this)->getActingDefinition(); in getActingDefinition()
1276 return const_cast<VarDecl*>(this)->getDefinition(C); in getDefinition()
1282 return const_cast<VarDecl*>(this)->getDefinition(); in getDefinition()
1285 /// Determine whether this is or was instantiated from an out-of-line
1295 if (getLexicalDeclContext()->getRedeclContext()->isFileContext()) in isFileVarDecl()
1317 return const_cast<VarDecl *>(this)->getInit(); in getInit()
1328 /// the in-class declaration.
1331 return const_cast<VarDecl *>(this)->getInitializingDeclaration(); in getInitializingDeclaration()
1340 /// "potentially-constant" variable.
1361 /// Return the already-evaluated value of this variable's
1399 /// C-style initialization is "int x = 1;". Call-style initialization is
1400 /// a C++98 direct-initializer, e.g. "int x(1);". The Init expression will be
1402 /// expression for class types. List-style initialization is C++11 syntax,
1405 /// C-style, "int x({1})" is call-style, and "int x{1};" is list-style; the
1411 /// Whether the initializer is a direct-initializer (list or call).
1434 /// C++ catch statememt or an Objective-C \@catch statement.
1447 /// non-volatile local variables of class type as NRVO objects. These
1461 /// Determine whether this variable is the for-range-declaration in
1462 /// a C++0x for-range statement.
1471 /// Determine whether this variable is a for-loop declaration for a
1472 /// for-in statement in Objective-C.
1481 /// Determine whether this variable is an ARC pseudo-__strong variable. A
1482 /// pseudo-__strong variable has a __strong-qualified type but does not
1486 /// if its 'self' in a non-init method, or 3) if its the variable in an for-in
1518 /// Whether this variable is the implicit variable for a lambda init-capture.
1528 /// init-capture pack.
1569 /// be instantiated, if it is an instantiation (rather than a non-template).
1584 /// for an instantiation of a class-scope explicit specialization.
1651 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
1659 /// Parameter for Objective-C 'self' argument
1662 /// Parameter for Objective-C '_cmd' argument
1686 static ImplicitParamDecl *Create(ASTContext &C, DeclContext *DC,
1687 SourceLocation IdLoc, IdentifierInfo *Id,
1692 static ImplicitParamDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
1694 ImplicitParamDecl(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, in ImplicitParamDecl() argument
1695 const IdentifierInfo *Id, QualType Type, in ImplicitParamDecl() argument
1697 : VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type, in ImplicitParamDecl()
1704 : VarDecl(ImplicitParam, C, /*DC=*/nullptr, SourceLocation(), in ImplicitParamDecl()
1705 SourceLocation(), /*Id=*/nullptr, Type, in ImplicitParamDecl()
1717 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
1728 ParmVarDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, in ParmVarDecl() argument
1729 SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, in ParmVarDecl() argument
1731 : VarDecl(DK, C, DC, StartLoc, IdLoc, Id, T, TInfo, S) { in ParmVarDecl()
1740 static ParmVarDecl *Create(ASTContext &C, DeclContext *DC,
1742 const IdentifierInfo *Id, QualType T,
1746 static ParmVarDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
1778 return (1u << NumScopeDepthOrObjCQualsBits) - 1; in getMaxFunctionScopeDepth()
1796 /// K&R-style default argument promotion:
1824 return const_cast<ParmVarDecl *>(this)->getDefaultArg(); in getDefaultArg()
1835 return const_cast<ParmVarDecl *>(this)->getUninstantiatedDefaultArg(); in getUninstantiatedDefaultArg()
1884 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
1890 enum { ParameterIndexSentinel = (1 << NumParameterIndexBits) - 1 };
1942 // A non-template function that is an instantiation or explicit
1947 // is a class-scope explicit specialization.
1952 // A non-template function which is in a dependent scope.
2010 /// de-serialized, so it's far better to have the (sometimes-redundant)
2019 /// For non-templates this value will be NULL, unless this declaration was
2050 /// \param InsertPos If non-NULL, the position in the function template
2086 FunctionDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
2121 Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
2128 return FunctionDecl::Create(C, DC, StartLoc, NameInfo, T, TInfo, SC,
2135 Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
2141 static FunctionDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
2156 const auto *FPT = getType()->getAs<FunctionProtoType>(); in getEllipsisLoc()
2157 if (FPT && FPT->isVariadic()) in getEllipsisLoc()
2158 return FPT->getEllipsisLoc(); in getEllipsisLoc()
2167 // - a non defining declaration,
2168 // - a definition. A function may be defined because:
2169 // - it has a body, or will have it in the case of late parsing.
2170 // - it has an uninstantiated body. The body does not exist because the
2173 // - it does not have a user specified body, but it does not allow
2179 /// The function body might be in any of the (re-)declarations of this
2221 return const_cast<FunctionDecl *>(this)->getDefinition(); in getDefinition()
2225 /// in any of the (re-)declarations of this function. The variant that accepts
2229 /// unnecessary AST de-serialization of the body.
2333 /// True if this method is user-declared and was not
2339 return !(DeclAsWritten->isDeleted() || in isUserProvided()
2340 DeclAsWritten->getCanonicalDecl()->isDefaulted()); in isUserProvided()
2351 /// If a more specific implicit return value is required, front-ends
2358 /// If a more specific implicit return value is required, front-ends
2452 /// whose type or lvalue/rvalue-ness would permit the use of a
2455 /// a floating-point number to an Integer type:
2466 return getCanonicalDecl()->FunctionDeclBits.IsDeleted; in isDeleted()
2563 return getCanonicalDecl()->FunctionDeclBits.IsMultiVersion; in isMultiVersion()
2569 getCanonicalDecl()->FunctionDeclBits.IsMultiVersion = V;
2576 ->FunctionDeclBits.FriendConstraintRefersToEnclosingTemplate = V;
2582 ->FunctionDeclBits.FriendConstraintRefersToEnclosingTemplate; in FriendConstraintRefersToEnclosingTemplate()
2611 /// the target-clones functionality.
2615 /// the target-version functionality.
2618 /// \brief Get the associated-constraints of this function declaration.
2620 /// trailing-requires-clause or an empty vector.
2632 ? DefaultedOrDeletedInfo->getDeletedMessage() in getDeletedMessage()
2640 return const_cast<FunctionDecl*>(this)->getCanonicalDecl(); in getCanonicalDecl()
2686 /// Returns the minimum number of non-object arguments needed to call this
2718 return getType()->castAs<FunctionType>()->getReturnType(); in getReturnType()
2736 QualType T = TSI ? TSI->getType() : getType(); in getDeclaredReturnType()
2737 return T->castAs<FunctionType>()->getReturnType(); in getDeclaredReturnType()
2743 QualType T = TSI ? TSI->getType() : getType(); in getExceptionSpecType()
2744 const auto *FPT = T->getAs<FunctionProtoType>(); in getExceptionSpecType()
2745 return FPT ? FPT->getExceptionSpecType() : EST_None; in getExceptionSpecType()
2754 return getType()->castAs<FunctionType>()->getCallResultType( in getCallResultType()
2817 /// This routine will return non-NULL for (non-templated) member
2828 /// The declaration for X<int>::f is a (non-templated) FunctionDecl
2893 /// be instantiated, if it is an instantiation (rather than a non-template
2898 /// corresponding to non-definition portions of the declaration, such as
2936 /// \param InsertPos If non-NULL, the position in the function template
2988 /// Determine whether this is or was instantiated from an out-of-line
2994 /// the corresponding Builtin ID. If the function is not a memory function,
3011 getMostRecentDecl()->getType()->getAs<FunctionProtoType>()) in getFunctionEffects()
3012 return FPT->getFunctionEffects(); in getFunctionEffects()
3017 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
3024 static FunctionDecl *castFromDeclContext(const DeclContext *DC) { in castFromDeclContext() argument
3025 return static_cast<FunctionDecl *>(const_cast<DeclContext*>(DC)); in castFromDeclContext()
3038 /// bit-width.
3042 /// holding the copy-initializer.
3046 /// holding the list-initializer.
3069 /// Storage for either the bit-width, the in-class initializer, or
3074 /// field has an in-class initializer that has not yet been parsed
3076 // FIXME: Tail-allocate this to reduce the size of FieldDecl in the
3090 FieldDecl(Kind DK, DeclContext *DC, SourceLocation StartLoc, in FieldDecl() argument
3091 SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, in FieldDecl() argument
3094 : DeclaratorDecl(DK, DC, IdLoc, Id, T, TInfo, StartLoc), BitField(false), in FieldDecl()
3105 static FieldDecl *Create(const ASTContext &C, DeclContext *DC,
3107 const IdentifierInfo *Id, QualType T,
3111 static FieldDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
3133 /// is a bit field. For non-bitfields, this returns \c nullptr.
3137 return hasInClassInitializer() ? InitAndBitWidth->BitWidth : BitWidth; in getBitWidth()
3141 /// May not be called on non-bitfields.
3144 /// Set the bit-field width for this member.
3158 /// Remove the bit-field width from this member.
3164 auto ExistingInit = InitAndBitWidth->Init; in removeBitWidth()
3170 /// Is this a zero-length bit-field? Such bit-fields aren't really bit-fields
3172 /// bit-fields.
3176 /// zero-length bit-field or a field of empty class type with the
3180 /// Determine if this field is of potentially-overlapping class type, that
3195 /// Determine whether getInClassInitializer() would return a non-null pointer
3198 return hasInClassInitializer() && (BitField ? InitAndBitWidth->Init : Init); in hasNonNullInClassInitializer()
3206 /// Set the C++11 in-class initializer for this member.
3213 /// Remove the C++11 in-class initializer from this member.
3219 Expr *ExistingBitWidth = InitAndBitWidth->BitWidth; in removeInClassInitializer()
3258 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
3275 EnumConstantDecl(const ASTContext &C, DeclContext *DC, SourceLocation L,
3276 IdentifierInfo *Id, QualType T, Expr *E,
3282 static EnumConstantDecl *Create(ASTContext &C, EnumDecl *DC,
3283 SourceLocation L, IdentifierInfo *Id,
3286 static EnumConstantDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
3307 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
3318 IndirectFieldDecl(ASTContext &C, DeclContext *DC, SourceLocation L,
3327 static IndirectFieldDecl *Create(ASTContext &C, DeclContext *DC,
3328 SourceLocation L, const IdentifierInfo *Id,
3332 static IndirectFieldDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
3358 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
3378 TypeDecl(Kind DK, DeclContext *DC, SourceLocation L, const IdentifierInfo *Id,
3380 : NamedDecl(DK, DC, L, Id), LocStart(StartL) {} in NamedDecl() argument
3383 // Low-level accessor. If you just want the type defined by this node,
3400 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
3404 /// Base class for declarations which introduce a typedef-name.
3420 TypedefNameDecl(Kind DK, ASTContext &C, DeclContext *DC, in TypedefNameDecl() argument
3422 const IdentifierInfo *Id, TypeSourceInfo *TInfo) in TypedefNameDecl() argument
3423 : TypeDecl(DK, DC, IdLoc, Id, StartLoc), redeclarable_base(C), in TypedefNameDecl()
3456 return isModed() ? MaybeModedTInfo.getPointer().get<ModedTInfo *>()->first in getTypeSourceInfo()
3461 return isModed() ? MaybeModedTInfo.getPointer().get<ModedTInfo *>()->second in getUnderlyingType()
3464 ->getType(); in getUnderlyingType()
3476 /// Retrieves the canonical declaration of this typedef-name.
3496 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
3505 /// Represents the declaration of a typedef-name via the 'typedef'
3508 TypedefDecl(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, in TypedefDecl() argument
3509 SourceLocation IdLoc, const IdentifierInfo *Id, in TypedefDecl() argument
3511 : TypedefNameDecl(Typedef, C, DC, StartLoc, IdLoc, Id, TInfo) {} in TypedefDecl()
3514 static TypedefDecl *Create(ASTContext &C, DeclContext *DC,
3516 const IdentifierInfo *Id, TypeSourceInfo *TInfo);
3517 static TypedefDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
3522 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
3526 /// Represents the declaration of a typedef-name via a C++11
3527 /// alias-declaration.
3532 TypeAliasDecl(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, in TypeAliasDecl() argument
3533 SourceLocation IdLoc, const IdentifierInfo *Id, in TypeAliasDecl() argument
3535 : TypedefNameDecl(TypeAlias, C, DC, StartLoc, IdLoc, Id, TInfo), in TypeAliasDecl()
3539 static TypeAliasDecl *Create(ASTContext &C, DeclContext *DC,
3541 const IdentifierInfo *Id, TypeSourceInfo *TInfo);
3542 static TypeAliasDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
3550 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
3568 // to be used for the (uncommon) case of out-of-line declarations.
3571 /// If the (out-of-line) tag declaration name
3588 TagDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC,
3589 SourceLocation L, IdentifierInfo *Id, TagDecl *PrevDecl,
3615 /// to have an out-of-date definition.
3650 return const_cast<TagDecl*>(this)->getCanonicalDecl(); in getCanonicalDecl()
3703 /// to have an out-of-date definition.
3771 /// - it is a class or enumeration type that is named (or has a
3775 /// the first typedef-name declared by the declaration to be that
3792 /// Retrieve the nested-name-specifier that qualifies the name of this
3795 return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier() in getQualifier()
3799 /// Retrieve the nested-name-specifier (with source-location
3803 return hasExtInfo() ? getExtInfo()->QualifierLoc in getQualifierLoc()
3810 return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0; in getNumTemplateParameterLists()
3815 return getExtInfo()->TemplParamLists[i]; in getTemplateParameterList()
3825 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
3832 static TagDecl *castFromDeclContext(const DeclContext *DC) { in castFromDeclContext() argument
3833 return static_cast<TagDecl *>(const_cast<DeclContext*>(DC)); in castFromDeclContext()
3837 /// Represents an enum. In C++11, enums can be forward-declared
3838 /// with a fixed underlying type, and in C we allow them to be forward-declared
3862 /// directly, but gcc-style large enumerators (and all enumerators
3876 EnumDecl(ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
3877 SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl,
3886 /// non-negative enumerators of this enum.
3909 /// True if this is an Objective-C, C++11, or
3910 /// Microsoft-style enumeration with a fixed underlying type.
3925 return const_cast<EnumDecl*>(this)->getCanonicalDecl(); in getCanonicalDecl()
3930 static_cast<TagDecl *>(this)->getPreviousDecl()); in getPreviousDecl()
3933 return const_cast<EnumDecl*>(this)->getPreviousDecl(); in getPreviousDecl()
3937 return cast<EnumDecl>(static_cast<TagDecl *>(this)->getMostRecentDecl()); in getMostRecentDecl()
3940 return const_cast<EnumDecl*>(this)->getMostRecentDecl(); in getMostRecentDecl()
3947 static EnumDecl *Create(ASTContext &C, DeclContext *DC,
3949 IdentifierInfo *Id, EnumDecl *PrevDecl,
3952 static EnumDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
3954 /// Overrides to provide correct range when there's an enum-base specifier
3959 /// forward-declared enum. This method is used to mark the
3981 return enumerator_iterator(E->decls_begin()); in enumerator_begin()
3988 return enumerator_iterator(E->decls_end()); in enumerator_end()
4005 return IntegerType.get<TypeSourceInfo*>()->getType().getUnqualifiedType(); in getIntegerType()
4025 /// non-negative enumerators of this enum.
4033 /// ------------------------ ------- -----------------
4034 /// -1 1111111 1
4035 /// -10 1110110 5
4036 /// -101 1001011 8
4052 /// Returns true if this is an Objective-C, C++11, or
4053 /// Microsoft-style enumeration with a fixed underlying type.
4060 // IntegerType is set for fixed type enums and non-fixed but implicitly in isComplete()
4061 // int-sized Microsoft enums. in isComplete()
4078 /// be instantiated, if it is an instantiation (rather than a non-template).
4110 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
4115 /// returned from function calls. This takes into account the target-specific
4116 /// and version-specific rules along with the rules determined by the
4127 /// a non-trivial copy/move constructor (if e.g. the corresponding copy/move
4149 RecordDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC,
4151 IdentifierInfo *Id, RecordDecl *PrevDecl);
4154 static RecordDecl *Create(const ASTContext &C, TagKind TK, DeclContext *DC,
4156 IdentifierInfo *Id, RecordDecl* PrevDecl = nullptr);
4157 static RecordDecl *CreateDeserialized(const ASTContext &C, GlobalDeclID ID);
4161 static_cast<TagDecl *>(this)->getPreviousDecl()); in getPreviousDecl()
4164 return const_cast<RecordDecl*>(this)->getPreviousDecl(); in getPreviousDecl()
4168 return cast<RecordDecl>(static_cast<TagDecl *>(this)->getMostRecentDecl()); in getMostRecentDecl()
4171 return const_cast<RecordDecl*>(this)->getMostRecentDecl(); in getMostRecentDecl()
4218 /// Functions to query basic properties of non-trivial C structs.
4268 /// it must have at least one trivial, non-deleted copy or move constructor.
4342 // the non-static data members of this class, ignoring any static
4354 // Whether there are any fields (non-static data members) in this record.
4362 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
4368 /// be turned on with an attribute, pragma, or -mms-bitfields
4374 /// intra-object-overflow bugs.
4397 FileScopeAsmDecl(DeclContext *DC, StringLiteral *asmstring, in FileScopeAsmDecl() argument
4399 : Decl(FileScopeAsm, DC, StartL), AsmString(asmstring), RParenLoc(EndL) {} in FileScopeAsmDecl()
4404 static FileScopeAsmDecl *Create(ASTContext &C, DeclContext *DC,
4408 static FileScopeAsmDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
4421 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
4428 /// \note This is used in libInterpreter, clang -cc1 -fincremental-extensions
4429 /// and in tools such as clang-repl.
4437 TopLevelStmtDecl(DeclContext *DC, SourceLocation L, Stmt *S) in TopLevelStmtDecl() argument
4438 : Decl(TopLevelStmt, DC, L), DeclContext(TopLevelStmt), Statement(S) {} in TopLevelStmtDecl()
4444 static TopLevelStmtDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
4453 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
4459 static TopLevelStmtDecl *castFromDeclContext(const DeclContext *DC) { in castFromDeclContext() argument
4460 return static_cast<TopLevelStmtDecl *>(const_cast<DeclContext *>(DC)); in castFromDeclContext()
4466 /// ^{ statement-body } or ^(int arg1, float arg2){ statement-body }
4501 return getVariable()->isEscapingByref(); in isEscapingByref()
4505 return getVariable()->isNonEscapingByref(); in isNonEscapingByref()
4534 BlockDecl(DeclContext *DC, SourceLocation CaretLoc);
4537 static BlockDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L);
4538 static BlockDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
4646 if (const auto *FPT = TSI->getType()->getAs<FunctionProtoType>()) in getFunctionEffects()
4647 return FPT->getFunctionEffects(); in getFunctionEffects()
4652 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
4657 static BlockDecl *castFromDeclContext(const DeclContext *DC) { in castFromDeclContext() argument
4658 return static_cast<BlockDecl *>(const_cast<DeclContext*>(DC)); in castFromDeclContext()
4682 explicit CapturedDecl(DeclContext *DC, unsigned NumParams);
4697 static CapturedDecl *Create(ASTContext &C, DeclContext *DC,
4699 static CapturedDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID,
4748 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
4753 static CapturedDecl *castFromDeclContext(const DeclContext *DC) { in castFromDeclContext() argument
4754 return static_cast<CapturedDecl *>(const_cast<DeclContext *>(DC)); in castFromDeclContext()
4791 /// Includes a bit that indicates whether we have source-location information
4798 ImportDecl(DeclContext *DC, SourceLocation StartLoc, Module *Imported,
4801 ImportDecl(DeclContext *DC, SourceLocation StartLoc, Module *Imported,
4822 static ImportDecl *Create(ASTContext &C, DeclContext *DC,
4826 /// Create a new module import declaration for an implicitly-generated
4828 static ImportDecl *CreateImplicit(ASTContext &C, DeclContext *DC,
4833 static ImportDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID,
4848 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
4867 ExportDecl(DeclContext *DC, SourceLocation ExportLoc) in ExportDecl() argument
4868 : Decl(Export, DC, ExportLoc), DeclContext(Export), in ExportDecl()
4872 static ExportDecl *Create(ASTContext &C, DeclContext *DC,
4874 static ExportDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
4887 return decls_empty() ? getLocation() : decls_begin()->getEndLoc(); in getEndLoc()
4894 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
4899 static ExportDecl *castFromDeclContext(const DeclContext *DC) { in castFromDeclContext() argument
4900 return static_cast<ExportDecl *>(const_cast<DeclContext*>(DC)); in castFromDeclContext()
4904 /// Represents an empty-declaration.
4906 EmptyDecl(DeclContext *DC, SourceLocation L) : Decl(Empty, DC, L) {} in EmptyDecl() argument
4911 static EmptyDecl *Create(ASTContext &C, DeclContext *DC,
4913 static EmptyDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
4915 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
4919 /// HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
4921 /// LBraceLoc - The ending location of the source range.
4923 /// RBraceLoc - The ending location of the source range.
4925 /// KwLoc - The location of the cbuffer or tbuffer keyword.
4927 /// IsCBuffer - Whether the buffer is a cbuffer (and not a tbuffer).
4930 HLSLBufferDecl(DeclContext *DC, bool CBuffer, SourceLocation KwLoc,
4931 IdentifierInfo *ID, SourceLocation IDLoc,
4937 IdentifierInfo *ID, SourceLocation IDLoc,
4939 static HLSLBufferDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
4951 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
4956 static HLSLBufferDecl *castFromDeclContext(const DeclContext *DC) { in castFromDeclContext() argument
4957 return static_cast<HLSLBufferDecl *>(const_cast<DeclContext *>(DC)); in castFromDeclContext()
4984 First = PrevDecl->getFirstDecl(); in setPreviousDecl()
4985 assert(First->RedeclLink.isFirst() && "Expected first"); in setPreviousDecl()
4986 decl_type *MostRecent = First->getNextRedeclaration(); in setPreviousDecl()
4991 static_cast<decl_type*>(this)->IdentifierNamespace |= in setPreviousDecl()
4992 MostRecent->getIdentifierNamespace() & in setPreviousDecl()
5000 First->RedeclLink.setLatest(static_cast<decl_type*>(this)); in setPreviousDecl()
5003 cast<NamedDecl>(static_cast<decl_type*>(this))->isLinkageValid()); in setPreviousDecl()
5013 return ED->isComplete(); in IsEnumDeclComplete()
5021 return ED->isScoped(); in IsEnumDeclScoped()