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