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

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

index 7ae377a48938e8cf91aa2d6d7398739b013b2178..d8118cb30f631c1f5cd48188c045d45d916f5841 100644 (file)
@@ -526,6 +526,10 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC,
       Out << "<var template> " << *cast<VarTemplateDecl>(I) << "\n";
       break;
     }
+    case Decl::StaticAssert: {
+      Out << "<static assert>\n";
+      break;
+    }
     default:
       Out << "DeclKind: " << DK << '"' << I << "\"\n";
       llvm_unreachable("decl unhandled");
index 17a44760674aa16f2a7051b618341986429b2fa8..1e3b0744950adf4af176582b63b249bb0cf72222 100644 (file)
@@ -63,3 +63,5 @@ private:
 
 // Variable template
 template <typename T> T varTemplate = 0;
+
+static_assert(true, "");