[PATCH] D23525: [ThinLTO] Fix temp file dumping, enable via llvm-lto and test it

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 14:55:22 PDT 2016


mehdi_amini added a comment.

> It doesn't seem there are any consumers of this


I noticed this last week looking at the coverage report on llvm.org. Thanks for adding this!


================
Comment at: lib/LTO/ThinLTOCodeGenerator.cpp:81
@@ -80,3 +80,2 @@
   // User asked to save temps, let dump the bitcode file after import.
-  auto SaveTempPath = TempDir + llvm::utostr(count) + Suffix;
   std::error_code EC;
----------------
Damn `auto`...

================
Comment at: lib/LTO/ThinLTOCodeGenerator.cpp:82
@@ -82,2 +81,3 @@
   std::error_code EC;
-  raw_fd_ostream OS(SaveTempPath.str(), EC, sys::fs::F_None);
+  raw_fd_ostream OS((TempDir + llvm::utostr(count) + Suffix).str(), EC,
+                    sys::fs::F_None);
----------------
To avoid the code duplication, can we keep the SaveTempPath but declared as follows?

```
std::string SaveTempPath = (TempDir + llvm::utostr(count) + Suffix).str();
```

================
Comment at: lib/LTO/ThinLTOCodeGenerator.cpp:83
@@ -82,3 +81,4 @@
   std::error_code EC;
-  raw_fd_ostream OS(SaveTempPath.str(), EC, sys::fs::F_None);
   if (EC)
----------------
I probably added the `.str()` here to fix a compile error, it should have hinted me that something was wrong!


https://reviews.llvm.org/D23525





More information about the llvm-commits mailing list