Skip to content

Commit

Permalink
updating RAP_LOG
Browse files Browse the repository at this point in the history
  • Loading branch information
hxuhack committed Dec 26, 2024
1 parent 4bd9d55 commit 929a578
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
12 changes: 6 additions & 6 deletions rap/src/analysis/core/alias/mop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ pub mod mop;
pub mod types;

use crate::analysis::core::alias::FnMap;
use crate::rap_debug;
use crate::utils::source::*;
use crate::{rap_debug, rap_trace};
use graph::MopGraph;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::fx::FxHashSet;
Expand All @@ -28,6 +28,7 @@ impl<'tcx> MopAlias<'tcx> {
}

pub fn start(&mut self) -> &FnMap {
rap_debug!("Start alias analysis via MoP.");
for local_def_id in self.tcx.iter_local_def_id() {
let hir_map = self.tcx.hir();
if hir_map.maybe_body_owned_by(local_def_id).is_some() {
Expand All @@ -38,16 +39,15 @@ impl<'tcx> MopAlias<'tcx> {
for (fn_id, fn_alias) in &self.fn_map {
let fn_name = get_fn_name(self.tcx, *fn_id);
if fn_alias.len() > 0 {
rap_debug!("{:?},{:?}", fn_name, fn_id);
rap_debug!("{}", fn_alias);
rap_debug!("Alias found in {:?}: {}", fn_name, fn_alias);
}
}
&self.fn_map
}

pub fn query_mop(&mut self, def_id: DefId) {
let fn_name = get_fn_name(self.tcx, def_id);
rap_debug!("query_mop: {:?}", fn_name);
rap_trace!("query_mop: {:?}", fn_name);
/* filter const mir */
if let Some(_other) = self.tcx.hir().body_const_context(def_id.expect_local()) {
return;
Expand All @@ -59,10 +59,10 @@ impl<'tcx> MopAlias<'tcx> {
let mut recursion_set = FxHashSet::default();
mop_graph.check(0, &mut self.fn_map, &mut recursion_set);
if mop_graph.visit_times > VISIT_LIMIT {
rap_debug!("Over visited: {:?}", def_id);
rap_trace!("Over visited: {:?}", def_id);
}
} else {
rap_debug!("mir is not available at {}", self.tcx.def_path_str(def_id));
rap_trace!("mir is not available at {}", self.tcx.def_path_str(def_id));
}
}
}
6 changes: 1 addition & 5 deletions rap/src/analysis/core/heap_item/type_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ impl<'tcx, 'a> TypeAnalysis<'tcx, 'a> {
EarlyBinder::skip_binder(ref_type_analysis.tcx().type_of(*elem.0))
);
let owning = format!("{:?}", elem.1);
rap_debug!(
"{} {}",
name.color(Color::Orange1),
owning.color(Color::Yellow3a)
);
rap_debug!("ADT analysis: {} {}", name, owning);
}
}

Expand Down
2 changes: 1 addition & 1 deletion rap/src/bin/cargo-rap/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Arguments {

let args: Vec<_> = env::args().collect();
let path = env::current_exe().expect("Current executable path invalid.");
rap_debug!("Current exe: {path:?}\tReceived args: {args:?}");
rap_trace!("Current exe: {path:?}\tReceived args: {args:?}");
let [args_group1, args_group2] = split_args_by_double_dash(&args);

Arguments {
Expand Down
2 changes: 1 addition & 1 deletion rap/src/bin/cargo-rap/cargo_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn cargo_check(dir: &Utf8Path) {
let cargo_rap_path = args::current_exe_path();
cmd.env("RUSTC_WRAPPER", cargo_rap_path);

rap_debug!("Command is: {:?}.", cmd);
rap_trace!("Command is: {:?}.", cmd);

let mut child = cmd.spawn().expect("Could not run cargo check.");
match child
Expand Down
2 changes: 1 addition & 1 deletion rap/src/bin/cargo-rap/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn find_rap() -> PathBuf {
}

pub fn run_cmd(mut cmd: Command) {
rap_debug!("Command is: {:?}.", cmd);
rap_trace!("Command is: {:?}.", cmd);
match cmd.status() {
Ok(status) => {
if !status.success() {
Expand Down

0 comments on commit 929a578

Please sign in to comment.