[cfe-dev] libclang locking files for write/delete on windows

Yaron Keren yaron.keren at gmail.com
Sat Dec 6 02:28:14 PST 2014


Wild guess, try this patch:

Index: tools/clang/lib/Lex/HeaderSearch.cpp
===================================================================
--- tools/clang/lib/Lex/HeaderSearch.cpp (revision 222541)
+++ tools/clang/lib/Lex/HeaderSearch.cpp (working copy)
@@ -257,7 +257,7 @@
     return File;
   }

-  return HS.getFileMgr().getFile(FileName, /*openFile=*/true);
+  return HS.getFileMgr().getFile(FileName, /*openFile=*/false);
 }

 /// LookupFile - Lookup the specified file in this search path, returning
it



2014-12-06 12:01 GMT+02:00 Manuel Klimek <klimek at google.com>:

> So, I think the general problem is that Windows by default does not allow
> multiple applications to have a file open. The question is whether we could
> get libclang to read all the files into memory instead of keeping them
> open...
>
> On Fri Dec 05 2014 at 10:13:08 PM Ivan Koster <ivankoster at gmail.com>
> wrote:
>
>> Hello,
>>
>> I was requested in https://github.com/Valloric/ycmd/issues/61 to post
>> about a file locking problem on windows. In that thread the suspicion was
>> raised that libclang.dll locks header files for writing or delete.
>>
>> I am writing a plugin that uses YCMD, which uses libclang to provide
>> autocomplete and goto definition among other services.
>>
>> To be completely honest, libclang and ycmd are a black box for me and I
>> have no idea on their internals, how libclang.dll and YCMD interact or how
>> to start debugging this.
>> In the above link you can find a .c and .h file that for me consistently
>> lock the files on windows 7 64bit. Only very few header files of my
>> projects get locked, and they all use a code construct as in the above
>> provided .c and .h file. From my experimenting, the header file also seems
>> to must be above a certain size for the lock to occur.
>>
>> I'm hoping the above is sufficient to pin down the problem.
>> If more information is need I'm happy to help.
>>
>> Greetings,
>>
>> Ivan
>>
>>
>>
>>
>>
> _______________________________________________
> 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/20141206/ef667201/attachment.html>


More information about the cfe-dev mailing list