summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-29 00:04:11 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-29 00:04:11 +0000
commit21610380de972a5307dfb07f446b44fbe2989be5 (patch)
tree95c3192bec0dc12a820a0f05839d4c2fec861d6d /clang/lib/AST
parent6c4d255bf3d64fd2ecb48334e780c87f060f1280 (diff)
downloadbcm5719-llvm-21610380de972a5307dfb07f446b44fbe2989be5.tar.gz
bcm5719-llvm-21610380de972a5307dfb07f446b44fbe2989be5.zip
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
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/DeclTemplate.cpp23
1 files changed, 23 insertions, 0 deletions
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<TemplateTypeParmDecl>(FirstParm))
+ return TTP->getDepth();
+ else if (const NonTypeTemplateParmDecl *NTTP
+ = dyn_cast<NonTypeTemplateParmDecl>(FirstParm))
+ return NTTP->getDepth();
+ else
+ return cast<TemplateTemplateParmDecl>(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<TemplateTypeParmType>()->getDepth();
+}
+
+unsigned TemplateTypeParmDecl::getIndex() const {
+ return TypeForDecl->getAs<TemplateTypeParmType>()->getIndex();
+}
+
//===----------------------------------------------------------------------===//
// NonTypeTemplateParmDecl Method Implementations
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud