From de872af4371ac9fb1934fbbbcfab008087e7a2b7 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Wed, 5 Dec 2012 22:53:06 +0000 Subject: [PATCH] In DeclPrint add printing of '= default' in constructors. llvm-svn: 169440 --- clang/lib/AST/DeclPrinter.cpp | 2 ++ clang/unittests/AST/DeclPrinterTest.cpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp index a5e1378..f277f1f 100644 --- a/clang/lib/AST/DeclPrinter.cpp +++ b/clang/lib/AST/DeclPrinter.cpp @@ -565,6 +565,8 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { Out << " = 0"; else if (D->isDeletedAsWritten()) Out << " = delete"; + else if (D->isExplicitlyDefaulted()) + Out << " = default"; else if (D->doesThisDeclarationHaveABody() && !Policy.TerseOutput) { if (!D->hasPrototype() && D->getNumParams()) { // This is a K&R function definition, so we need to print the diff --git a/clang/unittests/AST/DeclPrinterTest.cpp b/clang/unittests/AST/DeclPrinterTest.cpp index 2cb3a3f..50aab03 100644 --- a/clang/unittests/AST/DeclPrinterTest.cpp +++ b/clang/unittests/AST/DeclPrinterTest.cpp @@ -476,8 +476,8 @@ TEST(DeclPrinter, TestCXXConstructorDecl8) { " A() = default;" "};", constructorDecl(ofClass(hasName("A"))).bind("id"), - "A() noexcept")); - // WRONG; Should be: "A() = default;" + "A() noexcept = default")); + // Should be: "A() = default;" if we care about noexcept as written } TEST(DeclPrinter, TestCXXConstructorDecl9) { -- 2.7.4