Change the documented implicit value of -C instrument-coverage
to =yes
This commit is contained in:
parent
b77e0184a9
commit
9f287dd7b3
@ -590,7 +590,7 @@ macro_rules! tracked {
|
|||||||
tracked!(force_frame_pointers, Some(false));
|
tracked!(force_frame_pointers, Some(false));
|
||||||
tracked!(force_unwind_tables, Some(true));
|
tracked!(force_unwind_tables, Some(true));
|
||||||
tracked!(inline_threshold, Some(0xf007ba11));
|
tracked!(inline_threshold, Some(0xf007ba11));
|
||||||
tracked!(instrument_coverage, InstrumentCoverage::All);
|
tracked!(instrument_coverage, InstrumentCoverage::Yes);
|
||||||
tracked!(link_dead_code, Some(true));
|
tracked!(link_dead_code, Some(true));
|
||||||
tracked!(linker_plugin_lto, LinkerPluginLto::LinkerPluginAuto);
|
tracked!(linker_plugin_lto, LinkerPluginLto::LinkerPluginAuto);
|
||||||
tracked!(llvm_args, vec![String::from("1"), String::from("2")]);
|
tracked!(llvm_args, vec![String::from("1"), String::from("2")]);
|
||||||
|
@ -146,8 +146,10 @@ pub enum LtoCli {
|
|||||||
/// unless the function has type parameters.
|
/// unless the function has type parameters.
|
||||||
#[derive(Clone, Copy, PartialEq, Hash, Debug)]
|
#[derive(Clone, Copy, PartialEq, Hash, Debug)]
|
||||||
pub enum InstrumentCoverage {
|
pub enum InstrumentCoverage {
|
||||||
/// Default `-C instrument-coverage` or `-C instrument-coverage=statement`
|
/// `-C instrument-coverage=no` (or `off`, `false` etc.)
|
||||||
All,
|
No,
|
||||||
|
/// `-C instrument-coverage` or `-C instrument-coverage=yes`
|
||||||
|
Yes,
|
||||||
/// Additionally, instrument branches and output branch coverage.
|
/// Additionally, instrument branches and output branch coverage.
|
||||||
/// `-Zunstable-options -C instrument-coverage=branch`
|
/// `-Zunstable-options -C instrument-coverage=branch`
|
||||||
Branch,
|
Branch,
|
||||||
@ -155,8 +157,6 @@ pub enum InstrumentCoverage {
|
|||||||
ExceptUnusedGenerics,
|
ExceptUnusedGenerics,
|
||||||
/// `-Zunstable-options -C instrument-coverage=except-unused-functions`
|
/// `-Zunstable-options -C instrument-coverage=except-unused-functions`
|
||||||
ExceptUnusedFunctions,
|
ExceptUnusedFunctions,
|
||||||
/// `-C instrument-coverage=off` (or `no`, etc.)
|
|
||||||
Off,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Settings for `-Z instrument-xray` flag.
|
/// Settings for `-Z instrument-xray` flag.
|
||||||
@ -2722,7 +2722,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
|
|||||||
// This is what prevents them from being used on stable compilers.
|
// This is what prevents them from being used on stable compilers.
|
||||||
match cg.instrument_coverage {
|
match cg.instrument_coverage {
|
||||||
// Stable values:
|
// Stable values:
|
||||||
InstrumentCoverage::All | InstrumentCoverage::Off => {}
|
InstrumentCoverage::Yes | InstrumentCoverage::No => {}
|
||||||
// Unstable values:
|
// Unstable values:
|
||||||
InstrumentCoverage::Branch
|
InstrumentCoverage::Branch
|
||||||
| InstrumentCoverage::ExceptUnusedFunctions
|
| InstrumentCoverage::ExceptUnusedFunctions
|
||||||
@ -2736,7 +2736,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if cg.instrument_coverage != InstrumentCoverage::Off {
|
if cg.instrument_coverage != InstrumentCoverage::No {
|
||||||
if cg.profile_generate.enabled() || cg.profile_use.is_some() {
|
if cg.profile_generate.enabled() || cg.profile_use.is_some() {
|
||||||
early_dcx.early_fatal(
|
early_dcx.early_fatal(
|
||||||
"option `-C instrument-coverage` is not compatible with either `-C profile-use` \
|
"option `-C instrument-coverage` is not compatible with either `-C profile-use` \
|
||||||
|
@ -394,8 +394,7 @@ mod desc {
|
|||||||
pub const parse_linker_flavor: &str = ::rustc_target::spec::LinkerFlavorCli::one_of();
|
pub const parse_linker_flavor: &str = ::rustc_target::spec::LinkerFlavorCli::one_of();
|
||||||
pub const parse_optimization_fuel: &str = "crate=integer";
|
pub const parse_optimization_fuel: &str = "crate=integer";
|
||||||
pub const parse_dump_mono_stats: &str = "`markdown` (default) or `json`";
|
pub const parse_dump_mono_stats: &str = "`markdown` (default) or `json`";
|
||||||
pub const parse_instrument_coverage: &str =
|
pub const parse_instrument_coverage: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc) or (unstable) one of `branch`, `except-unused-generics`, `except-unused-functions`";
|
||||||
"`all` (default), `branch`, `except-unused-generics`, `except-unused-functions`, or `off`";
|
|
||||||
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_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_unpretty: &str = "`string` or `string=string`";
|
||||||
pub const parse_treat_err_as_bug: &str = "either no value or a non-negative number";
|
pub const parse_treat_err_as_bug: &str = "either no value or a non-negative number";
|
||||||
@ -918,18 +917,18 @@ pub(crate) fn parse_instrument_coverage(
|
|||||||
if v.is_some() {
|
if v.is_some() {
|
||||||
let mut bool_arg = false;
|
let mut bool_arg = false;
|
||||||
if parse_bool(&mut bool_arg, v) {
|
if parse_bool(&mut bool_arg, v) {
|
||||||
*slot = if bool_arg { InstrumentCoverage::All } else { InstrumentCoverage::Off };
|
*slot = if bool_arg { InstrumentCoverage::Yes } else { InstrumentCoverage::No };
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some(v) = v else {
|
let Some(v) = v else {
|
||||||
*slot = InstrumentCoverage::All;
|
*slot = InstrumentCoverage::Yes;
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
*slot = match v {
|
*slot = match v {
|
||||||
"all" => InstrumentCoverage::All,
|
"all" => InstrumentCoverage::Yes,
|
||||||
"branch" => InstrumentCoverage::Branch,
|
"branch" => InstrumentCoverage::Branch,
|
||||||
"except-unused-generics" | "except_unused_generics" => {
|
"except-unused-generics" | "except_unused_generics" => {
|
||||||
InstrumentCoverage::ExceptUnusedGenerics
|
InstrumentCoverage::ExceptUnusedGenerics
|
||||||
@ -937,7 +936,7 @@ pub(crate) fn parse_instrument_coverage(
|
|||||||
"except-unused-functions" | "except_unused_functions" => {
|
"except-unused-functions" | "except_unused_functions" => {
|
||||||
InstrumentCoverage::ExceptUnusedFunctions
|
InstrumentCoverage::ExceptUnusedFunctions
|
||||||
}
|
}
|
||||||
"off" | "no" | "n" | "false" | "0" => InstrumentCoverage::Off,
|
"0" => InstrumentCoverage::No,
|
||||||
_ => return false,
|
_ => return false,
|
||||||
};
|
};
|
||||||
true
|
true
|
||||||
@ -1444,15 +1443,15 @@ pub(crate) fn parse_function_return(slot: &mut FunctionReturn, v: Option<&str>)
|
|||||||
inline_threshold: Option<u32> = (None, parse_opt_number, [TRACKED],
|
inline_threshold: Option<u32> = (None, parse_opt_number, [TRACKED],
|
||||||
"set the threshold for inlining a function"),
|
"set the threshold for inlining a function"),
|
||||||
#[rustc_lint_opt_deny_field_access("use `Session::instrument_coverage` instead of this field")]
|
#[rustc_lint_opt_deny_field_access("use `Session::instrument_coverage` instead of this field")]
|
||||||
instrument_coverage: InstrumentCoverage = (InstrumentCoverage::Off, parse_instrument_coverage, [TRACKED],
|
instrument_coverage: InstrumentCoverage = (InstrumentCoverage::No, parse_instrument_coverage, [TRACKED],
|
||||||
"instrument the generated code to support LLVM source-based code coverage \
|
"instrument the generated code to support LLVM source-based code coverage \
|
||||||
reports (note, the compiler build config must include `profiler = true`); \
|
reports (note, the compiler build config must include `profiler = true`); \
|
||||||
implies `-C symbol-mangling-version=v0`. Optional values are:
|
implies `-C symbol-mangling-version=v0`. Optional values are:
|
||||||
`=all` (implicit value)
|
`=no` `=n` `=off` `=false` (default)
|
||||||
`=branch`
|
`=yes` `=y` `=on` `=true` (implicit value)
|
||||||
`=except-unused-generics`
|
`=branch` (unstable)
|
||||||
`=except-unused-functions`
|
`=except-unused-generics` (unstable)
|
||||||
`=off` (default)"),
|
`=except-unused-functions` (unstable)"),
|
||||||
link_arg: (/* redirected to link_args */) = ((), parse_string_push, [UNTRACKED],
|
link_arg: (/* redirected to link_args */) = ((), parse_string_push, [UNTRACKED],
|
||||||
"a single extra argument to append to the linker invocation (can be used several times)"),
|
"a single extra argument to append to the linker invocation (can be used several times)"),
|
||||||
link_args: Vec<String> = (Vec::new(), parse_list, [UNTRACKED],
|
link_args: Vec<String> = (Vec::new(), parse_list, [UNTRACKED],
|
||||||
|
@ -352,7 +352,7 @@ pub fn enable_internal_lints(&self) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn instrument_coverage(&self) -> bool {
|
pub fn instrument_coverage(&self) -> bool {
|
||||||
self.opts.cg.instrument_coverage() != InstrumentCoverage::Off
|
self.opts.cg.instrument_coverage() != InstrumentCoverage::No
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn instrument_coverage_branch(&self) -> bool {
|
pub fn instrument_coverage_branch(&self) -> bool {
|
||||||
|
@ -331,10 +331,29 @@ $ llvm-cov report \
|
|||||||
|
|
||||||
## `-C instrument-coverage=<options>`
|
## `-C instrument-coverage=<options>`
|
||||||
|
|
||||||
- `-C instrument-coverage=all`: Instrument all functions, including unused functions and unused generics. (This is the same as `-C instrument-coverage`, with no value.)
|
- `-C instrument-coverage=no` (or `n`/`off`/`false`):
|
||||||
- `-C instrument-coverage=off`: Do not instrument any functions. (This is the same as simply not including the `-C instrument-coverage` option.)
|
Don't enable coverage instrumentation. No functions will be instrumented for coverage.
|
||||||
- `-Zunstable-options -C instrument-coverage=except-unused-generics`: Instrument all functions except unused generics.
|
- This is the same as not using the `-C instrument-coverage` flag at all.
|
||||||
- `-Zunstable-options -C instrument-coverage=except-unused-functions`: Instrument only used (called) functions and instantiated generic functions.
|
- `-C instrument-coverage=yes` (or `y`/`on`/`true`):
|
||||||
|
Enable coverage instrumentation with the default behaviour.
|
||||||
|
Currently this instruments all functions, including unused functions and unused generics.
|
||||||
|
- This is the same as `-C instrument-coverage` with no value.
|
||||||
|
|
||||||
|
### Other values
|
||||||
|
|
||||||
|
- `-C instrument-coverage=all`:
|
||||||
|
Currently an alias for `yes`, but may behave differently in the future if
|
||||||
|
more fine-grained coverage options are added.
|
||||||
|
Using this value is currently not recommended.
|
||||||
|
|
||||||
|
### Unstable values
|
||||||
|
|
||||||
|
- `-Z unstable-options -C instrument-coverage=branch`:
|
||||||
|
Placeholder for potential branch coverage support in the future.
|
||||||
|
- `-Z unstable-options -C instrument-coverage=except-unused-generics`:
|
||||||
|
Instrument all functions except unused generics.
|
||||||
|
- `-Z unstable-options -C instrument-coverage=except-unused-functions`:
|
||||||
|
Instrument only used (called) functions and instantiated generic functions.
|
||||||
|
|
||||||
## Other references
|
## Other references
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
error: incorrect value `bad-value` for codegen option `instrument-coverage` - `all` (default), `branch`, `except-unused-generics`, `except-unused-functions`, or `off` was expected
|
error: incorrect value `bad-value` for codegen option `instrument-coverage` - either a boolean (`yes`, `no`, `on`, `off`, etc) or (unstable) one of `branch`, `except-unused-generics`, `except-unused-functions` was expected
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
error: incorrect value `` for codegen option `instrument-coverage` - `all` (default), `branch`, `except-unused-generics`, `except-unused-functions`, or `off` was expected
|
error: incorrect value `` for codegen option `instrument-coverage` - either a boolean (`yes`, `no`, `on`, `off`, etc) or (unstable) one of `branch`, `except-unused-generics`, `except-unused-functions` was expected
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user