RFR: 7903198: Refine filtering for enums
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Fri May 20 17:58:36 UTC 2022
This patch fixes an issue with the logic for filtering constants.
Since both enum constants and `#define` macros are represented as `Declaration.Constant` nodes, `OutputFactory` is confused as to whether the constant being generated is a macro or not.
This patch adds a new filtering option `--include-enum`; this option can be used to include an enum (and all its constants). `OutputFactory` has been rectified so that:
* `IncludeHelper` is also called on the enum (so that filtering happens)
* `visitConstant` does not call `IncludingHelper` filtering routine on things that are non toplevel constants
In other words, if we get to `visitConstant` and the parent node is an enum - we should not filter: if we're here it means that the parent enum is included in the filtering.
-------------
Commit messages:
- Initial push
Changes: https://git.openjdk.java.net/jextract/pull/36/files
Webrev: https://webrevs.openjdk.java.net/?repo=jextract&pr=36&range=00
Issue: https://bugs.openjdk.java.net/browse/CODETOOLS-7903198
Stats: 46 lines in 6 files changed: 24 ins; 4 del; 18 mod
Patch: https://git.openjdk.java.net/jextract/pull/36.diff
Fetch: git fetch https://git.openjdk.java.net/jextract pull/36/head:pull/36
PR: https://git.openjdk.java.net/jextract/pull/36
More information about the jextract-dev
mailing list