MochiLibraries / Biohazrd

A framework for automatically generating binding wrappers for C/C++ libraries
MIT License
60 stars 9 forks source link

Clang built-in types meta issue #46

Open PathogenDavid opened 4 years ago

PathogenDavid commented 4 years ago

This issue tracks the support for individual Clang built-in types. (For type classes, see #38)

The list below was gathered from CXTypeKind using the range CXType_FirstBuiltin..CXType_LastBuiltin. (Clang also considers some OpenCL stuff to be builtins, but they're out of scope for us.)

The documentation on the libclang side of things is pretty barren, BuiltinTypes.def is much more verbose. (Note that not all types defined in BuiltinTypes.def are exposed by libclang. It may be worthwhile to enumerate these too.)

Character types

Unsigned integer types

Signed integer types

Floating point types

Other

Out of scope: Fixed point types

In addition to _Accum, Clang also internally supports similar _Fract and _Sat types which aren't even exposed in libclang. These are apparently for use on processors which support fixed-point types

I am assuming these will definitely be out of scope for Biohazrd. If a library needs these, I assume they will need special library/language-specific transformation.

I assume we could kludge them into same-sized builtins, but without real samples I'm not a fan of doing that. (Anyone who happens across a library that uses these can use KludgeUnknownClangTypesIntoBuiltinTypesTransformation until they figure out their library-specific translation.)

Out of scope

PathogenDavid commented 4 years ago

When adding new types, make sure to check if pathogen_GetConstantValue needs to be updated to support them. (It will support some out of the box, but not all.)