clang++ -fsyntax-only -Xclang -print-decl-contexts a.cc
clang++ -fsyntax-only -Xclang -ast-dump a.cc
-print-decl-contexts (DeclContextPrinter) is a cc1 option that dumps
AST nodes in the following manner:
Out << "<using> " << *cast<UsingDecl>(I) << "\n";
Out << "<using shadow> " << *cast<UsingShadowDecl>(I) << "\n";
It lacks handling of many AST nodes which will lead to llvm_unreachable() crash.
Out << "DeclKind: " << DK << '"' << I << "\"\n";
I tried handling other cases with clang/AST/DeclNodes.inc but then
realized that deleting it might be better as it is a rarely used
feature (not actively maintained and easy to crash). Its functionality
is mostly covered by -ast-dump (which is a bit verbose)
I have sent out D52529 for deleting -print-decl-contexts and will commit
it if nobody opposes.