r285543 - Make output of ast-print closer to C++ code

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 2 09:39:06 PDT 2016


Test?

On 30 Oct 2016 10:20 pm, "Serge Pavlov via cfe-commits" <
cfe-commits at lists.llvm.org> wrote:

> Author: sepavloff
> Date: Mon Oct 31 00:11:12 2016
> New Revision: 285543
>
> URL: http://llvm.org/viewvc/llvm-project?rev=285543&view=rev
> Log:
> Make output of ast-print closer to C++ code
>
> Put semicolon after non-defining method declaration and a class
> specialization body.
>
> Modified:
>     cfe/trunk/lib/AST/DeclPrinter.cpp
>
> Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/
> DeclPrinter.cpp?rev=285543&r1=285542&r2=285543&view=diff
> ============================================================
> ==================
> --- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
> +++ cfe/trunk/lib/AST/DeclPrinter.cpp Mon Oct 31 00:11:12 2016
> @@ -337,10 +337,9 @@ void DeclPrinter::VisitDeclContext(DeclC
>      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
>      for (auto *I : D->specializations()) {
>        PrintTemplateParameters(Params, &I->getTemplateArgs());
>        Visit(I);
> -      Out << '\n';
> +      Out << ";\n";
>      }
>    }
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161102/1be1c3f3/attachment.html>


More information about the cfe-commits mailing list