Support for llvm_ostreams.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31988 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2006-11-28 23:31:42 +00:00
parent f45148e113
commit d96662360f
6 changed files with 22 additions and 16 deletions

View File

@ -29,7 +29,7 @@
#include <bitset>
#include <vector>
#include <functional>
#include <iostream>
#include <ostream>
namespace llvm {
@ -178,7 +178,7 @@ public:
if (O.stream()) print(*O.stream());
}
void print(std::ostream &O) const;
void dump() const { print(std::cerr); }
void dump() const { print(llvm_cerr); }
public:
//

View File

@ -43,8 +43,8 @@ namespace llvm {
/// if (!I->isLeader()) continue; // Ignore non-leader sets.
/// for (EquivalenceClasses<int>::member_iterator MI = EC.member_begin(I);
/// MI != EC.member_end(); ++MI) // Loop over members in this set.
/// std::cerr << *MI << " "; // Print member.
/// std::cerr << "\n"; // Finish set.
/// llvm_cerr << *MI << " "; // Print member.
/// llvm_cerr << "\n"; // Finish set.
/// }
///
/// This example prints:

View File

@ -71,8 +71,8 @@ class scc_iterator
SCCNodeStack.push_back(N);
MinVisitNumStack.push_back(visitNum);
VisitStack.push_back(std::make_pair(N, GT::child_begin(N)));
//DEBUG(std::cerr << "TarjanSCC: Node " << N <<
// " : visitNum = " << visitNum << "\n");
//DOUT << "TarjanSCC: Node " << N <<
// " : visitNum = " << visitNum << "\n";
}
// The stack-based DFS traversal; defined below.
@ -106,9 +106,9 @@ class scc_iterator
if (!MinVisitNumStack.empty() && MinVisitNumStack.back() > minVisitNum)
MinVisitNumStack.back() = minVisitNum;
//DEBUG(std::cerr << "TarjanSCC: Popped node " << visitingN <<
//DOUT << "TarjanSCC: Popped node " << visitingN <<
// " : minVisitNum = " << minVisitNum << "; Node visit num = " <<
// nodeVisitNumbers[visitingN] << "\n");
// nodeVisitNumbers[visitingN] << "\n";
if (minVisitNum == nodeVisitNumbers[visitingN]) {
// A full SCC is on the SCCNodeStack! It includes all nodes below

View File

@ -378,9 +378,12 @@ public:
/// print - Print a dot graph to the specified ostream...
///
void print(llvm_ostream &O) const {
if (O.stream()) print(*O.stream());
}
void print(std::ostream &O) const;
/// dump - call print(std::cerr), for use from the debugger...
/// dump - call print(llvm_cerr), for use from the debugger...
///
void dump() const;

View File

@ -362,6 +362,9 @@ public:
///
void forwardNode(DSNode *To, unsigned Offset);
void print(llvm_ostream &O, const DSGraph *G) const {
if (O.stream()) print(*O.stream(), G);
}
void print(std::ostream &O, const DSGraph *G) const;
void dump() const;

View File

@ -20,16 +20,16 @@
#include "llvm/Pass.h"
#include "llvm/Module.h"
#include <iostream>
#include "llvm/Support/Streams.h"
namespace llvm {
class PrintModulePass : public ModulePass {
std::ostream *Out; // ostream to print on
llvm_ostream *Out; // ostream to print on
bool DeleteStream; // Delete the ostream in our dtor?
public:
PrintModulePass() : Out(&std::cerr), DeleteStream(false) {}
PrintModulePass(std::ostream *o, bool DS = false)
PrintModulePass() : Out(&llvm_cerr), DeleteStream(false) {}
PrintModulePass(llvm_ostream *o, bool DS = false)
: Out(o), DeleteStream(DS) {
}
@ -49,11 +49,11 @@ public:
class PrintFunctionPass : public FunctionPass {
std::string Banner; // String to print before each function
std::ostream *Out; // ostream to print on
llvm_ostream *Out; // ostream to print on
bool DeleteStream; // Delete the ostream in our dtor?
public:
PrintFunctionPass() : Banner(""), Out(&std::cerr), DeleteStream(false) {}
PrintFunctionPass(const std::string &B, std::ostream *o = &std::cout,
PrintFunctionPass() : Banner(""), Out(&llvm_cerr), DeleteStream(false) {}
PrintFunctionPass(const std::string &B, llvm_ostream *o = &llvm_cout,
bool DS = false)
: Banner(B), Out(o), DeleteStream(DS) {
}