Move comments to improve attachment

Summary:
Cosmetic changes to comments to improve the results of the Reason
comment attachment logic.

These were found using `git grep -nH -e 'in[ ]*(\*'` although the
attachment logic seems ok if the associated `let` is on the same line.

Some others were found with `git grep -nH -e ')[ ]*(\*'` although the
attachment logic seems ok if the associated `(` is on the same line.

Reviewed By: jvillard

Differential Revision: D3654027

fbshipit-source-id: 122aa3b
master
Josh Berdine 8 years ago committed by Facebook Github Bot 8
parent 32146523ca
commit fe780cb6ff

@ -278,7 +278,7 @@ let make_dangling_boxes pe allocated_nodes (sigma_lambda: (Sil.hpred * int) list
| Dotdangling(coo, e, color):: l' ->
if (IList.exists (Sil.exp_equal e) seen_exp) then filter_duplicate l' seen_exp
else Dotdangling(coo, e, color):: filter_duplicate l' (e:: seen_exp)
| box:: l' -> box:: filter_duplicate l' seen_exp in (* this case cannot happen*)
| box:: l' -> box:: filter_duplicate l' seen_exp (* this case cannot happen*) in
let rec subtract_allocated candidate_dangling =
match candidate_dangling with
| [] -> []
@ -423,7 +423,7 @@ let rec compute_target_struct_fields dotnodes list_fld p f lambda cycle =
| _ -> (* by construction there must be at most 2 nodes for an expression*)
L.out "@\n Too many nodes! Error! @\n@.@."; assert false)
| Sil.Estruct (_, _) -> [] (* inner struct are printed by print_struc function *)
| Sil.Earray _ -> [] in (* inner arrays are printed by print_array function *)
| Sil.Earray _ -> [] (* inner arrays are printed by print_array function *) in
match list_fld with
| [] -> []
| a:: list_fld' ->
@ -819,7 +819,8 @@ and pp_dotty f kind (_prop: Prop.normal Prop.t) cycle =
let cmap_norm = Propgraph.diff_get_colormap false diff in
let cmap_foot = Propgraph.diff_get_colormap true diff in
let pe = { (Prop.prop_update_obj_sub pe_text pre) with pe_cmap_norm = cmap_norm; pe_cmap_foot = cmap_foot } in
let pre_stack = fst (Prop.sigma_get_stack_nonstack true (Prop.get_sigma pre)) in (* add stack vars from pre *)
(* add stack vars from pre *)
let pre_stack = fst (Prop.sigma_get_stack_nonstack true (Prop.get_sigma pre)) in
let prop = Prop.replace_sigma (pre_stack @ Prop.get_sigma _prop) _prop in
pe, Prop.normalize prop
| _ ->
@ -1194,7 +1195,8 @@ let make_set_dangling_nodes allocated_nodes (sigma: Sil.hpred list) =
else e:: filter_duplicate l' (e:: seen_exp) in
let rhs_exp_list = IList.flatten (IList.map get_rhs_predicate sigma) in
let candidate_dangling_exps = filter_duplicate rhs_exp_list [] in
let dangling_exps = IList.filter is_not_allocated candidate_dangling_exps in (* get rid of allocated ones*)
(* get rid of allocated ones*)
let dangling_exps = IList.filter is_not_allocated candidate_dangling_exps in
IList.map make_new_dangling dangling_exps
(* return a list of pairs (n,field_lab) where n is a target node*)

@ -630,7 +630,7 @@ let report_context_leaks pname sigma tenv =
let leak_path =
match Prop.get_fld_typ_path_opt fld_exps context_exp reachable_hpreds with
| Some path -> path
| None -> assert false in (* a path must exist in order for a leak to be reported *)
| None -> assert false (* a path must exist in order for a leak to be reported *) in
let err_desc =
Errdesc.explain_context_leak pname (Typ.Tstruct struct_typ) fld_name leak_path in
let exn = Exceptions.Context_leak (err_desc, __POS__) in
@ -847,7 +847,7 @@ let initial_prop
let new_formals =
if add_formals
then IList.map construct_decl (Cfg.Procdesc.get_formals curr_f)
else [] in (* no new formals added *)
else [] (* no new formals added *) in
let prop1 =
Prop.prop_reset_inst
(fun inst_old -> Sil.update_inst inst_old Sil.inst_formal)

