Add UnwindingInlineAsm

This commit is contained in:
Ellis Hoag 2022-08-26 20:44:44 -07:00
parent 7277046d84
commit 7fc07caf67
2 changed files with 9 additions and 1 deletions

View File

@ -12,6 +12,7 @@
use crate::builder::Builder;
use crate::context::CodegenCx;
use crate::errors::UnwindingInlineAsm;
use crate::type_of::LayoutGccExt;
use crate::callee::get_fn;
@ -109,7 +110,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
fn codegen_inline_asm(&mut self, template: &[InlineAsmTemplatePiece], rust_operands: &[InlineAsmOperandRef<'tcx, Self>], options: InlineAsmOptions, span: &[Span], _instance: Instance<'_>, _dest_catch_funclet: Option<(Self::BasicBlock, Self::BasicBlock, Option<&Self::Funclet>)>) {
if options.contains(InlineAsmOptions::MAY_UNWIND) {
self.sess()
.struct_span_err(span[0], "GCC backend does not support unwinding from inline asm")
.create_err(UnwindingInlineAsm { span: span[0] })
.emit();
return;
}

View File

@ -13,3 +13,10 @@ pub(crate) struct LinkageConstOrMutType {
#[primary_span]
pub span: Span
}
#[derive(SessionDiagnostic)]
#[diag(codegen_gcc::unwinding_inline_asm)]
pub(crate) struct UnwindingInlineAsm {
#[primary_span]
pub span: Span
}