Rust: fix CFG for MacroPat

This commit is contained in:
Arthur Baars
2025-06-02 15:36:05 +02:00
parent 943dd8e70c
commit ae0c547e89
4 changed files with 4 additions and 32 deletions

View File

@@ -143,6 +143,8 @@ class LetStmtTree extends PreOrderTree, LetStmt {
}
class MacroCallTree extends StandardPostOrderTree, MacroCall {
MacroCallTree() { not this.getParentNode() instanceof MacroPat }
override AstNode getChildNode(int i) { i = 0 and result = this.getMacroCallExpansion() }
}

View File

@@ -675,20 +675,11 @@ dominates
| test.rs:453:5:458:5 | enter fn or_pattern_3 | test.rs:455:13:455:25 | 2 |
| test.rs:453:5:458:5 | enter fn or_pattern_3 | test.rs:455:13:455:25 | [match(false)] 1 \| 2 |
| test.rs:453:5:458:5 | enter fn or_pattern_3 | test.rs:455:13:455:25 | [match(true)] 1 \| 2 |
| test.rs:453:5:458:5 | enter fn or_pattern_3 | test.rs:455:13:455:25 | one_or_two!... |
| test.rs:453:5:458:5 | enter fn or_pattern_3 | test.rs:455:30:455:30 | 3 |
| test.rs:453:5:458:5 | enter fn or_pattern_3 | test.rs:456:13:456:13 | _ |
| test.rs:454:9:457:9 | match a { ... } | test.rs:454:9:457:9 | match a { ... } |
| test.rs:455:13:455:25 | 2 | test.rs:455:13:455:25 | 2 |
| test.rs:455:13:455:25 | 2 | test.rs:455:13:455:25 | [match(false)] 1 \| 2 |
| test.rs:455:13:455:25 | 2 | test.rs:456:13:456:13 | _ |
| test.rs:455:13:455:25 | [match(false)] 1 \| 2 | test.rs:455:13:455:25 | [match(false)] 1 \| 2 |
| test.rs:455:13:455:25 | [match(false)] 1 \| 2 | test.rs:456:13:456:13 | _ |
| test.rs:455:13:455:25 | [match(true)] 1 \| 2 | test.rs:455:13:455:25 | [match(true)] 1 \| 2 |
| test.rs:455:13:455:25 | [match(true)] 1 \| 2 | test.rs:455:30:455:30 | 3 |
| test.rs:455:13:455:25 | one_or_two!... | test.rs:455:13:455:25 | one_or_two!... |
| test.rs:455:30:455:30 | 3 | test.rs:455:30:455:30 | 3 |
| test.rs:456:13:456:13 | _ | test.rs:456:13:456:13 | _ |
| test.rs:460:5:465:5 | enter fn irrefutable_pattern_and_dead_code | test.rs:460:5:465:5 | enter fn irrefutable_pattern_and_dead_code |
| test.rs:460:5:465:5 | enter fn irrefutable_pattern_and_dead_code | test.rs:461:9:464:9 | match pair { ... } |
| test.rs:460:5:465:5 | enter fn irrefutable_pattern_and_dead_code | test.rs:462:32:462:32 | _ |
@@ -1356,16 +1347,9 @@ postDominance
| test.rs:454:9:457:9 | match a { ... } | test.rs:455:13:455:25 | 2 |
| test.rs:454:9:457:9 | match a { ... } | test.rs:455:13:455:25 | [match(false)] 1 \| 2 |
| test.rs:454:9:457:9 | match a { ... } | test.rs:455:13:455:25 | [match(true)] 1 \| 2 |
| test.rs:454:9:457:9 | match a { ... } | test.rs:455:30:455:30 | 3 |
| test.rs:454:9:457:9 | match a { ... } | test.rs:456:13:456:13 | _ |
| test.rs:455:13:455:25 | 2 | test.rs:455:13:455:25 | 2 |
| test.rs:455:13:455:25 | [match(false)] 1 \| 2 | test.rs:455:13:455:25 | [match(false)] 1 \| 2 |
| test.rs:455:13:455:25 | [match(true)] 1 \| 2 | test.rs:455:13:455:25 | [match(true)] 1 \| 2 |
| test.rs:455:13:455:25 | one_or_two!... | test.rs:455:13:455:25 | one_or_two!... |
| test.rs:455:30:455:30 | 3 | test.rs:455:13:455:25 | [match(true)] 1 \| 2 |
| test.rs:455:30:455:30 | 3 | test.rs:455:30:455:30 | 3 |
| test.rs:456:13:456:13 | _ | test.rs:455:13:455:25 | [match(false)] 1 \| 2 |
| test.rs:456:13:456:13 | _ | test.rs:456:13:456:13 | _ |
| test.rs:460:5:465:5 | enter fn irrefutable_pattern_and_dead_code | test.rs:460:5:465:5 | enter fn irrefutable_pattern_and_dead_code |
| test.rs:461:9:464:9 | match pair { ... } | test.rs:460:5:465:5 | enter fn irrefutable_pattern_and_dead_code |
| test.rs:461:9:464:9 | match pair { ... } | test.rs:461:9:464:9 | match pair { ... } |
@@ -1673,9 +1657,6 @@ immediateDominator
| test.rs:455:13:455:25 | 2 | test.rs:453:5:458:5 | enter fn or_pattern_3 |
| test.rs:455:13:455:25 | [match(false)] 1 \| 2 | test.rs:455:13:455:25 | 2 |
| test.rs:455:13:455:25 | [match(true)] 1 \| 2 | test.rs:453:5:458:5 | enter fn or_pattern_3 |
| test.rs:455:13:455:25 | one_or_two!... | test.rs:453:5:458:5 | enter fn or_pattern_3 |
| test.rs:455:30:455:30 | 3 | test.rs:455:13:455:25 | [match(true)] 1 \| 2 |
| test.rs:456:13:456:13 | _ | test.rs:455:13:455:25 | [match(false)] 1 \| 2 |
| test.rs:461:9:464:9 | match pair { ... } | test.rs:460:5:465:5 | enter fn irrefutable_pattern_and_dead_code |
| test.rs:462:32:462:32 | _ | test.rs:460:5:465:5 | enter fn irrefutable_pattern_and_dead_code |
| test.rs:463:13:463:13 | _ | test.rs:460:5:465:5 | enter fn irrefutable_pattern_and_dead_code |
@@ -2204,12 +2185,10 @@ joinBlockPredecessor
| test.rs:443:13:443:36 | ... \| ... | test.rs:443:26:443:36 | Some(...) | 1 |
| test.rs:443:26:443:36 | Some(...) | test.rs:443:13:443:22 | Some(...) | 1 |
| test.rs:443:26:443:36 | Some(...) | test.rs:443:18:443:21 | true | 0 |
| test.rs:454:9:457:9 | match a { ... } | test.rs:455:30:455:30 | 3 | 0 |
| test.rs:454:9:457:9 | match a { ... } | test.rs:456:13:456:13 | _ | 1 |
| test.rs:454:9:457:9 | match a { ... } | test.rs:455:13:455:25 | [match(false)] 1 \| 2 | 0 |
| test.rs:454:9:457:9 | match a { ... } | test.rs:455:13:455:25 | [match(true)] 1 \| 2 | 1 |
| test.rs:455:13:455:25 | [match(true)] 1 \| 2 | test.rs:453:5:458:5 | enter fn or_pattern_3 | 1 |
| test.rs:455:13:455:25 | [match(true)] 1 \| 2 | test.rs:455:13:455:25 | 2 | 0 |
| test.rs:455:13:455:25 | one_or_two!... | test.rs:455:13:455:25 | [match(false)] 1 \| 2 | 0 |
| test.rs:455:13:455:25 | one_or_two!... | test.rs:455:13:455:25 | [match(true)] 1 \| 2 | 1 |
| test.rs:461:9:464:9 | match pair { ... } | test.rs:462:32:462:32 | _ | 0 |
| test.rs:461:9:464:9 | match pair { ... } | test.rs:463:13:463:13 | _ | 1 |
| test.rs:476:9:480:9 | match e { ... } | test.rs:477:32:477:32 | _ | 0 |

