diff options
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 7f85805..5fceacd 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -3156,25 +3156,25 @@ Sema::SubstParmVarDecl(ParmVarDecl *OldParm, const MultiLevelTemplateArgumentList &TemplateArgs, int indexAdjustment, UnsignedOrNone NumExpansions, bool ExpectParameterPack, bool EvaluateConstraint) { - TypeSourceInfo *OldDI = OldParm->getTypeSourceInfo(); - TypeSourceInfo *NewDI = nullptr; + TypeSourceInfo *OldTSI = OldParm->getTypeSourceInfo(); + TypeSourceInfo *NewTSI = nullptr; - TypeLoc OldTL = OldDI->getTypeLoc(); + TypeLoc OldTL = OldTSI->getTypeLoc(); if (PackExpansionTypeLoc ExpansionTL = OldTL.getAs<PackExpansionTypeLoc>()) { // We have a function parameter pack. Substitute into the pattern of the // expansion. - NewDI = SubstType(ExpansionTL.getPatternLoc(), TemplateArgs, - OldParm->getLocation(), OldParm->getDeclName()); - if (!NewDI) + NewTSI = SubstType(ExpansionTL.getPatternLoc(), TemplateArgs, + OldParm->getLocation(), OldParm->getDeclName()); + if (!NewTSI) return nullptr; - if (NewDI->getType()->containsUnexpandedParameterPack()) { + if (NewTSI->getType()->containsUnexpandedParameterPack()) { // We still have unexpanded parameter packs, which means that // our function parameter is still a function parameter pack. // Therefore, make its type a pack expansion type. - NewDI = CheckPackExpansion(NewDI, ExpansionTL.getEllipsisLoc(), - NumExpansions); + NewTSI = CheckPackExpansion(NewTSI, ExpansionTL.getEllipsisLoc(), + NumExpansions); } else if (ExpectParameterPack) { // We expected to get a parameter pack but didn't (because the type // itself is not a pack expansion type), so complain. This can occur when @@ -3182,18 +3182,18 @@ Sema::SubstParmVarDecl(ParmVarDecl *OldParm, // pack expansion. Diag(OldParm->getLocation(), diag::err_function_parameter_pack_without_parameter_packs) - << NewDI->getType(); + << NewTSI->getType(); return nullptr; } } else { - NewDI = SubstType(OldDI, TemplateArgs, OldParm->getLocation(), - OldParm->getDeclName()); + NewTSI = SubstType(OldTSI, TemplateArgs, OldParm->getLocation(), + OldParm->getDeclName()); } - if (!NewDI) + if (!NewTSI) return nullptr; - if (NewDI->getType()->isVoidType()) { + if (NewTSI->getType()->isVoidType()) { Diag(OldParm->getLocation(), diag::err_param_with_void_type); return nullptr; } @@ -3205,7 +3205,7 @@ Sema::SubstParmVarDecl(ParmVarDecl *OldParm, // here, when the instantiated versions of those referenced parameters are in // scope. if (TemplateTypeParmDecl *TTP = - GetContainedInventedTypeParmVisitor().Visit(OldDI->getType())) { + GetContainedInventedTypeParmVisitor().Visit(OldTSI->getType())) { if (const TypeConstraint *TC = TTP->getTypeConstraint()) { auto *Inst = cast_or_null<TemplateTypeParmDecl>( FindInstantiatedDecl(TTP->getLocation(), TTP, TemplateArgs)); @@ -3219,12 +3219,10 @@ Sema::SubstParmVarDecl(ParmVarDecl *OldParm, } } - ParmVarDecl *NewParm = CheckParameter(Context.getTranslationUnitDecl(), - OldParm->getInnerLocStart(), - OldParm->getLocation(), - OldParm->getIdentifier(), - NewDI->getType(), NewDI, - OldParm->getStorageClass()); + ParmVarDecl *NewParm = CheckParameter( + Context.getTranslationUnitDecl(), OldParm->getInnerLocStart(), + OldParm->getLocation(), OldParm->getIdentifier(), NewTSI->getType(), + NewTSI, OldParm->getStorageClass()); if (!NewParm) return nullptr; |
