forked from OSchip/llvm-project
Support for printing/dumping static asserts
llvm-svn: 127744
This commit is contained in:
parent
4828368dc8
commit
7d8a0b52d4
|
@ -54,6 +54,7 @@ namespace {
|
|||
void VisitLabelDecl(LabelDecl *D);
|
||||
void VisitParmVarDecl(ParmVarDecl *D);
|
||||
void VisitFileScopeAsmDecl(FileScopeAsmDecl *D);
|
||||
void VisitStaticAssertDecl(StaticAssertDecl *D);
|
||||
void VisitNamespaceDecl(NamespaceDecl *D);
|
||||
void VisitUsingDirectiveDecl(UsingDirectiveDecl *D);
|
||||
void VisitNamespaceAliasDecl(NamespaceAliasDecl *D);
|
||||
|
@ -590,6 +591,14 @@ void DeclPrinter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) {
|
|||
Out << ")";
|
||||
}
|
||||
|
||||
void DeclPrinter::VisitStaticAssertDecl(StaticAssertDecl *D) {
|
||||
Out << "static_assert(";
|
||||
D->getAssertExpr()->printPretty(Out, Context, 0, Policy, Indentation);
|
||||
Out << ", ";
|
||||
D->getMessage()->printPretty(Out, Context, 0, Policy, Indentation);
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// C++ declarations
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -284,6 +284,12 @@ void StmtDumper::DumpDeclarator(Decl *D) {
|
|||
OS << ";\"";
|
||||
} else if (LabelDecl *LD = dyn_cast<LabelDecl>(D)) {
|
||||
OS << "label " << LD->getNameAsString();
|
||||
} else if (StaticAssertDecl *SAD = dyn_cast<StaticAssertDecl>(D)) {
|
||||
OS << "\"static_assert(\n";
|
||||
DumpSubTree(SAD->getAssertExpr());
|
||||
OS << ",\n";
|
||||
DumpSubTree(SAD->getMessage());
|
||||
OS << ");\"";
|
||||
} else {
|
||||
assert(0 && "Unexpected decl");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue