Skip to content

Commit 9e35fca

Browse files
committed
allow filtering by crate in the backend
1 parent 093fc6b commit 9e35fca

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

kani-compiler/src/kani_middle/codegen_units.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ impl CodegenUnits {
9090
let (chosen, skipped) = automatic_harness_partition(
9191
tcx,
9292
args,
93+
&crate_info.name,
9394
*kani_fns.get(&KaniModel::Any.into()).unwrap(),
9495
);
9596
AUTOHARNESS_MD
@@ -360,6 +361,7 @@ fn get_all_automatic_harnesses(
360361
fn automatic_harness_partition(
361362
tcx: TyCtxt,
362363
args: &Arguments,
364+
crate_name: &str,
363365
kani_any_def: FnDef,
364366
) -> (Vec<Instance>, BTreeMap<String, AutoHarnessSkipReason>) {
365367
// If `filter_list` contains `name`, either as an exact match or a substring.
@@ -384,7 +386,8 @@ fn automatic_harness_partition(
384386
return Some(AutoHarnessSkipReason::NoBody);
385387
}
386388

387-
let name = instance.name();
389+
// Preprend the crate name so that users can filter out entire crates using the existing function filter flags.
390+
let name = format!("{crate_name}::{}", instance.name());
388391
let body = instance.body().unwrap();
389392

390393
if is_proof_harness(tcx, instance)

tests/script-based-pre/cargo_autoharness_include/include.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# Copyright Kani Contributors
33
# SPDX-License-Identifier: Apache-2.0 OR MIT
44

5-
cargo kani autoharness -Z autoharness --include-pattern include
5+
cargo kani autoharness -Z autoharness --include-pattern cargo_autoharness_include::include

0 commit comments

Comments
 (0)