about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorkhyperia <github@khyperia.com>2020-10-06 15:39:12 +0200
committerkhyperia <github@khyperia.com>2020-10-06 15:39:12 +0200
commitc5bc95676bf2063c54b3f010fc713d95b4e4dd68 (patch)
tree48612cce4283f9feddc67ad61e6e120776e13789 /compiler/rustc_codegen_ssa/src
parent5849a7eca90582ee59b67eb09548a2aa424d7f52 (diff)
downloadrust-c5bc95676bf2063c54b3f010fc713d95b4e4dd68.tar.gz
rust-c5bc95676bf2063c54b3f010fc713d95b4e4dd68.zip
Let backends access span information
Sometimes, a backend may need to emit warnings, errors, or otherwise
need to know the span of the current item in a basic block. So, add a
set_span method to give the backend that information.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/debuginfo.rs1
-rw-r--r--compiler/rustc_codegen_ssa/src/traits/builder.rs2
2 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
index d8a530d98fa..26a646b0293 100644
--- a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
@@ -55,6 +55,7 @@ impl<D> DebugScope<D> {
 impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
     pub fn set_debug_loc(&self, bx: &mut Bx, source_info: mir::SourceInfo) {
         let (scope, span) = self.debug_loc(source_info);
+        bx.set_span(span);
         if let Some(scope) = scope {
             bx.set_source_location(scope, span);
         }
diff --git a/compiler/rustc_codegen_ssa/src/traits/builder.rs b/compiler/rustc_codegen_ssa/src/traits/builder.rs
index b35b0f24208..0b8289a8dd9 100644
--- a/compiler/rustc_codegen_ssa/src/traits/builder.rs
+++ b/compiler/rustc_codegen_ssa/src/traits/builder.rs
@@ -15,6 +15,7 @@ use crate::MemFlags;
 
 use rustc_middle::ty::layout::{HasParamEnv, TyAndLayout};
 use rustc_middle::ty::Ty;
+use rustc_span::Span;
 use rustc_target::abi::{Abi, Align, Scalar, Size};
 use rustc_target::spec::HasTargetSpec;
 
@@ -44,6 +45,7 @@ pub trait BuilderMethods<'a, 'tcx>:
     fn build_sibling_block(&self, name: &str) -> Self;
     fn cx(&self) -> &Self::CodegenCx;
     fn llbb(&self) -> Self::BasicBlock;
+    fn set_span(&self, span: Span);
 
     fn position_at_end(&mut self, llbb: Self::BasicBlock);
     fn ret_void(&mut self);