<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi Manuel,<br>
</p>
<p><br>
</p>
<p>I believe it happens with both. The person who initially reported the issue is using Msys2 (http://sourceforge.net/projects/msys2/). On my side I'm using the Clang for Windows from (http://llvm.org/releases/download.html) and I built the trunk version using
 CMake + Ninja + VS 2013.<br>
</p>
<p><br>
</p>
<p>Yeah I looked at this issue and the related thread on cfe-dev (http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-December/040254.html) but I don't think the issue is the same, there is no issue writing the file as far as I can tell.<br>
</p>
<p><br>
</p>
<div style="color: rgb(33, 33, 33);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Manuel Klimek <klimek@google.com><br>
<b>Sent:</b> 03 January 2015 15:49<br>
<b>To:</b> papin_g; cfe-dev@cs.uiuc.edu<br>
<b>Subject:</b> Re: [cfe-dev] [libclang] Internal buffers becoming corrupted on Windows?</font>
<div> </div>
</div>
<div>Is your libclang compiled with mingw or VS?
<div><br>
<div>See <a href="https://github.com/Valloric/ycmd/issues/61">https://github.com/Valloric/ycmd/issues/61</a> for windows libclang issues on ycmd.</div>
</div>
<br>
<div class="gmail_quote">On Sat Jan 03 2015 at 12:37:18 AM papin_g <<a href="mailto:guillaume.papin@epitech.eu">guillaume.papin@epitech.eu</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div style="font-size:12pt; color:#000000; background-color:#ffffff; font-family:Calibri,Arial,Helvetica,sans-serif">
Hello,<br>
<div><br>
</div>
<div>I am the author of an package for Emacs that brings libclang power to Emacs. <span style="font-size:12pt">It has been reported to me (here: </span><a href="https://github.com/Sarcasm/irony-mode/issues/134#issuecomment-68412195" target="_blank" style="font-size:12pt">https://github.com/Sarcasm/irony-mode/issues/134</a><span style="font-size:12pt">) that libclang
 has some issues on Windows. </span><span style="font-size:12pt">After some search I have identified a situation that triggers the issue consistently.</span></div>
<div><span style="font-size:12pt"><br>
</span></div>
<div><span style="font-size:12pt">I have a pair of file, source file and header files.</span></div>
<div><span style="font-size:12pt"><br>
</span></div>
<div><strong>foo.h</strong><br>
</div>
<blockquote style="margin:0 0 0 40px; border:none; padding:0px">
<div>
<div>#ifndef FOO_H_</div>
</div>
<div>
<div>#define FOO_H_</div>
</div>
<div>
<div><br>
</div>
</div>
<div>
<div>struct Foo</div>
</div>
<div>
<div>{</div>
</div>
<div>
<div>  void foobar();</div>
</div>
<div>
<div>};</div>
</div>
<div>
<div><br>
</div>
</div>
<div>
<div>#endif /* !FOO_H_ */</div>
</div>
</blockquote>
<div>
<div><br>
</div>
<div><strong>foo.cpp</strong><br>
</div>
</div>
<blockquote style="margin:0 0 0 40px; border:none; padding:0px">
<div>
<div>
<div>#include "foo.h"</div>
</div>
</div>
<div>
<div>
<div><br>
</div>
</div>
</div>
<div>
<div>
<div>void Foo::|<br>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<div><br>
foo.cpp is incomplete because it is used for requesting code-completion to libclang at the point of the pipe '|'.<br>
</div>
</div>
<div><br>
</div>
<div>
<ol>
<li><span style="font-size:12pt">​</span><span style="font-size:12pt">If I request code </span><span style="font-size:12pt">completion a first time</span><span style="font-size:12pt">, everything work as expected.</span></li><li><span style="font-size:12pt"></span><span style="font-size:12pt">If I edit foo.h to remove the method foobar() from the struct Foo,</span><span style="font-size:12pt"> code completion still </span><span style="font-size:12pt">work as expected.</span></li><li><span style="font-size:12pt"></span><span style="font-size:12pt">If I restore the foobar() method, code completion breaks with the following diagnostics </span><span style="font-size:12pt">in this case:<br>
​<br>
<span style="font-size:12pt">    ​​​./foo.h:9:2: error: invalid preprocessing directive<br>
</span></span><span style="font-size:12pt">    ​​</span><span style="font-size:12pt">./foo.h:1:2</span><span style="font-size:12pt">: error: unterminated conditional directive<br>
<span style="font-size:12pt"><br>
I have tested with some bigger changes in terms of characters, removing a big comment  (~1000 chars) for example and the errors was slightly different in this case, warning about null chars in the header file.</span><br>
</span></li></ol>
</div>
</div>
<div>
<div>I have the feeling that the internal buffer Clang has for the header file foo.h get corrupted somehow.<br>
</div>
<div><span style="font-size:12pt"><br>
</span></div>
<div><span style="font-size:12pt">Does anyone have opinion about this?</span></div>
<div><span style="font-size:12pt">Some places to look for or ways to debug this?</span></div>
<br>
</div>
<div>Additional information:<br>
</div>
<div>
<ul>
<li>​​This doesn't seem to happen on Linux.<br>
</li><li><span style="font-size:12pt">I just tried with the trunk (</span><span style="font-size:12pt">r225060), the issue is still present.</span></li><li>A slightly more detailed procedure is described here <a href="https://github.com/Sarcasm/irony-mode/issues/134#issuecomment-68412195" target="_blank">https://github.com/Sarcasm/irony-mode/issues/134#issuecomment-68412195</a> if someone want to reproduce
 the bug. It is using irony-server, a small C++ program that builds with CMake and depends on libclang. This program should be easy to get working for people already building  Clang on Windows (should work with cl/clang-cl/mingw).<br>
</li></ul>
<div>Thanks,<br>
</div>
</div>
<div>Guillaume<br>
</div>
<div>
<div><br>
</div>
</div>
</div>
</div>
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
</blockquote>
</div>
</div>
</div>
</div>
</body>
</html>