]> granicus.if.org Git - clang/commitdiff
In DeclPrint add printing of '= default'
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 5 Dec 2012 22:53:06 +0000 (22:53 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 5 Dec 2012 22:53:06 +0000 (22:53 +0000)
in constructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169440 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclPrinter.cpp
unittests/AST/DeclPrinterTest.cpp

index a5e1378b46509873bbffb16a15097aa51fb818bf..f277f1fac739b872d9226e4ddba2d8b73f7805f1 100644 (file)
@@ -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
index 2cb3a3f748c52adfcde0fb467387c186e797f5fa..50aab032120823b65b739c6d59a78f089457b05f 100644 (file)
@@ -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) {