summaryrefslogtreecommitdiff
path: root/lib/Support/GraphWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/GraphWriter.cpp')
-rw-r--r--lib/Support/GraphWriter.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/Support/GraphWriter.cpp b/lib/Support/GraphWriter.cpp
index f651e25e76..163345e4e6 100644
--- a/lib/Support/GraphWriter.cpp
+++ b/lib/Support/GraphWriter.cpp
@@ -66,18 +66,17 @@ StringRef llvm::DOT::getColorString(unsigned ColorNumber) {
return Colors[ColorNumber % NumColors];
}
-std::string llvm::createGraphFilename(const Twine &Name) {
- std::string ErrMsg;
- sys::Path Filename = sys::Path::GetTemporaryDirectory(&ErrMsg);
- if (Filename.isEmpty()) {
- errs() << "Error: " << ErrMsg << "\n";
- return "";
- }
- Filename.appendComponent((Name + ".dot").str());
- if (Filename.makeUnique(true,&ErrMsg)) {
- errs() << "Error: " << ErrMsg << "\n";
+std::string llvm::createGraphFilename(const Twine &Name, int &FD) {
+ FD = -1;
+ SmallString<128> Filename;
+ error_code EC = sys::fs::unique_file(Twine(Name) + "-%%%%%%%.dot",
+ FD, Filename);
+ if (EC) {
+ errs() << "Error: " << EC.message() << "\n";
return "";
}
+
+ errs() << "Writing '" << Filename << "'... ";
return Filename.str();
}