[llvm] [llvm-profgen] Remove temporary perf script files (PR #86668)

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 10:04:29 PDT 2024


================
@@ -375,6 +376,9 @@ PerfScriptReader::convertPerfDataToTrace(ProfiledBinary *Binary,
                                           StringRef(ErrorFile)};    // Stderr
   sys::ExecuteAndWait(PerfPath, ScriptMMapArgs, std::nullopt, Redirects);
 
+  PerfScriptReader::markTempFile(PerfTraceFile);
+  PerfScriptReader::markTempFile(ErrorFile);
----------------
MatzeB wrote:

I don't think `sys::fs::createTemporaryFile` has any of the cleanup logic from `MarkTemp`. There is the `TempFile` class but as far as I can tell that is meant towards the use case of getting a C++ file descriptor that you can write to but doesn't work to give you a filename + later cleanup; you only get a filename when you explicitely do not want the cleanup to happen.

So while I looked a bit when reviewing, I don't think there is much better than can be done here?

https://github.com/llvm/llvm-project/pull/86668


More information about the llvm-commits mailing list