Skip to content

Commit

Permalink
Fix the missing recursion, add main functions to test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
JustusAdam committed Jul 27, 2024
1 parent bf56f94 commit 4fa243f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
24 changes: 15 additions & 9 deletions crates/flowistry_pdg_construction/src/body_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,22 @@ struct DumpingVisitor<'tcx> {
}

impl<'tcx> intravisit::Visitor<'tcx> for DumpingVisitor<'tcx> {
type NestedFilter = VisitFilter;
type NestedFilter = OnlyBodies;
fn nested_visit_map(&mut self) -> Self::Map {
self.tcx.hir()
}

fn visit_fn(
&mut self,
_: intravisit::FnKind<'tcx>,
_: &'tcx rustc_hir::FnDecl<'tcx>,
_: rustc_hir::BodyId,
function_kind: intravisit::FnKind<'tcx>,
function_declaration: &'tcx rustc_hir::FnDecl<'tcx>,
body_id: rustc_hir::BodyId,
_: rustc_span::Span,
id: rustc_hir::def_id::LocalDefId,
local_def_id: rustc_hir::def_id::LocalDefId,
) {
let mut body_with_facts = rustc_borrowck::consumers::get_body_with_borrowck_facts(
let body_with_facts = rustc_borrowck::consumers::get_body_with_borrowck_facts(
self.tcx,
id,
local_def_id,
ConsumerOptions::PoloniusInputFacts,
);

Expand All @@ -139,7 +139,7 @@ impl<'tcx> intravisit::Visitor<'tcx> for DumpingVisitor<'tcx> {
let dir = intermediate_out_dir(self.tcx);
let path = dir.join(
self.tcx
.def_path(id.to_def_id())
.def_path(local_def_id.to_def_id())
.to_filename_friendly_no_crate(),
);

Expand All @@ -152,7 +152,13 @@ impl<'tcx> intravisit::Visitor<'tcx> for DumpingVisitor<'tcx> {
to_write.encode(&mut encoder);
encoder.finish();

println!("Wrote bwbf data for function {id:?} to {}", path.display());
intravisit::walk_fn(
self,
function_kind,
function_declaration,
body_id,
local_def_id,
)
}
}

Expand Down
2 changes: 2 additions & 0 deletions crates/paralegal-flow/tests/boxes/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,5 @@ fn box_ref_mut() {
**inp += modifier();
sink(src);
}

fn main() {}
2 changes: 2 additions & 0 deletions crates/paralegal-flow/tests/marker-tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ struct MarkedZST;
fn typed_input_zst(w: MarkedZST) {
consume_any(w)
}

fn main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,5 @@ fn no_inlining_overtaint() {
send_user_data(&ud1);
send2_user_data(&ud2);
}

fn main() {}

0 comments on commit 4fa243f

Please sign in to comment.