RFR: 7904079: Fix setting up length parameter for CXUnsavedFiles Struct [v4]

Jorn Vernee jvernee at openjdk.org
Thu Sep 18 15:22:24 UTC 2025


On Thu, 18 Sep 2025 14:03:52 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Varada M has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   7904079: Fix setting up length parameter for CXUnsavedFiles Struct
>
> src/main/java/org/openjdk/jextract/clang/TranslationUnit.java line 96:
> 
>> 94:                 else {
>> 95:                    start.set((ValueLayout.OfLong) C_LONG, LENGTH_OFFSET, (long) inMemoryFiles[i].contents.length());
>> 96:                 }
> 
> There is some history here, but looking at this again, I think it would be better to use the setters that jextract generates here.
> 
> 
> CXUnsavedFile.Filename(start, arena.allocateFrom(inMemoryFiles[i].file));
> CXUnsavedFile.Contents(start, arena.allocateFrom(inMemoryFiles[i].contents));
> CXUnsavedFile.Length(start, inMemoryFiles[i].contents.length());

If you make this change, please also remove the `*_OFFSET` fields, which are no longer needed.

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

PR Review Comment: https://git.openjdk.org/jextract/pull/289#discussion_r2359839978


More information about the jextract-dev mailing list