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.).

llvm-svn: 232912
This commit is contained in:
Faisal Vali 2015-03-22 13:35:56 +00:00
parent bbb4cec2e8
commit 2da8ed9241
2 changed files with 6 additions and 0 deletions

View File

@ -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;

View File

@ -2294,6 +2294,11 @@ LLVM_DUMP_METHOD void Stmt::dump(raw_ostream &OS, SourceManager &SM) const {
P.dumpStmt(this);
}
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);
P.dumpStmt(this);