r232912 - Add a dump function to Stmt that takes only an output stream. No functionality change.

Faisal Vali faisalv at yahoo.com
Sun Mar 22 06:35:56 PDT 2015

Author: faisalv
Date: Sun Mar 22 08:35:56 2015
New Revision: 232912

URL: http://llvm.org/viewvc/llvm-project?rev=232912&view=rev
Add a dump function to Stmt that takes only an output stream.  No functionality change.

This allows dumping to any given output stream but without requiring a SourceManager, similar to the interface provided by Decl.

It's useful when writing certain generic debug functions, external to the clang code base (for e.g.).


Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=232912&r1=232911&r2=232912&view=diff
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Sun Mar 22 08:35:56 2015
@@ -374,6 +374,7 @@ public:
   void dump() const;
   void dump(SourceManager &SM) const;
   void dump(raw_ostream &OS, SourceManager &SM) const;
+  void dump(raw_ostream &OS) const;
   /// dumpColor - same as dump(), but forces color highlighting.
   void dumpColor() const;

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=232912&r1=232911&r2=232912&view=diff
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Sun Mar 22 08:35:56 2015
@@ -2294,6 +2294,11 @@ LLVM_DUMP_METHOD void Stmt::dump(raw_ost
+LLVM_DUMP_METHOD void Stmt::dump(raw_ostream &OS) const {
+  ASTDumper P(OS, nullptr, nullptr);
+  P.dumpStmt(this);
 LLVM_DUMP_METHOD void Stmt::dump() const {
   ASTDumper P(llvm::errs(), nullptr, nullptr);

More information about the cfe-commits mailing list