From: Anders Carlsson Date: Sat, 26 Sep 2009 21:58:53 +0000 (+0000) Subject: Make Decl::dump const. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f88df8652e0726fe9eee5d78f92e3c5b34d0a537;p=clang Make Decl::dump const. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82878 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index f60d36fc3d..f05574fcce 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -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; diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp index f448144d28..9d0d836cf6 100644 --- a/lib/AST/DeclPrinter.cpp +++ b/lib/AST/DeclPrinter.cpp @@ -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(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()); }