llvm.org GIT mirror llvm / d966623
Support for llvm_ostreams. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31988 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 13 years ago
6 changed file(s) with 22 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
2828 #include
2929 #include
3030 #include
31 #include <iostream>
31 #include <ostream>
3232
3333 namespace llvm {
3434
177177 if (O.stream()) print(*O.stream());
178178 }
179179 void print(std::ostream &O) const;
180 void dump() const { print(std::cerr); }
180 void dump() const { print(llvm_cerr); }
181181
182182 public:
183183 //
4242 /// if (!I->isLeader()) continue; // Ignore non-leader sets.
4343 /// for (EquivalenceClasses::member_iterator MI = EC.member_begin(I);
4444 /// MI != EC.member_end(); ++MI) // Loop over members in this set.
45 /// std::cerr << *MI << " "; // Print member.
46 /// std::cerr << "\n"; // Finish set.
45 /// llvm_cerr << *MI << " "; // Print member.
46 /// llvm_cerr << "\n"; // Finish set.
4747 /// }
4848 ///
4949 /// This example prints:
7070 SCCNodeStack.push_back(N);
7171 MinVisitNumStack.push_back(visitNum);
7272 VisitStack.push_back(std::make_pair(N, GT::child_begin(N)));
73 //DEBUG(std::cerr << "TarjanSCC: Node " << N <<
74 // " : visitNum = " << visitNum << "\n");
73 //DOUT << "TarjanSCC: Node " << N <<
74 // " : visitNum = " << visitNum << "\n";
7575 }
7676
7777 // The stack-based DFS traversal; defined below.
105105 if (!MinVisitNumStack.empty() && MinVisitNumStack.back() > minVisitNum)
106106 MinVisitNumStack.back() = minVisitNum;
107107
108 //DEBUG(std::cerr << "TarjanSCC: Popped node " << visitingN <<
108 //DOUT << "TarjanSCC: Popped node " << visitingN <<
109109 // " : minVisitNum = " << minVisitNum << "; Node visit num = " <<
110 // nodeVisitNumbers[visitingN] << "\n");
110 // nodeVisitNumbers[visitingN] << "\n";
111111
112112 if (minVisitNum == nodeVisitNumbers[visitingN]) {
113113 // A full SCC is on the SCCNodeStack! It includes all nodes below
377377
378378 /// print - Print a dot graph to the specified ostream...
379379 ///
380 void print(llvm_ostream &O) const {
381 if (O.stream()) print(*O.stream());
382 }
380383 void print(std::ostream &O) const;
381384
382 /// dump - call print(std::cerr), for use from the debugger...
385 /// dump - call print(llvm_cerr), for use from the debugger...
383386 ///
384387 void dump() const;
385388
361361 ///
362362 void forwardNode(DSNode *To, unsigned Offset);
363363
364 void print(llvm_ostream &O, const DSGraph *G) const {
365 if (O.stream()) print(*O.stream(), G);
366 }
364367 void print(std::ostream &O, const DSGraph *G) const;
365368 void dump() const;
366369
1919
2020 #include "llvm/Pass.h"
2121 #include "llvm/Module.h"
22 #include
22 #include "llvm/Support/Streams.h"
2323
2424 namespace llvm {
2525
2626 class PrintModulePass : public ModulePass {
27 std::ostream *Out; // ostream to print on
27 llvm_ostream *Out; // ostream to print on
2828 bool DeleteStream; // Delete the ostream in our dtor?
2929 public:
30 PrintModulePass() : Out(&std::cerr), DeleteStream(false) {}
31 PrintModulePass(std::ostream *o, bool DS = false)
30 PrintModulePass() : Out(&llvm_cerr), DeleteStream(false) {}
31 PrintModulePass(llvm_ostream *o, bool DS = false)
3232 : Out(o), DeleteStream(DS) {
3333 }
3434
4848
4949 class PrintFunctionPass : public FunctionPass {
5050 std::string Banner; // String to print before each function
51 std::ostream *Out; // ostream to print on
51 llvm_ostream *Out; // ostream to print on
5252 bool DeleteStream; // Delete the ostream in our dtor?
5353 public:
54 PrintFunctionPass() : Banner(""), Out(&std::cerr), DeleteStream(false) {}
55 PrintFunctionPass(const std::string &B, std::ostream *o = &std::cout,
54 PrintFunctionPass() : Banner(""), Out(&llvm_cerr), DeleteStream(false) {}
55 PrintFunctionPass(const std::string &B, llvm_ostream *o = &llvm_cout,
5656 bool DS = false)
5757 : Banner(B), Out(o), DeleteStream(DS) {
5858 }