<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - libclang: clang_disposeTranslationUnit does not delete .pch files"
href="https://bugs.llvm.org/show_bug.cgi?id=35259">35259</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>libclang: clang_disposeTranslationUnit does not delete .pch files
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>5.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>libclang
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>william.ledoux@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>klimek@google.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>SYMPTOM
=======
libclang clang_disposeTranslationUnit seems not to delete the .pch that was
generated
It's a problem because when using libclang for code completion, a lot of those
files are created and never deleted.
On Windows, it gets bad because the temp folder is not cleaned at boot
If the temp folder is a ramdisk, it's even worse because it can fill it up
really quickly.
HOW TO REPRODUCE
================
The bug is very old (at least a couple of years) so I guess any version would
reproduce, but for the record the latest I tried was the head of release_50 on
both LLVM and CLANG projects
LLVM:
<a href="https://github.com/llvm-mirror/llvm/commit/f042b00be5f69c21b3fe846f7343dd44ed92a74e">https://github.com/llvm-mirror/llvm/commit/f042b00be5f69c21b3fe846f7343dd44ed92a74e</a>
CLANG:
<a href="https://github.com/llvm-mirror/clang/commit/232230afd349ceeb784720d2266e2288523d871f">https://github.com/llvm-mirror/clang/commit/232230afd349ceeb784720d2266e2288523d871f</a>
PLATFORM: libclang.dll compiled and tested with VS2015 on Windows 7 64 bit
To reproduce, you need to create a dummy test.cpp file and parse it as follow:
CXIndex ClangIndex = clang_createIndex(false, true);
CXTranslationUnit myTU = clang_parseTranslationUnit(ClangIndex, "test.cpp",
NULL, 0, NULL, 0, CXTranslationUnit_PrecompiledPreamble |
CXTranslationUnit_CreatePreambleOnFirstParse);
// If myTU is not NULL, some preamble-%%%%%%.pch has been created
// in temp folder and a handle is hold on this file
clang_disposeTranslationUnit(myTU);
// The handle has been released but the preamble-%%%%%%.pch is still there</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>