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 | 4883d90396c210a95bb70409c0d4e712c2a79744 (patch) | |
tree | 9c09f657b0740b9ecbf8f2b27e4170b984c60028 /llvm/lib/Analysis/CFGPrinter.cpp | |
parent | 7e3cfe35ff03fed7bea78ab408962a46ca774466 (diff) | |
download | bcm5719-llvm-4883d90396c210a95bb70409c0d4e712c2a79744.tar.gz bcm5719-llvm-4883d90396c210a95bb70409c0d4e712c2a79744.zip |
convert LoopInfo.h and GraphWriter.h to use raw_ostream
llvm-svn: 79836
Diffstat (limited to 'llvm/lib/Analysis/CFGPrinter.cpp')
-rw-r--r-- | llvm/lib/Analysis/CFGPrinter.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/llvm/lib/Analysis/CFGPrinter.cpp b/llvm/lib/Analysis/CFGPrinter.cpp index f6ecfc596f5..4ac6b8d8e5d 100644 --- a/llvm/lib/Analysis/CFGPrinter.cpp +++ b/llvm/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 {} |