View File

@@ -1,7 +0,0 @@
deadEnd
| test.rs:455:13:455:25 | one_or_two!... |
multipleSuccessors
| test.rs:455:13:455:25 | [match(false)] 1 \| 2 | no-match | test.rs:455:13:455:25 | one_or_two!... |
| test.rs:455:13:455:25 | [match(false)] 1 \| 2 | no-match | test.rs:456:13:456:13 | _ |
| test.rs:455:13:455:25 | [match(true)] 1 \| 2 | match | test.rs:455:13:455:25 | one_or_two!... |
| test.rs:455:13:455:25 | [match(true)] 1 \| 2 | match | test.rs:455:30:455:30 | 3 |

View File

@@ -1129,9 +1129,7 @@ edges
| test.rs:455:13:455:25 | 2 | test.rs:455:13:455:25 | [match(false)] 1 \| 2 | no-match |
| test.rs:455:13:455:25 | 2 | test.rs:455:13:455:25 | [match(true)] 1 \| 2 | match |
| test.rs:455:13:455:25 | MacroPat | test.rs:455:13:455:25 | 1 | match |
| test.rs:455:13:455:25 | [match(false)] 1 \| 2 | test.rs:455:13:455:25 | one_or_two!... | no-match |
| test.rs:455:13:455:25 | [match(false)] 1 \| 2 | test.rs:456:13:456:13 | _ | no-match |
| test.rs:455:13:455:25 | [match(true)] 1 \| 2 | test.rs:455:13:455:25 | one_or_two!... | match |
| test.rs:455:13:455:25 | [match(true)] 1 \| 2 | test.rs:455:30:455:30 | 3 | match |
| test.rs:455:30:455:30 | 3 | test.rs:454:9:457:9 | match a { ... } | |
| test.rs:456:13:456:13 | _ | test.rs:456:18:456:18 | 4 | match |