From 21610380de972a5307dfb07f446b44fbe2989be5 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 29 Oct 2009 00:04:11 +0000 Subject: Implement support for semantic checking and template instantiation of class template partial specializations of member templates. Also, fixes a silly little bug in the marking of "used" template parameters in member templates. Fixes PR5236. llvm-svn: 85447 --- clang/lib/AST/DeclTemplate.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'clang/lib/AST/DeclTemplate.cpp') diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp index 1a40dd7e610..fb3bd09ff40 100644 --- a/clang/lib/AST/DeclTemplate.cpp +++ b/clang/lib/AST/DeclTemplate.cpp @@ -67,6 +67,21 @@ unsigned TemplateParameterList::getMinRequiredArguments() const { return NumRequiredArgs; } +unsigned TemplateParameterList::getDepth() const { + if (size() == 0) + return 0; + + const NamedDecl *FirstParm = getParam(0); + if (const TemplateTypeParmDecl *TTP + = dyn_cast(FirstParm)) + return TTP->getDepth(); + else if (const NonTypeTemplateParmDecl *NTTP + = dyn_cast(FirstParm)) + return NTTP->getDepth(); + else + return cast(FirstParm)->getDepth(); +} + //===----------------------------------------------------------------------===// // TemplateDecl Implementation //===----------------------------------------------------------------------===// @@ -229,6 +244,14 @@ TemplateTypeParmDecl::Create(ASTContext &C, DeclContext *DC, return new (C) TemplateTypeParmDecl(DC, L, Id, Typename, Type, ParameterPack); } +unsigned TemplateTypeParmDecl::getDepth() const { + return TypeForDecl->getAs()->getDepth(); +} + +unsigned TemplateTypeParmDecl::getIndex() const { + return TypeForDecl->getAs()->getIndex(); +} + //===----------------------------------------------------------------------===// // NonTypeTemplateParmDecl Method Implementations //===----------------------------------------------------------------------===// -- cgit v1.2.3