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

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Dec 15 12:49:37 UTC 2023


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.

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

Commit messages:
 - Initial push

Changes: https://git.openjdk.org/jextract/pull/165/files
 Webrev: https://webrevs.openjdk.org/?repo=jextract&pr=165&range=00
  Stats: 3 lines in 1 file changed: 2 ins; 1 del; 0 mod
  Patch: https://git.openjdk.org/jextract/pull/165.diff
  Fetch: git fetch https://git.openjdk.org/jextract.git pull/165/head:pull/165

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


More information about the jextract-dev mailing list