aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaExpr.cpp9
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp25
2 files changed, 14 insertions, 20 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 9896d1b0ee..60dbdc14be 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -3668,14 +3668,11 @@ ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc,
Param);
// Instantiate the expression.
- MultiLevelTemplateArgumentList ArgList
+ MultiLevelTemplateArgumentList MutiLevelArgList
= getTemplateInstantiationArgs(FD, 0, /*RelativeToPrimary=*/true);
- std::pair<const TemplateArgument *, unsigned> Innermost
- = ArgList.getInnermost();
InstantiatingTemplate Inst(*this, CallLoc, Param,
- ArrayRef<TemplateArgument>(Innermost.first,
- Innermost.second));
+ MutiLevelArgList.getInnermost());
if (Inst)
return ExprError();
@@ -3687,7 +3684,7 @@ ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc,
// default argument expression appears.
ContextRAII SavedContext(*this, FD);
LocalInstantiationScope Local(*this);
- Result = SubstExpr(UninstExpr, ArgList);
+ Result = SubstExpr(UninstExpr, MutiLevelArgList);
}
if (Result.isInvalid())
return ExprError();
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index e1b8ca2e95..ee471696bd 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1152,12 +1152,11 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
// this declaration.
FunctionTemplateDecl *FunctionTemplate = D->getDescribedFunctionTemplate();
if (FunctionTemplate && !TemplateParams) {
- std::pair<const TemplateArgument *, unsigned> Innermost
- = TemplateArgs.getInnermost();
+ ArrayRef<TemplateArgument> Innermost = TemplateArgs.getInnermost();
void *InsertPos = 0;
FunctionDecl *SpecFunc
- = FunctionTemplate->findSpecialization(Innermost.first, Innermost.second,
+ = FunctionTemplate->findSpecialization(Innermost.begin(), Innermost.size(),
InsertPos);
// If we already have a function template specialization, return it.
@@ -1282,12 +1281,11 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
}
} else if (FunctionTemplate) {
// Record this function template specialization.
- std::pair<const TemplateArgument *, unsigned> Innermost
- = TemplateArgs.getInnermost();
+ ArrayRef<TemplateArgument> Innermost = TemplateArgs.getInnermost();
Function->setFunctionTemplateSpecialization(FunctionTemplate,
TemplateArgumentList::CreateCopy(SemaRef.Context,
- Innermost.first,
- Innermost.second),
+ Innermost.begin(),
+ Innermost.size()),
/*InsertPos=*/0);
} else if (isFriend) {
// Note, we need this connection even if the friend doesn't have a body.
@@ -1460,12 +1458,12 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
// We are creating a function template specialization from a function
// template. Check whether there is already a function template
// specialization for this particular set of template arguments.
- std::pair<const TemplateArgument *, unsigned> Innermost
- = TemplateArgs.getInnermost();
+ ArrayRef<TemplateArgument> Innermost = TemplateArgs.getInnermost();
void *InsertPos = 0;
FunctionDecl *SpecFunc
- = FunctionTemplate->findSpecialization(Innermost.first, Innermost.second,
+ = FunctionTemplate->findSpecialization(Innermost.begin(),
+ Innermost.size(),
InsertPos);
// If we already have a function template specialization, return it.
@@ -1616,12 +1614,11 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
Method->setDescribedFunctionTemplate(FunctionTemplate);
} else if (FunctionTemplate) {
// Record this function template specialization.
- std::pair<const TemplateArgument *, unsigned> Innermost
- = TemplateArgs.getInnermost();
+ ArrayRef<TemplateArgument> Innermost = TemplateArgs.getInnermost();
Method->setFunctionTemplateSpecialization(FunctionTemplate,
TemplateArgumentList::CreateCopy(SemaRef.Context,
- Innermost.first,
- Innermost.second),
+ Innermost.begin(),
+ Innermost.size()),
/*InsertPos=*/0);
} else if (!isFriend) {
// Record that this is an instantiation of a member function.