@@ -16,7 +16,7 @@ use rustc_codegen_ssa::back::write::{BitcodeSection, CodegenContext, EmitObj, Mo
1616use rustc_codegen_ssa:: traits:: * ;
1717use rustc_codegen_ssa:: { CompiledModule , ModuleCodegen } ;
1818use rustc_data_structures:: small_c_str:: SmallCStr ;
19- use rustc_errors:: { FatalError , Handler } ;
19+ use rustc_errors:: { FatalError , Handler , Level } ;
2020use rustc_fs_util:: { link_or_copy, path_to_c_string} ;
2121use rustc_hir:: def_id:: LOCAL_CRATE ;
2222use rustc_middle:: bug;
@@ -242,6 +242,7 @@ impl<'a> Drop for DiagnosticHandlers<'a> {
242242fn report_inline_asm (
243243 cgcx : & CodegenContext < LlvmCodegenBackend > ,
244244 msg : String ,
245+ level : llvm:: DiagnosticLevel ,
245246 mut cookie : c_uint ,
246247 source : Option < ( String , Vec < InnerSpan > ) > ,
247248) {
@@ -251,7 +252,12 @@ fn report_inline_asm(
251252 if matches ! ( cgcx. lto, Lto :: Fat | Lto :: Thin ) {
252253 cookie = 0 ;
253254 }
254- cgcx. diag_emitter . inline_asm_error ( cookie as u32 , msg, source) ;
255+ let level = match level {
256+ llvm:: DiagnosticLevel :: Error => Level :: Error ,
257+ llvm:: DiagnosticLevel :: Warning => Level :: Warning ,
258+ llvm:: DiagnosticLevel :: Note | llvm:: DiagnosticLevel :: Remark => Level :: Note ,
259+ } ;
260+ cgcx. diag_emitter . inline_asm_error ( cookie as u32 , msg, level, source) ;
255261}
256262
257263unsafe extern "C" fn inline_asm_handler ( diag : & SMDiagnostic , user : * const c_void , cookie : c_uint ) {
@@ -264,6 +270,7 @@ unsafe extern "C" fn inline_asm_handler(diag: &SMDiagnostic, user: *const c_void
264270 // diagnostics.
265271 let mut have_source = false ;
266272 let mut buffer = String :: new ( ) ;
273+ let mut level = llvm:: DiagnosticLevel :: Error ;
267274 let mut loc = 0 ;
268275 let mut ranges = [ 0 ; 8 ] ;
269276 let mut num_ranges = ranges. len ( ) / 2 ;
@@ -273,6 +280,7 @@ unsafe extern "C" fn inline_asm_handler(diag: &SMDiagnostic, user: *const c_void
273280 diag,
274281 msg,
275282 buffer,
283+ & mut level,
276284 & mut loc,
277285 ranges. as_mut_ptr ( ) ,
278286 & mut num_ranges,
@@ -290,7 +298,7 @@ unsafe extern "C" fn inline_asm_handler(diag: &SMDiagnostic, user: *const c_void
290298 ( buffer, spans)
291299 } ) ;
292300
293- report_inline_asm ( cgcx, msg, cookie, source) ;
301+ report_inline_asm ( cgcx, msg, level , cookie, source) ;
294302}
295303
296304unsafe extern "C" fn diagnostic_handler ( info : & DiagnosticInfo , user : * mut c_void ) {
@@ -301,7 +309,13 @@ unsafe extern "C" fn diagnostic_handler(info: &DiagnosticInfo, user: *mut c_void
301309
302310 match llvm:: diagnostic:: Diagnostic :: unpack ( info) {
303311 llvm:: diagnostic:: InlineAsm ( inline) => {
304- report_inline_asm ( cgcx, llvm:: twine_to_string ( inline. message ) , inline. cookie , None ) ;
312+ report_inline_asm (
313+ cgcx,
314+ llvm:: twine_to_string ( inline. message ) ,
315+ inline. level ,
316+ inline. cookie ,
317+ None ,
318+ ) ;
305319 }
306320
307321 llvm:: diagnostic:: Optimization ( opt) => {
0 commit comments