Merge pull request #17954 from paldepind/rust-data-flow-fix-inconsistencies

Rust: Fix data flow fix inconsistencies
This commit is contained in:
Simon Friis Vindum
2024-11-11 11:56:10 +01:00
committed by GitHub
111 changed files with 19 additions and 710 deletions

View File

@@ -14,6 +14,14 @@ class AstCfgNode extends CfgNode {
AstCfgNode() { node = this.getAstNode() }
}
/** A CFG node that corresponds to a parameter in the AST. */
class ParamCfgNode extends AstCfgNode {
override Param node;
/** Gets the underlying parameter. */
Param getParam() { result = node }
}
/** A CFG node that corresponds to an expression in the AST. */
class ExprCfgNode extends AstCfgNode {
override Expr node;

View File

@@ -64,7 +64,9 @@ final class NormalCall extends DataFlowCall, TNormalCall {
/** Gets the underlying call in the CFG, if any. */
override CallCfgNode asCall() { result = c }
override DataFlowCallable getEnclosingCallable() { none() }
override DataFlowCallable getEnclosingCallable() {
result = TCfgScope(c.getExpr().getEnclosingCallable())
}
override string toString() { result = c.toString() }
@@ -150,18 +152,18 @@ module Node {
* flow graph.
*/
final class ParameterNode extends Node, TParameterNode {
Param parameter;
ParamCfgNode parameter;
ParameterNode() { this = TParameterNode(parameter) }
override CfgScope getCfgScope() { result = parameter.getEnclosingCallable() }
override CfgScope getCfgScope() { result = parameter.getParam().getEnclosingCallable() }
override Location getLocation() { result = parameter.getLocation() }
override string toString() { result = parameter.toString() }
/** Gets the parameter in the AST that this node corresponds to. */
Param getParameter() { result = parameter }
Param getParameter() { result = parameter.getParam() }
}
final class ArgumentNode = NaNode;
@@ -198,7 +200,7 @@ module Node {
abstract DataFlowCall getCall();
}
final private class ExprOutNode extends OutNode {
final private class ExprOutNode extends ExprNode, OutNode {
ExprOutNode() { this.asExpr() instanceof CallExpr }
/** Gets the underlying call CFG node that includes this out node. */
@@ -230,7 +232,7 @@ final class Node = Node::Node;
module SsaFlow {
private module Impl = SsaImpl::DataFlowIntegration;
private Node::ParameterNode toParameterNode(Param p) { result = TParameterNode(p) }
private Node::ParameterNode toParameterNode(Param p) { result.getParameter() = p }
/** Converts a control flow node into an SSA control flow node. */
Impl::Node asNode(Node n) {
@@ -482,7 +484,7 @@ private module Cached {
cached
newtype TNode =
TExprNode(ExprCfgNode n) or
TParameterNode(Param p) or
TParameterNode(ParamCfgNode p) or
TSsaNode(SsaImpl::DataFlowIntegration::SsaNode node)
cached

View File

@@ -1,3 +0,0 @@
uniqueCallEnclosingCallable
| canonical_paths.rs:32:9:32:14 | CallExpr | Call should have one enclosing callable but has 0. |
| canonical_paths.rs:66:13:66:20 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_abi.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_arg_list.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_array_type.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_assoc_type_arg.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_attr.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_await_expr.rs:6:17:6:21 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_become_expr.rs:8:17:8:36 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,4 +0,0 @@
uniqueCallEnclosingCallable
| gen_break_expr.rs:6:12:6:22 | CallExpr | Call should have one enclosing callable but has 0. |
| gen_break_expr.rs:11:12:11:17 | CallExpr | Call should have one enclosing callable but has 0. |
| gen_break_expr.rs:16:12:16:17 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,5 +0,0 @@
uniqueCallEnclosingCallable
| gen_call_expr.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |
| gen_call_expr.rs:6:5:6:23 | CallExpr | Call should have one enclosing callable but has 0. |
| gen_call_expr.rs:7:5:7:14 | CallExpr | Call should have one enclosing callable but has 0. |
| gen_call_expr.rs:8:5:8:10 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_closure_binder.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| comments.rs:6:3:6:14 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_const.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_const_arg.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_const_param.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_continue_expr.rs:6:12:6:22 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_dyn_trait_type.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_enum.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,3 +0,0 @@
uniqueCallEnclosingCallable
| gen_expr_stmt.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |
| gen_expr_stmt.rs:6:5:6:12 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_extern_block.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_extern_crate.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_extern_item_list.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_fn_ptr_type.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_for_expr.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_for_type.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_format_args_arg.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_format_args_expr.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_generic_param_list.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_if_expr.rs:6:18:6:36 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_impl.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_impl_trait_type.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_infer_type.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_item_list.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_label.rs:6:18:6:39 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_let_else.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_let_expr.rs:6:18:6:24 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_let_stmt.rs:10:19:10:38 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_lifetime.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_lifetime_arg.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_lifetime_param.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_loop_expr.rs:6:18:6:40 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_macro_call.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_macro_def.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_macro_expr.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_macro_pat.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_macro_rules.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_macro_stmts.rs:5:14:5:28 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_macro_type.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_match_arm_list.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_match_guard.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_meta.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_name.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_name_ref.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_never_type.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_param.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_param_list.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_paren_expr.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_paren_pat.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_paren_type.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_path_segment.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_path_type.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_ptr_type.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_record_expr_field_list.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_record_field.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_record_field_list.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_record_pat_field_list.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_ref_type.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_rename.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_rest_pat.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_ret_type.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_return_type_syntax.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_self_param.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_slice_type.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_source_file.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_static.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_stmt_list.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_struct.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_token_tree.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueEnclosingCallable
| gen_trait.rs:7:32:7:60 | Param | Node should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_trait_alias.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_try_expr.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_tuple_field.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_tuple_field_list.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_tuple_type.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_type_alias.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_type_arg.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_type_bound.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_type_bound_list.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_type_param.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_union.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_use.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_use_tree.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_use_tree_list.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_variant.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_variant_list.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_visibility.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_where_clause.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

View File

@@ -1,2 +0,0 @@
uniqueCallEnclosingCallable
| gen_where_pred.rs:5:5:5:11 | CallExpr | Call should have one enclosing callable but has 0. |

Some files were not shown because too many files have changed in this diff Show More