reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced

References

tools/clang/include/clang/Sema/Template.h
  490       StartingScope = SemaRef.CurrentInstantiationScope;
tools/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
   69   return ::SubstQualifier(SemaRef, OldDecl, NewDecl, TemplateArgs);
   74   return ::SubstQualifier(SemaRef, OldDecl, NewDecl, TemplateArgs);
  682   LabelDecl *Inst = LabelDecl::Create(SemaRef.Context, Owner, D->getLocation(),
  696     = NamespaceAliasDecl::Create(SemaRef.Context, Owner,
  713     DI = SemaRef.SubstType(DI, TemplateArgs,
  717       DI = SemaRef.Context.getTrivialTypeSourceInfo(SemaRef.Context.IntTy);
  717       DI = SemaRef.Context.getTrivialTypeSourceInfo(SemaRef.Context.IntTy);
  720     SemaRef.MarkDeclarationsReferencedInType(D->getLocation(), DI->getType());
  731       RD->getEnclosingNamespaceContext() == SemaRef.getStdNamespace() &&
  734       SemaRef.getSourceManager().isInSystemHeader(D->getBeginLoc()))
  736     DI = SemaRef.Context.getTrivialTypeSourceInfo(
  742     Typedef = TypeAliasDecl::Create(SemaRef.Context, Owner, D->getBeginLoc(),
  745     Typedef = TypedefDecl::Create(SemaRef.Context, Owner, D->getBeginLoc(),
  762     NamedDecl *InstPrev = SemaRef.FindInstantiatedDecl(D->getLocation(), Prev,
  770     SemaRef.isIncompatibleTypedef(InstPrevTypedef, Typedef);
  775   SemaRef.InstantiateAttrs(TemplateArgs, D, Typedef);
  778     SemaRef.inferGslPointerAttribute(Typedef);
  803   LocalInstantiationScope Scope(SemaRef);
  826     = TypeAliasTemplateDecl::Create(SemaRef.Context, Owner, D->getLocation(),
  843   auto *NewBD = BindingDecl::Create(SemaRef.Context, Owner, D->getLocation(),
  846   SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, NewBD);
  876   TypeSourceInfo *DI = SemaRef.SubstType(
  883     SemaRef.Diag(D->getLocation(), diag::err_variable_instantiates_to_function)
  890     SemaRef.adjustContextForLocalExternDecl(DC);
  895     Var = DecompositionDecl::Create(SemaRef.Context, DC, D->getInnerLocStart(),
  899     Var = VarDecl::Create(SemaRef.Context, DC, D->getInnerLocStart(),
  904   if (SemaRef.getLangOpts().ObjCAutoRefCount &&
  905       SemaRef.inferObjCARCLifetime(Var))
  912   SemaRef.BuildVariableInstantiation(Var, D, TemplateArgs, LateAttrs, Owner,
  917     if (SemaRef.isCopyElisionCandidate(ReturnType, Var, Sema::CES_Strict))
  924     SemaRef.CheckStaticLocalForDllExport(Var);
  931     = AccessSpecDecl::Create(SemaRef.Context, D->getAccess(), Owner,
  942     DI = SemaRef.SubstType(DI, TemplateArgs,
  954       SemaRef.Diag(D->getLocation(), diag::err_field_instantiates_to_function)
  959     SemaRef.MarkDeclarationsReferencedInType(D->getLocation(), DI->getType());
  968         SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
  971       = SemaRef.SubstExpr(BitWidth, TemplateArgs);
  979   FieldDecl *Field = SemaRef.CheckFieldDecl(D->getDeclName(),
  994   SemaRef.InstantiateAttrs(TemplateArgs, D, Field, LateAttrs, StartingScope);
  997     SemaRef.CheckAlignasUnderalignment(Field);
 1004     SemaRef.Context.setInstantiatedFromUnnamedFieldDecl(Field, D);
 1009       SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Field);
 1024     SemaRef.Diag(D->getLocation(), diag::err_property_is_variably_modified)
 1028     DI = SemaRef.SubstType(DI, TemplateArgs,
 1040       SemaRef.Diag(D->getLocation(), diag::err_field_instantiates_to_function)
 1045     SemaRef.MarkDeclarationsReferencedInType(D->getLocation(), DI->getType());
 1049       SemaRef.Context, Owner, D->getLocation(), D->getDeclName(), DI->getType(),
 1052   SemaRef.InstantiateAttrs(TemplateArgs, D, Property, LateAttrs,
 1066     new (SemaRef.Context)NamedDecl*[D->getChainingSize()];
 1070     NamedDecl *Next = SemaRef.FindInstantiatedDecl(D->getLocation(), PI,
 1080       SemaRef.Context, Owner, D->getLocation(), D->getIdentifier(), T,
 1084     IndirectField->addAttr(Attr->clone(SemaRef.Context));
 1104       InstTy = SemaRef.SubstType(Ty, TemplateArgs,
 1110     FriendDecl *FD = SemaRef.CheckFriendTypeDecl(D->getBeginLoc(),
 1132     FriendDecl::Create(SemaRef.Context, Owner, D->getLocation(),
 1145       SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
 1148     = SemaRef.SubstExpr(AssertExpr, TemplateArgs);
 1152   return SemaRef.BuildStaticAssertDeclaration(D->getLocation(),
 1162     NamedDecl *Prev = SemaRef.FindInstantiatedDecl(D->getLocation(),
 1170       EnumDecl::Create(SemaRef.Context, Owner, D->getBeginLoc(),
 1179       TypeSourceInfo *NewTI = SemaRef.SubstType(TI, TemplateArgs, UnderlyingLoc,
 1181       if (!NewTI || SemaRef.CheckEnumUnderlyingType(NewTI))
 1182         Enum->setIntegerType(SemaRef.Context.IntTy);
 1192   SemaRef.InstantiateAttrs(TemplateArgs, D, Enum);
 1197   SemaRef.Context.setManglingNumber(Enum, SemaRef.Context.getManglingNumber(D));
 1197   SemaRef.Context.setManglingNumber(Enum, SemaRef.Context.getManglingNumber(D));
 1200   if (DeclaratorDecl *DD = SemaRef.Context.getDeclaratorForUnnamedTagDecl(D))
 1201     SemaRef.Context.addDeclaratorForUnnamedTagDecl(Enum, DD);
 1204   if (TypedefNameDecl *TND = SemaRef.Context.getTypedefNameForUnnamedTagDecl(D))
 1205     SemaRef.Context.addTypedefNameForUnnamedTagDecl(Enum, TND);
 1217         SemaRef.SubstType(TI->getType(), TemplateArgs,
 1219       SemaRef.CheckEnumRedeclaration(Def->getLocation(), Def->isScoped(),
 1232     SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Enum);
 1255           SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
 1257       Value = SemaRef.SubstExpr(UninstValue, TemplateArgs);
 1268       = SemaRef.CheckEnumConstant(Enum, LastEnumConst,
 1279       SemaRef.InstantiateAttrs(TemplateArgs, EC, EnumConst);
 1290         SemaRef.CurrentInstantiationScope->InstantiatedLocal(EC, EnumConst);
 1295   SemaRef.ActOnEnumBody(Enum->getLocation(), Enum->getBraceRange(), Enum,
 1313   LocalInstantiationScope Scope(SemaRef);
 1326     QualifierLoc = SemaRef.SubstNestedNameSpecifierLoc(QualifierLoc,
 1353       DC = SemaRef.computeDeclContext(SS);
 1356       DC = SemaRef.FindInstantiatedContext(Pattern->getLocation(),
 1363     LookupResult R(SemaRef, Pattern->getDeclName(), Pattern->getLocation(),
 1365                    SemaRef.forRedeclarationInCurContext());
 1366     SemaRef.LookupQualifiedName(R, DC);
 1375       SemaRef.Diag(Pattern->getLocation(), diag::err_not_tag_in_scope)
 1409       if (!SemaRef.TemplateParameterListsAreEqual(InstParams, PrevParams,
 1422           SemaRef.CheckTemplateParameterList(InstParams, PrevParams,
 1429       SemaRef.Context, Pattern->getTagKind(), DC, Pattern->getBeginLoc(),
 1436   SemaRef.InstantiateAttrsForDecl(TemplateArgs, Pattern, RecordInst, LateAttrs,
 1440     = ClassTemplateDecl::Create(SemaRef.Context, DC, D->getLocation(),
 1463   SemaRef.Context.getInjectedClassNameType(RecordInst,
 1525   LocalInstantiationScope Scope(SemaRef);
 1548       SemaRef.Context, DC, D->getLocation(), D->getIdentifier(), InstParams,
 1606   LocalInstantiationScope Scope(SemaRef);
 1646     SemaRef.CheckFriendAccess(InstTemplate);
 1657     NamedDecl *Prev = SemaRef.FindInstantiatedDecl(D->getLocation(),
 1665       SemaRef.Context, D->getTagKind(), Owner, D->getBeginLoc(),
 1672   SemaRef.InstantiateAttrsForDecl(TemplateArgs, D, Record, LateAttrs,
 1694     SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Record);
 1697   SemaRef.Context.setManglingNumber(Record,
 1698                                     SemaRef.Context.getManglingNumber(D));
 1702   if (DeclaratorDecl *DD = SemaRef.Context.getDeclaratorForUnnamedTagDecl(D))
 1703     SemaRef.Context.addDeclaratorForUnnamedTagDecl(Record, DD);
 1707   if (TypedefNameDecl *TND = SemaRef.Context.getTypedefNameForUnnamedTagDecl(D))
 1708     SemaRef.Context.addTypedefNameForUnnamedTagDecl(Record, TND);
 1715     Sema::LocalEagerInstantiationScope LocalInstantiations(SemaRef);
 1717     SemaRef.InstantiateClass(D->getLocation(), Record, D, TemplateArgs,
 1724       SemaRef.InstantiateClassMembers(D->getLocation(), Record, TemplateArgs,
 1732   SemaRef.DiagnoseUnusedNestedTypedefs(Record);
 1791   LocalInstantiationScope Scope(SemaRef, MergeWithParentScope);
 1796         SemaRef, TemplateArgs, DGuide->getExplicitSpecifier(), DGuide);
 1805   QualType T = adjustFunctionTypeForInstantiation(SemaRef.Context, D, TInfo);
 1809     QualifierLoc = SemaRef.SubstNestedNameSpecifierLoc(QualifierLoc,
 1821     SemaRef.adjustContextForLocalExternDecl(DC);
 1825     DC = SemaRef.computeDeclContext(SS);
 1828     DC = SemaRef.FindInstantiatedContext(D->getLocation(), D->getDeclContext(),
 1833     = SemaRef.SubstDeclarationNameInfo(D->getNameInfo(), TemplateArgs);
 1838         SemaRef.Context, DC, D->getInnerLocStart(),
 1846         SemaRef.Context, DC, D->getInnerLocStart(), NameInfo, T, TInfo,
 1890     FunctionTemplate = FunctionTemplateDecl::Create(SemaRef.Context, DC,
 1906                             TemplateArgumentList::CreateCopy(SemaRef.Context,
 1925       SemaRef, Function->getDeclName(), SourceLocation(),
 1929                              : SemaRef.forRedeclarationInCurContext());
 1938     if (SemaRef.Subst(Info->getTemplateArgs(), Info->getNumTemplateArgs(),
 1944       Decl *Temp = SemaRef.FindInstantiatedDecl(D->getLocation(),
 1952     if (SemaRef.CheckFunctionTemplateSpecialization(Function,
 1961     SemaRef.LookupQualifiedName(Previous, DC);
 1966     if (SemaRef.Subst(Info->getTemplateArgs(), Info->getNumTemplateArgs(),
 1970     if (SemaRef.CheckFunctionTemplateSpecialization(Function,
 1980     SemaRef.LookupQualifiedName(Previous, DC);
 1990   SemaRef.CheckFunctionDeclaration(/*Scope*/ nullptr, Function, Previous,
 2014       SemaRef.CheckForFunctionRedefinition(Function);
 2028                 SemaRef.PendingLocalImplicitInstantiations.push_back(
 2043       SemaRef.CheckTemplateParameterList(
 2053     SemaRef.SetDeclDefaulted(Function, D->getLocation());
 2055     SemaRef.SetDeclDeleted(Function, D->getLocation());
 2096   LocalInstantiationScope Scope(SemaRef, MergeWithParentScope);
 2113       instantiateExplicitSpecifier(SemaRef, TemplateArgs,
 2122   QualType T = adjustFunctionTypeForInstantiation(SemaRef.Context, D, TInfo);
 2126     QualifierLoc = SemaRef.SubstNestedNameSpecifierLoc(QualifierLoc,
 2137       DC = SemaRef.computeDeclContext(SS);
 2139       if (DC && SemaRef.RequireCompleteDeclContext(SS, DC))
 2142       DC = SemaRef.FindInstantiatedContext(D->getLocation(),
 2155     = SemaRef.SubstDeclarationNameInfo(D->getNameInfo(), TemplateArgs);
 2158         SemaRef.Context, Record, StartLoc, NameInfo, T, TInfo,
 2164         SemaRef.Context, Record, StartLoc, NameInfo, T, TInfo,
 2169         SemaRef.Context, Record, StartLoc, NameInfo, T, TInfo,
 2174     Method = CXXMethodDecl::Create(SemaRef.Context, Record, StartLoc, NameInfo,
 2199     FunctionTemplate = FunctionTemplateDecl::Create(SemaRef.Context, Record,
 2213                          TemplateArgumentList::CreateCopy(SemaRef.Context,
 2227           SemaRef.Context,
 2243   LookupResult Previous(SemaRef, NameInfo, Sema::LookupOrdinaryName,
 2257     if (SemaRef.Subst(Info->getTemplateArgs(), Info->getNumTemplateArgs(),
 2263       Decl *Temp = SemaRef.FindInstantiatedDecl(D->getLocation(),
 2271     if (SemaRef.CheckFunctionTemplateSpecialization(Method,
 2280     SemaRef.LookupQualifiedName(Previous, DC);
 2284     if (SemaRef.Subst(Info->getTemplateArgs(), Info->getNumTemplateArgs(),
 2288     if (SemaRef.CheckFunctionTemplateSpecialization(Method,
 2297     SemaRef.LookupQualifiedName(Previous, DC);
 2298     if (SemaRef.CheckFunctionTemplateSpecialization(Method, nullptr, Previous))
 2303     SemaRef.LookupQualifiedName(Previous, Record);
 2313   SemaRef.CheckFunctionDeclaration(nullptr, Method, Previous,
 2317     SemaRef.CheckPureMethod(Method, SourceRange());
 2329   SemaRef.CheckOverrideControl(Method);
 2333     SemaRef.SetDeclDefaulted(Method, Method->getLocation());
 2335     SemaRef.SetDeclDeleted(Method, Method->getLocation());
 2341     SemaRef.CompleteMemberSpecialization(Method, Previous);
 2356       SemaRef.CheckFriendAccess(Method);
 2377       SemaRef.MarkFunctionReferenced(Loc, Method);
 2397   return SemaRef.SubstParmVarDecl(D, TemplateArgs, /*indexAdjustment*/ 0, None,
 2407       SemaRef.Context, Owner, D->getBeginLoc(), D->getLocation(),
 2415         SemaRef.SubstType(D->getDefaultArgumentInfo(), TemplateArgs,
 2423   SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Inst);
 2446           SemaRef.SubstType(D->getExpansionTypeSourceInfo(I), TemplateArgs,
 2452           SemaRef.CheckNonTypeTemplateParameterType(NewDI, D->getLocation());
 2470     SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
 2479     if (SemaRef.CheckParameterPacksForExpansion(Expansion.getEllipsisLoc(),
 2489         Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, I);
 2490         TypeSourceInfo *NewDI = SemaRef.SubstType(Pattern, TemplateArgs,
 2497             SemaRef.CheckNonTypeTemplateParameterType(NewDI, D->getLocation());
 2514       Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, -1);
 2515       TypeSourceInfo *NewPattern = SemaRef.SubstType(Pattern, TemplateArgs,
 2521       SemaRef.CheckNonTypeTemplateParameterType(NewPattern, D->getLocation());
 2522       DI = SemaRef.CheckPackExpansion(NewPattern, Expansion.getEllipsisLoc(),
 2531     DI = SemaRef.SubstType(D->getTypeSourceInfo(), TemplateArgs,
 2537     T = SemaRef.CheckNonTypeTemplateParameterType(DI, D->getLocation());
 2539       T = SemaRef.Context.IntTy;
 2547         SemaRef.Context, Owner, D->getInnerLocStart(), D->getLocation(),
 2553         SemaRef.Context, Owner, D->getInnerLocStart(), D->getLocation(),
 2564         SemaRef, Sema::ExpressionEvaluationContext::ConstantEvaluated);
 2565     ExprResult Value = SemaRef.SubstExpr(D->getDefaultArgument(), TemplateArgs);
 2572   SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Param);
 2609       LocalInstantiationScope Scope(SemaRef);
 2624     collectUnexpandedParameterPacks(SemaRef, D->getTemplateParameters(),
 2632     if (SemaRef.CheckParameterPacksForExpansion(D->getLocation(),
 2642         Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, I);
 2643         LocalInstantiationScope Scope(SemaRef);
 2658       Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, -1);
 2660       LocalInstantiationScope Scope(SemaRef);
 2668     LocalInstantiationScope Scope(SemaRef);
 2678         SemaRef.Context, Owner, D->getLocation(),
 2683         SemaRef.Context, Owner, D->getLocation(),
 2690         SemaRef.SubstNestedNameSpecifierLoc(QualifierLoc, TemplateArgs);
 2691     TemplateName TName = SemaRef.SubstTemplateName(
 2696           SemaRef.Context,
 2706   SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Param);
 2716     = UsingDirectiveDecl::Create(SemaRef.Context, Owner, D->getLocation(),
 2742     = SemaRef.SubstNestedNameSpecifierLoc(D->getQualifierLoc(),
 2752     if (auto *RD = dyn_cast<CXXRecordDecl>(SemaRef.CurContext))
 2753       NameInfo.setName(SemaRef.Context.DeclarationNames.getCXXConstructorName(
 2754           SemaRef.Context.getCanonicalType(SemaRef.Context.getRecordType(RD))));
 2754           SemaRef.Context.getCanonicalType(SemaRef.Context.getRecordType(RD))));
 2761   LookupResult Prev(SemaRef, NameInfo, Sema::LookupUsingDeclName,
 2764   UsingDecl *NewUD = UsingDecl::Create(SemaRef.Context, Owner,
 2774     SemaRef.LookupQualifiedName(Prev, Owner);
 2777     if (SemaRef.CheckUsingDeclRedeclaration(D->getUsingLoc(),
 2785       SemaRef.CheckUsingDeclQualifier(D->getUsingLoc(), D->hasTypename(),
 2789   SemaRef.Context.setInstantiatedFromUsingDecl(NewUD, D);
 2798     SemaRef.CheckInheritingConstructorUsingDecl(NewUD);
 2812         cast_or_null<NamedDecl>(SemaRef.FindInstantiatedDecl(
 2819       if (SemaRef.CheckUsingShadowDecl(NewUD, InstTarget, Prev, PrevDecl))
 2823       PrevDecl = cast_or_null<UsingShadowDecl>(SemaRef.FindInstantiatedDecl(
 2828         SemaRef.BuildUsingShadowDecl(/*Scope*/nullptr, NewUD, InstTarget,
 2830     SemaRef.Context.setInstantiatedFromUsingShadowDecl(InstShadow, Shadow);
 2833       SemaRef.CurrentInstantiationScope->InstantiatedLocal(Shadow, InstShadow);
 2856     SemaRef.collectUnexpandedParameterPacks(D->getQualifierLoc(), Unexpanded);
 2857     SemaRef.collectUnexpandedParameterPacks(D->getNameInfo(), Unexpanded);
 2864     if (SemaRef.CheckParameterPacksForExpansion(
 2877       Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, -1);
 2889       SemaRef.Diag(D->getEllipsisLoc(),
 2897       Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, I);
 2908     auto *NewD = SemaRef.BuildUsingPackDecl(D, Expansions);
 2910       SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, NewD);
 2918     = SemaRef.SubstNestedNameSpecifierLoc(D->getQualifierLoc(),
 2927     = SemaRef.SubstDeclarationNameInfo(D->getNameInfo(), TemplateArgs);
 2932                             SemaRef.ArgumentPackSubstitutionIndex != -1;
 2936   NamedDecl *UD = SemaRef.BuildUsingDeclaration(
 2942     SemaRef.Context.setInstantiatedFromUsingDecl(UD, D);
 2961             SemaRef.FindInstantiatedDecl(D->getLocation(), UD, TemplateArgs))
 2967   auto *NewD = SemaRef.BuildUsingPackDecl(D, Expansions);
 2969     SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, NewD);
 2984     Expr *Var = SemaRef.SubstExpr(I, TemplateArgs).get();
 2990     SemaRef.CheckOMPThreadPrivateDecl(D->getLocation(), Vars);
 3001     Expr *Var = SemaRef.SubstExpr(I, TemplateArgs).get();
 3009     ExprResult NewE = SemaRef.SubstExpr(AC->getAllocator(), TemplateArgs);
 3012     OMPClause *IC = SemaRef.ActOnOpenMPAllocatorClause(
 3017   Sema::DeclGroupPtrTy Res = SemaRef.ActOnOpenMPAllocateDirective(
 3038     SubstReductionType = SemaRef.ActOnOpenMPDeclareReductionType(
 3040         ParsedType::make(SemaRef.SubstType(
 3054         SemaRef.CurrentInstantiationScope->findInstantiationOf(PrevDeclInScope)
 3057   auto DRD = SemaRef.ActOnOpenMPDeclareReductionDirectiveStart(
 3061   SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, NewDRD);
 3071     (void)SemaRef.ActOnOpenMPDeclareReductionDirectiveEnd(
 3079     SemaRef.ActOnOpenMPDeclareReductionCombinerStart(
 3081     SemaRef.CurrentInstantiationScope->InstantiatedLocal(
 3084     SemaRef.CurrentInstantiationScope->InstantiatedLocal(
 3088     Sema::CXXThisScopeRAII ThisScope(SemaRef, ThisContext, Qualifiers(),
 3090     SubstCombiner = SemaRef.SubstExpr(D->getCombiner(), TemplateArgs).get();
 3091     SemaRef.ActOnOpenMPDeclareReductionCombinerEnd(NewDRD, SubstCombiner);
 3095           SemaRef.ActOnOpenMPDeclareReductionInitializerStart(
 3097       SemaRef.CurrentInstantiationScope->InstantiatedLocal(
 3100       SemaRef.CurrentInstantiationScope->InstantiatedLocal(
 3105             SemaRef.SubstExpr(D->getInitializer(), TemplateArgs).get();
 3109       SemaRef.ActOnOpenMPDeclareReductionInitializerEnd(
 3123   (void)SemaRef.ActOnOpenMPDeclareReductionDirectiveEnd(/*S=*/nullptr, DRD,
 3139     SubstMapperTy = SemaRef.ActOnOpenMPDeclareMapperType(
 3141         ParsedType::make(SemaRef.SubstType(D->getType(), TemplateArgs,
 3152         SemaRef.CurrentInstantiationScope->findInstantiationOf(PrevDeclInScope)
 3155   OMPDeclareMapperDecl *NewDMD = SemaRef.ActOnOpenMPDeclareMapperDirectiveStart(
 3158   SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, NewDMD);
 3170     SemaRef.StartOpenMPDSABlock(OMPD_declare_mapper, DirName, /*S=*/nullptr,
 3172     SemaRef.ActOnOpenMPDeclareMapperDirectiveVarDecl(
 3174     SemaRef.CurrentInstantiationScope->InstantiatedLocal(
 3178     Sema::CXXThisScopeRAII ThisScope(SemaRef, ThisContext, Qualifiers(),
 3185         Expr *NE = SemaRef.SubstExpr(OE, TemplateArgs).get();
 3195           SemaRef.SubstNestedNameSpecifierLoc(OldC->getMapperQualifierLoc(),
 3199       DeclarationNameInfo NewNameInfo = SemaRef.SubstDeclarationNameInfo(
 3203       OMPClause *NewC = SemaRef.ActOnOpenMPMapClause(
 3209     SemaRef.EndOpenMPDSABlock(nullptr);
 3211   (void)SemaRef.ActOnOpenMPDeclareMapperDirectiveEnd(NewDMD, /*S=*/nullptr,
 3257       cast_or_null<ClassTemplateDecl>(SemaRef.FindInstantiatedDecl(
 3271   if (SemaRef.Subst(ArgLocs.data(), ArgLocs.size(),
 3278   if (SemaRef.CheckTemplateArgumentList(InstClassTemplate,
 3295       SemaRef.CheckSpecializationInstantiationRedecl(D->getLocation(),
 3317     SemaRef.Diag(D->getLocation(), diag::err_redefinition) << PrevDecl;
 3318     SemaRef.Diag(PrevDecl->getDefinition()->getLocation(),
 3326           SemaRef.Context, D->getTagKind(), Owner, D->getBeginLoc(),
 3340   QualType CanonType = SemaRef.Context.getTemplateSpecializationType(
 3342       SemaRef.Context.getRecordType(InstD));
 3351   TypeSourceInfo *WrittenTy = SemaRef.Context.getTemplateSpecializationTypeInfo(
 3369       SemaRef.InstantiateClass(D->getLocation(), InstD, D, TemplateArgs,
 3386       cast_or_null<VarTemplateDecl>(SemaRef.FindInstantiatedDecl(
 3396   if (SemaRef.Subst(TemplateArgsInfo.getArgumentArray(),
 3402   if (SemaRef.CheckTemplateArgumentList(InstVarTemplate, D->getLocation(),
 3414   if (PrevDecl && SemaRef.CheckSpecializationInstantiationRedecl(
 3432       SemaRef.SubstType(D->getTypeSourceInfo(), TemplateArgs,
 3438     SemaRef.Diag(D->getLocation(), diag::err_variable_instantiates_to_function)
 3445       SemaRef.Context, Owner, D->getInnerLocStart(), D->getLocation(),
 3455   SemaRef.BuildVariableInstantiation(Var, D, TemplateArgs, LateAttrs, Owner,
 3467   unsigned DiagID = SemaRef.getDiagnostics().getCustomDiagID(
 3470   SemaRef.Diag(D->getLocation(), DiagID)
 3526     ExprResult Res = SemaRef.SubstExpr(E, TemplateArgs);
 3534     = TemplateParameterList::Create(SemaRef.Context, L->getTemplateLoc(),
 3565   LocalInstantiationScope Scope(SemaRef);
 3580   if (SemaRef.Subst(TemplArgInfo->getTemplateArgs(),
 3588   if (SemaRef.CheckTemplateArgumentList(ClassTemplate,
 3596   if (SemaRef.CheckTemplatePartialSpecializationArgs(
 3610     = SemaRef.Context.getTemplateSpecializationType(TemplateName(ClassTemplate),
 3621     = SemaRef.Context.getTemplateSpecializationTypeInfo(
 3643     SemaRef.Diag(PartialSpec->getLocation(), diag::err_partial_spec_redeclared)
 3645     SemaRef.Diag(PrevDecl->getLocation(), diag::note_prev_partial_spec_here)
 3646       << SemaRef.Context.getTypeDeclType(PrevDecl);
 3654           SemaRef.Context, PartialSpec->getTagKind(), Owner,
 3665   SemaRef.CheckTemplatePartialSpecialization(InstPartialSpec);
 3692   LocalInstantiationScope Scope(SemaRef);
 3707   if (SemaRef.Subst(TemplArgInfo->getTemplateArgs(),
 3715   if (SemaRef.CheckTemplateArgumentList(VarTemplate, PartialSpec->getLocation(),
 3720   if (SemaRef.CheckTemplatePartialSpecializationArgs(
 3733   QualType CanonType = SemaRef.Context.getTemplateSpecializationType(
 3743   TypeSourceInfo *WrittenTy = SemaRef.Context.getTemplateSpecializationTypeInfo(
 3763     SemaRef.Diag(PartialSpec->getLocation(),
 3766     SemaRef.Diag(PrevDecl->getLocation(),
 3772   TypeSourceInfo *DI = SemaRef.SubstType(
 3779     SemaRef.Diag(PartialSpec->getLocation(),
 3788           SemaRef.Context, Owner, PartialSpec->getInnerLocStart(),
 3800   SemaRef.CheckTemplatePartialSpecialization(InstPartialSpec);
 3806   SemaRef.BuildVariableInstantiation(InstPartialSpec, PartialSpec, TemplateArgs,
 3827     = SemaRef.SubstFunctionDeclType(OldTInfo, TemplateArgs,
 3844         LocalInstantiationScope *Scope = SemaRef.CurrentInstantiationScope;
 3849               SemaRef.getNumArgumentsInExpansion(OldParam->getType(),
 3877           Params.push_back(SemaRef.BuildParmVarDeclForTypedef(
 3902     if (SemaRef.SubstParmTypes(D->getLocation(), D->parameters(), nullptr,
 4026   SemaRef.Context.setManglingNumber(New,
 4027                                     SemaRef.Context.getManglingNumber(Tmpl));
 4038   ActiveInstType &ActiveInst = SemaRef.CodeSynthesisContexts.back();
 4046       atTemplateEnd(SemaRef.TemplateInstCallbacks, SemaRef, ActiveInst);
 4046       atTemplateEnd(SemaRef.TemplateInstCallbacks, SemaRef, ActiveInst);
 4049       atTemplateBegin(SemaRef.TemplateInstCallbacks, SemaRef, ActiveInst);
 4049       atTemplateBegin(SemaRef.TemplateInstCallbacks, SemaRef, ActiveInst);
 4063     if (SemaRef.getLangOpts().CPlusPlus11 &&
 4083       New->setType(SemaRef.Context.getFunctionType(
 4086       Sema::ContextRAII SwitchContext(SemaRef, New);
 4087       SemaRef.SubstExceptionSpec(New, Proto, TemplateArgs);
 4095   SemaRef.InstantiateAttrs(TemplateArgs, Definition, New,
 4112   if (isa<CXXDestructorDecl>(New) && SemaRef.getLangOpts().CPlusPlus11)
 4113     SemaRef.AdjustDestructorExceptionSpec(cast<CXXDestructorDecl>(New));