fix filter to support &
and |
This commit is contained in:
parent
b4d71ea6f8
commit
681f54f795
1 changed files with 19 additions and 6 deletions
|
@ -57,9 +57,19 @@ pub enum PassWhere {
|
||||||
/// where `<filter>` takes the following forms:
|
/// where `<filter>` takes the following forms:
|
||||||
///
|
///
|
||||||
/// - `all` -- dump MIR for all fns, all passes, all everything
|
/// - `all` -- dump MIR for all fns, all passes, all everything
|
||||||
/// - `substring1&substring2,...` -- `&`-separated list of substrings
|
/// - a filter defined by a set of substrings combined with `&` and `|`
|
||||||
/// that can appear in the pass-name or the `item_path_str` for the given
|
/// (`&` has higher precedence). At least one of the `|`-separated groups
|
||||||
/// node-id. If any one of the substrings match, the data is dumped out.
|
/// must match; an `|`-separated group matches if all of its `&`-separated
|
||||||
|
/// substrings are matched.
|
||||||
|
///
|
||||||
|
/// Example:
|
||||||
|
///
|
||||||
|
/// - `nll` == match if `nll` appears in the name
|
||||||
|
/// - `foo & nll` == match if `foo` and `nll` both appear in the name
|
||||||
|
/// - `foo & nll | typeck` == match if `foo` and `nll` both appear in the name
|
||||||
|
/// or `typeck` appears in the name.
|
||||||
|
/// - `foo & nll | bar & typeck` == match if `foo` and `nll` both appear in the name
|
||||||
|
/// or `typeck` and `bar` both appear in the name.
|
||||||
pub fn dump_mir<'a, 'gcx, 'tcx, F>(
|
pub fn dump_mir<'a, 'gcx, 'tcx, F>(
|
||||||
tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
||||||
pass_num: Option<&Display>,
|
pass_num: Option<&Display>,
|
||||||
|
@ -104,8 +114,10 @@ pub fn dump_enabled<'a, 'gcx, 'tcx>(
|
||||||
// see notes on #41697 below
|
// see notes on #41697 below
|
||||||
tcx.item_path_str(source.def_id)
|
tcx.item_path_str(source.def_id)
|
||||||
});
|
});
|
||||||
filters.split("&").any(|filter| {
|
filters.split("|").any(|or_filter| {
|
||||||
filter == "all" || pass_name.contains(filter) || node_path.contains(filter)
|
or_filter.split("&").all(|and_filter| {
|
||||||
|
and_filter == "all" || pass_name.contains(and_filter) || node_path.contains(and_filter)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +369,8 @@ fn write_extra<'cx, 'gcx, 'tcx, F>(
|
||||||
write: &mut Write,
|
write: &mut Write,
|
||||||
mut visit_op: F,
|
mut visit_op: F,
|
||||||
) -> io::Result<()>
|
) -> io::Result<()>
|
||||||
where F: FnMut(&mut ExtraComments<'cx, 'gcx, 'tcx>)
|
where
|
||||||
|
F: FnMut(&mut ExtraComments<'cx, 'gcx, 'tcx>),
|
||||||
{
|
{
|
||||||
let mut extra_comments = ExtraComments {
|
let mut extra_comments = ExtraComments {
|
||||||
_tcx: tcx,
|
_tcx: tcx,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue