@ -795,70 +795,6 @@ let has_modify_in_block_attr procdesc pvar =
List . exists ~ f : pvar_local_matches ( get_locals procdesc )
List . exists ~ f : pvar_local_matches ( get_locals procdesc )
let is_connected proc_desc =
let is_exit_node n = match Node . get_kind n with Node . Exit_node -> true | _ -> false in
let is_between_join_and_exit_node n =
match Node . get_kind n with
| Node . Stmt_node ( BetweenJoinAndExit | Destruction _ ) -> (
match Node . get_succs n with [ n' ] when is_exit_node n' -> true | _ -> false )
| _ ->
false
in
let rec is_consecutive_join_nodes n visited =
match Node . get_kind n with
| Node . Join_node -> (
if NodeSet . mem n visited then false
else
let succs = Node . get_succs n in
match succs with
| [ n' ] ->
is_consecutive_join_nodes n' ( NodeSet . add n visited )
| _ ->
false )
| _ ->
is_between_join_and_exit_node n
in
let find_broken_node n =
let succs = Node . get_succs n in
let preds = Node . get_preds n in
match Node . get_kind n with
| Node . Start_node ->
if List . is_empty succs | | not ( List . is_empty preds ) then Error ` Other else Ok ()
| Node . Exit_node ->
if ( not ( List . is_empty succs ) ) | | List . is_empty preds then Error ` Other else Ok ()
| Node . Stmt_node _ | Node . Prune_node _ | Node . Skip_node _ ->
if List . is_empty succs | | List . is_empty preds then Error ` Other else Ok ()
| Node . Join_node ->
(* Join node has the exception that it may be without predecessors
and pointing to between_join_and_exit which points to an exit node .
This happens when the if branches end with a return .
Nested if statements , where all branches have return statements ,
introduce a sequence of join nodes * )
if
( List . is_empty preds && not ( is_consecutive_join_nodes n NodeSet . empty ) )
| | ( ( not ( List . is_empty preds ) ) && List . is_empty succs )
then Error ` Join
else Ok ()
in
(* unconnected nodes generated by Join nodes are expected *)
let skip_join_errors current_status node =
match find_broken_node node with
| Ok () ->
Ok current_status
| Error ` Join ->
Ok ( Some ` Join )
| Error _ as other_error ->
other_error
in
match List . fold_result ( get_nodes proc_desc ) ~ init : None ~ f : skip_join_errors with
| Ok ( Some ` Join ) ->
Error ` Join
| Ok None ->
Ok ()
| Error _ as error ->
error
module SQLite = SqliteUtils . MarshalledNullableDataNOTForComparison ( struct
module SQLite = SqliteUtils . MarshalledNullableDataNOTForComparison ( struct
type nonrec t = t
type nonrec t = t
end )
end )