summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorCraig Silverstein <csilvers2000@yahoo.com>2010-07-09 20:25:10 +0000
committerCraig Silverstein <csilvers2000@yahoo.com>2010-07-09 20:25:10 +0000
commit4a5d086b50bcf6df6c2f2ddc69ed44d92582c728 (patch)
tree50d38966d4dd1ffbb63ab2253417d6fd9ac3556c /clang/lib
parentd8c60e34da0230cac0f79054bdcf86328e4554be (diff)
downloadbcm5719-llvm-4a5d086b50bcf6df6c2f2ddc69ed44d92582c728.tar.gz
bcm5719-llvm-4a5d086b50bcf6df6c2f2ddc69ed44d92582c728.zip
Fix a crashing but trying to print a TemplateTemplateParmDecl
for code like this: template<template<typename T> class U> class V {}; The problem is that the DeclPrinter assumed all TemplateDecls have a getTemplatedClass(), but template template params don't (so we got a NULL dereference). The solution is to detect if we're a template template param, and construct the template class name ('class U') specially in this case. OKed by dgregor and chandlerc llvm-svn: 108007
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/DeclPrinter.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index c4378949760..765772dd13f 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -654,7 +654,11 @@ void DeclPrinter::VisitTemplateDecl(TemplateDecl *D) {
Out << "> ";
- Visit(D->getTemplatedDecl());
+ if (isa<TemplateTemplateParmDecl>(D)) {
+ Out << "class " << D->getName();
+ } else {
+ Visit(D->getTemplatedDecl());
+ }
}
//----------------------------------------------------------------------------
OpenPOWER on IntegriCloud