[cfe-commits] r73297 - in /cfe/trunk: include/clang/AST/DeclTemplate.h lib/Sema/Sema.h lib/Sema/SemaTemplate.cpp
Anders Carlsson
andersca at mac.com
Sat Jun 13 11:20:51 PDT 2009
Author: andersca
Date: Sat Jun 13 13:20:51 2009
New Revision: 73297
URL: http://llvm.org/viewvc/llvm-project?rev=73297&view=rev
Log:
Have CheckClassTemplatePartialSpecializationArgs take a TemplateArgumentListBuilder. No functionality change.
Modified:
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaTemplate.cpp
Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=73297&r1=73296&r2=73297&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Sat Jun 13 13:20:51 2009
@@ -623,6 +623,7 @@
/// EndParameterPack - Finish adding arguments from a parameter pack.
void EndParameterPack();
+ const TemplateArgument *getFlatArgumentList() const { return Args.data(); }
TemplateArgument *getFlatArgumentList() { return Args.data(); }
};
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=73297&r1=73296&r2=73297&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Sat Jun 13 13:20:51 2009
@@ -1959,7 +1959,7 @@
bool CheckClassTemplatePartialSpecializationArgs(
TemplateParameterList *TemplateParams,
- const TemplateArgument *TemplateArgs,
+ const TemplateArgumentListBuilder &TemplateArgs,
bool &MirrorsPrimaryTemplate);
virtual DeclResult
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=73297&r1=73296&r2=73297&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Sat Jun 13 13:20:51 2009
@@ -2080,11 +2080,14 @@
/// \returns true if there was an error, false otherwise.
bool Sema::CheckClassTemplatePartialSpecializationArgs(
TemplateParameterList *TemplateParams,
- const TemplateArgument *TemplateArgs,
+ const TemplateArgumentListBuilder &TemplateArgs,
bool &MirrorsPrimaryTemplate) {
// FIXME: the interface to this function will have to change to
// accommodate variadic templates.
MirrorsPrimaryTemplate = true;
+
+ const TemplateArgument *ArgList = TemplateArgs.getFlatArgumentList();
+
for (unsigned I = 0, N = TemplateParams->size(); I != N; ++I) {
// Determine whether the template argument list of the partial
// specialization is identical to the implicit argument list of
@@ -2094,7 +2097,7 @@
if (TemplateTypeParmDecl *TTP
= dyn_cast<TemplateTypeParmDecl>(TemplateParams->getParam(I))) {
if (Context.getCanonicalType(Context.getTypeDeclType(TTP)) !=
- Context.getCanonicalType(TemplateArgs[I].getAsType()))
+ Context.getCanonicalType(ArgList[I].getAsType()))
MirrorsPrimaryTemplate = false;
} else if (TemplateTemplateParmDecl *TTP
= dyn_cast<TemplateTemplateParmDecl>(
@@ -2103,10 +2106,10 @@
// Expression storage for template template parameters.
TemplateTemplateParmDecl *ArgDecl
= dyn_cast_or_null<TemplateTemplateParmDecl>(
- TemplateArgs[I].getAsDecl());
+ ArgList[I].getAsDecl());
if (!ArgDecl)
if (DeclRefExpr *DRE
- = dyn_cast_or_null<DeclRefExpr>(TemplateArgs[I].getAsExpr()))
+ = dyn_cast_or_null<DeclRefExpr>(ArgList[I].getAsExpr()))
ArgDecl = dyn_cast<TemplateTemplateParmDecl>(DRE->getDecl());
if (!ArgDecl ||
@@ -2122,7 +2125,7 @@
continue;
}
- Expr *ArgExpr = TemplateArgs[I].getAsExpr();
+ Expr *ArgExpr = ArgList[I].getAsExpr();
if (!ArgExpr) {
MirrorsPrimaryTemplate = false;
continue;
@@ -2281,7 +2284,7 @@
// template.
TemplateArgumentListBuilder ConvertedTemplateArgs(Context);
if (CheckTemplateArgumentList(ClassTemplate, TemplateNameLoc, LAngleLoc,
- &TemplateArgs[0], TemplateArgs.size(),
+ TemplateArgs.data(), TemplateArgs.size(),
RAngleLoc, ConvertedTemplateArgs))
return true;
@@ -2296,7 +2299,7 @@
bool MirrorsPrimaryTemplate;
if (CheckClassTemplatePartialSpecializationArgs(
ClassTemplate->getTemplateParameters(),
- ConvertedTemplateArgs.getFlatArgumentList(),
+ ConvertedTemplateArgs,
MirrorsPrimaryTemplate))
return true;
@@ -2456,7 +2459,7 @@
// template arguments in the specialization.
QualType WrittenTy
= Context.getTemplateSpecializationType(Name,
- &TemplateArgs[0],
+ TemplateArgs.data(),
TemplateArgs.size(),
Context.getTypeDeclType(Specialization));
Specialization->setTypeAsWritten(WrittenTy);
More information about the cfe-commits
mailing list