D17289: KDevelop/Shell: set dedicated TMPDIR

Aaron Puchert noreply at phabricator.kde.org
Sat Jan 26 14:45:09 GMT 2019


aaronpuchert added a comment.


  I've had a look at the Clang code. They actually go to some lengths to make sure all temporary files are deleted on a clean exit — they register all open temporary files and clean them up in an exit-time destructor. (See `TemporaryFiles` in lib/Frontend/PrecompiledPreamble.cpp <https://github.com/llvm-mirror/clang/blob/master/lib/Frontend/PrecompiledPreamble.cpp>.) However, this won't work in the case of a crash. They have some mechanisms for cleanup in the case of crashes, but I suspect that this works by setting a signal handler and is thus only available in the stand-alone executable. There are mechanisms to ensure cleanup in any event by removing an open file on POSIX compatibles (close will then automatically delete it), or FILE_FLAG_DELETE_ON_CLOSE <https://blogs.msdn.microsoft.com/oldnewthing/20160108-00/?p=92821> on Windows. But that doesn't work for Clang, because they work with paths and don't pass file descriptors around.
  
  By the way, does someone know why we are using `CXTranslationUnit_CreatePreambleOnFirstParse`? This seems overly wasteful to me — most of these preambles are not reused again. It was introduced by f14a8fc9ceb38a91c2d718552779da666d509bf1 <https://phabricator.kde.org/R32:f14a8fc9ceb38a91c2d718552779da666d509bf1>, but I fail to see how this relates to the problem the commit message describes. The documentation for `CXTranslationUnit_PrecompiledPreamble` says that “An implicit precompiled header is used as an optimization when a particular translation unit is likely to be reparsed many times when the sources aren't changing that often.” For `CXTranslationUnit_CreatePreambleOnFirstParse` it says “Used to indicate that the precompiled preamble should be created on the first parse. Otherwise it will be created on the first //reparse//. This trades runtime on the first parse (serializing the preamble takes time) for reduced runtime on the second parse (can now reuse the preamble).” I don't understand why we are doing this - we're creating preambles for all files in a project, although most of them are probably not even open in the editor at the time.

REPOSITORY
  R32 KDevelop

REVISION DETAIL
  https://phabricator.kde.org/D17289

To: rjvbb, #kdevelop, kfunk, mwolff
Cc: aaronpuchert, mwolff, pino, kfunk, kdevelop-devel, glebaccon, hase, antismap, iodelay, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20190126/b6761e55/attachment-0001.html>


More information about the KDevelop-devel mailing list