xoofx / xoofx/CppAst.NET

Integer type sizes incorrectly handled on Linux

Open
#73 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug PR Welcome
Dominant language
C#
Stars
620
Forks
79
Avg merge
14h 27m
Merged PRs (30d)
1

Description

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;

https://github.com/xoofx/CppAst.NET/blob/d0d3a1ffd8cbdd035bf797d477bfd76ed7773f03/src/CppAst/CppModelBuilder.cs#L1747-L1770

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect src/CppAst/CppModelBuilder.cs around lines 1747-1770, starting with the CXType_ULong handling shown in the issue. Check how SizeOf maps Linux integer types to CppPrimitiveType values, and verify that an 8-byte uint64_t is reported with the correct primitive type and size.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, csharp
Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.