diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-06 22:42:48 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-06 22:42:48 +0000 |
commit | cd72ba97e73f514ccb12212184e1312268b8bebe (patch) | |
tree | 9d6197b565008720775400978e22df5fcdfb79f6 /clang/lib/AST/DeclTemplate.cpp | |
parent | dc93bbc4b07eb30cfb13ea70fcb801b189f3ef5b (diff) | |
download | bcm5719-llvm-cd72ba97e73f514ccb12212184e1312268b8bebe.tar.gz bcm5719-llvm-cd72ba97e73f514ccb12212184e1312268b8bebe.zip |
Semantic checking for class template declarations and
redeclarations. For example, checks that a class template
redeclaration has the same template parameters as previous
declarations.
Detangled class-template checking from ActOnTag, whose logic was
getting rather convoluted because it tried to handle C, C++, and C++
template semantics in one shot.
Made some inroads toward eliminating extraneous "declaration does not
declare anything" errors by adding an "error" type specifier.
llvm-svn: 63973
Diffstat (limited to 'clang/lib/AST/DeclTemplate.cpp')
-rw-r--r-- | clang/lib/AST/DeclTemplate.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp index 394939569ea..d005ca3b067 100644 --- a/clang/lib/AST/DeclTemplate.cpp +++ b/clang/lib/AST/DeclTemplate.cpp @@ -22,19 +22,25 @@ using namespace clang; // TemplateParameterList Implementation //===----------------------------------------------------------------------===// -TemplateParameterList::TemplateParameterList(Decl **Params, unsigned NumParams) - : NumParams(NumParams) { +TemplateParameterList::TemplateParameterList(SourceLocation TemplateLoc, + SourceLocation LAngleLoc, + Decl **Params, unsigned NumParams, + SourceLocation RAngleLoc) + : TemplateLoc(TemplateLoc), LAngleLoc(LAngleLoc), RAngleLoc(RAngleLoc), + NumParams(NumParams) { for (unsigned Idx = 0; Idx < NumParams; ++Idx) begin()[Idx] = Params[Idx]; } TemplateParameterList * -TemplateParameterList::Create(ASTContext &C, Decl **Params, - unsigned NumParams) { +TemplateParameterList::Create(ASTContext &C, SourceLocation TemplateLoc, + SourceLocation LAngleLoc, Decl **Params, + unsigned NumParams, SourceLocation RAngleLoc) { unsigned Size = sizeof(TemplateParameterList) + sizeof(Decl *) * NumParams; unsigned Align = llvm::AlignOf<TemplateParameterList>::Alignment; void *Mem = C.Allocate(Size, Align); - return new (Mem) TemplateParameterList(Params, NumParams); + return new (Mem) TemplateParameterList(TemplateLoc, LAngleLoc, Params, + NumParams, RAngleLoc); } //===----------------------------------------------------------------------===// |