44/// For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler,
55/// see design document in the tracking issue #89653.
66use bitflags:: bitflags;
7- use rustc_middle:: ty:: { FnSig , Instance , Ty , TyCtxt } ;
7+ use rustc_middle:: ty:: { Instance , Ty , TyCtxt } ;
88use rustc_target:: abi:: call:: FnAbi ;
99use std:: hash:: Hasher ;
1010use twox_hash:: XxHash64 ;
1111
1212bitflags ! {
13- /// Options for typeid_for_fnabi and typeid_for_fnsig .
13+ /// Options for typeid_for_fnabi.
1414 #[ derive( Clone , Copy , Debug ) ]
1515 pub struct TypeIdOptions : u32 {
1616 const GENERALIZE_POINTERS = 1 ;
@@ -30,15 +30,6 @@ pub fn typeid_for_fnabi<'tcx>(
3030 typeid_itanium_cxx_abi:: typeid_for_fnabi ( tcx, fn_abi, options)
3131}
3232
33- /// Returns a type metadata identifier for the specified FnSig.
34- pub fn typeid_for_fnsig < ' tcx > (
35- tcx : TyCtxt < ' tcx > ,
36- fn_sig : & FnSig < ' tcx > ,
37- options : TypeIdOptions ,
38- ) -> String {
39- typeid_itanium_cxx_abi:: typeid_for_fnsig ( tcx, fn_sig, options)
40- }
41-
4233/// Returns a type metadata identifier for the specified Instance.
4334pub fn typeid_for_instance < ' tcx > (
4435 tcx : TyCtxt < ' tcx > ,
@@ -61,19 +52,6 @@ pub fn kcfi_typeid_for_fnabi<'tcx>(
6152 hash. finish ( ) as u32
6253}
6354
64- /// Returns a KCFI type metadata identifier for the specified FnSig.
65- pub fn kcfi_typeid_for_fnsig < ' tcx > (
66- tcx : TyCtxt < ' tcx > ,
67- fn_sig : & FnSig < ' tcx > ,
68- options : TypeIdOptions ,
69- ) -> u32 {
70- // A KCFI type metadata identifier is a 32-bit constant produced by taking the lower half of the
71- // xxHash64 of the type metadata identifier. (See llvm/llvm-project@cff5bef.)
72- let mut hash: XxHash64 = Default :: default ( ) ;
73- hash. write ( typeid_itanium_cxx_abi:: typeid_for_fnsig ( tcx, fn_sig, options) . as_bytes ( ) ) ;
74- hash. finish ( ) as u32
75- }
76-
7755/// Returns a KCFI type metadata identifier for the specified Instance.
7856pub fn kcfi_typeid_for_instance < ' tcx > (
7957 tcx : TyCtxt < ' tcx > ,
0 commit comments