]> granicus.if.org Git - clang/commitdiff
Make output of ast-print closer to C++ code
authorSerge Pavlov <sepavloff@gmail.com>
Mon, 31 Oct 2016 05:11:12 +0000 (05:11 +0000)
committerSerge Pavlov <sepavloff@gmail.com>
Mon, 31 Oct 2016 05:11:12 +0000 (05:11 +0000)
Put semicolon after non-defining method declaration and a class
specialization body.

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

lib/AST/DeclPrinter.cpp

index 6d47dd7b8837608be9f65e498139c9ea8774fb11..4a8db43817cdead1fdda44275a4d1c28fca69f24 100644 (file)
@@ -337,10 +337,9 @@ void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent) {
     const char *Terminator = nullptr;
     if (isa<OMPThreadPrivateDecl>(*D) || isa<OMPDeclareReductionDecl>(*D))
       Terminator = nullptr;
-    else if (isa<FunctionDecl>(*D) &&
-             cast<FunctionDecl>(*D)->isThisDeclarationADefinition())
+    else if (isa<FunctionDecl>(*D) && cast<FunctionDecl>(*D)->hasBody())
       Terminator = nullptr;
-    else if (isa<ObjCMethodDecl>(*D) && cast<ObjCMethodDecl>(*D)->getBody())
+    else if (isa<ObjCMethodDecl>(*D) && cast<ObjCMethodDecl>(*D)->hasBody())
       Terminator = nullptr;
     else if (isa<NamespaceDecl>(*D) || isa<LinkageSpecDecl>(*D) ||
              isa<ObjCImplementationDecl>(*D) ||
@@ -984,7 +983,7 @@ void DeclPrinter::VisitClassTemplateDecl(ClassTemplateDecl *D) {
     for (auto *I : D->specializations()) {
       PrintTemplateParameters(Params, &I->getTemplateArgs());
       Visit(I);
-      Out << '\n';
+      Out << ";\n";
     }
   }