]> granicus.if.org Git - clang/commitdiff
Handle EmptyDecl in DeclContextPrinter
authorAlex Lorenz <arphaman@gmail.com>
Tue, 3 Jan 2017 12:09:39 +0000 (12:09 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Tue, 3 Jan 2017 12:09:39 +0000 (12:09 +0000)
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@290882 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/ASTConsumers.cpp
test/Coverage/cxx-language-features.inc

index 2bb78b3d306962a92291cceb34d54e5cb4403c3d..d30d486b6e0b8d98ec18ddb86d7184953ef87aad 100644 (file)
@@ -493,6 +493,10 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC,
       Out << "<using shadow> " << *cast<UsingShadowDecl>(I) << "\n";
       break;
     }
+    case Decl::Empty: {
+      Out << "<empty>\n";
+      break;
+    }
     default:
       Out << "DeclKind: " << DK << '"' << I << "\"\n";
       llvm_unreachable("decl unhandled");
index 0652d6980a93f6004c89f49f1c95e0012afba7c6..5a2cc2374ee57426674bb54a1e2e0d56d45899db 100644 (file)
@@ -41,3 +41,6 @@ namespace provider {
 namespace user {
   using provider::foo;
 }
+
+// Empty declaration
+;