Skip to content

Commit

Permalink
Handle UsingDecl and UsingShadowDecl in DeclContextPrinter
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hyp committed Jan 3, 2017
1 parent 14abc7f commit 1d86ab4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions clang/lib/Frontend/ASTConsumers.cpp
Expand Up @@ -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");
Expand Down
8 changes: 8 additions & 0 deletions clang/test/Coverage/cxx-language-features.inc
Expand Up @@ -33,3 +33,11 @@ struct FriendlyStruct {
};

struct FriendedStruct { };

// Using declaration
namespace provider {
void foo();
}
namespace user {
using provider::foo;
}

0 comments on commit 1d86ab4

Please sign in to comment.