forked from model-checking/kani
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the clap
derive
API for the command line arguments of `kani-com…
…piler` (model-checking#2689)
- Loading branch information
1 parent
8c37721
commit 093697e
Showing
14 changed files
with
152 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
use strum_macros::{AsRefStr, EnumString, EnumVariantNames}; | ||
use tracing_subscriber::filter::Directive; | ||
|
||
#[derive(Debug, Default, Clone, Copy, AsRefStr, EnumString, EnumVariantNames, PartialEq, Eq)] | ||
#[strum(serialize_all = "snake_case")] | ||
pub enum ReachabilityType { | ||
/// Start the cross-crate reachability analysis from all harnesses in the local crate. | ||
Harnesses, | ||
/// Don't perform any reachability analysis. This will skip codegen for this crate. | ||
#[default] | ||
None, | ||
/// Start the cross-crate reachability analysis from all public functions in the local crate. | ||
PubFns, | ||
/// Start the cross-crate reachability analysis from all *test* (i.e. `#[test]`) harnesses in the local crate. | ||
Tests, | ||
} | ||
|
||
/// Command line arguments that this instance of the compiler run was called | ||
/// with. Usually stored in and accessible via [`crate::kani_queries::QueryDb`]. | ||
#[derive(Debug, Default, Clone, clap::Parser)] | ||
pub struct Arguments { | ||
/// Option name used to enable assertion reachability checks. | ||
#[clap(long = "assertion-reach-checks")] | ||
pub check_assertion_reachability: bool, | ||
/// Option name used to enable coverage checks. | ||
#[clap(long = "coverage-checks")] | ||
pub check_coverage: bool, | ||
/// Option name used to dump function pointer restrictions. | ||
#[clap(long = "restrict-vtable-fn-ptrs")] | ||
pub emit_vtable_restrictions: bool, | ||
/// Option name used to use json pretty-print for output files. | ||
#[clap(long = "pretty-json-files")] | ||
pub output_pretty_json: bool, | ||
/// Option used for suppressing global ASM error. | ||
#[clap(long)] | ||
pub ignore_global_asm: bool, | ||
#[clap(long)] | ||
/// Option used to write JSON symbol tables instead of GOTO binaries. | ||
/// | ||
/// When set, instructs the compiler to produce the symbol table for CBMC in JSON format and use symtab2gb. | ||
pub write_json_symtab: bool, | ||
/// Option name used to select which reachability analysis to perform. | ||
#[clap(long = "reachability", default_value = "none")] | ||
pub reachability_analysis: ReachabilityType, | ||
#[clap(long = "enable-stubbing")] | ||
pub stubbing_enabled: bool, | ||
/// Option name used to define unstable features. | ||
#[clap(short = 'Z', long = "unstable")] | ||
pub unstable_features: Vec<String>, | ||
#[clap(long)] | ||
/// Option used for building standard library. | ||
/// | ||
/// Flag that indicates that we are currently building the standard library. | ||
/// Note that `kani` library will not be available if this is `true`. | ||
pub build_std: bool, | ||
#[clap(long)] | ||
/// Option name used to set log level. | ||
pub log_level: Option<Directive>, | ||
#[clap(long)] | ||
/// Option name used to set the log output to a json file. | ||
pub json_output: bool, | ||
#[clap(long, conflicts_with = "json_output")] | ||
/// Option name used to force logger to use color output. This doesn't work with --json-output. | ||
pub color_output: bool, | ||
#[clap(long)] | ||
/// Pass the kani version to the compiler to ensure cache coherence. | ||
check_version: Option<String>, | ||
#[clap(long)] | ||
/// A legacy flag that is now ignored. | ||
goto_c: bool, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.