@@ -61,7 +61,7 @@ struct LtoData {
61
61
tmp_path : TempDir ,
62
62
}
63
63
64
- fn prepare_lto ( cgcx : & CodegenContext < GccCodegenBackend > , diag_handler : & DiagCtxt ) -> Result < LtoData , FatalError > {
64
+ fn prepare_lto ( cgcx : & CodegenContext < GccCodegenBackend > , dcx : & DiagCtxt ) -> Result < LtoData , FatalError > {
65
65
let export_threshold = match cgcx. lto {
66
66
// We're just doing LTO for our one crate
67
67
Lto :: ThinLocal => SymbolExportLevel :: Rust ,
@@ -106,18 +106,18 @@ fn prepare_lto(cgcx: &CodegenContext<GccCodegenBackend>, diag_handler: &DiagCtxt
106
106
// Make sure we actually can run LTO
107
107
for crate_type in cgcx. crate_types . iter ( ) {
108
108
if !crate_type_allows_lto ( * crate_type) {
109
- diag_handler . emit_err ( LtoDisallowed ) ;
109
+ dcx . emit_err ( LtoDisallowed ) ;
110
110
return Err ( FatalError ) ;
111
111
} else if * crate_type == CrateType :: Dylib {
112
112
if !cgcx. opts . unstable_opts . dylib_lto {
113
- diag_handler . emit_err ( LtoDylib ) ;
113
+ dcx . emit_err ( LtoDylib ) ;
114
114
return Err ( FatalError ) ;
115
115
}
116
116
}
117
117
}
118
118
119
119
if cgcx. opts . cg . prefer_dynamic && !cgcx. opts . unstable_opts . dylib_lto {
120
- diag_handler . emit_err ( DynamicLinkingWithLTO ) ;
120
+ dcx . emit_err ( DynamicLinkingWithLTO ) ;
121
121
return Err ( FatalError ) ;
122
122
}
123
123
@@ -154,7 +154,7 @@ fn prepare_lto(cgcx: &CodegenContext<GccCodegenBackend>, diag_handler: &DiagCtxt
154
154
upstream_modules. push ( ( module, CString :: new ( name) . unwrap ( ) ) ) ;
155
155
}
156
156
Err ( e) => {
157
- diag_handler . emit_err ( e) ;
157
+ dcx . emit_err ( e) ;
158
158
return Err ( FatalError ) ;
159
159
}
160
160
}
@@ -183,16 +183,16 @@ pub(crate) fn run_fat(
183
183
modules : Vec < FatLtoInput < GccCodegenBackend > > ,
184
184
cached_modules : Vec < ( SerializedModule < ModuleBuffer > , WorkProduct ) > ,
185
185
) -> Result < LtoModuleCodegen < GccCodegenBackend > , FatalError > {
186
- let diag_handler = cgcx. create_dcx ( ) ;
187
- let lto_data = prepare_lto ( cgcx, & diag_handler ) ?;
186
+ let dcx = cgcx. create_dcx ( ) ;
187
+ let lto_data = prepare_lto ( cgcx, & dcx ) ?;
188
188
/*let symbols_below_threshold =
189
189
lto_data.symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();*/
190
- fat_lto ( cgcx, & diag_handler , modules, cached_modules, lto_data. upstream_modules , lto_data. tmp_path ,
190
+ fat_lto ( cgcx, & dcx , modules, cached_modules, lto_data. upstream_modules , lto_data. tmp_path ,
191
191
//&symbols_below_threshold,
192
192
)
193
193
}
194
194
195
- fn fat_lto ( cgcx : & CodegenContext < GccCodegenBackend > , _diag_handler : & DiagCtxt , modules : Vec < FatLtoInput < GccCodegenBackend > > , cached_modules : Vec < ( SerializedModule < ModuleBuffer > , WorkProduct ) > , mut serialized_modules : Vec < ( SerializedModule < ModuleBuffer > , CString ) > , tmp_path : TempDir ,
195
+ fn fat_lto ( cgcx : & CodegenContext < GccCodegenBackend > , _dcx : & DiagCtxt , modules : Vec < FatLtoInput < GccCodegenBackend > > , cached_modules : Vec < ( SerializedModule < ModuleBuffer > , WorkProduct ) > , mut serialized_modules : Vec < ( SerializedModule < ModuleBuffer > , CString ) > , tmp_path : TempDir ,
196
196
//symbols_below_threshold: &[*const libc::c_char],
197
197
) -> Result < LtoModuleCodegen < GccCodegenBackend > , FatalError > {
198
198
let _timer = cgcx. prof . generic_activity ( "GCC_fat_lto_build_monolithic_module" ) ;
@@ -257,7 +257,7 @@ fn fat_lto(cgcx: &CodegenContext<GccCodegenBackend>, _diag_handler: &DiagCtxt, m
257
257
let (buffer, name) = serialized_modules.remove(0);
258
258
info!("no in-memory regular modules to choose from, parsing {:?}", name);
259
259
ModuleCodegen {
260
- module_llvm: GccContext::parse(cgcx, &name, buffer.data(), diag_handler )?,
260
+ module_llvm: GccContext::parse(cgcx, &name, buffer.data(), dcx )?,
261
261
name: name.into_string().unwrap(),
262
262
kind: ModuleKind::Regular,
263
263
}*/
0 commit comments