diff options
| author | zhuyunxing <zhuyunxing.zyx@alibaba-inc.com> | 2024-04-19 10:43:53 +0800 | 
|---|---|---|
| committer | zhuyunxing <zhuyunxing.zyx@alibaba-inc.com> | 2024-04-19 10:43:53 +0800 | 
| commit | 68f86381ee9a5af00a6071773d54c00f032fe385 (patch) | |
| tree | 1390c8e2a3421656537a1a69dbe1c89bf66d5766 /compiler/rustc_session/src/options.rs | |
| parent | e3181b091e88321f5ea149afed6db0edf0a4f37b (diff) | |
| download | rust-68f86381ee9a5af00a6071773d54c00f032fe385.tar.gz rust-68f86381ee9a5af00a6071773d54c00f032fe385.zip | |
coverage. Add coverage-options=mcdc as gate for MC/DC instrument
Diffstat (limited to 'compiler/rustc_session/src/options.rs')
| -rw-r--r-- | compiler/rustc_session/src/options.rs | 22 | 
1 files changed, 12 insertions, 10 deletions
| diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 6a2975263cf..1a0b02205d4 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -396,7 +396,7 @@ mod desc { pub const parse_optimization_fuel: &str = "crate=integer"; pub const parse_dump_mono_stats: &str = "`markdown` (default) or `json`"; pub const parse_instrument_coverage: &str = parse_bool; - pub const parse_coverage_options: &str = "`branch` or `no-branch`"; + pub const parse_coverage_options: &str = "either `no-branch`, `branch` or `mcdc`"; pub const parse_instrument_xray: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit`"; pub const parse_unpretty: &str = "`string` or `string=string`"; pub const parse_treat_err_as_bug: &str = "either no value or a non-negative number"; @@ -946,17 +946,19 @@ mod parse { let Some(v) = v else { return true }; for option in v.split(',') { - let (option, enabled) = match option.strip_prefix("no-") { - Some(without_no) => (without_no, false), - None => (option, true), - }; - let slot = match option { - "branch" => &mut slot.branch, + match option { + "no-branch" => { + slot.branch = false; + slot.mcdc = false; + } + "branch" => slot.branch = true, + "mcdc" => { + slot.branch = true; + slot.mcdc = true; + } _ => return false, - }; - *slot = enabled; + } } - true } | 
