[foreign-jextract] [Rev 01] RFR: Represent typedef with Declaration.Variable instead of Declaration.Scoped
Henry Jen
henryjen at openjdk.java.net
Fri May 1 00:51:16 UTC 2020
> Currently jextract API only present typedef declaration for record types, and using Declaration.Scoped to do so.
>
> This makes downstream tools like jextract impossible to generate more comprehensive type. For example, if the tool
> would like to create a carrier type for size_t with similar name, because we pass through that, this is impossible.
> This patch try to present typedef as Declaration.Variable with Kind TYPE. This will give us more transparency on
> dealing with typedef, and enable factoring an Declaration.Variable.TYPE from a Type.Delegated.TYPEDEF.
> This would also be useful when a tool collecting type dependencies and encounter anonymous type or types without
> declaration, this gave the tool a chance to inject an implicit typedef to associate a type with a proper name.
> There is one thing worth further discussion is that if we would like to consider generate array with typedef, currently
> the array element type won't be a Type.Delegated.TYPEDEF, but canonical type. The test case try to explain what should
> be expected for most use cases, if there is any possible way to use typedef, I'll try to add them.
Henry Jen has updated the pull request incrementally with one additional commit since the last revision:
Add Declaration.Typedef
-------------
Changes:
- all: https://git.openjdk.java.net/panama-foreign/pull/137/files
- new: https://git.openjdk.java.net/panama-foreign/pull/137/files/d5030a44..2fa5f912
Webrevs:
- full: https://webrevs.openjdk.java.net/panama-foreign/137/webrev.01
- incr: https://webrevs.openjdk.java.net/panama-foreign/137/webrev.00-01
Stats: 121 lines in 6 files changed: 87 ins; 20 del; 14 mod
Patch: https://git.openjdk.java.net/panama-foreign/pull/137.diff
Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/137/head:pull/137
PR: https://git.openjdk.java.net/panama-foreign/pull/137
More information about the panama-dev
mailing list