Biohazrd
Biohazrd copied to clipboard
Clang built-in types meta issue
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
- [x]
Char_S
--char
(with-fsigned-char
) always translated asbyte
since a barechar
usually indicates a C-style string and .NET's encoding utilities usebyte
- [x]
Char_U
--char
(with-fno-signed-char
) - [ ]
Char8
--char8_t
UTF-8 character (C++20 feature) should translate toSystem.Char8
once both are released. - [x]
Char16
--char16_t
, translated as C#char
- [x]
WChar
--wchar_t
(16-bit -- on Windows platforms) - [ ]
WChar
--wchar_t
(32-bit -- on Itanium platforms) https://github.com/InfectedLibraries/Biohazrd/issues/45 - [ ]
Char32
--char32_t
https://github.com/InfectedLibraries/Biohazrd/issues/45
Unsigned integer types
- [x]
UChar
--unsigned char
/uint8_t
- [x]
UShort
- [x]
UInt
- [x]
ULong
- [x]
ULongLong
- [ ]
UInt128
Signed integer types
- [x]
SChar
--signed char
/int8_t
- [x]
Short
- [x]
Int
- [x]
Long
- [x]
LongLong
- [ ]
Int128
Floating point types
- [ ]
Float16
--_Float16
- [ ]
Half
--half
(OpenCL) /__fp16
(ARM NEON) https://github.com/InfectedLibraries/Biohazrd/issues/44 - [x]
Float
- [x]
Double
- [ ]
Float128
--__float128
- [ ]
LongDouble
Other
- [x]
Bool
- [ ]
NullPtr
-- https://github.com/InfectedLibraries/Biohazrd/issues/43 - [x]
Void
- [x] ~~
Dependent
~~ The impression I get from the description of this type is that it won't appear in valid code. - [x] ~~
Overload
~~ Similarly, this description implies this is used internally within Clang and won't appear in valid code.
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.)
- [x] ~~
Accum
~~ - [x] ~~
UAccum
~~ - [x] ~~
ShortAccum
~~ - [x] ~~
UShortAccum
~~ - [x] ~~
LongAccum
~~ - [x] ~~
ULongAccum
~~
Out of scope
- [x] ~~
ObjCClass
~~ - [x] ~~
ObjCId
~~ - [x] ~~
ObjCSel
~~ - [x] ~~All
CXType_OCL*
types~~
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.)