<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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/Windows: preamble file is not deleted on clang_disposeTranslationUnit()"
   href="https://llvm.org/bugs/show_bug.cgi?id=25741">25741</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>libclang/Windows: preamble file is not deleted on clang_disposeTranslationUnit()
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows 2000
          </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>nikolai.kosjar@theqtcompany.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>klimek@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Generated preamble files are deleted on Linux, but not on Windows. As a result,
the preamble files accumulate in %TEMP% until the disk is full. Preamble files
up to 20MB are not unusual for some *.cpp files.

Reproducible with libclang 3.6.2 and libclang from trunk (3.8, r253269).

Used test code (pass in a suitable file):

  #include <clang-c/Index.h>

  #include <cstdlib>
  #include <cstdio>
  #include <vector>

  int main(int argc, char *argv[])
  {
      if (argc != 2) {
          fprintf(stderr, "Usage: $0 <file>\n");
          return 0;
      }
      const char *filePath = argv[1];

      // Construct parse arguments
      std::vector<const char *> arguments;
      arguments.push_back(filePath);

      // Parse
      CXIndex index = clang_createIndex(0, /*displayDiagnostics*/ 1);
      const unsigned tuOptions = CXTranslationUnit_PrecompiledPreamble;
      CXTranslationUnit tu = clang_parseTranslationUnit(index,
                                                        NULL,
                                                        arguments.data(),
                                                        arguments.size(),
                                                        NULL,
                                                        0,
                                                        tuOptions);

      // Re-parse in order to create the preamble file
      clang_reparseTranslationUnit(tu, NULL, 0, 0);

      // Dispose the TU + index
      clang_disposeTranslationUnit(tu);
      clang_disposeIndex(index);

      return 0;
  }</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>