Skip to content

Commit

Permalink
analyze: replace some debug prints with log macros
Browse files Browse the repository at this point in the history
  • Loading branch information
spernsteiner committed Jun 25, 2024
1 parent 6c3e7af commit 8aa58bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions c2rust-analyze/src/rewrite/expr/mir_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::pointee_type::PointeeTypes;
use crate::pointer_id::{PointerId, PointerTable};
use crate::type_desc::{self, Ownership, Quantity, TypeDesc};
use crate::util::{self, ty_callee, Callee};
use log::trace;
use rustc_ast::Mutability;
use rustc_middle::mir::{
BasicBlock, Body, BorrowKind, Location, Operand, Place, PlaceElem, PlaceRef, Rvalue, Statement,
Expand Down Expand Up @@ -990,15 +991,15 @@ where
(self.emit)(RewriteKind::OptionUnwrap);
from.option = false;
} else if from.option && to.option {
eprintln!("try_build_cast_desc_desc: emit OptionMapBegin");
trace!("try_build_cast_desc_desc: emit OptionMapBegin");
if from.own != to.own {
eprintln!(" own differs: {:?} != {:?}", from.own, to.own);
trace!(" own differs: {:?} != {:?}", from.own, to.own);
}
if from.qty != to.qty {
eprintln!(" qty differs: {:?} != {:?}", from.qty, to.qty);
trace!(" qty differs: {:?} != {:?}", from.qty, to.qty);
}
if from.pointee_ty != to.pointee_ty {
eprintln!(
trace!(
" pointee_ty differs: {:?} != {:?}",
from.pointee_ty, to.pointee_ty
);
Expand Down
6 changes: 3 additions & 3 deletions c2rust-analyze/src/rewrite/expr/unlower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ fn filter_term(term: &mir::Terminator) -> bool {
}

fn build_span_index(mir: &Body<'_>) -> SpanIndex<Location> {
eprintln!("building span index for {:?}:", mir.source);
debug!("building span index for {:?}:", mir.source);
let mut span_index_items = Vec::new();
for (bb, bb_data) in mir.basic_blocks().iter_enumerated() {
for (i, stmt) in bb_data.statements.iter().enumerate() {
Expand All @@ -906,7 +906,7 @@ fn build_span_index(mir: &Body<'_>) -> SpanIndex<Location> {
block: bb,
statement_index: i,
};
eprintln!(" {:?}: {:?}", loc, stmt.source_info.span);
debug!(" {:?}: {:?}", loc, stmt.source_info.span);
span_index_items.push((stmt.source_info.span, loc));
}

Expand All @@ -916,7 +916,7 @@ fn build_span_index(mir: &Body<'_>) -> SpanIndex<Location> {
block: bb,
statement_index: bb_data.statements.len(),
};
eprintln!(" {:?}: {:?}", loc, term.source_info.span);
debug!(" {:?}: {:?}", loc, term.source_info.span);
span_index_items.push((term.source_info.span, loc));
}
}
Expand Down

0 comments on commit 8aa58bf

Please sign in to comment.