RFR: 7904079: Fix setting up length parameter for CXUnsavedFiles Struct [v2]
Jorn Vernee
jvernee at openjdk.org
Thu Sep 11 11:27:10 UTC 2025
On Thu, 11 Sep 2025 07:03:13 GMT, Varada M <varadam at openjdk.org> wrote:
>> CXUnsavedFile struct contains three members, first two are pointers and last one is unsigned long. When jextract makes downcall to clang_reparseTranslationUnit_Impl it sets up the third parameter in the struct incorrectly. It sets INT instead of LONG so on big endian platform the parameter will be set differently.
>>
>> JBS Issue : [CODETOOLS-7904079](https://bugs.openjdk.org/browse/CODETOOLS-7904079)
>
> Varada M has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
>
> CODETOOLS-7904079: Fix setting up length parameter for CXUnsavedFiles Struct
This seems to be the one field in the libclang library that uses the non-portable type `unsigned long`, instead of the `long long` that is used everywhere else. (https://clang.llvm.org/doxygen/structCXUnsavedFile.html)
The issue with writing a 64 bit value here is that the value will be out of bounds on Windows, where a `long` is only 32 bits. We should also update the initializer of `C_LONG` in `Index_h` so that it uses `Linker::cannonicalLayouts` which will return the right layout based on the platform.
-------------
PR Comment: https://git.openjdk.org/jextract/pull/289#issuecomment-3280060668
More information about the jextract-dev
mailing list