mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 05:25:47 +00:00
Convert a use of sys::Path::GetTemporaryDirectory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183987 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user