Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integer type sizes incorrectly handled on Linux #73

Open
BeanCheeseBurrito opened this issue Feb 18, 2023 · 0 comments
Open

Integer type sizes incorrectly handled on Linux #73

BeanCheeseBurrito opened this issue Feb 18, 2023 · 0 comments
Labels
bug Something isn't working PR Welcome Extra attention is needed

Comments

@BeanCheeseBurrito
Copy link

Some platforms define 8-byte types like uint64_t as unsigned long int and causes CppAst to return CppPrimitiveType objects with the wrong byte size. A possible fix would be something like:

// Old
case CXTypeKind.CXType_ULong:
    return CppPrimitiveType.UnsignedInt;

// New
case CXTypeKind.CXType_ULong:
    return type.SizeOf == 8 ? CppPrimitiveType.UnsignedLongLong : CppPrimitiveType.UnsignedInt;

private CppType GetCppTypeInternal(CXCursor cursor, CXType type, CXCursor parent, void* data)
{
switch (type.kind)
{
case CXTypeKind.CXType_Void:
return CppPrimitiveType.Void;
case CXTypeKind.CXType_Bool:
return CppPrimitiveType.Bool;
case CXTypeKind.CXType_UChar:
return CppPrimitiveType.UnsignedChar;
case CXTypeKind.CXType_UShort:
return CppPrimitiveType.UnsignedShort;
case CXTypeKind.CXType_UInt:
return CppPrimitiveType.UnsignedInt;
case CXTypeKind.CXType_ULong:
return CppPrimitiveType.UnsignedInt;
case CXTypeKind.CXType_ULongLong:
return CppPrimitiveType.UnsignedLongLong;

@xoofx xoofx added bug Something isn't working PR Welcome Extra attention is needed labels Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PR Welcome Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants