[PATCH] D45686: [Tooling] Clean up tmp files when creating a fixed compilation database

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 23 07:34:14 PDT 2018


lebedev.ri added inline comments.


================
Comment at: lib/Tooling/CompilationDatabase.cpp:303
+  // Remove temp files.
+  Compilation->CleanupFileList(Compilation->getTempFiles());
+
----------------
dstenb wrote:
> erichkeane wrote:
> > It seems to me that this would be best called from the destructor of the Compilation object.  I realize nothing returns before this, but IMO this seems universal enough that if it doesn't break anything, putting this in the destructor would be a proper place for cleanup.
> That sounds cleaner (if it's viable).
> 
> I considered that initially, but I was not sure that there are no cases where the temporary files outlive a Compilation object, and the "/// Temporary files which should be removed on exit." comment for the TempFiles field did not really make me more confident, so I went the conservative route instead.
> 
> I'll do that change and run some tests to see where that leads.
> 
It just looks off-place for the function named `stripPositionalArgs()`


Repository:
  rC Clang

https://reviews.llvm.org/D45686





More information about the cfe-commits mailing list