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

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Dec 15 15:47:10 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.

This pull request has now been integrated.

Changeset: 7ab15579
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.org/jextract/commit/7ab1557965fcf5966d2a6cb5486df173e71ca1e5
Stats:     3 lines in 1 file changed: 2 ins; 1 del; 0 mod

Don't chase typedefs in Utils::declarationFor

Reviewed-by: jvernee

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

PR: https://git.openjdk.org/jextract/pull/165


More information about the jextract-dev mailing list