diff options
author | Alex Lorenz <arphaman@gmail.com> | 2017-01-03 12:11:17 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2017-01-03 12:11:17 +0000 |
commit | eebc494a577adb3d67a778c6fa1488299016ee88 (patch) | |
tree | c08f38278962af41c3af5b78aaa156d9830cc27e /clang/lib/Frontend/ASTConsumers.cpp | |
parent | cfa7d3748e4c774d325cf0f10518ae9307f8d1ea (diff) | |
download | bcm5719-llvm-eebc494a577adb3d67a778c6fa1488299016ee88.tar.gz bcm5719-llvm-eebc494a577adb3d67a778c6fa1488299016ee88.zip |
Handle ClassTemplateSpecializationDecl in DeclContextPrinter
This commit fixes a crash that occurs when -print-decl-contexts AST consumer
tries to print an unhandled declaration.
rdar://19467234
Differential Revision: https://reviews.llvm.org/D26964
llvm-svn: 290884
Diffstat (limited to 'clang/lib/Frontend/ASTConsumers.cpp')
-rw-r--r-- | clang/lib/Frontend/ASTConsumers.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/clang/lib/Frontend/ASTConsumers.cpp b/clang/lib/Frontend/ASTConsumers.cpp index d30d486b6e0..f5cca139bca 100644 --- a/clang/lib/Frontend/ASTConsumers.cpp +++ b/clang/lib/Frontend/ASTConsumers.cpp @@ -370,6 +370,26 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, break; } + case Decl::ClassTemplateSpecialization: { + const auto *CTSD = cast<ClassTemplateSpecializationDecl>(DC); + if (CTSD->isCompleteDefinition()) + Out << "[class template specialization] "; + else + Out << "<class template specialization> "; + Out << *CTSD; + break; + } + + case Decl::ClassTemplatePartialSpecialization: { + const auto *CTPSD = cast<ClassTemplatePartialSpecializationDecl>(DC); + if (CTPSD->isCompleteDefinition()) + Out << "[class template partial specialization] "; + else + Out << "<class template partial specialization> "; + Out << *CTPSD; + break; + } + default: llvm_unreachable("a decl that inherits DeclContext isn't handled"); } @@ -400,7 +420,8 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, case Decl::CXXConstructor: case Decl::CXXDestructor: case Decl::CXXConversion: - { + case Decl::ClassTemplateSpecialization: + case Decl::ClassTemplatePartialSpecialization: { DeclContext* DC = cast<DeclContext>(I); PrintDeclContext(DC, Indentation+2); break; |