RFR: 7903605: Simplify TypeMaker [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Dec 11 11:01:09 UTC 2023


On Mon, 11 Dec 2023 10:43:12 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> src/main/java/org/openjdk/jextract/impl/TreeMaker.java line 134:
>> 
>>> 132:             case EnumDecl -> createEnum(c);
>>> 133:             case EnumConstantDecl -> createEnumConstant(c);
>>> 134:             case FieldDecl -> createVar(c, Declaration.Variable.Kind.FIELD);
>> 
>> FWIW, I see the `FieldDecl` case as being never executed in the code coverage report. Not sure why...
>
> I think this is caused by the fact that the new `TreeMaker::recordDeclaration` (introduced in previous PR) does all the processing of a struct/union inline.

I've changed this now to call `createTree` recursively (which seems consistent with other methods in `TreeMaker`, like `createFunction`). This uncovered a bug in the deduplication logic where we were caching the contents of declaration whose position was NO_POSITION (and so ending up with same cached decl for different fields).

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

PR Review Comment: https://git.openjdk.org/jextract/pull/155#discussion_r1422298210


More information about the jextract-dev mailing list