mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
Rust: Add more missing CFG trees
This commit is contained in:
@@ -61,6 +61,10 @@ import CfgImpl
|
||||
/** Holds if `p` is a trivial pattern that is always guaranteed to match. */
|
||||
predicate trivialPat(Pat p) { p instanceof WildcardPat or p instanceof IdentPat }
|
||||
|
||||
class ArrayExprTree extends StandardPostOrderTree, ArrayExpr {
|
||||
override AstNode getChildNode(int i) { result = this.getExpr(i) }
|
||||
}
|
||||
|
||||
class AsmExprTree extends LeafTree instanceof AsmExpr { }
|
||||
|
||||
class AwaitExprTree extends StandardPostOrderTree instanceof AwaitExpr {
|
||||
@@ -392,6 +396,9 @@ class ForExprTree extends LoopingExprTree instanceof ForExpr {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: replace with expanded macro once the extractor supports it
|
||||
class MacroExprTree extends LeafTree, MacroExpr { }
|
||||
|
||||
class MatchArmTree extends ControlFlowTree instanceof MatchArm {
|
||||
override predicate propagatesAbnormal(AstNode child) { child = super.getExpr() }
|
||||
|
||||
@@ -452,6 +459,10 @@ class MethodCallExprTree extends StandardPostOrderTree instanceof MethodCallExpr
|
||||
}
|
||||
}
|
||||
|
||||
class NameTree extends LeafTree, Name { }
|
||||
|
||||
class NameRefTree extends LeafTree, NameRef { }
|
||||
|
||||
class OffsetOfExprTree extends LeafTree instanceof OffsetOfExpr { }
|
||||
|
||||
class ParenExprTree extends StandardPostOrderTree, ParenExpr {
|
||||
@@ -461,6 +472,18 @@ class ParenExprTree extends StandardPostOrderTree, ParenExpr {
|
||||
// This covers all patterns as they all extend `Pat`
|
||||
class PatExprTree extends LeafTree instanceof Pat { }
|
||||
|
||||
class PathTree extends StandardPostOrderTree, Path {
|
||||
override AstNode getChildNode(int i) {
|
||||
i = 0 and result = this.getQualifier()
|
||||
or
|
||||
i = 1 and result = this.getPart()
|
||||
}
|
||||
}
|
||||
|
||||
class PathSegmentTree extends StandardPostOrderTree, PathSegment {
|
||||
override AstNode getChildNode(int i) { i = 0 and result = this.getNameRef() }
|
||||
}
|
||||
|
||||
class PathExprTree extends LeafTree instanceof PathExpr { }
|
||||
|
||||
class PrefixExprTree extends StandardPostOrderTree instanceof PrefixExpr {
|
||||
@@ -499,6 +522,14 @@ class ReturnExprTree extends PostOrderTree instanceof ReturnExpr {
|
||||
}
|
||||
}
|
||||
|
||||
class StaticTree extends StandardPostOrderTree, Static {
|
||||
override AstNode getChildNode(int i) {
|
||||
i = 0 and result = this.getName()
|
||||
or
|
||||
i = 1 and result = this.getBody()
|
||||
}
|
||||
}
|
||||
|
||||
class TupleExprTree extends StandardPostOrderTree instanceof TupleExpr {
|
||||
override AstNode getChildNode(int i) { result = super.getField(i) }
|
||||
}
|
||||
@@ -507,6 +538,10 @@ class TypeRefTree extends LeafTree instanceof TypeRef { }
|
||||
|
||||
class UnderscoreExprTree extends LeafTree instanceof UnderscoreExpr { }
|
||||
|
||||
class UseTree_ extends StandardPreOrderTree, Use {
|
||||
override AstNode getChildNode(int i) { i = 0 and result = this.getUseTree().getPath() }
|
||||
}
|
||||
|
||||
// NOTE: `yield` is a reserved but unused keyword.
|
||||
class YieldExprTree extends StandardPostOrderTree instanceof YieldExpr {
|
||||
override AstNode getChildNode(int i) { i = 0 and result = super.getExpr() }
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_abi.rs:3:1:6:1 | test_abi |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_arg_list.rs:3:1:6:1 | test_arg_list |
|
||||
@@ -1,2 +0,0 @@
|
||||
deadEnd
|
||||
| gen_array_expr.rs:5:5:5:14 | ExprStmt |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_array_type.rs:3:1:6:1 | test_array_type |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_assoc_item_list.rs:3:1:6:1 | test_assoc_item_list |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_assoc_type_arg.rs:3:1:6:1 | test_assoc_type_arg |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_attr.rs:3:1:6:1 | test_attr |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_closure_binder.rs:3:1:6:1 | test_closure_binder |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_const.rs:3:1:6:1 | test_const |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_const_arg.rs:3:1:6:1 | test_const_arg |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_const_param.rs:3:1:6:1 | test_const_param |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_dyn_trait_type.rs:3:1:6:1 | test_dyn_trait_type |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_enum.rs:3:1:6:1 | test_enum |
|
||||
@@ -1,2 +0,0 @@
|
||||
deadEnd
|
||||
| gen_expr_stmt.rs:6:5:6:12 | CallExpr |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_extern_block.rs:3:1:6:1 | test_extern_block |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_extern_crate.rs:3:1:6:1 | test_extern_crate |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_extern_item_list.rs:3:1:6:1 | test_extern_item_list |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_fn_ptr_type.rs:3:1:6:1 | test_fn_ptr_type |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_for_expr.rs:3:1:6:1 | test_for_expr |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_for_type.rs:3:1:6:1 | test_for_type |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_format_args_arg.rs:3:1:6:1 | test_format_args_arg |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_format_args_expr.rs:3:1:6:1 | test_format_args_expr |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_generic_param_list.rs:3:1:6:1 | test_generic_param_list |
|
||||
@@ -1,2 +0,0 @@
|
||||
deadEnd
|
||||
| gen_if_expr.rs:6:9:6:38 | ExprStmt |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_impl.rs:3:1:6:1 | test_impl |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_impl_trait_type.rs:3:1:6:1 | test_impl_trait_type |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_infer_type.rs:3:1:6:1 | test_infer_type |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_item_list.rs:3:1:6:1 | test_item_list |
|
||||
@@ -1,2 +0,0 @@
|
||||
deadEnd
|
||||
| gen_label.rs:6:9:6:41 | ExprStmt |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_let_else.rs:3:1:6:1 | test_let_else |
|
||||
@@ -1,2 +0,0 @@
|
||||
deadEnd
|
||||
| gen_let_expr.rs:6:9:6:26 | ExprStmt |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_lifetime.rs:3:1:6:1 | test_lifetime |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_lifetime_arg.rs:3:1:6:1 | test_lifetime_arg |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_lifetime_param.rs:3:1:6:1 | test_lifetime_param |
|
||||
@@ -1,2 +0,0 @@
|
||||
deadEnd
|
||||
| gen_loop_expr.rs:6:9:6:42 | ExprStmt |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_macro_call.rs:3:1:6:1 | test_macro_call |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_macro_def.rs:3:1:6:1 | test_macro_def |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_macro_expr.rs:3:1:6:1 | test_macro_expr |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_macro_pat.rs:3:1:6:1 | test_macro_pat |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_macro_rules.rs:3:1:6:1 | test_macro_rules |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_macro_type.rs:3:1:6:1 | test_macro_type |
|
||||
@@ -1,2 +0,0 @@
|
||||
deadEnd
|
||||
| gen_match_arm.rs:10:20:10:25 | ... != ... |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_match_arm_list.rs:3:1:6:1 | test_match_arm_list |
|
||||
@@ -1,2 +0,0 @@
|
||||
deadEnd
|
||||
| gen_match_expr.rs:10:20:10:25 | ... != ... |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_match_guard.rs:3:1:6:1 | test_match_guard |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_meta.rs:3:1:6:1 | test_meta |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_name.rs:3:1:6:1 | test_name |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_name_ref.rs:3:1:6:1 | test_name_ref |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_never_type.rs:3:1:6:1 | test_never_type |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_param.rs:3:1:6:1 | test_param |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_param_list.rs:3:1:6:1 | test_param_list |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_paren_expr.rs:3:1:6:1 | test_paren_expr |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_paren_pat.rs:3:1:6:1 | test_paren_pat |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_paren_type.rs:3:1:6:1 | test_paren_type |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_path_segment.rs:3:1:6:1 | test_path_segment |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_path_type.rs:3:1:6:1 | test_path_type |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_ptr_type.rs:3:1:6:1 | test_ptr_type |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_record_expr_field_list.rs:3:1:6:1 | test_record_expr_field_list |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_record_field.rs:3:1:6:1 | test_record_field |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_record_field_list.rs:3:1:6:1 | test_record_field_list |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_record_pat_field_list.rs:3:1:6:1 | test_record_pat_field_list |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_ref_type.rs:3:1:6:1 | test_ref_type |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_rename.rs:3:1:6:1 | test_rename |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_rest_pat.rs:3:1:6:1 | test_rest_pat |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_ret_type.rs:3:1:6:1 | test_ret_type |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_return_type_syntax.rs:3:1:6:1 | test_return_type_syntax |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_self_param.rs:3:1:6:1 | test_self_param |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_slice_type.rs:3:1:6:1 | test_slice_type |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_source_file.rs:3:1:6:1 | test_source_file |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_static.rs:3:1:6:1 | test_static |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_stmt_list.rs:3:1:6:1 | test_stmt_list |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_struct.rs:3:1:6:1 | test_struct |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_token_tree.rs:3:1:6:1 | test_token_tree |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_trait.rs:3:1:6:1 | test_trait |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_trait_alias.rs:3:1:6:1 | test_trait_alias |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_try_expr.rs:3:1:6:1 | test_try_expr |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_tuple_field.rs:3:1:6:1 | test_tuple_field |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_tuple_field_list.rs:3:1:6:1 | test_tuple_field_list |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_tuple_type.rs:3:1:6:1 | test_tuple_type |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_type_alias.rs:3:1:6:1 | test_type_alias |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_type_arg.rs:3:1:6:1 | test_type_arg |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_type_bound.rs:3:1:6:1 | test_type_bound |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_type_bound_list.rs:3:1:6:1 | test_type_bound_list |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_type_param.rs:3:1:6:1 | test_type_param |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_union.rs:3:1:6:1 | test_union |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_use.rs:3:1:6:1 | test_use |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_use_tree.rs:3:1:6:1 | test_use_tree |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_use_tree_list.rs:3:1:6:1 | test_use_tree_list |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_variant.rs:3:1:6:1 | test_variant |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_variant_list.rs:3:1:6:1 | test_variant_list |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_visibility.rs:3:1:6:1 | test_visibility |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_where_clause.rs:3:1:6:1 | test_where_clause |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_where_pred.rs:3:1:6:1 | test_where_pred |
|
||||
@@ -1,2 +0,0 @@
|
||||
scopeNoFirst
|
||||
| gen_while_expr.rs:3:1:6:1 | test_while_expr |
|
||||
@@ -1,4 +0,0 @@
|
||||
deadEnd
|
||||
| variables.rs:2:5:2:22 | ExprStmt |
|
||||
| variables.rs:6:5:6:22 | ExprStmt |
|
||||
| variables.rs:310:5:310:42 | LetStmt |
|
||||
@@ -1,4 +0,0 @@
|
||||
deadEnd
|
||||
| error.rs:2:5:2:32 | ExprStmt |
|
||||
| my_macro.rs:16:9:16:19 | ExprStmt |
|
||||
| my_struct.rs:17:9:17:34 | ExprStmt |
|
||||
@@ -1,8 +0,0 @@
|
||||
deadEnd
|
||||
| main.rs:14:2:14:23 | ExprStmt |
|
||||
| main.rs:38:2:38:23 | ExprStmt |
|
||||
| main.rs:93:2:93:44 | ExprStmt |
|
||||
| main.rs:107:2:107:20 | LetStmt |
|
||||
| main.rs:151:2:151:53 | ExprStmt |
|
||||
scopeNoFirst
|
||||
| main.rs:125:1:133:1 | statics |
|
||||
Reference in New Issue
Block a user