Project

General

Profile

Revision b08ffca7 src/backends/C/c_backend_common.ml

View differences:

src/backends/C/c_backend_common.ml
24 24
 
25 25
(* Generation of a non-clashing name for the self memory variable (for step and reset functions) *)
26 26
let mk_self m =
27
  mk_new_name (m.mstep.step_inputs@m.mstep.step_outputs@m.mstep.step_locals@m.mmemory) "self"
27
  let used name =
28
       (List.exists (fun v -> v.var_id = name) m.mstep.step_inputs)
29
    || (List.exists (fun v -> v.var_id = name) m.mstep.step_outputs)
30
    || (List.exists (fun v -> v.var_id = name) m.mstep.step_locals)
31
    || (List.exists (fun v -> v.var_id = name) m.mmemory) in
32
  mk_new_name used "self"
28 33

  
29 34
(* Generation of a non-clashing name for the instance variable of static allocation macro *)
30 35
let mk_instance m =
31
  mk_new_name (m.mstep.step_inputs@m.mmemory) "inst"
36
  let used name =
37
       (List.exists (fun v -> v.var_id = name) m.mstep.step_inputs)
38
    || (List.exists (fun v -> v.var_id = name) m.mmemory) in
39
  mk_new_name used "inst"
32 40

  
33 41
(* Generation of a non-clashing name for the attribute variable of static allocation macro *)
34 42
let mk_attribute m =
35
  mk_new_name (m.mstep.step_inputs@m.mmemory) "attr"
43
  let used name =
44
       (List.exists (fun v -> v.var_id = name) m.mstep.step_inputs)
45
    || (List.exists (fun v -> v.var_id = name) m.mmemory) in
46
  mk_new_name used "attr"
36 47

  
37 48
let mk_call_var_decl loc id =
38 49
  { var_id = id;

Also available in: Unified diff