Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize find_debug_info #2912

Merged
merged 4 commits into from
Dec 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions kani-compiler/src/codegen_cprover_gotoc/codegen/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

use crate::codegen_cprover_gotoc::GotocCtx;
use cbmc::goto_program::Location;
use rustc_middle::mir::{Local, VarDebugInfo, VarDebugInfoContents};
use rustc_middle::mir::{Local, VarDebugInfoContents};
use rustc_smir::rustc_internal;
use rustc_span::Span;
use stable_mir::mir::VarDebugInfo;

impl<'tcx> GotocCtx<'tcx> {
pub fn codegen_span(&self, sp: &Span) -> Location {
Expand Down Expand Up @@ -43,10 +44,12 @@ impl<'tcx> GotocCtx<'tcx> {
sp.map_or(Location::none(), |x| self.codegen_span(&x))
}

pub fn find_debug_info(&self, l: &Local) -> Option<&VarDebugInfo<'tcx>> {
self.current_fn().mir().var_debug_info.iter().find(|info| match info.value {
VarDebugInfoContents::Place(p) => p.local == *l && p.projection.len() == 0,
VarDebugInfoContents::Const(_) => false,
})
pub fn find_debug_info(&self, l: &Local) -> Option<VarDebugInfo> {
rustc_internal::stable(self.current_fn().mir().var_debug_info.iter().find(|info| {
celinval marked this conversation as resolved.
Show resolved Hide resolved
match info.value {
VarDebugInfoContents::Place(p) => p.local == *l && p.projection.len() == 0,
VarDebugInfoContents::Const(_) => false,
}
}))
}
}
Loading