mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 18:29:46 +00:00
Revert rr123550. It causes clang build failure on darwin9.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123661 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
02e27ed21b
commit
5860c6c09e
@ -24,7 +24,6 @@
|
|||||||
#define LLVM_SUPPORT_GRAPHWRITER_H
|
#define LLVM_SUPPORT_GRAPHWRITER_H
|
||||||
|
|
||||||
#include "llvm/Support/DOTGraphTraits.h"
|
#include "llvm/Support/DOTGraphTraits.h"
|
||||||
#include "llvm/Support/FileSystem.h"
|
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/ADT/GraphTraits.h"
|
#include "llvm/ADT/GraphTraits.h"
|
||||||
#include "llvm/Support/Path.h"
|
#include "llvm/Support/Path.h"
|
||||||
@ -310,21 +309,32 @@ raw_ostream &WriteGraph(raw_ostream &O, const GraphType &G,
|
|||||||
template<typename GraphType>
|
template<typename GraphType>
|
||||||
sys::Path WriteGraph(const GraphType &G, const std::string &Name,
|
sys::Path WriteGraph(const GraphType &G, const std::string &Name,
|
||||||
bool ShortNames = false, const std::string &Title = "") {
|
bool ShortNames = false, const std::string &Title = "") {
|
||||||
SmallString<128> FilePath;
|
std::string ErrMsg;
|
||||||
|
sys::Path Filename = sys::Path::GetTemporaryDirectory(&ErrMsg);
|
||||||
int FileFD;
|
if (Filename.isEmpty()) {
|
||||||
if (error_code ec = sys::fs::unique_file("graph-" + Name + "-%%-%%-%%-%%.dot",
|
errs() << "Error: " << ErrMsg << "\n";
|
||||||
FileFD, FilePath)) {
|
return Filename;
|
||||||
errs() << "Error creating output file: " << ec.message() << '\n';
|
}
|
||||||
|
Filename.appendComponent(Name + ".dot");
|
||||||
|
if (Filename.makeUnique(true,&ErrMsg)) {
|
||||||
|
errs() << "Error: " << ErrMsg << "\n";
|
||||||
return sys::Path();
|
return sys::Path();
|
||||||
}
|
}
|
||||||
|
|
||||||
errs() << "Writing '" << FilePath << "'... ";
|
errs() << "Writing '" << Filename.str() << "'... ";
|
||||||
raw_fd_ostream O(FileFD, true);
|
|
||||||
llvm::WriteGraph(O, G, ShortNames, Title);
|
|
||||||
errs() << " done. \n";
|
|
||||||
|
|
||||||
return sys::Path(FilePath.str());
|
std::string ErrorInfo;
|
||||||
|
raw_fd_ostream O(Filename.c_str(), ErrorInfo);
|
||||||
|
|
||||||
|
if (ErrorInfo.empty()) {
|
||||||
|
llvm::WriteGraph(O, G, ShortNames, Title);
|
||||||
|
errs() << " done. \n";
|
||||||
|
} else {
|
||||||
|
errs() << "error opening file '" << Filename.str() << "' for writing!\n";
|
||||||
|
Filename.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ViewGraph - Emit a dot graph, run 'dot', run gv on the postscript file,
|
/// ViewGraph - Emit a dot graph, run 'dot', run gv on the postscript file,
|
||||||
|
Loading…
Reference in New Issue
Block a user