[cfe-dev] [libclang] Internal buffers becoming corrupted on Windows?

Manuel Klimek klimek at google.com
Sat Jan 3 09:37:27 PST 2015


On Sat Jan 03 2015 at 6:23:17 PM papin_g <guillaume.papin at epitech.eu> wrote:

>  Hi Manuel,
>
>
>  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.
>
>
>  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.
>

As apparently a couple of people are using libclang on Windows with ycmd,
I'm wondering whether there's a difference in the use of libclang that
explains it.

>
>  ------------------------------
> *From:* Manuel Klimek <klimek at google.com>
> *Sent:* 03 January 2015 15:49
> *To:* papin_g; cfe-dev at cs.uiuc.edu
> *Subject:* Re: [cfe-dev] [libclang] Internal buffers becoming corrupted
> on Windows?
>
>  Is your libclang compiled with mingw or VS?
>
> See https://github.com/Valloric/ycmd/issues/61 for windows libclang
> issues on ycmd.
>
> On Sat Jan 03 2015 at 12:37:18 AM papin_g <guillaume.papin at epitech.eu>
> wrote:
>
>>  Hello,
>>
>>  I am the author of an package for Emacs that brings libclang power to
>> Emacs. It has been reported to me (here:
>> https://github.com/Sarcasm/irony-mode/issues/134
>> <https://github.com/Sarcasm/irony-mode/issues/134#issuecomment-68412195>) that libclang
>> has some issues on Windows. After some search I have identified a
>> situation that triggers the issue consistently.
>>
>>  I have a pair of file, source file and header files.
>>
>>  *foo.h*
>>
>>  #ifndef FOO_H_
>>  #define FOO_H_
>>
>>   struct Foo
>>  {
>>    void foobar();
>>  };
>>
>>   #endif /* !FOO_H_ */
>>
>>
>>  *foo.cpp*
>>
>>  #include "foo.h"
>>
>>    void Foo::|
>>
>>
>> foo.cpp is incomplete because it is used for requesting code-completion
>> to libclang at the point of the pipe '|'.
>>
>>
>>    1. ​If I request code completion a first time, everything work as
>>    expected.
>>    2. If I edit foo.h to remove the method foobar() from the struct Foo,
>>    code completion still work as expected.
>>    3. If I restore the foobar() method, code completion breaks with the
>>    following diagnostics in this case:
>>>>        ​​​./foo.h:9:2: error: invalid preprocessing directive
>>        ​​./foo.h:1:2: error: unterminated conditional directive
>>
>>    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.
>>
>>   I have the feeling that the internal buffer Clang has for the header
>> file foo.h get corrupted somehow.
>>
>>  Does anyone have opinion about this?
>> Some places to look for or ways to debug this?
>>
>>  Additional information:
>>
>>    - ​​This doesn't seem to happen on Linux.
>>    - I just tried with the trunk (r225060), the issue is still present.
>>    - A slightly more detailed procedure is described here
>>    https://github.com/Sarcasm/irony-mode/issues/134#issuecomment-68412195 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).
>>
>> Thanks,
>>  Guillaume
>>
>>   _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150103/fb710c49/attachment.html>


More information about the cfe-dev mailing list