RFR: Don't chase typedefs in Utils::declarationFor

Jorn Vernee jvernee at openjdk.org
Fri Dec 15 15:29:07 UTC 2023


On Fri, 15 Dec 2023 12:43:16 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> The fix for https://git.openjdk.org/jextract/pull/161 introduced a method, namely `Utils::declarationFor` which gives us a scoped declaration from a given type.This routine was implemented "the right way", but that revealed issues with the underlying IR, especially when extracting big header files like windows.h. In some cases the order in which cursors are seen is slightly different, and that leads to the wrong name to be attached to the typedeff'ed entity. This problem is also existing in the jdk22 branch, but given that branch has a much more primitive logic for visiting declaration types, it was never exposed in full.
> 
> For now, the solution is to dumb down `Utils::declarationFor`. Of course a longer term solution is to make sure that declarations that need to be visited can be seen in the declaration tree, so that chasing types is no longer necessary.

Marked as reviewed by jvernee (Committer).

-------------

PR Review: https://git.openjdk.org/jextract/pull/165#pullrequestreview-1784376940


More information about the jextract-dev mailing list