Lines Matching +full:msi +full:- +full:specifier

1 //===- Decl.cpp - Declaration AST Node Implementation ---------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
78 return D->getASTContext().getPrimaryMergedDecl(D);
82 SourceLocation Loc = this->Loc;
83 if (!Loc.isValid() && TheDecl) Loc = TheDecl->getLocation();
92 ND->getNameForDiagnostic(OS, Context.getPrintingPolicy(), true);
101 return !getLexicalDeclContext()->Equals(getDeclContext());
108 //===----------------------------------------------------------------------===//
110 //===----------------------------------------------------------------------===//
135 // 5. When computing the visibility of a non-type, including a
136 // non-type member of a class, only non-type visibility restrictions
137 // are considered: the 'visibility' attribute, global value-visibility
142 // the 'type_visibility' attribute and global type-visibility settings.
176 return D->getExplicitVisibility(kind.getExplicitVisibilityKind());
193 D->getMemberSpecializationInfo()) {
194 return member->isExplicitSpecialization();
203 return D->isMemberSpecialization();
210 switch (attr->getVisibility()) {
227 if (const auto *A = D->getAttr<TypeVisibilityAttr>()) {
233 if (const auto *A = D->getAttr<VisibilityAttr>()) {
259 // Non-type template parameters can be restricted by the value type, e.g.
264 // Handle the non-pack case first.
265 if (!NTTP->isExpandedParameterPack()) {
266 if (!NTTP->getType()->isDependentType()) {
267 LV.merge(getLVForType(*NTTP->getType(), computation));
273 for (unsigned i = 0, n = NTTP->getNumExpansionTypes(); i != n; ++i) {
274 QualType type = NTTP->getExpansionType(i);
275 if (!type->isDependentType())
285 // Handle the non-pack case first.
286 if (!TTP->isExpandedParameterPack()) {
287 LV.merge(getLVForTemplateParameterList(TTP->getTemplateParameters(),
293 for (unsigned i = 0, n = TTP->getNumExpansionTemplateParameters();
296 TTP->getExpansionTemplateParameters(i), computation));
305 const DeclContext *DC = D->getDeclContext();
306 while (DC->getDeclKind() != Decl::TranslationUnit) {
309 DC = DC->getParent();
379 if (!specInfo->isExplicitInstantiationOrSpecialization())
382 return !fn->hasAttr<VisibilityAttr>();
385 /// Merge in template-related linkage and visibility for the given
399 FunctionTemplateDecl *temp = specInfo->getTemplate();
408 getLVForTemplateParameterList(temp->getTemplateParameters(), computation);
412 const TemplateArgumentList &templateArgs = *specInfo->TemplateArguments;
424 return (computation.isTypeVisibility() && D->hasAttr<TypeVisibilityAttr>()) ||
425 D->hasAttr<VisibilityAttr>();
444 // An explicit class specialization is an independent, top-level
451 // specialization, we always want to consider template-related
453 if (!spec->isExplicitInstantiationOrSpecialization())
457 if (spec->isExplicitSpecialization() &&
464 /// Merge in template-related linkage and visibility for the given
473 ClassTemplateDecl *temp = spec->getSpecializedTemplate();
481 getLVForTemplateParameterList(temp->getTemplateParameters(), computation);
486 // template-argument visibility if we've got an explicit
488 const TemplateArgumentList &templateArgs = spec->getTemplateArgs();
506 if (!spec->isExplicitInstantiationOrSpecialization())
509 // An explicit variable specialization is an independent, top-level
513 if (spec->isExplicitSpecialization() &&
520 /// Merge in template-related linkage and visibility for the given
530 VarTemplateDecl *temp = spec->getSpecializedTemplate();
532 getLVForTemplateParameterList(temp->getTemplateParameters(), computation);
537 // template-argument visibility if we've got an explicit
539 const TemplateArgumentList &templateArgs = spec->getTemplateArgs();
547 // FIXME: we should warn if -fvisibility-inlines-hidden is used with c.
548 const LangOptions &Opts = D->getASTContext().getLangOpts();
558 = FD->getTemplateSpecializationInfo()) {
559 TSK = spec->getTemplateSpecializationKind();
560 } else if (MemberSpecializationInfo *MSI =
561 FD->getMemberSpecializationInfo()) {
562 TSK = MSI->getTemplateSpecializationKind();
571 FD->hasBody(Def) && Def->isInlined() && !Def->hasAttr<GNUInlineAttr>();
575 const T *First = D->getFirstDecl();
576 return First->isInExternCContext();
581 if (!SD->hasBraces())
587 if (auto *M = D->getOwningModule())
588 return M->isInterfaceOrPartition();
598 D = TD->getTemplatedDecl();
601 return VD->getStorageClass();
603 return FD->getStorageClass();
612 assert(D->getDeclContext()->getRedeclContext()->isFileContext() &&
614 ASTContext &Context = D->getASTContext();
621 if ((getStorageClass(D->getCanonicalDecl()) == SC_Static) ||
622 (Context.getLangOpts().C23 && Var && Var->isConstexpr())) {
623 // - a variable, variable template, function, or function template
629 // an object contains any of the storage-class specifiers static or
635 // - a non-template variable of non-volatile const-qualified type, unless
636 // - it is explicitly declared extern, or
637 // - it is declared in the purview of a module interface unit
638 // (outside the private-module-fragment, if any) or module partition, or
639 // - it is inline, or
640 // - it was previously declared and the prior declaration did not have
643 if (Context.getLangOpts().CPlusPlus && Var->getType().isConstQualified() &&
644 !Var->getType().isVolatileQualified() && !Var->isInline() &&
647 !Var->getDescribedVarTemplate()) {
648 const VarDecl *PrevVar = Var->getPreviousDecl();
652 if (Var->getStorageClass() != SC_Extern &&
653 Var->getStorageClass() != SC_PrivateExtern &&
658 for (const VarDecl *PrevVar = Var->getPreviousDecl(); PrevVar;
659 PrevVar = PrevVar->getPreviousDecl()) {
660 if (PrevVar->getStorageClass() == SC_PrivateExtern &&
661 Var->getStorageClass() == SC_None)
664 if (PrevVar->getStorageClass() == SC_Static)
668 // - a data member of an anonymous union.
669 const VarDecl *VD = IFD->getVarDecl();
677 if (D->isInAnonymousNamespace()) {
681 // wording, but we retain it from the pre-DR1113 model to avoid breaking
696 // scope and no storage-class specifier, its linkage is
706 for (const DeclContext *DC = D->getDeclContext();
708 DC = DC->getParent()) {
729 // -finline-visibility-hidden if this is an inline method.
741 // - if the enclosing namespace has internal linkage, the name has
743 // - otherwise, if the declaration of the name is attached to a named
745 // - otherwise, the name has external linkage.
750 // - a variable; or
759 // - the entity has C language linkage, or
760 // - the entity is declared within an unnamed namespace, or
761 // - the entity is not used or is defined in the same
771 // Note that we don't want to make the variable non-external
772 // because of this, but unique-external linkage suits us.
776 LinkageInfo TypeLV = getLVForType(*Var->getType(), computation);
783 if (Var->getStorageClass() == SC_PrivateExtern)
797 // - a function; or
804 if (Function->getStorageClass() == SC_PrivateExtern)
809 // functions as the host-callable kernel functions are emitted at codegen.
822 // unique-external linkage, it's not legally usable from outside
826 // Only look at the type-as-written. Otherwise, deducing the return type
828 QualType TypeAsWritten = Function->getType();
829 if (TypeSourceInfo *TSI = Function->getTypeSourceInfo())
830 TypeAsWritten = TSI->getType();
831 if (!isExternallyVisible(TypeAsWritten->getLinkage()))
839 = Function->getTemplateSpecializationInfo()) {
843 // - a named class (Clause 9), or an unnamed class defined in a
846 // - a named enumeration (7.2), or an unnamed enumeration
851 if (!Tag->hasNameForLinkage())
862 // - an enumerator belonging to an enumeration with external linkage; or
864 LinkageInfo EnumLV = getLVForDecl(cast<NamedDecl>(D->getDeclContext()),
870 // - a template
874 getLVForTemplateParameterList(temp->getTemplateParameters(), computation);
885 // By extension, we assign external linkage to Objective-C
893 if (!TD->getAnonDeclWithTypedefName(/*AnyRedecl*/true))
905 // If we ended up with non-externally-visible linkage, visibility should
919 // purposes of calculating linkage of pointer-to-data-member
942 // -finline-visibility-hidden if this is an inline method.
958 getLVForDecl(cast<RecordDecl>(D->getDeclContext()), classComputation);
973 // Only look at the type-as-written. Otherwise, deducing the return type
975 QualType TypeAsWritten = MD->getType();
976 if (TypeSourceInfo *TSI = MD->getTypeSourceInfo())
977 TypeAsWritten = TSI->getType();
978 if (!isExternallyVisible(TypeAsWritten->getLinkage()))
984 = MD->getTemplateSpecializationInfo()) {
986 if (spec->isExplicitSpecialization()) {
988 } else if (isExplicitMemberSpecialization(spec->getTemplate())) {
989 explicitSpecSuppressor = spec->getTemplate()->getTemplatedDecl();
997 // functions as the host-callable kernel functions are emitted at codegen.
998 ASTContext &Context = D->getASTContext();
1009 if (spec->isExplicitSpecialization()) {
1012 const ClassTemplateDecl *temp = spec->getSpecializedTemplate();
1014 explicitSpecSuppressor = temp->getTemplatedDecl();
1029 LinkageInfo typeLV = getLVForType(*VD->getType(), computation);
1048 getLVForTemplateParameterList(temp->getTemplateParameters(), computation);
1053 explicitSpecSuppressor = temp->getTemplatedDecl();
1091 // A declaration is name-independent if its name is _ and it declares
1092 // - a variable with automatic storage duration,
1093 // - a structured binding not inhabiting a namespace scope,
1094 // - the variable introduced by an init-capture
1095 // - or a non-static data member.
1098 !getIdentifier()->isPlaceholder())
1103 if (!getDeclContext()->isFunctionOrMethod() &&
1104 !getDeclContext()->isRecord())
1106 const VarDecl *VD = IFD->getVarDecl();
1107 return !VD || VD->getStorageDuration() == SD_Automatic;
1113 if (VD->isInitCapture())
1115 return VD->getStorageDuration() == StorageDuration::SD_Automatic;
1118 BD && getDeclContext()->isFunctionOrMethod()) {
1119 const VarDecl *VD = BD->getHoldingVar();
1120 return !VD || VD->getStorageDuration() == StorageDuration::SD_Automatic;
1134 ReservedIdentifierStatus Status = II->isReserved(LangOpts);
1148 const DeclContext *DC = getDeclContext()->getRedeclContext();
1149 if (DC->isTranslationUnit())
1152 if (VD->isExternC())
1155 if (FD->isExternC())
1186 switch (D->getModuleOwnershipKind()) {
1193 return D->isInNamedModule();
1204 // - if the declaration of the name is attached to a named module and is not
1213 cast<NamedDecl>(this->getCanonicalDecl())) &&
1228 assert(!IsMostRecent || ND == ND->getMostRecentDecl());
1237 CXXRecordDecl *InstantiatedFrom = RD->getInstantiatedFromMemberClass();
1248 const auto *TD = spec->getSpecializedTemplate()->getTemplatedDecl();
1253 TD = TD->getPreviousDecl();
1260 const NamedDecl *MostRecent = ND->getMostRecentDecl();
1266 if (Var->isStaticDataMember()) {
1267 VarDecl *InstantiatedFrom = Var->getInstantiatedFromStaticDataMember();
1273 return getVisibilityOf(VTSD->getSpecializedTemplate()->getTemplatedDecl(),
1283 = fn->getTemplateSpecializationInfo())
1284 return getVisibilityOf(templateInfo->getTemplate()->getTemplatedDecl(),
1289 FunctionDecl *InstantiatedFrom = fn->getInstantiatedFromMemberFunction();
1298 return getVisibilityOf(TD->getTemplatedDecl(), kind);
1317 dyn_cast<NamedDecl>(ContextDecl->getDeclContext()->getRedeclContext());
1321 Owner = dyn_cast<NamedDecl>(ContextDecl->getDeclContext());
1335 VD && VD->getType()->getContainedDeducedType()
1350 if (Function->isInAnonymousNamespace() &&
1355 if (Function->getCanonicalDecl()->getStorageClass() == SC_Static)
1373 if (Var->hasExternalStorage()) {
1374 if (Var->isInAnonymousNamespace() && !isFirstInExternCContext(Var))
1378 if (Var->getStorageClass() == SC_PrivateExtern)
1386 if (const VarDecl *Prev = Var->getPreviousDecl()) {
1396 if (!Var->isStaticLocal())
1400 ASTContext &Context = D->getASTContext();
1405 if (!OuterD || OuterD->isInvalidDecl())
1410 if (!BD->getBlockManglingNumber())
1413 LV = getLVForClosure(BD->getDeclContext()->getRedeclContext(),
1414 BD->getBlockManglingContextDecl(), computation);
1417 if (!FD->isInlined() &&
1418 !isTemplateInstantiation(FD->getTemplateSpecializationKind()))
1421 // If a function is hidden by -fvisibility-inlines-hidden option and
1428 assert(cast<VarDecl>(D)->isStaticLocal());
1433 LV = getLVForDecl(MD->getParent(), computation);
1454 if (D->hasAttr<InternalLinkageAttr>())
1457 // Objective-C: treat all Objective-C declarations as having external
1459 switch (D->getKind()) {
1481 if (D->getASTContext().getLangOpts().CPlusPlus)
1482 return getLVForDecl(cast<EnumDecl>(D->getDeclContext()), computation);
1490 ->getAnonDeclWithTypedefName(/*AnyRedecl*/true))
1509 if (Record->isLambda()) {
1510 if (Record->hasKnownLambdaInternalLinkage() ||
1511 !Record->getLambdaManglingNumber()) {
1517 Record->getDeclContext()->getRedeclContext(),
1518 Record->getLambdaContextDecl(), computation);
1528 LinkageInfo LV = getLVForType(*TPO->getType(), computation);
1529 LV.merge(getLVForValue(TPO->getValue(), computation));
1534 // Handle linkage for namespace-scope names.
1535 if (D->getDeclContext()->getRedeclContext()->isFileContext())
1541 // enumeration defined in a class-scope typedef declaration such
1545 if (D->getDeclContext()->isRecord())
1556 // one such matching entity, the program is ill-formed. Otherwise,
1559 if (D->getDeclContext()->isFunctionOrMethod())
1567 /// getLVForDecl - Get the linkage and visibility for the given declaration.
1571 if (D->hasAttr<InternalLinkageAttr>())
1574 if (computation.IgnoreAllVisibility && D->hasCachedLinkage())
1575 return LinkageInfo(D->getCachedLinkage(), DefaultVisibility, false);
1581 if (D->hasCachedLinkage())
1582 assert(D->getCachedLinkage() == LV.getLinkage());
1584 D->setCachedLinkage(LV.getLinkage());
1591 const LangOptions &Opts = D->getASTContext().getLangOpts();
1599 for (auto *I : D->redecls()) {
1603 if (!T->isInvalidDecl() && T->hasCachedLinkage()) {
1608 assert(!Old || Old->getCachedLinkage() == D->getCachedLinkage());
1619 return getLVForDecl(D, D->getASTContext().getLangOpts().IgnoreXCOFFVisibility
1634 switch (M->Kind) {
1654 return M->Parent;
1681 if (getDeclContext()->isFunctionOrMethod()) {
1713 if (auto *ID = MD->getClassInterface())
1716 if (auto *MD = PD->getGetterMethodDecl())
1717 if (auto *ID = MD->getClassInterface())
1720 if (auto *CI = ID->getContainingInterface())
1724 if (Ctx->isFunctionOrMethod())
1732 for (; Ctx; Ctx = Ctx->getParent()) {
1735 cast<NamespaceDecl>(Ctx)->isAnonymousNamespace())
1739 if (P.SuppressInlineNamespace && Ctx->isInlineNamespace() && NameInScope &&
1740 cast<NamespaceDecl>(Ctx)->isRedundantInlineQualifierFor(NameInScope))
1743 // Skip non-named contexts such as linkage specifications and ExportDecls.
1749 NameInScope = ND->getDeclName();
1754 OS << Spec->getName();
1755 const TemplateArgumentList &TemplateArgs = Spec->getTemplateArgs();
1758 Spec->getSpecializedTemplate()->getTemplateParameters());
1760 if (ND->isAnonymousNamespace()) {
1767 if (!RD->getIdentifier())
1768 OS << "(anonymous " << RD->getKindName() << ')';
1773 if (FD->hasWrittenPrototype())
1774 FT = dyn_cast<FunctionProtoType>(FD->getType()->castAs<FunctionType>());
1778 unsigned NumParams = FD->getNumParams();
1782 OS << FD->getParamDecl(i)->getType().stream(P);
1785 if (FT->isVariadic()) {
1793 // C++ [dcl.enum]p10: Each enum-name and each unscoped
1795 // the enum-specifier. Each scoped enumerator is declared in the
1800 if (ED->isScoped())
1837 assert(getDeclName() == OldD->getDeclName() && "Declaration name mismatch");
1840 // when re-exporting.
1841 if (OldD->isFromASTFile() && isFromASTFile())
1845 if (OldD->getKind() != getKind())
1853 // Objective-C) permitted as an extension.
1860 if (!this->getDeclContext()->getRedeclContext()->Equals(
1861 OldD->getDeclContext()->getRedeclContext()))
1868 return Context.getCanonicalNestedNameSpecifier(UD->getQualifier()) ==
1870 cast<UsingDecl>(OldD)->getQualifier());
1874 return Context.getCanonicalNestedNameSpecifier(UUVD->getQualifier()) ==
1876 cast<UnresolvedUsingValueDecl>(OldD)->getQualifier());
1880 if (getCanonicalDecl() != OldD->getCanonicalDecl())
1897 if (D->isCanonicalDecl())
1922 llvm_unreachable("Non-formal linkage is not allowed here!");
1933 ND = UD->getTargetDecl();
1936 return AD->getClassInterface();
1939 return AD->getNamespace();
1950 D = cast<UsingShadowDecl>(D)->getTargetDecl();
1954 if (const auto *MD = dyn_cast_if_present<CXXMethodDecl>(D->getAsFunction()))
1955 return MD->isInstance();
1959 //===----------------------------------------------------------------------===//
1961 //===----------------------------------------------------------------------===//
1965 if (decl->getNumTemplateParameterLists() > 0)
1966 return decl->getTemplateParameterList(0)->getTemplateLoc();
1967 return decl->getInnerLocStart();
1972 if (TSI) return TSI->getTypeLoc().getBeginLoc();
1978 if (TSI) return TSI->getTypeLoc().getEndLoc();
1986 // Save (non-extended) type source info pointer.
1991 getExtInfo()->TInfo = savedTInfo;
1994 getExtInfo()->QualifierLoc = QualifierLoc;
1997 getExtInfo()->QualifierLoc = QualifierLoc;
2005 // Save (non-extended) type source info pointer.
2010 getExtInfo()->TInfo = savedTInfo;
2013 getExtInfo()->TrailingRequiresClause = TrailingRequiresClause;
2021 // Save (non-extended) type source info pointer.
2026 getExtInfo()->TInfo = savedTInfo;
2029 getExtInfo()->setTemplateParameterListsInfo(Context, TPLists);
2041 switch (T->getTypeClass()) {
2045 QT = cast<PointerType>(T)->getPointeeType();
2048 QT = cast<BlockPointerType>(T)->getPointeeType();
2051 QT = cast<MemberPointerType>(T)->getPointeeType();
2055 QT = cast<ReferenceType>(T)->getPointeeType();
2058 QT = cast<PackExpansionType>(T)->getPattern();
2077 if (!getDeclName() || typeIsPostfix(TInfo->getType()))
2078 RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();
2099 //===----------------------------------------------------------------------===//
2101 //===----------------------------------------------------------------------===//
2169 llvm_unreachable("Unknown thread storage class specifier!");
2174 SourceLocation InitEnd = Init->getEndLoc();
2199 if (DC->isRecord())
2215 if (DC->isRecord()) {
2232 return getLexicalDeclContext()->isExternCContext();
2236 return getLexicalDeclContext()->isExternCXXContext();
2248 // specifier or a linkage-specification and neither an initializer [...],
2249 // it declares a non-inline static data member in a class declaration [...],
2251 // was defined within the class with the constexpr specifier [...],
2261 !(getCanonicalDecl()->isInline() &&
2262 getCanonicalDecl()->isConstexpr()) &&
2264 // If the first declaration is out-of-line, this may be an
2265 // instantiation of an out-of-line partial specialization of a variable
2267 (getFirstDecl()->isOutOfLine()
2280 // Note: that applies for all non-file-scope objects.
2291 if (!SAA->isInherited())
2298 if (VTSD->getTemplateSpecializationKind() != TSK_ExplicitSpecialization &&
2300 !VTSD->IsCompleteDefinition)
2308 // A declaration directly contained in a linkage-specification is treated
2309 // as if it contains the extern specifier for the purpose of determining
2316 // and without a storage class specifier or the scs 'static', constitutes
2322 // What's left is (in C, block-scope) declarations without initializers or
2336 Decl = Decl->getPreviousDecl()) {
2337 Kind = Decl->isThisDeclarationADefinition();
2350 for (auto *I : First->redecls()) {
2351 if (I->isThisDeclarationADefinition(C) == Definition)
2361 for (auto *I : First->redecls()) {
2362 Kind = std::max(Kind, I->isThisDeclarationADefinition(C));
2372 if (auto Expr = I->getInit()) {
2382 if (P->hasUnparsedDefaultArg() || P->hasUninstantiatedDefaultArg())
2386 return Eval->Value.isValid();
2400 return cast<Expr>(Eval->Value.get(
2401 Eval->Value.isOffset() ? getASTContext().getExternalSource() : nullptr));
2406 return ES->Value.getAddressOfPointer(getASTContext().getExternalSource());
2414 if (I->hasInit())
2417 if (I->isThisDeclarationADefinition()) {
2435 // out-of-line.
2437 return VD->isOutOfLine();
2444 Eval->~EvaluatedStmt();
2469 if (Lang.CPlusPlus11 && getType()->isReferenceType())
2473 // not require the variable to be non-volatile, but we consider this to be a
2478 // In C++, but not in C, const, non-volatile variables of integral or
2480 if (getType()->isIntegralOrEnumerationType() && !Lang.C23)
2485 // - declared with storage-class specifier constexpr and has an object type,
2488 // Additionally, in C++11, non-volatile constexpr variables can be used in
2499 if (!Init || Init->isValueDependent() || getType()->isDependentType())
2502 // const-qualified integral or enumeration type, ...
2503 if (!DefVD->mightBeUsableInConstantExpressions(Context))
2507 !DefVD->hasConstantInitialization())
2510 // An integral constant-expression can involve only [...] const variables
2514 !Context.getLangOpts().CPlusPlus11 && !DefVD->hasICEInitializer(Context))
2530 Eval->Value = Init.get<Stmt *>();
2550 assert(!Init->isValueDependent());
2552 // We only produce notes indicating why an initializer is non-constant the
2555 if (Eval->WasEvaluated)
2556 return Eval->Evaluated.isAbsent() ? nullptr : &Eval->Evaluated;
2558 if (Eval->IsEvaluating) {
2559 // FIXME: Produce a diagnostic for self-initialization.
2563 Eval->IsEvaluating = true;
2566 bool Result = Init->EvaluateAsInitializer(Eval->Evaluated, Ctx, this, Notes,
2583 Eval->Evaluated = APValue();
2584 else if (Eval->Evaluated.needsCleanup())
2585 Ctx.addDestruction(&Eval->Evaluated);
2587 Eval->IsEvaluating = false;
2588 Eval->WasEvaluated = true;
2590 return Result ? &Eval->Evaluated : nullptr;
2595 if (Eval->WasEvaluated)
2596 return &Eval->Evaluated;
2606 if (!Eval->CheckedForICEInit) {
2607 Eval->CheckedForICEInit = true;
2608 Eval->HasICEInit = Init->isIntegerConstantExpr(Context);
2610 return Eval->HasICEInit;
2624 return Eval->HasConstantInitialization;
2635 assert(!Eval->WasEvaluated &&
2641 assert(!getInit()->isValueDependent());
2644 Eval->HasConstantInitialization =
2647 // If evaluation as a constant initializer failed, allow re-evaluation as a
2648 // non-constant initializer if we later find we want the value.
2649 if (!Eval->HasConstantInitialization)
2650 Eval->WasEvaluated = false;
2652 return Eval->HasConstantInitialization;
2662 if (auto *Def = D->getDefinition())
2677 return T->isDependentType() || T->isUndeducedType() ||
2679 return AA->isAlignmentDependent();
2688 if (MemberSpecializationInfo *MSInfo = VD->getMemberSpecializationInfo()) {
2689 if (isTemplateInstantiation(MSInfo->getTemplateSpecializationKind())) {
2690 VD = VD->getInstantiatedFromStaticDataMember();
2691 while (auto *NewVD = VD->getInstantiatedFromStaticDataMember())
2699 if (isTemplateInstantiation(VDTemplSpec->getTemplateSpecializationKind())) {
2700 auto From = VDTemplSpec->getInstantiatedFrom();
2702 while (!VTD->isMemberSpecialization()) {
2703 auto *NewVTD = VTD->getInstantiatedFromMemberTemplate();
2708 return getDefinitionOrSelf(VTD->getTemplatedDecl());
2712 while (!VTPSD->isMemberSpecialization()) {
2713 auto *NewVTPSD = VTPSD->getInstantiatedFromMember();
2725 if (VarTemplateDecl *VarTemplate = VD->getDescribedVarTemplate()) {
2726 while (!VarTemplate->isMemberSpecialization()) {
2727 auto *NewVT = VarTemplate->getInstantiatedFromMemberTemplate();
2733 return getDefinitionOrSelf(VarTemplate->getTemplatedDecl());
2742 if (MemberSpecializationInfo *MSI = getMemberSpecializationInfo())
2743 return cast<VarDecl>(MSI->getInstantiatedFrom());
2750 return Spec->getSpecializationKind();
2752 if (MemberSpecializationInfo *MSI = getMemberSpecializationInfo())
2753 return MSI->getTemplateSpecializationKind();
2760 if (MemberSpecializationInfo *MSI = getMemberSpecializationInfo())
2761 return MSI->getTemplateSpecializationKind();
2764 return Spec->getSpecializationKind();
2771 return Spec->getPointOfInstantiation();
2773 if (MemberSpecializationInfo *MSI = getMemberSpecializationInfo())
2774 return MSI->getPointOfInstantiation();
2814 if (Eval->HasConstantDestruction)
2825 auto *Ty = getType()->getAs<RecordType>();
2826 if (!Ty || !Ty->getDecl()->hasFlexibleArrayMember())
2828 auto *List = dyn_cast<InitListExpr>(getInit()->IgnoreParens());
2831 const Expr *FlexibleInit = List->getInit(List->getNumInits() - 1);
2832 auto InitTy = Ctx.getAsConstantArrayType(FlexibleInit->getType());
2835 return !InitTy->isZeroSize();
2840 auto *Ty = getType()->getAs<RecordType>();
2841 if (!Ty || !Ty->getDecl()->hasFlexibleArrayMember())
2843 auto *List = dyn_cast<InitListExpr>(getInit()->IgnoreParens());
2844 if (!List || List->getNumInits() == 0)
2846 const Expr *FlexibleInit = List->getInit(List->getNumInits() - 1);
2847 auto InitTy = Ctx.getAsConstantArrayType(FlexibleInit->getType());
2851 const ASTRecordLayout &RL = Ctx.getASTRecordLayout(Ty->getDecl());
2853 Ctx.toCharUnitsFromBits(RL.getFieldOffset(RL.getFieldCount() - 1));
2856 return FlexibleArrayOffset + FlexibleArraySize - RL.getSize();
2876 Spec->setSpecializationKind(TSK);
2879 Spec->getPointOfInstantiation().isInvalid()) {
2880 Spec->setPointOfInstantiation(PointOfInstantiation);
2882 L->InstantiationRequested(this);
2884 } else if (MemberSpecializationInfo *MSI = getMemberSpecializationInfo()) {
2885 MSI->setTemplateSpecializationKind(TSK);
2887 MSI->getPointOfInstantiation().isInvalid()) {
2888 MSI->setPointOfInstantiation(PointOfInstantiation);
2890 L->InstantiationRequested(this);
2903 //===----------------------------------------------------------------------===//
2905 //===----------------------------------------------------------------------===//
2918 QualType T = TSI ? TSI->getType() : getType();
2920 return DT->getOriginalType();
2952 const auto *RT = getType()->getAs<RecordType>();
2953 if (RT && RT->getDecl()->isParamDestroyedInCallee() &&
2967 return E->getSubExpr();
2985 return getUninstantiatedDefaultArg()->getSourceRange();
2989 return E->getSourceRange();
3025 //===----------------------------------------------------------------------===//
3027 //===----------------------------------------------------------------------===//
3040 assert(T.isNull() || T->isFunctionType());
3078 printTemplateArgumentList(OS, TemplateArgs->asArray(), Policy);
3082 if (const auto *FT = getType()->getAs<FunctionProtoType>())
3083 return FT->isVariadic();
3099 Info->NumLookups = Lookups.size();
3100 Info->HasDeletedMessage = DeletedMessage != nullptr;
3103 Info->getTrailingObjects<DeclAccessPair>());
3105 *Info->getTrailingObjects<StringLiteral *>() = DeletedMessage;
3124 DefaultedOrDeletedInfo->setDeletedMessage(Message);
3150 if (I->doesThisDeclarationHaveABody()) {
3167 if (isa<CompoundStmt>(S) && cast<CompoundStmt>(S)->body_empty())
3180 return InstantiatedFrom->getFriendObjectKind() &&
3181 InstantiatedFrom->isThisDeclarationADefinition();
3187 Template->getInstantiatedFromMemberTemplate())
3188 return InstantiatedFrom->getFriendObjectKind() &&
3189 InstantiatedFrom->isThisDeclarationADefinition();
3198 if (FD->isThisDeclarationADefinition()) {
3219 FD->isThisDeclarationInstantiatedFromAFriendDefinition()) {
3232 assert(!Definition->FunctionDeclBits.HasDefaultedOrDeletedInfo &&
3234 if (Definition->Body)
3235 return Definition->Body.get(getASTContext().getExternalSource());
3244 EndRangeLoc = B->getEndLoc();
3251 Parent->markedVirtualFunctionPure();
3256 const IdentifierInfo *II = ND->getIdentifier();
3257 return II && II->isStr(Str);
3262 // An immediate-escalating function is
3263 // - the call operator of a lambda that is not declared with the consteval
3264 // specifier,
3267 // - a defaulted special member function that is not declared with the
3268 // consteval specifier,
3271 // - a function that results from the instantiation of a templated entity
3272 // defined with the constexpr specifier.
3283 // - declared with the consteval specifier
3286 // - an immediate-escalating function F whose function body contains an
3287 // immediate-escalating expression
3292 MD && MD->isLambdaStaticInvoker())
3293 return MD->getParent()->getLambdaCallOperator()->isImmediateFunction();
3300 dyn_cast<TranslationUnitDecl>(getDeclContext()->getRedeclContext());
3302 !tunit->getASTContext().getLangOpts().Freestanding &&
3308 dyn_cast<TranslationUnitDecl>(getDeclContext()->getRedeclContext());
3316 if (!TUnit->getASTContext().getTargetInfo().getTriple().isOSMSVCRT())
3342 if (!getDeclContext()->getRedeclContext()->isTranslationUnit())
3345 const auto *proto = getType()->castAs<FunctionProtoType>();
3346 if (proto->getNumParams() != 2 || proto->isVariadic())
3350 cast<TranslationUnitDecl>(getDeclContext()->getRedeclContext())
3351 ->getASTContext();
3355 return (proto->getParamType(1).getCanonicalType() == Context.VoidPtrTy);
3372 if (!getDeclContext()->getRedeclContext()->isTranslationUnit())
3375 const auto *FPT = getType()->castAs<FunctionProtoType>();
3376 if (FPT->getNumParams() == 0 || FPT->getNumParams() > 4 || FPT->isVariadic())
3379 // If this is a single-parameter function, it must be a replaceable global
3381 if (FPT->getNumParams() == 1)
3385 QualType Ty = FPT->getParamType(Params);
3390 Ty = Params < FPT->getNumParams() ? FPT->getParamType(Params) : QualType();
3405 if (Ctx.getLangOpts().AlignedAllocation && !Ty.isNull() && Ty->isAlignValT()) {
3413 if (!IsSizedDelete && !Ty.isNull() && Ty->isReferenceType()) {
3414 Ty = Ty->getPointeeType();
3417 if (Ty->isNothrowT()) {
3428 if (!IsSizedDelete && !Ty.isNull() && Ty->isEnumeralType()) {
3430 while (const auto *TD = T->getAs<TypedefType>())
3431 T = TD->getDecl()->getUnderlyingType();
3433 T->castAs<EnumType>()->getDecl()->getIdentifier();
3434 if (II && II->isStr("__hot_cold_t"))
3438 return Params == FPT->getNumParams();
3449 if (!Definition->isInlineSpecified() ||
3450 !Definition->hasAttr<AlwaysInlineAttr>())
3475 auto *RD = getParamDecl(1)->getType()->getAsCXXRecordDecl();
3476 return RD && RD->isInStdNamespace() && RD->getIdentifier() &&
3477 RD->getIdentifier()->isStr("destroying_delete_t");
3491 return getLexicalDeclContext()->isExternCContext();
3495 return getLexicalDeclContext()->isExternCXXContext();
3500 return Method->isStatic();
3502 if (getCanonicalDecl()->getStorageClass() == SC_Static)
3506 DC->isNamespace();
3507 DC = DC->getParent()) {
3509 if (!Namespace->getDeclName())
3522 if (auto *FnTy = getType()->getAs<FunctionType>())
3523 return FnTy->getNoReturnAttr();
3530 // A non-template friend declaration with a requires-clause [or]
3535 // If this isn't a friend then it's not a member-like constrained friend.
3581 return getAttr<TargetAttr>()->isDefaultVersion();
3583 getAttr<TargetVersionAttr>()->isDefaultVersion();
3600 = PrevDecl? PrevDecl->getDescribedFunctionTemplate() : nullptr;
3602 FunTmpl->setPreviousDecl(PrevFunTmpl);
3605 if (PrevDecl && PrevDecl->isInlined())
3614 /// The function corresponds to a built-in function if it is declared at
3618 /// target-independent range \c [1,Builtin::First), or a target-specific builtin
3628 BuiltinID = ABAA->getBuiltinName()->getBuiltinID();
3630 BuiltinID = BAA->getBuiltinName()->getBuiltinID();
3632 BuiltinID = A->getID();
3656 // OpenCL v1.2 s6.9.f - The library functions defined in
3662 // CUDA does not have device-side standard library. printf and malloc are the
3663 // only special cases that are supported by device-side runtime.
3669 // As AMDGCN implementation of OpenMP does not have a device-side standard
3681 /// getNumParams - Return the number of parameters this function must have
3685 const auto *FPT = getType()->getAs<FunctionProtoType>();
3686 return FPT ? FPT->getNumParams() : 0;
3694 // Zero params -> null pointer.
3701 /// getMinRequiredArguments - Returns the minimum number of arguments
3714 if (!Param->isParameterPack()) {
3716 if (!Param->hasDefaultArg())
3724 return getNumParams() != 0 && getParamDecl(0)->isExplicitObjectParameter();
3728 return getNumParams() -
3733 return getMinRequiredArguments() -
3741 [](ParmVarDecl *P) { return P->hasDefaultArg(); }));
3758 FD = FD->getPreviousDecl())
3759 if (!FD->isImplicit() && FD->getStorageClass() == SC_Extern)
3766 if (Redecl->getStorageClass() != SC_Extern)
3769 for (const FunctionDecl *FD = Redecl->getPreviousDecl(); FD;
3770 FD = FD->getPreviousDecl())
3771 if (!FD->isImplicit() && FD->getStorageClass() == SC_Extern)
3778 // Only consider file-scope declarations in this test.
3779 if (!Redecl->getLexicalDeclContext()->isTranslationUnit())
3784 if (Redecl->isImplicit())
3787 if (!Redecl->isInlineSpecified() || Redecl->getStorageClass() == SC_Extern)
3807 if (hasBody(Definition) && Definition->isInlined() &&
3826 while ((Prev = Prev->getPreviousDecl())) {
3827 FoundBody |= Prev->doesThisDeclarationHaveABody();
3829 if (Prev->doesThisDeclarationHaveABody()) {
3832 if (!Prev->isInlineSpecified() ||
3833 Prev->getStorageClass() != SC_Extern)
3835 } else if (Prev->isInlineSpecified() &&
3836 Prev->getStorageClass() != SC_Extern) {
3845 // translation unit include the inline function specifier without extern,
3851 while ((Prev = Prev->getPreviousDecl())) {
3852 FoundBody |= Prev->doesThisDeclarationHaveABody();
3861 return TSI ? TSI->getTypeLoc().IgnoreParens().getAs<FunctionTypeLoc>()
3870 // Skip self-referential return types.
3889 NP > 0 ? ParamInfo[0]->getSourceRange().getBegin() : EllipsisLoc;
3892 : ParamInfo[NP - 1]->getSourceRange().getEnd();
3911 /// if even one of the global-scope declarations is marked "extern inline", the
3941 if (Redecl->isInlineSpecified() &&
3942 Redecl->getStorageClass() != SC_Extern)
3949 // The rest of this function is C-only.
3955 // translation unit include the inline function specifier without extern,
3969 /// getOverloadedOperator - Which C++ overloaded operator this
3977 /// getLiteralIdentifier - The literal suffix identifier this function
4008 return cast<FunctionDecl>(Info->getInstantiatedFrom());
4014 if (auto *MSI =
4016 return MSI;
4019 return FTSI->getMemberSpecializationInfo();
4086 HasPattern = PatternDecl->hasBody(PatternDecl);
4095 return PatternDecl->isInlined();
4112 // (i.e. instantiated-from-member-template) to use as an instantiation
4118 return getDefinitionOrSelf(getPrimaryTemplate()->getTemplatedDecl());
4127 if (MemberSpecializationInfo *Info = FD->getMemberSpecializationInfo()) {
4129 !clang::isTemplateInstantiation(Info->getTemplateSpecializationKind()))
4131 return getDefinitionOrSelf(cast<FunctionDecl>(Info->getInstantiatedFrom()));
4141 while (!ForDefinition || !Primary->isMemberSpecialization()) {
4142 auto *NewPrimary = Primary->getInstantiatedFromMemberTemplate();
4148 return getDefinitionOrSelf(Primary->getTemplatedDecl());
4158 return Info->getTemplate();
4174 return Info->TemplateArguments;
4184 return Info->TemplateArgumentsAsWritten;
4189 return Info->TemplateArgumentsAsWritten;
4215 Template->addSpecialization(Info, InsertPos);
4254 return cast<FunctionTemplateDecl>(ND->getUnderlyingDecl());
4264 return FTSInfo->getTemplateSpecializationKind();
4268 return MSInfo->getTemplateSpecializationKind();
4307 if (auto *MSInfo = FTSInfo->getMemberSpecializationInfo())
4308 return MSInfo->getTemplateSpecializationKind();
4309 return FTSInfo->getTemplateSpecializationKind();
4314 return MSInfo->getTemplateSpecializationKind();
4330 FTSInfo->setTemplateSpecializationKind(TSK);
4333 FTSInfo->getPointOfInstantiation().isInvalid()) {
4334 FTSInfo->setPointOfInstantiation(PointOfInstantiation);
4336 L->InstantiationRequested(this);
4340 MSInfo->setTemplateSpecializationKind(TSK);
4343 MSInfo->getPointOfInstantiation().isInvalid()) {
4344 MSInfo->setPointOfInstantiation(PointOfInstantiation);
4346 L->InstantiationRequested(this);
4356 return FTSInfo->getPointOfInstantiation();
4359 return MSInfo->getPointOfInstantiation();
4369 // class template, check whether that member function was defined out-of-line.
4372 if (FD->hasBody(Definition))
4373 return Definition->isOutOfLine();
4377 // check whether that function template was defined out-of-line.
4380 if (FunTmpl->getTemplatedDecl()->hasBody(Definition))
4381 return Definition->isOutOfLine();
4474 if (FnInfo->isStr("memset"))
4476 if (FnInfo->isStr("memcpy"))
4478 if (FnInfo->isStr("mempcpy"))
4480 if (FnInfo->isStr("memmove"))
4482 if (FnInfo->isStr("memcmp"))
4484 if (FnInfo->isStr("bcmp"))
4486 if (FnInfo->isStr("strncpy"))
4488 if (FnInfo->isStr("strncmp"))
4490 if (FnInfo->isStr("strncasecmp"))
4492 if (FnInfo->isStr("strncat"))
4494 if (FnInfo->isStr("strndup"))
4496 if (FnInfo->isStr("strlen"))
4498 if (FnInfo->isStr("bzero"))
4500 if (FnInfo->isStr("bcopy"))
4503 if (FnInfo->isStr("free"))
4522 ODRHash = FT->getODRHash();
4533 //===----------------------------------------------------------------------===//
4535 //===----------------------------------------------------------------------===//
4556 if (const auto *Record = getType()->getAs<RecordType>())
4557 return Record->getDecl()->isAnonymousStructOrUnion();
4566 LazyDeclStmtPtr InitPtr = BitField ? InitAndBitWidth->Init : Init;
4579 InitAndBitWidth->Init = NewInit;
4586 return getBitWidth()->EvaluateKnownConstInt(Ctx).getZExtValue();
4590 return isUnnamedBitField() && !getBitWidth()->isValueDependent() &&
4600 // -- is not a potentially-overlapping subobject, or
4604 // -- is not of class type, or
4605 const auto *RT = getType()->getAs<RecordType>();
4608 const RecordDecl *RD = RT->getDecl()->getDefinition();
4614 // -- [has] virtual member functions or virtual base classes, or
4615 // -- has subobjects of nonzero size or bit-fields of nonzero length
4617 if (!CXXRD->isEmpty())
4621 // are implementation-defined.
4627 return !llvm::any_of(CXXRD->fields(), [](const FieldDecl *Field) {
4628 return Field->getType()->getAs<RecordType>();
4633 return hasAttr<NoUniqueAddressAttr>() && getType()->getAsCXXRecordDecl();
4639 return Canonical->getFieldIndex();
4641 if (CachedFieldIndex) return CachedFieldIndex - 1;
4644 const RecordDecl *RD = getParent()->getDefinition();
4647 for (auto *Field : RD->fields()) {
4648 Field->getCanonicalDecl()->CachedFieldIndex = Index + 1;
4649 assert(Field->getCanonicalDecl()->CachedFieldIndex == Index + 1 &&
4655 return CachedFieldIndex - 1;
4663 return SourceRange(getInnerLocStart(), FinalExpr->getEndLoc());
4668 assert((getParent()->isLambda() || getParent()->isCapturedRecord()) &&
4669 "capturing type in non-lambda or captured record.");
4671 "bit-field or field with default member initializer cannot capture "
4680 this->getType().print(OS, Policy);
4687 //===----------------------------------------------------------------------===//
4689 //===----------------------------------------------------------------------===//
4724 assert(T->isLinkageValid());
4736 cast<CXXRecordDecl>(I)->DefinitionData = Data;
4742 cast<CXXRecordDecl>(this)->hasDefinition()) &&
4749 L->CompletedTagDefinition(this);
4756 // If it's possible for us to have an out-of-date definition, check now.
4759 if (II->isOutOfDate()) {
4766 return CXXRD->getDefinition();
4769 if (R->isCompleteDefinition())
4781 getExtInfo()->QualifierLoc = QualifierLoc;
4785 if (getExtInfo()->NumTemplParamLists == 0) {
4790 getExtInfo()->QualifierLoc = QualifierLoc;
4820 getExtInfo()->setTemplateParameterListsInfo(Context, TPLists);
4823 //===----------------------------------------------------------------------===//
4825 //===----------------------------------------------------------------------===//
4851 Enum->setMayHaveOutOfDateDef(C.getLangOpts().Modules);
4860 Enum->setMayHaveOutOfDateDef(C.getLangOpts().Modules);
4866 return TI->getTypeLoc().getSourceRange();
4885 return A->getExtensibility() == EnumExtensibilityAttr::Closed;
4898 if (MemberSpecializationInfo *MSI = getMemberSpecializationInfo())
4899 return MSI->getTemplateSpecializationKind();
4906 MemberSpecializationInfo *MSI = getMemberSpecializationInfo();
4907 assert(MSI && "Not an instantiated member enumeration?");
4908 MSI->setTemplateSpecializationKind(TSK);
4911 MSI->getPointOfInstantiation().isInvalid())
4912 MSI->setPointOfInstantiation(PointOfInstantiation);
4917 if (isTemplateInstantiation(MSInfo->getTemplateSpecializationKind())) {
4919 while (auto *NewED = ED->getInstantiatedFromMemberEnum())
4932 return cast<EnumDecl>(SpecializationInfo->getInstantiatedFrom());
4956 // Set end-point to enum-base, e.g. enum foo : ^bar
4960 Res.setEnd(TSI->getTypeLoc().getEndLoc());
4972 Max = llvm::APInt(Bitwidth, 1) << (NumBits - 1);
4973 Min = -Max;
4980 //===----------------------------------------------------------------------===//
4982 //===----------------------------------------------------------------------===//
5012 R->setMayHaveOutOfDateDef(C.getLangOpts().Modules);
5023 R->setMayHaveOutOfDateDef(C.getLangOpts().Modules);
5028 return isImplicit() && getDeclName() && getDeclContext()->isRecord() &&
5029 cast<RecordDecl>(getDeclContext())->getDeclName() == getDeclName();
5034 return RD->isLambda();
5051 for (const FieldDecl *FD : Def->fields()) {
5052 const RecordType *RT = FD->getType()->getAs<RecordType>();
5053 if (RT && RT->getDecl()->isOrContainsUnion())
5067 return D->field_begin();
5071 /// completeDefinition - Notes that the definition of this type is now
5091 /// isMsStruct - Get whether or not this record uses ms_struct layout.
5093 /// -mms-bitfields command-line option.
5100 LastDecl->NextInContextAndBits.setPointer(nullptr);
5113 Source->FindExternalLexicalDecls(this, [](Decl::Kind K) {
5129 ExternalLast->NextInContextAndBits.setPointer(FirstDecl);
5144 int ReasonToReject = -1;
5145 if (!CXXRD || CXXRD->isExternCContext())
5147 else if (CXXRD->hasAttr<PackedAttr>())
5149 else if (CXXRD->isUnion())
5151 else if (CXXRD->isTriviallyCopyable())
5153 else if (CXXRD->hasTrivialDestructor())
5155 else if (CXXRD->isStandardLayout())
5158 "field-padding"))
5161 EnabledAsanMask, getQualifiedNameAsString(), "field-padding"))
5181 if (I->getIdentifier())
5184 if (const auto *RT = I->getType()->getAs<RecordType>())
5186 RT->getDecl()->findFirstNamedDataMember())
5207 //===----------------------------------------------------------------------===//
5209 //===----------------------------------------------------------------------===//
5224 // Zero params -> null pointer.
5234 this->setCapturesCXXThis(CapturesCXXThis);
5235 this->NumCaptures = Captures.size();
5238 this->Captures = nullptr;
5242 this->Captures = Captures.copy(Context).data();
5255 return SourceRange(getLocation(), Body ? Body->getEndLoc() : getLocation());
5258 //===----------------------------------------------------------------------===//
5260 //===----------------------------------------------------------------------===//
5272 Listener->AddedAnonymousNamespace(this, D);
5285 memcpy(PCD->getTrailingObjects<char>(), Arg.data(), Arg.size());
5286 PCD->getTrailingObjects<char>()[Arg.size()] = '\0';
5307 memcpy(PDMD->getTrailingObjects<char>(), Name.data(), Name.size());
5308 PDMD->getTrailingObjects<char>()[Name.size()] = '\0';
5309 memcpy(PDMD->getTrailingObjects<char>() + ValueStart, Value.data(),
5311 PDMD->getTrailingObjects<char>()[ValueStart + Value.size()] = '\0';
5359 return MostRecent->hasAttr<WeakAttr>() ||
5360 MostRecent->hasAttr<WeakRefAttr>() || isWeakImported();
5365 return Var->isInitCapture();
5398 New->setHasWrittenPrototype(hasWrittenPrototype);
5489 End = Init->getEndLoc();
5505 if (auto *TT = getTypeSourceInfo()->getType()->getAs<TagType>()) {
5506 auto *OwningTypedef = TT->getDecl()->getTypedefNameForAnonDecl();
5509 OwningTypedef = OwningTypedef->getCanonicalDecl();
5510 ThisTypedef = ThisTypedef->getCanonicalDecl();
5513 return TT->getDecl();
5521 if (auto *TT = getUnderlyingType()->getAs<TagType>()) {
5522 if (auto *TD = TT->getDecl()) {
5523 if (TD->getName() != getName())
5526 SourceLocation TDLoc = TD->getLocation();
5563 if (typeIsPostfix(TInfo->getType()))
5564 RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();
5572 RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();
5597 SourceLocation Loc = Statement ? Statement->getBeginLoc() : SourceLocation();
5610 return SourceRange(getLocation(), Statement->getEndLoc());
5616 setLocation(Statement->getBeginLoc());
5651 // FIXME: support nested buffers if required for back-compat.
5664 //===----------------------------------------------------------------------===//
5666 //===----------------------------------------------------------------------===//
5672 while (Mod->Parent) {
5673 Mod = Mod->Parent;
5711 Import->setImplicit();
5737 //===----------------------------------------------------------------------===//
5739 //===----------------------------------------------------------------------===//
5755 if (FD->hasAttr<ArmLocallyStreamingAttr>())
5758 if (const Type *Ty = FD->getType().getTypePtrOrNull())
5759 if (const auto *FPT = Ty->getAs<FunctionProtoType>())
5760 if (FPT->getAArch64SMEAttributes() &