Skip to content

C++: Add support for C23 _BitInts - #22816

Open
jketema wants to merge 4 commits into
github:mainfrom
jketema:jketema/bitint
Open

jketema wants to merge 4 commits into
github:mainfrom
jketema:jketema/bitint

Conversation

@jketema

@jketema jketema commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread cpp/ql/lib/semmle/code/cpp/Type.qll Fixed
Comment thread cpp/ql/lib/semmle/code/cpp/Type.qll Fixed
@github-actions github-actions Bot added the C++ label Oct 13, 2026
@jketema
jketema force-pushed the jketema/bitint branch 6 times, most recently from 2961468 to 3aebb27 Compare October 14, 2026 09:15
Comment thread cpp/ql/lib/semmle/code/cpp/Type.qll Fixed
@jketema
jketema marked this pull request as ready for review October 14, 2026 14:45
Copilot AI balanced review requested due to automatic review settings October 14, 2026 14:45
@jketema
jketema requested a review from a team as a code owner October 14, 2026 14:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Numeric consumers still confuse storage size with declared precision, and the downgrade emits an undefined type kind.

2 open findings
What changed in this PR

Adds C23 _BitInt(N) representation to CodeQL’s C/C++ schema and type library.

Changes:

  • Adds bit-precise integer kinds and declared bit widths.
  • Extends integral-type classification and width-preserving mappings.
  • Adds schema migration files and a feature note.
File Description
cpp/​ql/​lib/​upgrades/​0853f43dc8c08deecb473c54a2b70da8597f1ab5/​upgrade.properties Declares upgrade compatibility.
cpp/​ql/​lib/​upgrades/​0853f43dc8c08deecb473c54a2b70da8597f1ab5/​old.dbscheme Records the pre-upgrade schema.
cpp/​ql/​lib/​semmlecode.cpp.dbscheme Adds integer kinds and bit-width metadata.
cpp/​ql/​lib/​semmle/​code/​cpp/​Type.qll Exposes bit-precise types and mappings.
cpp/​ql/​lib/​change-notes/​2026-10-14-bitint.md Announces the feature.
cpp/​downgrades/​6aec212e408fad907b19368a3376a4d9837783d2/​upgrade.properties Configures downgrade transformations.
cpp/​downgrades/​6aec212e408fad907b19368a3376a4d9837783d2/​semmlecode.cpp.dbscheme Records the downgrade target schema.
cpp/​downgrades/​6aec212e408fad907b19368a3376a4d9837783d2/​old.dbscheme Records the downgrade source schema.
cpp/​downgrades/​6aec212e408fad907b19368a3376a4d9837783d2/​builtintypes.ql Maps new kinds for older schemas.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cpp/downgrades/6aec212e408fad907b19368a3376a4d9837783d2/builtintypes.ql Outdated
or
kind = 51
or
67 <= kind and kind <= 69

@jketema jketema Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is correct, and might produce some FP/FN, but this does not seem worth fixing at this point given that we have not seen any real world use of _BitInt.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants