Issue 160729
Summary libclang: CXUnsavedFile::length should use a fixed-width type
Labels new issue
Assignees
Reporter nizarbenalla
    `CXUnsavedFile` in `clang-c/Index.h` declares `unsigned long Length`.

```C
struct CXUnsavedFile {
  const char *Filename;
  const char *Contents;
  unsigned long Length;
};
```

This varies across ABIs (eg. on big endian architectures), which can cause crashes or incorrect lengths.

Here is an example of a [downstream](https://bugs.openjdk.org/browse/CODETOOLS-7904079) Bug.

I plan to work on a fix, likely updating the struct to use `uint64_t Length` and adjust internal uses.

Any concerns or suggestions before I start? This change intentionally alters libclang's C API layout. Based on the [LLVM Developer Policy](https://llvm.org/docs/DeveloperPolicy.html#c-api-changes), I should start a forum thread about this and later write a release note?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to