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/CFGPrinter.cpp | |
parent | a36b81d64f90f7cc7c946080d317322c3f4e3a0f (diff) | |
download | external_llvm-103289e9383ad1eb66caf28c9b166aebce963a35.zip external_llvm-103289e9383ad1eb66caf28c9b166aebce963a35.tar.gz external_llvm-103289e9383ad1eb66caf28c9b166aebce963a35.tar.bz2 |
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/CFGPrinter.cpp')
-rw-r--r-- | lib/Analysis/CFGPrinter.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp index f6ecfc5..4ac6b8d 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 {} |