[cfe-commits] r72916 - in /cfe/trunk: include/clang/AST/DeclTemplate.h lib/AST/DeclTemplate.cpp lib/Sema/SemaTemplate.cpp
Anders Carlsson
andersca at mac.com
Thu Jun 4 21:06:48 PDT 2009
Author: andersca
Date: Thu Jun 4 23:06:48 2009
New Revision: 72916
URL: http://llvm.org/viewvc/llvm-project?rev=72916&view=rev
Log:
Change the specialization decls to take a TemplateArgumentListBuilder.
Modified:
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/lib/AST/DeclTemplate.cpp
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=72916&r1=72915&r2=72916&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Thu Jun 4 23:06:48 2009
@@ -578,7 +578,7 @@
llvm::SmallVector<TemplateArgument, 16> Args;
public:
- // FIXME: Should use index array size.
+ // FIXME: Should use the index array size.
size_t size() const { return Args.size(); }
size_t flatSize() const { return Args.size(); }
@@ -691,14 +691,13 @@
ClassTemplateSpecializationDecl(ASTContext &Context, Kind DK,
DeclContext *DC, SourceLocation L,
ClassTemplateDecl *SpecializedTemplate,
- TemplateArgument *TemplateArgs,
- unsigned NumTemplateArgs);
+ TemplateArgumentListBuilder &Builder);
public:
static ClassTemplateSpecializationDecl *
Create(ASTContext &Context, DeclContext *DC, SourceLocation L,
ClassTemplateDecl *SpecializedTemplate,
- TemplateArgument *TemplateArgs, unsigned NumTemplateArgs,
+ TemplateArgumentListBuilder &Builder,
ClassTemplateSpecializationDecl *PrevDecl);
/// \brief Retrieve the template that this specialization specializes.
@@ -761,11 +760,9 @@
DeclContext *DC, SourceLocation L,
TemplateParameterList *Params,
ClassTemplateDecl *SpecializedTemplate,
- TemplateArgument *TemplateArgs,
- unsigned NumTemplateArgs)
+ TemplateArgumentListBuilder &Builder)
: ClassTemplateSpecializationDecl(Context, ClassTemplatePartialSpecialization,
- DC, L, SpecializedTemplate, TemplateArgs,
- NumTemplateArgs),
+ DC, L, SpecializedTemplate, Builder),
TemplateParams(Params) { }
public:
@@ -773,7 +770,7 @@
Create(ASTContext &Context, DeclContext *DC, SourceLocation L,
TemplateParameterList *Params,
ClassTemplateDecl *SpecializedTemplate,
- TemplateArgument *TemplateArgs, unsigned NumTemplateArgs,
+ TemplateArgumentListBuilder &Builder,
ClassTemplatePartialSpecializationDecl *PrevDecl);
/// Get the list of template parameters
Modified: cfe/trunk/lib/AST/DeclTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclTemplate.cpp?rev=72916&r1=72915&r2=72916&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclTemplate.cpp (original)
+++ cfe/trunk/lib/AST/DeclTemplate.cpp Thu Jun 4 23:06:48 2009
@@ -271,8 +271,7 @@
ClassTemplateSpecializationDecl(ASTContext &Context, Kind DK,
DeclContext *DC, SourceLocation L,
ClassTemplateDecl *SpecializedTemplate,
- TemplateArgument *TemplateArgs,
- unsigned NumTemplateArgs)
+ TemplateArgumentListBuilder &Builder)
: CXXRecordDecl(DK,
SpecializedTemplate->getTemplatedDecl()->getTagKind(),
DC, L,
@@ -280,7 +279,8 @@
// class template specializations?
SpecializedTemplate->getIdentifier()),
SpecializedTemplate(SpecializedTemplate),
- TemplateArgs(Context, TemplateArgs, NumTemplateArgs, /*CopyArgs=*/true),
+ TemplateArgs(Context, Builder.getFlatArgumentList(), Builder.flatSize(),
+ /*CopyArgs=*/true),
SpecializationKind(TSK_Undeclared) {
}
@@ -288,16 +288,14 @@
ClassTemplateSpecializationDecl::Create(ASTContext &Context,
DeclContext *DC, SourceLocation L,
ClassTemplateDecl *SpecializedTemplate,
- TemplateArgument *TemplateArgs,
- unsigned NumTemplateArgs,
+ TemplateArgumentListBuilder &Builder,
ClassTemplateSpecializationDecl *PrevDecl) {
ClassTemplateSpecializationDecl *Result
= new (Context)ClassTemplateSpecializationDecl(Context,
ClassTemplateSpecialization,
DC, L,
SpecializedTemplate,
- TemplateArgs,
- NumTemplateArgs);
+ Builder);
Context.getTypeDeclType(Result, PrevDecl);
return Result;
}
@@ -310,14 +308,13 @@
Create(ASTContext &Context, DeclContext *DC, SourceLocation L,
TemplateParameterList *Params,
ClassTemplateDecl *SpecializedTemplate,
- TemplateArgument *TemplateArgs, unsigned NumTemplateArgs,
+ TemplateArgumentListBuilder &Builder,
ClassTemplatePartialSpecializationDecl *PrevDecl) {
ClassTemplatePartialSpecializationDecl *Result
= new (Context)ClassTemplatePartialSpecializationDecl(Context,
DC, L, Params,
SpecializedTemplate,
- TemplateArgs,
- NumTemplateArgs);
+ Builder);
Result->setSpecializationKind(TSK_ExplicitSpecialization);
Context.getTypeDeclType(Result, PrevDecl);
return Result;
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=72916&r1=72915&r2=72916&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Thu Jun 4 23:06:48 2009
@@ -856,8 +856,7 @@
ClassTemplate->getDeclContext(),
TemplateLoc,
ClassTemplate,
- ConvertedTemplateArgs.getFlatArgumentList(),
- ConvertedTemplateArgs.flatSize(), 0);
+ ConvertedTemplateArgs, 0);
ClassTemplate->getSpecializations().InsertNode(Decl, InsertPos);
Decl->setLexicalDeclContext(CurContext);
}
@@ -2129,12 +2128,11 @@
ClassTemplatePartialSpecializationDecl *Partial
= ClassTemplatePartialSpecializationDecl::Create(Context,
ClassTemplate->getDeclContext(),
- TemplateNameLoc,
- TemplateParams,
- ClassTemplate,
- ConvertedTemplateArgs.getFlatArgumentList(),
- ConvertedTemplateArgs.flatSize(),
- PrevPartial);
+ TemplateNameLoc,
+ TemplateParams,
+ ClassTemplate,
+ ConvertedTemplateArgs,
+ PrevPartial);
if (PrevPartial) {
ClassTemplate->getPartialSpecializations().RemoveNode(PrevPartial);
@@ -2150,9 +2148,8 @@
= ClassTemplateSpecializationDecl::Create(Context,
ClassTemplate->getDeclContext(),
TemplateNameLoc,
- ClassTemplate,
- ConvertedTemplateArgs.getFlatArgumentList(),
- ConvertedTemplateArgs.flatSize(),
+ ClassTemplate,
+ ConvertedTemplateArgs,
PrevDecl);
if (PrevDecl) {
@@ -2331,9 +2328,7 @@
ClassTemplate->getDeclContext(),
TemplateNameLoc,
ClassTemplate,
- ConvertedTemplateArgs.getFlatArgumentList(),
- ConvertedTemplateArgs.flatSize(),
- 0);
+ ConvertedTemplateArgs, 0);
Specialization->setLexicalDeclContext(CurContext);
CurContext->addDecl(Context, Specialization);
return DeclPtrTy::make(Specialization);
@@ -2359,9 +2354,7 @@
ClassTemplate->getDeclContext(),
TemplateNameLoc,
ClassTemplate,
- ConvertedTemplateArgs.getFlatArgumentList(),
- ConvertedTemplateArgs.flatSize(),
- 0);
+ ConvertedTemplateArgs, 0);
ClassTemplate->getSpecializations().InsertNode(Specialization,
InsertPos);
More information about the cfe-commits
mailing list