From 1d86ab4d362655fee7c9dd80c2d1c9342d982a73 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Tue, 3 Jan 2017 12:08:40 +0000 Subject: [PATCH] Handle UsingDecl and UsingShadowDecl 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: 290881 --- clang/lib/Frontend/ASTConsumers.cpp | 8 ++++++++ clang/test/Coverage/cxx-language-features.inc | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/clang/lib/Frontend/ASTConsumers.cpp b/clang/lib/Frontend/ASTConsumers.cpp index 329f15fbef1f..2bb78b3d3069 100644 --- a/clang/lib/Frontend/ASTConsumers.cpp +++ b/clang/lib/Frontend/ASTConsumers.cpp @@ -485,6 +485,14 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << "\n"; break; } + case Decl::Using: { + Out << " " << *cast(I) << "\n"; + break; + } + case Decl::UsingShadow: { + Out << " " << *cast(I) << "\n"; + break; + } default: Out << "DeclKind: " << DK << '"' << I << "\"\n"; llvm_unreachable("decl unhandled"); diff --git a/clang/test/Coverage/cxx-language-features.inc b/clang/test/Coverage/cxx-language-features.inc index 18e28e0fabce..0652d6980a93 100644 --- a/clang/test/Coverage/cxx-language-features.inc +++ b/clang/test/Coverage/cxx-language-features.inc @@ -33,3 +33,11 @@ struct FriendlyStruct { }; struct FriendedStruct { }; + +// Using declaration +namespace provider { + void foo(); +} +namespace user { + using provider::foo; +}