@ -121,7 +121,7 @@ let execute___set_array_length { Builtin.pdesc; prop_; path; ret_ids; args; }
let hpred' = Sil.Hpointsto (e, Sil.Earray (n_len, esel, inst), t) in
let prop' = Prop.replace_sigma (hpred':: sigma') prop in
[(Prop.normalize prop', path)]
| _ -> [])) (* by construction of prop_a this case is impossible *)
| _ -> [] (* by construction of prop_a this case is impossible *) ))
| _ -> raise (Exceptions.Wrong_argument_number __POS__)
let execute___print_value { Builtin.pdesc; prop_; path; args; }

@ -292,7 +292,8 @@ end = struct
let rec doit level session path prev_exn_opt = match path with
| Pstart _ -> f level path session prev_exn_opt
| Pnode (_, exn_opt, session', p, _, _) ->
let next_exn_opt = if prev_exn_opt <> None then None else exn_opt in (* no two consecutive exceptions *)
(* no two consecutive exceptions *)
let next_exn_opt = if prev_exn_opt <> None then None else exn_opt in
doit level (session' :> int) p next_exn_opt;
f level path session prev_exn_opt
| Pjoin (p1, p2, _) ->

@ -1868,7 +1868,8 @@ let rec hpred_imply tenv calc_index_frame calc_missing subs prop1 sigma2 hpred2
res
| Some iter1' ->
let elist2 = IList.map (fun e -> Sil.exp_sub (snd subs) e) _elist2 in
let subs' = exp_list_imply calc_missing subs (f2:: elist2) (f2:: elist2) in (* force instantiation of existentials *)
(* force instantiation of existentials *)
let subs' = exp_list_imply calc_missing subs (f2:: elist2) (f2:: elist2) in
let prop1' = Prop.prop_iter_remove_curr_then_to_prop iter1' in
let hpred1 = match Prop.prop_iter_current iter1' with
| hpred1, b ->
@ -1926,7 +1927,7 @@ let rec hpred_imply tenv calc_index_frame calc_missing subs prop1 sigma2 hpred2
let _, para_inst2 =
if Sil.exp_equal iF2 iB2 then
Sil.hpara_dll_instantiate para2 iF2 oB2 oF2 elist2
else assert false in (* Only base case of rhs list considered for now *)
else assert false (* Only base case of rhs list considered for now *) in
L.d_increase_indent 1;
let res =
decrease_indent_when_exception
@ -1936,7 +1937,10 @@ let rec hpred_imply tenv calc_index_frame calc_missing subs prop1 sigma2 hpred2
res
| Some iter1' -> (* Only consider implications between identical listsegs for now *)
let elist2 = IList.map (fun e -> Sil.exp_sub (snd subs) e) elist2 in
let subs' = exp_list_imply calc_missing subs (iF2:: oB2:: oF2:: iB2:: elist2) (iF2:: oB2:: oF2:: iB2:: elist2) in (* force instantiation of existentials *)
(* force instantiation of existentials *)
let subs' =
exp_list_imply calc_missing subs
(iF2:: oB2:: oF2:: iB2:: elist2) (iF2:: oB2:: oF2:: iB2:: elist2) in
let prop1' = Prop.prop_iter_remove_curr_then_to_prop iter1'
in (subs', prop1')
)

@ -581,7 +581,7 @@ let resolve_virtual_pname tenv prop actuals callee_pname call_flags : Procname.t
callee_pname :: call_flags.CallFlags.cf_targets
else
(* interface call--[called_pname] has no implementation), we don't want to consider *)
call_flags.CallFlags.cf_targets in (* interface call, don't want to consider *)
call_flags.CallFlags.cf_targets (* interface call, don't want to consider *) in
(* return true if (receiver typ of [target_pname]) <: [actual_receiver_typ] *)
let may_dispatch_to target_pname =
let target_receiver_typ = get_receiver_typ target_pname actual_receiver_typ in

@ -368,7 +368,7 @@ let check_path_errors_in_post caller_pname post post_path =
let current_path, _ = State.get_path () in
if Paths.Path.contains_position post_path path_pos
then post_path, Some path_pos
else current_path, None in (* position not found, only use the path up to the callee *)
else current_path, None (* position not found, only use the path up to the callee *) in
State.set_path new_path path_pos_opt;
let exn = Exceptions.Divide_by_zero (desc, __POS__) in
let pre_opt = State.get_normalized_pre (fun _ p -> p) (* Abs.abstract_no_symop *) in

@ -425,7 +425,7 @@ struct
let sizeof_typ =
match tp with
| Some tp -> CTypes_decl.type_ptr_to_sil_type tenv tp
| None -> typ in (* Some default type since the type is missing *)
| None -> typ (* Some default type since the type is missing *) in
{ empty_res_trans with
exps = [(Sil.Sizeof (sizeof_typ, None, Subtype.exact), sizeof_typ)] }
| k -> Printing.log_stats
@ -556,7 +556,7 @@ struct
let ms_opt = CMethod_trans.method_signature_of_pointer context.tenv decl_ptr in
let is_instance_method = match ms_opt with
| Some ms -> CMethod_signature.ms_is_instance ms
| _ -> true in (* might happen for methods that are not exported yet (some templates). *)
| _ -> true (* might happen for methods that are not exported yet (some templates). *) in
let is_cpp_virtual = match ms_opt with
| Some ms -> CMethod_signature.ms_is_cpp_virtual ms
| _ -> false in
@ -702,7 +702,7 @@ struct
let array_stmt, idx_stmt = (match stmt_list with
| [a; i] -> a, i (* Assumption: the statement list contains 2 elements,
the first is the array expr and the second the index *)
| _ -> assert false) in (* Let's get notified if the assumption is wrong...*)
| _ -> assert false (* Let's get notified if the assumption is wrong...*) ) in
let res_trans_a = instruction trans_state array_stmt in
let res_trans_idx = instruction trans_state idx_stmt in
let (a_exp, _) = extract_exp_from_list res_trans_a.exps
@ -2302,7 +2302,7 @@ struct
| [stmt], [attr] ->
(match stmt, attr with
| NullStmt _, FallThroughAttr _ -> nullStmt_trans trans_state.succ_nodes
| _ -> assert false) (* More cases to come. With the assert false we can find them *)
| _ -> assert false (* More cases to come. With the assert false we can find them *) )
| _ -> assert false (* Expect that this doesn't happen *)
and trans_into_undefined_expr trans_state expr_info =

@ -181,7 +181,7 @@ and get_struct_cpp_class_declaration_type tenv decl =
else [] in
let struct_annotations =
if csu = Csu.Class Csu.CPP then Typ.cpp_class_annotation
else Typ.item_annotation_empty in (* No annotations for structs *)
else Typ.item_annotation_empty (* No annotations for structs *) in
if is_complete_definition then (
Ast_utils.update_sil_types_map type_ptr (Typ.Tvar sil_typename);
let non_static_fields = get_struct_fields tenv decl in

@ -35,7 +35,8 @@ let translate_exceptions context exit_nodes get_body_nodes handler_table =
let ret_var = Cfg.Procdesc.get_ret_var procdesc in
let ret_type = Cfg.Procdesc.get_ret_type procdesc in
let id_ret_val = Ident.create_fresh Ident.knormal in
let id_exn_val = Ident.create_fresh Ident.knormal in (* this is removed in the true branches, and in the false branch of the last handler *)
(* this is removed in the true branches, and in the false branch of the last handler *)
let id_exn_val = Ident.create_fresh Ident.knormal in
let create_entry_node loc =
let instr_get_ret_val = Sil.Letderef (id_ret_val, Sil.Lvar ret_var, ret_type, loc) in
let id_deactivate = Ident.create_fresh Ident.knormal in

Loading…
Cancel
Save