diff options
author | Chris Lattner <sabre@nondot.org> | 2009-08-23 07:19:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-08-23 07:19:13 +0000 |
commit | 103289e9383ad1eb66caf28c9b166aebce963a35 (patch) | |
tree | 610f140c3f32fdfab3f0ec1d59b6a28875577f9d /lib/Analysis | |
parent | a36b81d64f90f7cc7c946080d317322c3f4e3a0f (diff) |
convert LoopInfo.h and GraphWriter.h to use raw_ostream
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79836 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/CFGPrinter.cpp | 25 | ||||
-rw-r--r-- | lib/Analysis/LoopPass.cpp | 2 |
2 files changed, 15 insertions, 12 deletions
diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp index f6ecfc596f..4ac6b8d8e5 100644 --- a/lib/Analysis/CFGPrinter.cpp +++ b/lib/Analysis/CFGPrinter.cpp @@ -25,7 +25,6 @@ #include "llvm/Support/CFG.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/GraphWriter.h" -#include "llvm/Config/config.h" using namespace llvm; namespace llvm { @@ -136,14 +135,16 @@ namespace { virtual bool runOnFunction(Function &F) { std::string Filename = "cfg." + F.getNameStr() + ".dot"; - cerr << "Writing '" << Filename << "'..."; - std::ofstream File(Filename.c_str()); + errs() << "Writing '" << Filename << "'..."; + + std::string ErrorInfo; + raw_fd_ostream File(Filename.c_str(), ErrorInfo, raw_fd_ostream::F_Force); - if (File.good()) + if (ErrorInfo.empty()) WriteGraph(File, (const Function*)&F); else - cerr << " error opening file for writing!"; - cerr << "\n"; + errs() << " error opening file for writing!"; + errs() << "\n"; return false; } @@ -166,14 +167,16 @@ namespace { explicit CFGOnlyPrinter(void *pid) : FunctionPass(pid) {} virtual bool runOnFunction(Function &F) { std::string Filename = "cfg." + F.getNameStr() + ".dot"; - cerr << "Writing '" << Filename << "'..."; - std::ofstream File(Filename.c_str()); + errs() << "Writing '" << Filename << "'..."; - if (File.good()) + std::string ErrorInfo; + raw_fd_ostream File(Filename.c_str(), ErrorInfo, raw_fd_ostream::F_Force); + + if (ErrorInfo.empty()) WriteGraph(File, (const Function*)&F, true); else - cerr << " error opening file for writing!"; - cerr << "\n"; + errs() << " error opening file for writing!"; + errs() << "\n"; return false; } void print(raw_ostream &OS, const Module* = 0) const {} diff --git a/lib/Analysis/LoopPass.cpp b/lib/Analysis/LoopPass.cpp index ee03556f27..0007aded2b 100644 --- a/lib/Analysis/LoopPass.cpp +++ b/lib/Analysis/LoopPass.cpp @@ -272,7 +272,7 @@ bool LPPassManager::runOnFunction(Function &F) { /// Print passes managed by this manager void LPPassManager::dumpPassStructure(unsigned Offset) { - llvm::cerr << std::string(Offset*2, ' ') << "Loop Pass Manager\n"; + errs().indent(Offset*2) << "Loop Pass Manager\n"; for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { Pass *P = getContainedPass(Index); P->dumpPassStructure(Offset + 1); |