<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Hello list,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">I am facing a problem with the recent version of libclang on Windows. </div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">The first problem: file save permission error within codelite IDE:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">In codelite IDE I am using libclang in the following manner:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">1) When a file is loaded into the editor I am calling libclang API to create a TU which is later then cache (up to 5 TUs are cached). Note that I am using the preamble flag to boost completion speed (and indeed it does)</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">2) A subsequent calls to code complete (Ctrl-SPACE) are re-using the TU (which works great and in acceptable response time) </div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">The following causes an issue within codelite:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">If I load into the IDE a file (e.g. file.cpp) which has an include statement to another header file (e.g. file.h) - codelite will compile and cache the TU for file.cpp</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Now, if I will try to open, edit and save file.h - I will get a "Save" error (this is because apparently the file.h is being kept opened by the libclang)</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">The only way to unlock and release the file is by calling clang_disposeTranslationUnit() for the cache TU for file.cpp</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
I can workaround it in the IDE in 2 ways:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">1) When a tab is changed inside the IDE - I can clear the TU cache. This will probably work, but will force a recreation of the TU object each time user loads the file</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">2) whenever user faces a write error (permission denied) codelite will dispose the cached TU and try to save the file again (internally)</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
The Second problem:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">My SSD drive size is about 120GB of free space, I noticed that its size was reduced to ~70GB ... searching around the file system, I noticed that under %TMP% there are hundreds of preamble*.pch files</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">It seems as if when disposing a TU the PCH file is not removed from the file system.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Again, I worked around it by adding a cleaner thread that will periodically remove all preamble*.pch files (and silently ignore those who are opened in codelite)</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div>-- <br><div dir="ltr">Eran Ifrah<br>Author of codelite, a cross platform open source C/C++ IDE: <a href="http://www.codelite.org" target="_blank">http://www.codelite.org</a><br>
<div>wxCrafter, a wxWidgets RAD: http://<a href="http://wxcrafter.codelite.org" target="_blank">wxcrafter.codelite.org</a></div></div>
</div>