[PATCH] D45686: [Tooling] Clean up tmp files when creating a fixed compilation database
David Stenberg via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 23 07:32:46 PDT 2018
dstenb added inline comments.
================
Comment at: lib/Tooling/CompilationDatabase.cpp:303
+ // Remove temp files.
+ Compilation->CleanupFileList(Compilation->getTempFiles());
+
----------------
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.
Repository:
rC Clang
https://reviews.llvm.org/D45686
More information about the cfe-commits
mailing list