Preserve DebugInfo in DeadStoreElimination.
This commit is contained in:
parent
1bc0463b18
commit
27d6a57e58
30 changed files with 773 additions and 807 deletions
20
compiler/rustc_mir_dataflow/src/debuginfo.rs
Normal file
20
compiler/rustc_mir_dataflow/src/debuginfo.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
use rustc_index::bit_set::BitSet;
|
||||
use rustc_middle::mir::visit::*;
|
||||
use rustc_middle::mir::*;
|
||||
|
||||
/// Return the set of locals that appear in debuginfo.
|
||||
pub fn debuginfo_locals(body: &Body<'_>) -> BitSet<Local> {
|
||||
let mut visitor = DebuginfoLocals(BitSet::new_empty(body.local_decls.len()));
|
||||
for debuginfo in body.var_debug_info.iter() {
|
||||
visitor.visit_var_debug_info(debuginfo);
|
||||
}
|
||||
visitor.0
|
||||
}
|
||||
|
||||
struct DebuginfoLocals(BitSet<Local>);
|
||||
|
||||
impl Visitor<'_> for DebuginfoLocals {
|
||||
fn visit_local(&mut self, local: Local, _: PlaceContext, _: Location) {
|
||||
self.0.insert(local);
|
||||
}
|
||||
}
|
|
@ -35,6 +35,7 @@ pub use self::framework::{
|
|||
|
||||
use self::move_paths::MoveData;
|
||||
|
||||
pub mod debuginfo;
|
||||
pub mod drop_flag_effects;
|
||||
pub mod elaborate_drops;
|
||||
mod errors;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue