libclang crashes when using TU with PCH

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

libclang crashes when using TU with PCH

jaytee
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.

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?

Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: libclang crashes when using TU with PCH

Argyrios Kyrtzidis
On May 15, 2013, at 5:22 AM, jaytee <[hidden email]> 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
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: libclang crashes when using TU with PCH

jaytee
This post was updated on .
The files are modified (or do no longer exist), after the PCH is created, but before the TU is generated.
The TU is generated successfully, but libclang performs checks on the directory and asserts when I'm trying to retrieve location information from the TU, using clang_getInstantiationLocation or clang_getCursorExtent.
I'm using clang 2.9.

Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: libclang crashes when using TU with PCH

Argyrios Kyrtzidis
On May 16, 2013, at 11:39 PM, jaytee <[hidden email]> wrote:

> The files are modified (or do no longer exist), after the PCH is created, but
> before the TU is generated.
> The TU is generated successfully, but libclang performs checks on the
> directory when I'm trying to retrieve location information from the TU,
> using clang_getInstantiationLocation or clang_getCursorExtent.
> I'm using clang 2.9.

This is rather old, I'd suggest you move to libclang from trunk.
If you are still seeing issues, please post code with a reduced test case.

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


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: libclang crashes when using TU with PCH

jaytee
Thank you for your replies.