@@ -22,10 +22,7 @@ use itertools::Itertools;
2222use  rustc_codegen_ssa:: traits:: TypeMembershipMethods ; 
2323use  rustc_data_structures:: fx:: FxIndexSet ; 
2424use  rustc_middle:: ty:: { Instance ,  Ty } ; 
25- use  rustc_symbol_mangling:: typeid:: { 
26-     kcfi_typeid_for_fnabi,  kcfi_typeid_for_instance,  typeid_for_fnabi,  typeid_for_instance, 
27-     TypeIdOptions , 
28- } ; 
25+ use  rustc_sanitizers:: { cfi,  kcfi} ; 
2926use  smallvec:: SmallVec ; 
3027
3128/// Declare a function. 
@@ -145,47 +142,49 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
145142            if  let  Some ( instance)  = instance { 
146143                let  mut  typeids = FxIndexSet :: default ( ) ; 
147144                for  options in  [ 
148-                     TypeIdOptions :: GENERALIZE_POINTERS , 
149-                     TypeIdOptions :: NORMALIZE_INTEGERS , 
150-                     TypeIdOptions :: USE_CONCRETE_SELF , 
145+                     cfi :: TypeIdOptions :: GENERALIZE_POINTERS , 
146+                     cfi :: TypeIdOptions :: NORMALIZE_INTEGERS , 
147+                     cfi :: TypeIdOptions :: USE_CONCRETE_SELF , 
151148                ] 
152149                . into_iter ( ) 
153150                . powerset ( ) 
154-                 . map ( TypeIdOptions :: from_iter) 
151+                 . map ( cfi :: TypeIdOptions :: from_iter) 
155152                { 
156-                     let  typeid = typeid_for_instance ( self . tcx ,  instance,  options) ; 
153+                     let  typeid = cfi :: typeid_for_instance ( self . tcx ,  instance,  options) ; 
157154                    if  typeids. insert ( typeid. clone ( ) )  { 
158155                        self . add_type_metadata ( llfn,  typeid) ; 
159156                    } 
160157                } 
161158            }  else  { 
162-                 for  options in 
163-                     [ TypeIdOptions :: GENERALIZE_POINTERS ,  TypeIdOptions :: NORMALIZE_INTEGERS ] 
164-                         . into_iter ( ) 
165-                         . powerset ( ) 
166-                         . map ( TypeIdOptions :: from_iter) 
159+                 for  options in  [ 
160+                     cfi:: TypeIdOptions :: GENERALIZE_POINTERS , 
161+                     cfi:: TypeIdOptions :: NORMALIZE_INTEGERS , 
162+                 ] 
163+                 . into_iter ( ) 
164+                 . powerset ( ) 
165+                 . map ( cfi:: TypeIdOptions :: from_iter) 
167166                { 
168-                     let  typeid = typeid_for_fnabi ( self . tcx ,  fn_abi,  options) ; 
167+                     let  typeid = cfi :: typeid_for_fnabi ( self . tcx ,  fn_abi,  options) ; 
169168                    self . add_type_metadata ( llfn,  typeid) ; 
170169                } 
171170            } 
172171        } 
173172
174173        if  self . tcx . sess . is_sanitizer_kcfi_enabled ( )  { 
175174            // LLVM KCFI does not support multiple !kcfi_type attachments 
176-             let  mut  options = TypeIdOptions :: empty ( ) ; 
175+             let  mut  options = kcfi :: TypeIdOptions :: empty ( ) ; 
177176            if  self . tcx . sess . is_sanitizer_cfi_generalize_pointers_enabled ( )  { 
178-                 options. insert ( TypeIdOptions :: GENERALIZE_POINTERS ) ; 
177+                 options. insert ( kcfi :: TypeIdOptions :: GENERALIZE_POINTERS ) ; 
179178            } 
180179            if  self . tcx . sess . is_sanitizer_cfi_normalize_integers_enabled ( )  { 
181-                 options. insert ( TypeIdOptions :: NORMALIZE_INTEGERS ) ; 
180+                 options. insert ( kcfi :: TypeIdOptions :: NORMALIZE_INTEGERS ) ; 
182181            } 
183182
184183            if  let  Some ( instance)  = instance { 
185-                 let  kcfi_typeid = kcfi_typeid_for_instance ( self . tcx ,  instance,  options) ; 
184+                 let  kcfi_typeid = kcfi :: typeid_for_instance ( self . tcx ,  instance,  options) ; 
186185                self . set_kcfi_type_metadata ( llfn,  kcfi_typeid) ; 
187186            }  else  { 
188-                 let  kcfi_typeid = kcfi_typeid_for_fnabi ( self . tcx ,  fn_abi,  options) ; 
187+                 let  kcfi_typeid = kcfi :: typeid_for_fnabi ( self . tcx ,  fn_abi,  options) ; 
189188                self . set_kcfi_type_metadata ( llfn,  kcfi_typeid) ; 
190189            } 
191190        } 
0 commit comments