r285543 - Make output of ast-print closer to C++ code
Serge Pavlov via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 30 22:11:12 PDT 2016
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";
}
}
More information about the cfe-commits
mailing list