@@ -398,6 +398,8 @@ private predicate isIntegralType(@builtintype type, int kind) {
398398 kind = 44
399399 or
400400 kind = 51
401+ or
402+ 67 <= kind and kind <= 69
401403 )
402404}
403405
@@ -484,6 +486,12 @@ private predicate integralTypeMapping(int original, int canonical, int unsigned,
484486 original = 44 and canonical = 44 and unsigned = - 1 and signed = - 1 // char32_t
485487 or
486488 original = 51 and canonical = 51 and unsigned = - 1 and signed = - 1 // char8_t
489+ or
490+ original = 67 and canonical = 67 and unsigned = 68 and signed = 69 // _BitInt(N)
491+ or
492+ original = 68 and canonical = 68 and unsigned = 68 and signed = 69 // unsigned _BitInt(N)
493+ or
494+ original = 69 and canonical = 67 and unsigned = 68 and signed = 69 // signed _BitInt(N)
487495}
488496
489497/**
@@ -517,7 +525,8 @@ class IntegralType extends ArithmeticType, IntegralOrEnumType {
517525 builtintypes ( underlyingElement ( this ) , _, 13 , _, _, _) or
518526 builtintypes ( underlyingElement ( this ) , _, 16 , _, _, _) or
519527 builtintypes ( underlyingElement ( this ) , _, 19 , _, _, _) or
520- builtintypes ( underlyingElement ( this ) , _, 37 , _, _, _)
528+ builtintypes ( underlyingElement ( this ) , _, 37 , _, _, _) or
529+ builtintypes ( underlyingElement ( this ) , _, 69 , _, _, _)
521530 }
522531
523532 /** Holds if this integral type is explicitly unsigned. */
@@ -527,7 +536,8 @@ class IntegralType extends ArithmeticType, IntegralOrEnumType {
527536 builtintypes ( underlyingElement ( this ) , _, 12 , _, _, _) or
528537 builtintypes ( underlyingElement ( this ) , _, 15 , _, _, _) or
529538 builtintypes ( underlyingElement ( this ) , _, 18 , _, _, _) or
530- builtintypes ( underlyingElement ( this ) , _, 36 , _, _, _)
539+ builtintypes ( underlyingElement ( this ) , _, 36 , _, _, _) or
540+ builtintypes ( underlyingElement ( this ) , _, 68 , _, _, _)
531541 }
532542
533543 /** Holds if this integral type is implicitly signed. */
@@ -537,7 +547,8 @@ class IntegralType extends ArithmeticType, IntegralOrEnumType {
537547 builtintypes ( underlyingElement ( this ) , _, 11 , _, - 1 , _) or
538548 builtintypes ( underlyingElement ( this ) , _, 14 , _, - 1 , _) or
539549 builtintypes ( underlyingElement ( this ) , _, 17 , _, - 1 , _) or
540- builtintypes ( underlyingElement ( this ) , _, 35 , _, - 1 , _)
550+ builtintypes ( underlyingElement ( this ) , _, 35 , _, - 1 , _) or
551+ builtintypes ( underlyingElement ( this ) , _, 67 , _, - 1 , _)
541552 }
542553
543554 /**
@@ -547,7 +558,14 @@ class IntegralType extends ArithmeticType, IntegralOrEnumType {
547558 IntegralType getUnsigned ( ) {
548559 exists ( int unsignedKind |
549560 integralTypeMapping ( kind , _, unsignedKind , _) and
550- builtintypes ( unresolveElement ( result ) , _, unsignedKind , _, _, _)
561+ builtintypes ( unresolveElement ( result ) , _, unsignedKind , _, _, _) and
562+ (
563+ not kind in [ 67 , 68 , 69 ]
564+ or
565+ exists ( int bitWidth | bit_precise_int_types ( underlyingElement ( this ) , bitWidth ) |
566+ bit_precise_int_types ( unresolveElement ( result ) , bitWidth )
567+ )
568+ )
551569 )
552570 }
553571
@@ -562,7 +580,14 @@ class IntegralType extends ArithmeticType, IntegralOrEnumType {
562580 IntegralType getCanonicalArithmeticType ( ) {
563581 exists ( int canonicalKind |
564582 integralTypeMapping ( kind , canonicalKind , _, _) and
565- builtintypes ( unresolveElement ( result ) , _, canonicalKind , _, _, _)
583+ builtintypes ( unresolveElement ( result ) , _, canonicalKind , _, _, _) and
584+ (
585+ not kind in [ 67 , 68 , 69 ]
586+ or
587+ exists ( int bitWidth | bit_precise_int_types ( underlyingElement ( this ) , bitWidth ) |
588+ bit_precise_int_types ( unresolveElement ( result ) , bitWidth )
589+ )
590+ )
566591 )
567592 }
568593}
@@ -1045,6 +1070,18 @@ class Char32Type extends IntegralType {
10451070 override string getAPrimaryQlClass ( ) { result = "Char32Type" }
10461071}
10471072
1073+ /**
1074+ * A C23 bit-precise integer type `_BitInt(N)`.
1075+ */
1076+ class BitPreciseIntegerType extends IntegralType {
1077+ BitPreciseIntegerType ( ) { builtintypes ( underlyingElement ( this ) , _, [ 67 , 68 , 69 ] , _, _, _) }
1078+
1079+ /** Get the bit-with of the bit-precise integer. */
1080+ int getBitWidth ( ) { bit_precise_int_types ( underlyingElement ( this ) , result ) }
1081+
1082+ override string getAPrimaryQlClass ( ) { result = "BitPreciseIntType" }
1083+ }
1084+
10481085/**
10491086 * The (primitive) type of the C++11 `nullptr` constant. It is a
10501087 * distinct type, denoted by `decltype(nullptr)`, that is not itself a pointer
0 commit comments