@@ -386,6 +386,9 @@ pub(crate) struct BindgenContext {
386386 /// Whether a bindgen complex was generated
387387 generated_bindgen_complex : Cell < bool > ,
388388
389+ /// Whether a bindgen float16 was generated
390+ generated_bindgen_float16 : Cell < bool > ,
391+
389392 /// The set of `ItemId`s that are allowlisted. This the very first thing
390393 /// computed after parsing our IR, and before running any of our analyses.
391394 allowlisted : Option < ItemSet > ,
@@ -585,6 +588,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
585588 target_info,
586589 options,
587590 generated_bindgen_complex : Cell :: new ( false ) ,
591+ generated_bindgen_float16 : Cell :: new ( false ) ,
588592 allowlisted : None ,
589593 blocklisted_types_implement_traits : Default :: default ( ) ,
590594 codegen_items : None ,
@@ -2005,6 +2009,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
20052009 CXType_ULongLong => TypeKind :: Int ( IntKind :: ULongLong ) ,
20062010 CXType_Int128 => TypeKind :: Int ( IntKind :: I128 ) ,
20072011 CXType_UInt128 => TypeKind :: Int ( IntKind :: U128 ) ,
2012+ CXType_Float16 | CXType_Half => TypeKind :: Float ( FloatKind :: Float16 ) ,
20082013 CXType_Float => TypeKind :: Float ( FloatKind :: Float ) ,
20092014 CXType_Double => TypeKind :: Float ( FloatKind :: Double ) ,
20102015 CXType_LongDouble => TypeKind :: Float ( FloatKind :: LongDouble ) ,
@@ -2013,6 +2018,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
20132018 let float_type =
20142019 ty. elem_type ( ) . expect ( "Not able to resolve complex type?" ) ;
20152020 let float_kind = match float_type. kind ( ) {
2021+ CXType_Float16 | CXType_Half => FloatKind :: Float16 ,
20162022 CXType_Float => FloatKind :: Float ,
20172023 CXType_Double => FloatKind :: Double ,
20182024 CXType_LongDouble => FloatKind :: LongDouble ,
@@ -2528,6 +2534,16 @@ If you encounter an error missing from this list, please file an issue or a PR!"
25282534 self . generated_bindgen_complex . get ( )
25292535 }
25302536
2537+ /// Call if a bindgen float16 is generated
2538+ pub ( crate ) fn generated_bindgen_float16 ( & self ) {
2539+ self . generated_bindgen_float16 . set ( true )
2540+ }
2541+
2542+ /// Whether we need to generate the bindgen float16 type
2543+ pub ( crate ) fn need_bindgen_float16_type ( & self ) -> bool {
2544+ self . generated_bindgen_float16 . get ( )
2545+ }
2546+
25312547 /// Compute which `enum`s have an associated `typedef` definition.
25322548 fn compute_enum_typedef_combos ( & mut self ) {
25332549 let _t = self . timer ( "compute_enum_typedef_combos" ) ;
0 commit comments