From: Alex Lorenz Date: Tue, 3 Jan 2017 12:08:40 +0000 (+0000) Subject: Handle UsingDecl and UsingShadowDecl in DeclContextPrinter X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=550e0fa7a8a01e4cb76e492ef2c3afdb17f4a764;p=clang 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290881 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/ASTConsumers.cpp b/lib/Frontend/ASTConsumers.cpp index 329f15fbef..2bb78b3d30 100644 --- a/lib/Frontend/ASTConsumers.cpp +++ b/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/test/Coverage/cxx-language-features.inc b/test/Coverage/cxx-language-features.inc index 18e28e0fab..0652d6980a 100644 --- a/test/Coverage/cxx-language-features.inc +++ b/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; +}