diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-14 16:43:15 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-14 16:43:15 +0000 |
commit | a54ba12ae7a8cf826b65d2e4a882258e952c35b1 (patch) | |
tree | 26720c1cc52db28b8895f76e2999dd925c0cddbb /include | |
parent | bb40b3e957b29d9147198aecdbc6c58d1486a610 (diff) | |
download | llvm-a54ba12ae7a8cf826b65d2e4a882258e952c35b1.tar.gz llvm-a54ba12ae7a8cf826b65d2e4a882258e952c35b1.tar.bz2 llvm-a54ba12ae7a8cf826b65d2e4a882258e952c35b1.tar.xz |
Convert a use of sys::Path::GetTemporaryDirectory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183987 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Support/GraphWriter.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h index b021364019..62547ddf0c 100644 --- a/include/llvm/Support/GraphWriter.h +++ b/include/llvm/Support/GraphWriter.h @@ -319,25 +319,23 @@ raw_ostream &WriteGraph(raw_ostream &O, const GraphType &G, return O; } -std::string createGraphFilename(const Twine &Name); +std::string createGraphFilename(const Twine &Name, int &FD); template <typename GraphType> std::string WriteGraph(const GraphType &G, const Twine &Name, bool ShortNames = false, const Twine &Title = "") { - std::string Filename = createGraphFilename(Name); - errs() << "Writing '" << Filename << "'... "; + int FD; + std::string Filename = createGraphFilename(Name, FD); + raw_fd_ostream O(FD, /*shouldClose=*/ true); - std::string ErrorInfo; - raw_fd_ostream O(Filename.c_str(), ErrorInfo); - - if (ErrorInfo.empty()) { - llvm::WriteGraph(O, G, ShortNames, Title); - errs() << " done. \n"; - } else { + if (FD == -1) { errs() << "error opening file '" << Filename << "' for writing!\n"; return ""; } + llvm::WriteGraph(O, G, ShortNames, Title); + errs() << " done. \n"; + return Filename; } |