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

papin_g guillaume.papin at epitech.eu
Fri Jan 2 15:32:39 PST 2015


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150102/3c275afe/attachment.html>


More information about the cfe-dev mailing list