@@ -16,7 +16,7 @@ use rustc_codegen_ssa::back::write::{BitcodeSection, CodegenContext, EmitObj, Mo
16
16
use rustc_codegen_ssa:: traits:: * ;
17
17
use rustc_codegen_ssa:: { CompiledModule , ModuleCodegen } ;
18
18
use rustc_data_structures:: small_c_str:: SmallCStr ;
19
- use rustc_errors:: { FatalError , Handler } ;
19
+ use rustc_errors:: { FatalError , Handler , Level } ;
20
20
use rustc_fs_util:: { link_or_copy, path_to_c_string} ;
21
21
use rustc_hir:: def_id:: LOCAL_CRATE ;
22
22
use rustc_middle:: bug;
@@ -242,6 +242,7 @@ impl<'a> Drop for DiagnosticHandlers<'a> {
242
242
fn report_inline_asm (
243
243
cgcx : & CodegenContext < LlvmCodegenBackend > ,
244
244
msg : String ,
245
+ level : llvm:: DiagnosticLevel ,
245
246
mut cookie : c_uint ,
246
247
source : Option < ( String , Vec < InnerSpan > ) > ,
247
248
) {
@@ -251,7 +252,12 @@ fn report_inline_asm(
251
252
if matches ! ( cgcx. lto, Lto :: Fat | Lto :: Thin ) {
252
253
cookie = 0 ;
253
254
}
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) ;
255
261
}
256
262
257
263
unsafe 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
264
270
// diagnostics.
265
271
let mut have_source = false ;
266
272
let mut buffer = String :: new ( ) ;
273
+ let mut level = llvm:: DiagnosticLevel :: Error ;
267
274
let mut loc = 0 ;
268
275
let mut ranges = [ 0 ; 8 ] ;
269
276
let mut num_ranges = ranges. len ( ) / 2 ;
@@ -273,6 +280,7 @@ unsafe extern "C" fn inline_asm_handler(diag: &SMDiagnostic, user: *const c_void
273
280
diag,
274
281
msg,
275
282
buffer,
283
+ & mut level,
276
284
& mut loc,
277
285
ranges. as_mut_ptr ( ) ,
278
286
& mut num_ranges,
@@ -290,7 +298,7 @@ unsafe extern "C" fn inline_asm_handler(diag: &SMDiagnostic, user: *const c_void
290
298
( buffer, spans)
291
299
} ) ;
292
300
293
- report_inline_asm ( cgcx, msg, cookie, source) ;
301
+ report_inline_asm ( cgcx, msg, level , cookie, source) ;
294
302
}
295
303
296
304
unsafe 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
301
309
302
310
match llvm:: diagnostic:: Diagnostic :: unpack ( info) {
303
311
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
+ ) ;
305
319
}
306
320
307
321
llvm:: diagnostic:: Optimization ( opt) => {
0 commit comments