]> granicus.if.org Git - clang/commitdiff
Make Decl::dump const.
authorAnders Carlsson <andersca@mac.com>
Sat, 26 Sep 2009 21:58:53 +0000 (21:58 +0000)
committerAnders Carlsson <andersca@mac.com>
Sat, 26 Sep 2009 21:58:53 +0000 (21:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82878 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclBase.h
lib/AST/DeclPrinter.cpp

index f60d36fc3d937a2804cd5ba2952e5a7dcdad0e5d..f05574fccebe438fdc1370af5b3febbe5caf0163 100644 (file)
@@ -456,13 +456,13 @@ public:
   /// 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;
index f448144d2821d678be452098aff7678ebc771409..9d0d836cf62b9f0aebc28e57f402e8a552e095b9 100644 (file)
@@ -77,14 +77,14 @@ namespace {
   };
 }
 
-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::printGroup(Decl** Begin, unsigned NumDecls,
   }
 }
 
-void Decl::dump() {
+void Decl::dump() const {
   print(llvm::errs());
 }