@@ -386,6 +386,9 @@ pub(crate) struct BindgenContext {
386
386
/// Whether a bindgen complex was generated
387
387
generated_bindgen_complex : Cell < bool > ,
388
388
389
+ /// Whether a bindgen float16 was generated
390
+ generated_bindgen_float16 : Cell < bool > ,
391
+
389
392
/// The set of `ItemId`s that are allowlisted. This the very first thing
390
393
/// computed after parsing our IR, and before running any of our analyses.
391
394
allowlisted : Option < ItemSet > ,
@@ -585,6 +588,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
585
588
target_info,
586
589
options,
587
590
generated_bindgen_complex : Cell :: new ( false ) ,
591
+ generated_bindgen_float16 : Cell :: new ( false ) ,
588
592
allowlisted : None ,
589
593
blocklisted_types_implement_traits : Default :: default ( ) ,
590
594
codegen_items : None ,
@@ -2005,6 +2009,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
2005
2009
CXType_ULongLong => TypeKind :: Int ( IntKind :: ULongLong ) ,
2006
2010
CXType_Int128 => TypeKind :: Int ( IntKind :: I128 ) ,
2007
2011
CXType_UInt128 => TypeKind :: Int ( IntKind :: U128 ) ,
2012
+ CXType_Float16 | CXType_Half => TypeKind :: Float ( FloatKind :: Float16 ) ,
2008
2013
CXType_Float => TypeKind :: Float ( FloatKind :: Float ) ,
2009
2014
CXType_Double => TypeKind :: Float ( FloatKind :: Double ) ,
2010
2015
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!"
2013
2018
let float_type =
2014
2019
ty. elem_type ( ) . expect ( "Not able to resolve complex type?" ) ;
2015
2020
let float_kind = match float_type. kind ( ) {
2021
+ CXType_Float16 | CXType_Half => FloatKind :: Float16 ,
2016
2022
CXType_Float => FloatKind :: Float ,
2017
2023
CXType_Double => FloatKind :: Double ,
2018
2024
CXType_LongDouble => FloatKind :: LongDouble ,
@@ -2528,6 +2534,16 @@ If you encounter an error missing from this list, please file an issue or a PR!"
2528
2534
self . generated_bindgen_complex . get ( )
2529
2535
}
2530
2536
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
+
2531
2547
/// Compute which `enum`s have an associated `typedef` definition.
2532
2548
fn compute_enum_typedef_combos ( & mut self ) {
2533
2549
let _t = self . timer ( "compute_enum_typedef_combos" ) ;
0 commit comments