[cfe-dev] libclang crashes when using TU with PCH

Argyrios Kyrtzidis akyrtzi at gmail.com
Thu May 16 14:50:35 PDT 2013

On May 15, 2013, at 5:22 AM, jaytee <aloha_arts at yahoo.com> wrote:

> I'm generating a TU using a PCH file and libclang asserts and causes access
> violation when I get cursor instantiation locations from that TU, if files
> from which the PCH file was generated no longer exist or have been modified.

Are these files modified after the TU is created ? If the PCH file is stale I'd expect it would fail to give you a TU in the first place.

> If I pass the unsaved buffer of file "header.h", which has been used with
> the saved state to compile the PCH file, I also get wrong cursor location
> information if I use these to generate a TU.
> Does somebody know why is the PCH file so tied to the files on disk? Is
> there a workaround for this issue?

PCHs are not independent, the parser may refer back to the file on disk for diagnostic rendering, parsing of numeric literals in macro definitions, etc.
We try to recover when a header file was modified, however; it would be helpful if you could provide some minimal test case that reproduces your problem and file a bugzilla report about it.

> Thank you!
> --
> View this message in context: http://clang-developers.42468.n3.nabble.com/libclang-crashes-when-using-TU-with-PCH-tp4032121.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list