[cfe-commits] r82878 - in /cfe/trunk: include/clang/AST/DeclBase.h lib/AST/DeclPrinter.cpp

Anders Carlsson andersca at mac.com
Sat Sep 26 14:58:53 PDT 2009


Author: andersca
Date: Sat Sep 26 16:58:53 2009
New Revision: 82878

URL: http://llvm.org/viewvc/llvm-project?rev=82878&view=rev
Log:
Make Decl::dump const.

Modified:
    cfe/trunk/include/clang/AST/DeclBase.h
    cfe/trunk/lib/AST/DeclPrinter.cpp

Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=82878&r1=82877&r2=82878&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Sat Sep 26 16:58:53 2009
@@ -456,13 +456,13 @@
   /// Destroy - Call destructors and release memory.
   virtual void Destroy(ASTContext& C);
 
-  void print(llvm::raw_ostream &Out, unsigned Indentation = 0);
+  void print(llvm::raw_ostream &Out, unsigned Indentation = 0) const;
   void print(llvm::raw_ostream &Out, const PrintingPolicy &Policy,
-             unsigned Indentation = 0);
+             unsigned Indentation = 0) const;
   static void printGroup(Decl** Begin, unsigned NumDecls,
                          llvm::raw_ostream &Out, const PrintingPolicy &Policy,
                          unsigned Indentation = 0);
-  void dump();
+  void dump() const;
 
 private:
   const Attr *getAttrsImpl() const;

Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=82878&r1=82877&r2=82878&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Sat Sep 26 16:58:53 2009
@@ -77,14 +77,14 @@
   };
 }
 
-void Decl::print(llvm::raw_ostream &Out, unsigned Indentation) {
+void Decl::print(llvm::raw_ostream &Out, unsigned Indentation) const {
   print(Out, getASTContext().PrintingPolicy, Indentation);
 }
 
 void Decl::print(llvm::raw_ostream &Out, const PrintingPolicy &Policy,
-                 unsigned Indentation) {
+                 unsigned Indentation) const {
   DeclPrinter Printer(Out, getASTContext(), Policy, Indentation);
-  Printer.Visit(this);
+  Printer.Visit(const_cast<Decl*>(this));
 }
 
 static QualType GetBaseType(QualType T) {
@@ -149,7 +149,7 @@
   }
 }
 
-void Decl::dump() {
+void Decl::dump() const {
   print(llvm::errs());
 }
 





More information about the cfe-commits mailing list