[cfe-commits] r170684 - /cfe/trunk/lib/AST/ASTDumper.cpp
Chandler Carruth
chandlerc at google.com
Thu Dec 20 03:19:55 PST 2012
On Thu, Dec 20, 2012 at 3:08 AM, Alexander Kornienko <alexfh at google.com>wrote:
> Author: alexfh
> Date: Thu Dec 20 05:08:38 2012
> New Revision: 170684
>
> URL: http://llvm.org/viewvc/llvm-project?rev=170684&view=rev
> Log:
> ASTDumper coding style fixes.
> http://llvm-reviews.chandlerc.com/D226
>
> Patch by Philip Craig!
>
>
> Modified:
> cfe/trunk/lib/AST/ASTDumper.cpp
>
> Modified: cfe/trunk/lib/AST/ASTDumper.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=170684&r1=170683&r2=170684&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/AST/ASTDumper.cpp (original)
> +++ cfe/trunk/lib/AST/ASTDumper.cpp Thu Dec 20 05:08:38 2012
> @@ -70,15 +70,15 @@
> void dumpLocation(SourceLocation Loc);
> void dumpBareType(QualType T);
> void dumpType(QualType T);
> - void dumpBareDeclRef(Decl *node);
> - void dumpDeclRef(Decl *node, const char *Label = NULL);
> - void dumpName(NamedDecl *D);
> - void dumpDeclContext(DeclContext *DC);
> + void dumpBareDeclRef(const Decl *Node);
> + void dumpDeclRef(const Decl *Node, const char *Label = NULL);
>
Speaking of coding style, LLVM's style is to use '0' not 'NULL'.
> + void dumpName(const NamedDecl *D);
> + void dumpDeclContext(const DeclContext *DC);
>
> // C++ Utilities
> void dumpAccessSpecifier(AccessSpecifier AS);
> - void dumpCXXCtorInitializer(CXXCtorInitializer *Init);
> - void dumpTemplateParameters(TemplateParameterList *TPL);
> + void dumpCXXCtorInitializer(const CXXCtorInitializer *Init);
> + void dumpTemplateParameters(const TemplateParameterList *TPL);
> void dumpTemplateArgumentListInfo(const TemplateArgumentListInfo
> &TALI);
> void dumpTemplateArgumentLoc(const TemplateArgumentLoc &A);
> void dumpTemplateArgumentList(const TemplateArgumentList &TAL);
> @@ -271,21 +271,21 @@
> dumpBareType(T);
> }
>
> -void ASTDumper::dumpBareDeclRef(Decl *D) {
> +void ASTDumper::dumpBareDeclRef(const Decl *D) {
> OS << D->getDeclKindName();
> dumpPointer(D);
>
> - if (NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
> + if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
> OS << " '";
> ND->getDeclName().printName(OS);
> OS << "'";
> }
>
> - if (ValueDecl *VD = dyn_cast<ValueDecl>(D))
> + if (const ValueDecl *VD = dyn_cast<ValueDecl>(D))
> dumpType(VD->getType());
> }
>
> -void ASTDumper::dumpDeclRef(Decl *D, const char *Label) {
> +void ASTDumper::dumpDeclRef(const Decl *D, const char *Label) {
> if (!D)
> return;
>
> @@ -295,12 +295,12 @@
> dumpBareDeclRef(D);
> }
>
> -void ASTDumper::dumpName(NamedDecl *ND) {
> +void ASTDumper::dumpName(const NamedDecl *ND) {
> if (ND->getDeclName())
> OS << ' ' << ND->getNameAsString();
> }
>
> -void ASTDumper::dumpDeclContext(DeclContext *DC) {
> +void ASTDumper::dumpDeclContext(const DeclContext *DC) {
> if (!DC)
> return;
> for (DeclContext::decl_iterator I = DC->decls_begin(), E =
> DC->decls_end();
> @@ -328,7 +328,7 @@
> }
> }
>
> -void ASTDumper::dumpCXXCtorInitializer(CXXCtorInitializer *Init) {
> +void ASTDumper::dumpCXXCtorInitializer(const CXXCtorInitializer *Init) {
> IndentScope Indent(*this);
> OS << "CXXCtorInitializer";
> if (Init->isAnyMemberInitializer()) {
> @@ -340,11 +340,11 @@
> dumpStmt(Init->getInit());
> }
>
> -void ASTDumper::dumpTemplateParameters(TemplateParameterList *TPL) {
> +void ASTDumper::dumpTemplateParameters(const TemplateParameterList *TPL) {
> if (!TPL)
> return;
>
> - for (TemplateParameterList::iterator I = TPL->begin(), E = TPL->end();
> + for (TemplateParameterList::const_iterator I = TPL->begin(), E =
> TPL->end();
> I != E; ++I)
> dumpDecl(*I);
> }
> @@ -386,8 +386,7 @@
> OS << " nullptr";
> break;
> case TemplateArgument::Integral:
> - OS << " integral";
> - OS << ' ' << A.getAsIntegral();
> + OS << " integral " << A.getAsIntegral();
> break;
> case TemplateArgument::Template:
> OS << " template ";
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121220/887ce518/attachment.html>
More information about the cfe-commits
mailing list