`clang_Type_getOffsetOf` should be deprecated
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
`clang_Type_getOffsetOf(CXType T, const char *S)` is a very rare case of libclang API taking a string that is not a path or buffer of characters, and it doesn't follow the "cursor design" of libclang. I think it should be deprecated in favor of `clang_Type_visitFields` and `clang_Cursor_getOffsetOfField(CXCursor C)`. I believe the reason it exists is that it predates `clang_Cursor_getOffsetOfField` by two years.
Following this change, `Type.get_offset` in Python bindings should be reimplemented the right way.
Contributor guide
Research direction
Start by tracing the libclang entry points `clang_Type_getOffsetOf`, `clang_Type_visitFields`, and `clang_Cursor_getOffsetOfField`, then inspect the Python binding implementation of `Type.get_offset`. Done means the older API is deprecated and the Python binding uses the cursor-based approach while preserving the expected offset behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100