Skip to content

Commit 65778ec

Browse files
author
Carolyn Zech
committed
Address PR comments
1 parent 61269de commit 65778ec

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
5 test_scan_fn_loops.csv
22
20 test_scan_functions.csv
33
5 test_scan_input_tys.csv
4-
16 test_scan_overall.csv
4+
17 test_scan_overall.csv
55
3 test_scan_recursion.csv
6+
9 test_scan_unsafe_distance.csv
67
6 test_scan_unsafe_ops.csv

tests/script-based-pre/tool-scanner/scanner-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ cargo run -p scanner test.rs --crate-type lib
1717
wc -l *csv
1818

1919
popd
20-
#rm -rf ${OUT_DIR}
20+
rm -rf ${OUT_DIR}

tests/script-based-pre/tool-scanner/test.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ pub fn generic<T: Default>() -> T {
1414
T::default()
1515
}
1616

17-
pub fn blah() {
18-
ok();
19-
assert_eq!(u8::default(), 0);
20-
}
21-
2217
pub struct RecursiveType {
2318
pub inner: Option<*const RecursiveType>,
2419
}
@@ -112,6 +107,7 @@ extern "C" {
112107
fn external_function();
113108
}
114109

110+
/// Ensure scanner finds unsafe calls to external functions.
115111
pub fn call_external() {
116112
unsafe { external_function() };
117113
}

tools/scanner/src/analysis.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright Kani Contributors
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

4-
//! Provide different static analysis to be performed in the crate under compilation
4+
//! Provide passes that perform intra-function analysis on the crate under compilation
55
66
use crate::info;
77
use csv::WriterBuilder;
@@ -253,11 +253,11 @@ macro_rules! fn_props {
253253
}
254254

255255
impl $name {
256-
pub const fn num_props() -> usize {
256+
$vis const fn num_props() -> usize {
257257
[$(stringify!($prop),)+].len()
258258
}
259259

260-
pub fn new(fn_name: String) -> Self {
260+
$vis fn new(fn_name: String) -> Self {
261261
Self { fn_name, $($prop: 0,)+}
262262
}
263263
}

tools/scanner/src/call_graph.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
// Copyright Kani Contributors
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

4-
//! Provide different static analysis to be performed in the call graph
4+
//! Provide passes that perform inter-function analysis on the crate under compilation.
5+
//!
6+
//! This module also includes a `CallGraph` structure to help the analysis.
7+
//! For now, we build the CallGraph as part of the pass, but as we add more analysis,
8+
//! the call-graph could be reused by different analysis.
59
610
use crate::analysis::{FnCallVisitor, FnUnsafeOperations, OverallStats};
711
use stable_mir::mir::{MirVisitor, Safety};

0 commit comments

Comments
 (0)