[cfe-commits] [PATCH] ASTDumper coding style fixes

Philip Craig philipjcraig at gmail.com
Wed Dec 19 22:18:40 PST 2012


Hi alexfh,

Addresses review comments from http://llvm-reviews.chandlerc.com/D52

http://llvm-reviews.chandlerc.com/D226

Files:
  lib/AST/ASTDumper.cpp

Index: lib/AST/ASTDumper.cpp
===================================================================
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -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);
+    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<const NamedDecl>(D)) {
     OS << " '";
     ND->getDeclName().printName(OS);
     OS << "'";
   }
 
-  if (ValueDecl *VD = dyn_cast<ValueDecl>(D))
+  if (const ValueDecl *VD = dyn_cast<const 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 ";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D226.1.patch
Type: text/x-patch
Size: 3277 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121219/3ce8a989/attachment.bin>


More information about the cfe-commits mailing list