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
This commit is contained in:
Alex Lorenz 2017-01-03 12:08:40 +00:00
parent 14abc7f007
commit 1d86ab4d36
2 changed files with 16 additions and 0 deletions

View File

@ -485,6 +485,14 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC,
Out << "\n";
break;
}
case Decl::Using: {
Out << "<using> " << *cast<UsingDecl>(I) << "\n";
break;
}
case Decl::UsingShadow: {
Out << "<using shadow> " << *cast<UsingShadowDecl>(I) << "\n";
break;
}
default:
Out << "DeclKind: " << DK << '"' << I << "\"\n";
llvm_unreachable("decl unhandled");

View File

@ -33,3 +33,11 @@ struct FriendlyStruct {
};
struct FriendedStruct { };
// Using declaration
namespace provider {
void foo();
}
namespace user {
using provider::foo;
}