r290881 - Handle UsingDecl and UsingShadowDecl in DeclContextPrinter
Alex Lorenz via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 3 04:08:41 PST 2017
Author: arphaman
Date: Tue Jan 3 06:08:40 2017
New Revision: 290881
URL: http://llvm.org/viewvc/llvm-project?rev=290881&view=rev
Log:
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
Modified:
cfe/trunk/lib/Frontend/ASTConsumers.cpp
cfe/trunk/test/Coverage/cxx-language-features.inc
Modified: cfe/trunk/lib/Frontend/ASTConsumers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTConsumers.cpp?rev=290881&r1=290880&r2=290881&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTConsumers.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTConsumers.cpp Tue Jan 3 06:08:40 2017
@@ -485,6 +485,14 @@ void DeclContextPrinter::PrintDeclContex
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");
Modified: cfe/trunk/test/Coverage/cxx-language-features.inc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/cxx-language-features.inc?rev=290881&r1=290880&r2=290881&view=diff
==============================================================================
--- cfe/trunk/test/Coverage/cxx-language-features.inc (original)
+++ cfe/trunk/test/Coverage/cxx-language-features.inc Tue Jan 3 06:08:40 2017
@@ -33,3 +33,11 @@ struct FriendlyStruct {
};
struct FriendedStruct { };
+
+// Using declaration
+namespace provider {
+ void foo();
+}
+namespace user {
+ using provider::foo;
+}
More information about the cfe-commits
mailing list