let term_visible (fm,kf) t =
    let module M = struct exception Invisible end in
    let visitor = object inherit Visitor.frama_c_inplace
      method vlogic_var_use v =
        match v.lv_origin with
          | None -> DoChildren
          | Some v when v.vformal ->
              let n_param = Kernel_function.get_formal_position v kf + 1 in
                if not (param_visible (fm,kf) n_param)
                then raise M.Invisible
                else DoChildren
          | Some v when not v.vglob ->
              if not (loc_var_visible (fm, kf) v)
              then raise M.Invisible
              else DoChildren
          | Some _ -> DoChildren
    end
    in
      try ignore (Visitor.visitFramacTerm visitor t); true
      with M.Invisible -> false