<div dir="ltr"><div>Hi Manuel,</div><div><br></div><div>I had forgotten this point and I see your mail only now...<br></div><div>Thanks for your interest.<br></div><div><br></div><div>I did not evaluate this issue with a newer release of clang (issue seen in 3.6.2)</div><div><br></div><div>However, it seems that other people still have this kind of issue for several months.</div><div><a href="https://bugreports.qt.io/browse/QTCREATORBUG-15449">https://bugreports.qt.io/browse/QTCREATORBUG-15449</a></div><div>So I imagine it would be worth seeing if it is related.</div><div><br></div><div>Since I did this patch, I never had again the lock on the H files.</div><div>And I use qtcreator with clang as my everyday c++ IDE.</div><div>So it seems to be a good candidate.</div><div><br></div><div>An IDE is more sensitive to leaks than a compiler / analyzer as it keeps the files open on a longer duration.</div><div>So it may explain why nobody else complains.</div><div><br></div><div>Thanks,</div><div>Jean-Yves</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 27, 2016 at 1:54 PM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Stumbling over this (much too late, of course), is this still a problem for you?</div><br><div class="gmail_quote"><div><div class="h5"><div dir="ltr">On Thu, Nov 26, 2015 at 5:01 PM jean-yves desbree via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>I use clang 3.6.2 with qt creator 3.5.1 on windows 7 for parsing code in this IDE.</div><div>It works well.</div><div><br></div><div>However, I can see that clang keeps a few times some file descriptors opened on c++ header files (h files) after having parsed a cpp file (that includes these h files).</div><div>The effect is that we cannot save these h files, what is quite frustrating when using an IDE.</div><div><br></div><div>After debugging clang, I remarked that there was a file descriptor leak in the method Preprocessor::HandleIncludeDirective</div><div>(file tools/clang/lib/Lex/PPDirectives.cpp)</div><div><br></div><div>The object 'FileEntry *File' is created (for a given h file) and after some checks, the regular treatment calls EnterSourceFile.</div><div>The File object is detroyed during this call (quite deeply in the stack)</div><div><br></div><div>However, when some errors occur, the execution path goes through early returns and other code pathes.</div><div>In this case, the file descriptor associated to File is not closed and the file descriptor remains open.</div><div><br></div><div>So I did a correction that uses RAII in order to have the file descriptor closed.</div><div>So I wrapped 'FileEntry *File' in a dedicated 'FileEntryCloser fileEntryCloser(File)'</div><div><br></div><div>On regular treatment, the closer is released:</div><div>  // If all is good, enter the new file!</div><div>  if (EnterSourceFile(FID, CurDir, FilenameTok.getLocation()))</div><div>  {</div><div>     fileEntryCloser.release();</div><div>     return;</div><div>  }</div><div>  </div><div>Otherwise, the file descriptor is closed  </div><div>   ~FileEntryCloser()</div><div>   {</div><div>      if(m_File)</div><div>         m_File->closeFile();</div><div>   }</div><div><br></div><div><br></div><div>Now, I have no more remaining file descriptors ...</div><div>Would it be possible to have an evaluation on that?</div><div><br></div><div>Thanks in advance.</div></div></div></div>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>
</blockquote></div><br></div>