Hi Argyrios, By convention, dump() methods in LLVM usually go to stderr. That is more useful from inside a debugger or when inserting debugging statements.
I think it would make more sense to take the raw_ostream as an argument to a print() method, and change -ast-print and -ast-dump to use llvm::outs(), while keeping the existing behavior the same. - Daniel On Tue, Aug 3, 2010 at 10:29 AM, Argyrios Kyrtzidis <[email protected]> wrote: > Author: akirtzidis > Date: Tue Aug 3 12:29:57 2010 > New Revision: 110123 > > URL: http://llvm.org/viewvc/llvm-project?rev=110123&view=rev > Log: > Send AST dumping/printing to stdout instead of stderr. > > Modified: > cfe/trunk/lib/AST/StmtDumper.cpp > cfe/trunk/lib/AST/StmtPrinter.cpp > cfe/trunk/lib/Frontend/ASTConsumers.cpp > > Modified: cfe/trunk/lib/AST/StmtDumper.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtDumper.cpp?rev=110123&r1=110122&r2=110123&view=diff > ============================================================================== > --- cfe/trunk/lib/AST/StmtDumper.cpp (original) > +++ cfe/trunk/lib/AST/StmtDumper.cpp Tue Aug 3 12:29:57 2010 > @@ -631,30 +631,30 @@ > /// specified node and a few nodes underneath it, but not the whole subtree. > /// This is useful in a debugger. > void Stmt::dump(SourceManager &SM) const { > - StmtDumper P(&SM, llvm::errs(), 4); > + StmtDumper P(&SM, llvm::outs(), 4); > P.DumpSubTree(const_cast<Stmt*>(this)); > - llvm::errs() << "\n"; > + llvm::outs() << "\n"; > } > > /// dump - This does a local dump of the specified AST fragment. It dumps > the > /// specified node and a few nodes underneath it, but not the whole subtree. > /// This is useful in a debugger. > void Stmt::dump() const { > - StmtDumper P(0, llvm::errs(), 4); > + StmtDumper P(0, llvm::outs(), 4); > P.DumpSubTree(const_cast<Stmt*>(this)); > - llvm::errs() << "\n"; > + llvm::outs() << "\n"; > } > > /// dumpAll - This does a dump of the specified AST fragment and all > subtrees. > void Stmt::dumpAll(SourceManager &SM) const { > - StmtDumper P(&SM, llvm::errs(), ~0U); > + StmtDumper P(&SM, llvm::outs(), ~0U); > P.DumpSubTree(const_cast<Stmt*>(this)); > - llvm::errs() << "\n"; > + llvm::outs() << "\n"; > } > > /// dumpAll - This does a dump of the specified AST fragment and all > subtrees. > void Stmt::dumpAll() const { > - StmtDumper P(0, llvm::errs(), ~0U); > + StmtDumper P(0, llvm::outs(), ~0U); > P.DumpSubTree(const_cast<Stmt*>(this)); > - llvm::errs() << "\n"; > + llvm::outs() << "\n"; > } > > Modified: cfe/trunk/lib/AST/StmtPrinter.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=110123&r1=110122&r2=110123&view=diff > ============================================================================== > --- cfe/trunk/lib/AST/StmtPrinter.cpp (original) > +++ cfe/trunk/lib/AST/StmtPrinter.cpp Tue Aug 3 12:29:57 2010 > @@ -1354,7 +1354,7 @@ > //===----------------------------------------------------------------------===// > > void Stmt::dumpPretty(ASTContext& Context) const { > - printPretty(llvm::errs(), Context, 0, > + printPretty(llvm::outs(), Context, 0, > PrintingPolicy(Context.getLangOptions())); > } > > > Modified: cfe/trunk/lib/Frontend/ASTConsumers.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTConsumers.cpp?rev=110123&r1=110122&r2=110123&view=diff > ============================================================================== > --- cfe/trunk/lib/Frontend/ASTConsumers.cpp (original) > +++ cfe/trunk/lib/Frontend/ASTConsumers.cpp Tue Aug 3 12:29:57 2010 > @@ -37,7 +37,7 @@ > > public: > ASTPrinter(llvm::raw_ostream* o = NULL, bool Dump = false) > - : Out(o? *o : llvm::errs()), Dump(Dump) { } > + : Out(o? *o : llvm::outs()), Dump(Dump) { } > > virtual void HandleTranslationUnit(ASTContext &Context) { > PrintingPolicy Policy = Context.PrintingPolicy; > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
