Remove variable resolution and use pointers to declarations instead

Summary: @​public
This removes the old way of finding variable declarations to create sil variables and replaces it with
a a new way based on the map from pointers to declarations.
Basically, every variable dereference contains a pointer to the variable declaration, with that we can
build the corresponding sil variable.

Reviewed By: @akotulski

Differential Revision: D2536000

fb-gh-sync-id: dd29cf9
master
Dulma Rodriguez 9 years ago committed by facebook-github-bot-7
parent c01df1fe90
commit ba00f08f00

@ -28,6 +28,9 @@ let dummy_stmt_info () = {
let fresh_stmt_info stmt_info =
{ stmt_info with Clang_ast_t.si_pointer = Ast_utils.get_fresh_pointer () }
let fresh_decl_info decl_info =
{ decl_info with Clang_ast_t.di_pointer = Ast_utils.get_fresh_pointer () }
let dummy_decl_info decl_info = {
decl_info with
Clang_ast_t.di_pointer = Ast_utils.get_fresh_pointer ();
@ -371,7 +374,10 @@ let translate_dispatch_function block_name stmt_info stmt_list ei n =
let block_expr =
try Utils.list_nth stmt_list (n + 1)
with Not_found -> assert false in
let block_name_info = Ast_utils.make_name_decl block_name in
let block_name_info = {
Clang_ast_t.ni_name = block_name;
Clang_ast_t.ni_qual_name = [block_name; CFrontend_config.block]
} in
let open Clang_ast_t in
match block_expr with
| BlockExpr (bsi, bsl, bei, bd) ->
@ -379,8 +385,10 @@ let translate_dispatch_function block_name stmt_info stmt_list ei n =
let cast_info = { cei_cast_kind = `BitCast; cei_base_path =[]} in
let block_def = ImplicitCastExpr(stmt_info,[block_expr], bei, cast_info) in
let decl_info = { empty_decl_info
with di_pointer = stmt_info.si_pointer; di_source_range = stmt_info.si_source_range } in
let var_decl_info = { empty_var_decl_info with vdi_init_expr = Some block_def } in
with di_pointer = Ast_utils.get_fresh_pointer();
di_source_range = stmt_info.si_source_range } in
let stmt_info = { stmt_info with si_pointer = Ast_utils.get_fresh_pointer(); } in
let var_decl_info = { empty_var_decl_info with vdi_init_expr = Some block_def} in
let block_var_decl = VarDecl(decl_info, block_name_info, ei.ei_type_ptr, var_decl_info) in
let decl_stmt = DeclStmt(stmt_info,[], [block_var_decl]) in
@ -403,6 +411,7 @@ let make_DeclStmt stmt_info di tp vname iexp =
Some ie, [ie]
| None -> None, [] in
let var_decl_info = { empty_var_decl_info with Clang_ast_t.vdi_init_expr = init_expr_opt } in
let di = fresh_decl_info di in
let var_decl = Clang_ast_t.VarDecl (di, vname, tp, var_decl_info) in
Clang_ast_t.DeclStmt (stmt_info, init_expr_l, [var_decl])

@ -13,12 +13,6 @@
open Utils
open CFrontend_utils
type varStack = (Mangled.t * Sil.typ * int) Stack.t
type varMap = varStack StringMap.t
type pointerVarMap = Sil.pvar StringMap.t
module L = Logging
type curr_class =
@ -38,187 +32,11 @@ type t =
curr_class: curr_class;
is_callee_expression : bool;
namespace: string option; (* contains the name of the namespace if we are in the scope of one*)
mutable local_vars : (Mangled.t * Sil.typ * bool) list; (* (name, type, is_static flag) *)
mutable captured_vars : (Mangled.t * Sil.typ * bool) list; (* (name, type, is_static flag) *)
mutable local_vars_stack : varMap;
mutable local_vars_pointer : pointerVarMap;
outer_context : t option; (* in case of objc blocks, the context of the method containing the block *)
mutable blocks : Procname.t list (* List of blocks defined in this method *)
}
module LocalVars =
struct
module Block =
struct
let depth_counter = ref 0
let enter () =
depth_counter := !depth_counter + 1
let leave () =
depth_counter := !depth_counter - 1
let reset () =
depth_counter := 0
let depth () = !depth_counter
end
let lookup_var_map context var_name =
try
StringMap.find var_name context.local_vars_stack
with Not_found -> Stack.create ()
let lookup_var_formals context procname var_name =
let formals = Cfg.Procdesc.get_formals context.procdesc in
let arg, typ = list_find (fun (arg, typ) -> arg = var_name) formals in
let var = Sil.mk_pvar (Mangled.from_string var_name) procname in
(var, typ)
let lookup_var_captured context procname var_name =
let cv, typ, _ = list_find (fun (arg, typ, _) -> arg = Mangled.from_string var_name) context.captured_vars in
let var = Sil.mk_pvar cv procname in
(var, typ)
let lookup_var_globals context procname name =
let var_name = Mangled.from_string name in
let global_var = CGlobal_vars.find var_name in
let var = CGlobal_vars.var_get_name global_var in
Printing.log_out " ...Variable '%s' found in globals!!@\n" (Sil.pvar_to_string var);
let typ = CGlobal_vars.var_get_typ global_var in
var, typ
let is_captured_var context name =
list_exists (fun (v, _, _) -> (Mangled.to_string v) = name) context.captured_vars
let is_global_var context name =
try
let procname = Cfg.Procdesc.get_proc_name context.procdesc in
ignore (lookup_var_globals context procname name);
true
with Not_found -> false
let print_locals context =
let print_stack var_name stack =
Stack.iter
(fun (var_name, typ, level) ->
Printing.log_out "var item %s:" (Mangled.to_string var_name);
Printing.log_out "%s" (Sil.typ_to_string typ);
Printing.log_out "- %s @." (string_of_int level)) stack in
Printing.log_out "LOCAL VARS:@\n";
StringMap.iter print_stack context.local_vars_stack
let print_pointer_vars context =
let print_pointer_var pointer var =
Printing.log_out "%s ->" pointer;
Printing.log_out " %s@\n" (Sil.pvar_to_string var) in
Printing.log_out "POINTER VARS:@\n";
StringMap.iter print_pointer_var context.local_vars_pointer
let add_pointer_var pointer var context =
Printing.log_out " ...Adding pointer '%s' " pointer;
Printing.log_out "to the map with variable '%s'@." (Sil.pvar_to_string var);
context.local_vars_pointer <- StringMap.add pointer var context.local_vars_pointer
let find_var_with_pointer context pointer =
try
StringMap.find pointer context.local_vars_pointer
with Not_found ->
(Printing.log_err " ...Variable for pointer %s not found!!\n%!" pointer);
print_pointer_vars context;
assert false
let lookup_var_locals context procname var_name =
let stack = lookup_var_map context var_name in
let (var_name, typ, level) = Stack.top stack in
Printing.log_out " ...Variable %s found in locals!!@." (Mangled.to_string var_name);
(Sil.mk_pvar var_name procname), typ
let lookup_var context pointer var_name kind =
let procname = Cfg.Procdesc.get_proc_name context.procdesc in
if (kind = `Var) then
try
Some (fst (lookup_var_locals context procname var_name))
with Stack.Empty ->
try
Some (fst (lookup_var_globals context procname var_name))
with Not_found ->
if is_captured_var context var_name then
try (* if it's a captured variable we need to look at the parameters list*)
Some (fst (lookup_var_formals context procname var_name))
with Not_found ->
Printing.log_err "Variable %s not found!!\n%!" var_name;
print_locals context;
None
else None
else if (kind = `ParmVar) then
try
Some (fst (lookup_var_formals context procname var_name))
with Not_found ->
let list_to_string = list_to_string (fun (a, typ) -> a^":"^(Sil.typ_to_string typ)) in
Printing.log_err "Warning: Parameter %s not found!!\n%!" var_name;
Printing.log_err "Formals of procdesc %s" (Procname.to_string procname);
Printing.log_err " are %s\n%!" (list_to_string (Cfg.Procdesc.get_formals context.procdesc));
Printing.print_failure_info pointer;
assert false
else if (kind = `Function || kind = `ImplicitParam) then (
(* ImplicitParam are 'self' and '_cmd'. These are never defined but they can be referred to in the code. *)
Printing.log_err "Creating a variable for '%s' \n%!" var_name;
Some (Sil.mk_pvar (Mangled.from_string var_name) procname))
else if (kind = `EnumConstant) then
(Printing.print_failure_info pointer;
assert false)
else (Printing.log_err "WARNING: In lookup_var kind %s not handled. Giving up!\n%!" (Clang_ast_j.string_of_decl_kind kind);
Printing.print_failure_info pointer;
assert false)
let get_variable_name name =
Mangled.mangled name ((string_of_int(Block.depth ())))
let add_local_var context var_name typ pointer is_static =
Printing.log_out " ...Creating var %s" var_name;
Printing.log_out " with pointer %s@\n" pointer;
if not (is_global_var context var_name) || is_static then
let var = get_variable_name var_name in
context.local_vars <- context.local_vars@[(var, typ, is_static)] ;
let stack = lookup_var_map context var_name in
let procname = Cfg.Procdesc.get_proc_name context.procdesc in
let pvar = Sil.mk_pvar var procname in
Stack.push (var, typ, Block.depth ()) stack;
context.local_vars_stack <- StringMap.add var_name stack context.local_vars_stack;
add_pointer_var pointer pvar context
let reset_local_vars context =
context.local_vars <- []
let get_local_vars context =
context.local_vars
let remove_top_level_local_vars context =
let remove_top var_name stack =
try
let (top_var, top_typ, top_level) = Stack.top stack in
if top_level == (Block.depth ()) then
(ignore (Stack.pop stack);
context.local_vars_stack <-
StringMap.add var_name stack context.local_vars_stack)
else ()
with Stack.Empty -> () in
StringMap.iter remove_top context.local_vars_stack
let enter_and_leave_scope context f lstmt =
Block.enter ();
f context lstmt;
remove_top_level_local_vars context;
Block.leave ()
let reset_block = Block.reset
end
let create_context tenv cg cfg procdesc ns curr_class is_objc_method cv outer_context_opt =
let create_context tenv cg cfg procdesc ns curr_class is_objc_method context_opt =
{ tenv = tenv;
cg = cg;
cfg = cfg;
@ -227,11 +45,7 @@ let create_context tenv cg cfg procdesc ns curr_class is_objc_method cv outer_co
is_callee_expression = false;
is_objc_method = is_objc_method;
namespace = ns;
local_vars = [];
captured_vars = cv;
local_vars_stack = StringMap.empty;
local_vars_pointer = StringMap.empty;
outer_context = outer_context_opt;
outer_context = context_opt;
blocks = []
}
@ -261,7 +75,6 @@ let rec get_curr_class context =
get_curr_class outer_context
| _ -> context.curr_class
let get_curr_class_name curr_class =
match curr_class with
| ContextCls (name, _, _) -> name
@ -304,8 +117,6 @@ let curr_class_hash curr_class =
| ContextProtocol name -> Hashtbl.hash name
| ContextNoCls -> Hashtbl.hash "no class"
let get_captured_vars context = context.captured_vars
let create_curr_class tenv class_name =
let class_tn_name = Sil.TN_csu (Sil.Class, (Mangled.from_string class_name)) in
match Sil.tenv_lookup tenv class_tn_name with
@ -322,3 +133,8 @@ let rec add_block context block =
match context.outer_context with
| Some outer_context -> add_block outer_context block
| None -> ()
let rec get_outer_procname context =
match context.outer_context with
| Some outer_context -> get_outer_procname outer_context
| None -> Cfg.Procdesc.get_proc_name context.procdesc

@ -10,9 +10,6 @@
(** Contains current class and current method to be translated as well as local variables, *)
(** and the cg, cfg, and tenv corresponding to the current file. *)
type varMap
type pointerVarMap
type curr_class =
| ContextCls of string * string option * string list
(*class name and name of (optional) super class , and a list of protocols *)
@ -30,25 +27,10 @@ type t =
curr_class: curr_class;
is_callee_expression : bool;
namespace: string option; (* contains the name of the namespace if we are in the scope of one*)
mutable local_vars : (Mangled.t * Sil.typ * bool) list; (* (name, type, is_static flag) *)
mutable captured_vars : (Mangled.t * Sil.typ * bool) list; (* (name, type, is_static flag) *)
mutable local_vars_stack : varMap;
mutable local_vars_pointer : pointerVarMap;
outer_context : t option; (* in case of objc blocks, the context of the method containing the block *)
mutable blocks : Procname.t list (* List of blocks defined in this method *)
mutable blocks: Procname.t list; (* List of blocks defined in this method *)
}
module LocalVars :
sig
val find_var_with_pointer : t -> string -> Sil.pvar
val lookup_var: t -> string -> string -> Clang_ast_t.decl_kind -> Sil.pvar option
val add_pointer_var : string -> Sil.pvar -> t -> unit
val enter_and_leave_scope : t -> (t -> 'a -> 'b) -> 'a -> unit
val add_local_var : t -> string -> Sil.typ -> string -> bool -> unit
val reset_block : unit -> unit
val add_pointer_var : string -> Sil.pvar -> t -> unit
end
val get_procdesc : t -> Cfg.Procdesc.t
val get_cfg : t -> Cfg.cfg
@ -72,10 +54,12 @@ val is_objc_method : t -> bool
val get_tenv : t -> Sil.tenv
val create_context : Sil.tenv -> Cg.t -> Cfg.cfg -> Cfg.Procdesc.t ->
string option -> curr_class -> bool -> (Mangled.t * Sil.typ * bool) list -> t option -> t
string option -> curr_class -> bool -> t option -> t
val create_curr_class : Sil.tenv -> string -> curr_class
val add_block : t -> Procname.t -> unit
val is_objc_instance : t -> bool
val get_outer_procname : t -> Procname.t

@ -51,7 +51,7 @@ let enum_decl name tenv cfg cg namespace type_ptr decl_list opt_type =
Printing.log_out "ADDING: EnumDecl '%s'\n" name;
let context' =
CContext.create_context tenv cg cfg !global_procdesc namespace CContext.ContextNoCls
false [] None in
false None in
let enum_constants = get_enum_constants context' decl_list 0 in
let name = (match opt_type with (* If the type is defined it's of the kind "enum name" and we take that.*)
| `Type s -> s

@ -45,8 +45,7 @@ let rec translate_one_declaration tenv cg cfg namespace parent_dec dec =
list_iter tranlate_method method_decls
| VarDecl(decl_info, name_info, t, _) ->
let name = name_info.Clang_ast_t.ni_name in
CVar_decl.global_var_decl tenv namespace decl_info name t
Printing.log_out "Nothing to do for global variable %s " name_info.Clang_ast_t.ni_name
| ObjCInterfaceDecl(decl_info, name_info, decl_list, decl_context_info, oi_decl_info) ->
let name = name_info.Clang_ast_t.ni_name in
@ -125,7 +124,6 @@ let init_global_state source_file =
DB.current_source := source_file;
DB.Results_dir.init ();
Ident.reset_name_generator ();
CGlobal_vars.reset_map ();
CFrontend_config.global_translation_unit_decls := [];
ObjcProperty_decl.reset_property_table ();
CFrontend_utils.General_utils.reset_block_counter ()

@ -163,3 +163,5 @@ let type_pointer_prefix = "internal_type"
let nsarray_cl = "NSArray"
let infer = "infer"
let block = "block"

@ -158,3 +158,5 @@ val type_pointer_prefix : string
val nsarray_cl : string
val infer : string
val block : string

@ -344,6 +344,8 @@ let get_fresh_block_index () =
module General_utils =
struct
type var_info = Clang_ast_t.decl_info * Clang_ast_t.type_ptr * Clang_ast_t.var_decl_info * bool
let rec swap_elements_list l =
match l with
| el1:: el2:: rest ->
@ -493,6 +495,29 @@ struct
let type_name_crc = Some (CRC.crc16 type_name) in
Procname.mangled_c_method class_name method_name type_name_crc
let mk_sil_var name decl_info_type_ptr_opt procname outer_procname =
let name_string = name.Clang_ast_t.ni_name in
let simple_name = Mangled.from_string name_string in
match decl_info_type_ptr_opt with
| Some (decl_info, type_ptr, var_decl_info, should_be_mangled) ->
if var_decl_info.Clang_ast_t.vdi_is_global then
let global_mangled_name =
if var_decl_info.Clang_ast_t.vdi_is_static_local then
Mangled.from_string ((Procname.to_string outer_procname) ^ "_" ^ name_string)
else simple_name in
Sil.mk_pvar_global global_mangled_name
else if not should_be_mangled then Sil.mk_pvar simple_name procname
else
let type_name = Ast_utils.string_of_type_ptr type_ptr in
let start_location = fst decl_info.Clang_ast_t.di_source_range in
let file_opt = start_location.Clang_ast_t.sl_file in
let line_opt = start_location.Clang_ast_t.sl_line in
let line_str = match line_opt with | Some line -> string_of_int line | None -> "" in
let rel_path = get_rel_file_path file_opt in
let mangled = CRC.crc16 (type_name ^ rel_path ^ line_str) in
let mangled_name = Mangled.mangled name.Clang_ast_t.ni_name mangled in
Sil.mk_pvar mangled_name procname
| None -> Sil.mk_pvar simple_name procname
end

@ -105,6 +105,8 @@ end
module General_utils :
sig
type var_info = Clang_ast_t.decl_info * Clang_ast_t.type_ptr * Clang_ast_t.var_decl_info * bool
val string_from_list : string list -> string
val append_no_duplicates_fields : (Ident.fieldname * Sil.typ * Sil.item_annotation) list ->
@ -150,5 +152,6 @@ sig
val mk_class_field_name : Clang_ast_t.named_decl_info -> Ident.fieldname
val mk_sil_var : Clang_ast_t.named_decl_info -> var_info option -> Procname.t -> Procname.t ->
Sil.pvar
end

@ -1,57 +0,0 @@
(*
* Copyright (c) 2013 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*)
open CFrontend_utils
module L = Logging
type t = {
_name : Sil.pvar;
_type : Sil.typ
}
let var_get_name var =
var._name
let var_get_typ var =
var._type
module MangledMap = Map.Make (struct
type t = Mangled.t
let compare = Mangled.compare end)
type varMap = t MangledMap.t
let varMap = ref MangledMap.empty
let make_var name typ =
{ _name = name;
_type = typ }
let add name typ =
let name = (Mangled.from_string name) in
let pvar = Sil.mk_pvar_global name in
Printing.log_out "Adding global variable %s !!@." (Sil.pvar_to_string pvar);
let var_el = make_var pvar typ in
varMap := MangledMap.add name var_el !varMap
let find var =
MangledMap.find var !varMap
let reset_map () =
varMap := MangledMap.empty
let print_map () =
let print_item key value =
L.out "%a ->%a:%a@."
Mangled.pp key
(Sil.pp_pvar Utils.pe_text) value._name
(Sil.pp_typ_full Utils.pe_text) value._type in
if !CFrontend_config.debug_mode then
(L.out "GLOBAL VARS:@.";
MangledMap.iter print_item !varMap)

@ -1,22 +0,0 @@
(*
* Copyright (c) 2013 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*)
type t
val add : string -> Sil.typ -> unit
val find : Mangled.t -> t
val reset_map : unit -> unit
val var_get_name : t -> Sil.pvar
val var_get_typ : t -> Sil.typ
val print_map : unit -> unit

@ -49,19 +49,14 @@ struct
if (Cfg.Procdesc.is_defined procdesc && not (model_exists procname)) then
(let context =
CContext.create_context tenv cg cfg procdesc namespace class_decl_opt
is_objc_method captured_vars outer_context_opt in
CVar_decl.get_fun_locals context instrs;
let local_vars = list_map (fun (n, t, _) -> n, t) context.CContext.local_vars in
is_objc_method outer_context_opt in
let start_node = Cfg.Procdesc.get_start_node procdesc in
let exit_node = Cfg.Procdesc.get_exit_node procdesc in
Cfg.Procdesc.append_locals procdesc local_vars;
Cfg.Node.add_locals_ret_declaration start_node local_vars;
Printing.log_out
"\n\n>>---------- Start translating body of function: '%s' ---------<<\n@."
(Procname.to_string procname);
let meth_body_nodes = T.instructions_trans context instrs extra_instrs exit_node in
let is_anonym_block = Option.is_some outer_context_opt in
if (not is_anonym_block) then CContext.LocalVars.reset_block ();
Cfg.Node.add_locals_ret_declaration start_node (Cfg.Procdesc.get_locals procdesc);
Cfg.Node.set_succs_exn start_node meth_body_nodes [];
Cg.add_node (CContext.get_cg context) (Cfg.Procdesc.get_proc_name procdesc))
| None -> ())

@ -208,35 +208,6 @@ let get_formal_parameters tenv ms =
(name, typ):: defined_parameters pl' in
defined_parameters (CMethod_signature.ms_get_args ms)
(* Returns a list of captured variables. *)
(* In order to get the right mangled name we search among *)
(* the local variables of the defining function and it's formals.*)
let captured_vars_from_block_info context cvl =
let formal2captured (s, t) =
(Mangled.from_string s, t, false) in
let find lv n =
try
list_find (fun (n', _, _) -> Mangled.to_string n' = n) lv
with Not_found -> Printing.log_err "Trying to find variable %s@." n; assert false in
let rec f cvl' =
match cvl' with
| [] -> []
| cv:: cvl'' ->
(match cv.Clang_ast_t.bcv_variable with
| Some dr ->
(match dr.Clang_ast_t.dr_name, dr.Clang_ast_t.dr_type_ptr with
| Some name_info, _ ->
let n = name_info.Clang_ast_t.ni_name in
if n = CFrontend_config.self && not (CContext.is_objc_instance context) then []
else
(let procdesc_formals = Cfg.Procdesc.get_formals context.CContext.procdesc in
(Printing.log_err "formals are %s@." (Utils.list_to_string (fun (x, _) -> x) procdesc_formals));
let formals = list_map formal2captured procdesc_formals in
[find (context.CContext.local_vars @ formals) n])
| _ -> assert false)
| None -> []) :: f cvl'' in
list_flatten (f cvl)
let get_return_type tenv ms =
let return_type = CMethod_signature.ms_get_ret_type ms in
CTypes_decl.type_ptr_to_sil_type tenv return_type

@ -25,8 +25,6 @@ val create_local_procdesc : Cfg.cfg -> Sil.tenv -> CMethod_signature.method_sign
val create_external_procdesc : Cfg.cfg -> Procname.t -> bool -> (Sil.typ * Sil.typ list) option -> unit
val captured_vars_from_block_info : CContext.t -> Clang_ast_t.block_captured_variable list -> (Mangled.t * Sil.typ * bool) list
val get_class_selector_instance : CContext.t -> Clang_ast_t.obj_c_message_expr_info -> (Sil.exp * Sil.typ) list
-> (string * string * Clang_ast_t.pointer option * method_call_type)

@ -301,28 +301,28 @@ struct
let name = get_name_decl_ref_exp_info decl_ref_expr_info stmt_info in
let procname = Cfg.Procdesc.get_proc_name context.procdesc in
let pointer = CTrans_utils.get_decl_pointer decl_ref_expr_info in
let is_function =
match get_decl_kind decl_ref_expr_info with
| `Function -> true
| _ -> false in
if is_enumeration_constant d then (
let decl_kind = get_decl_kind decl_ref_expr_info in
match decl_kind with
| `EnumConstant ->
let const_exp = (match CTypes.search_enum_type_by_name context.tenv name with
| Some v ->
let ce = Sil.Const v in
Printing.log_out " ....Found enum constant '%s', " name;
Printing.log_out "replacing with integer '%s' \n" (Sil.exp_to_string ce); ce
| None ->
Printing.log_stats
" WARNING: Found enum constant '%s', but its value was not found in the tenv. Returning 0.\n" name;
Printing.log_out
"WARNING: Found enum constant '%s', but its value was not found in the tenv.\n"
name;
(Sil.Const(Sil.Cint Sil.Int.zero))) in
{ root_nodes = []; leaf_nodes = []; ids = []; instrs = []; exps = [(const_exp, typ)]}
) else if is_function then (
| `Function ->
let pname =
if CTrans_models.is_modeled_builtin name then
Procname.from_string_c_fun (CFrontend_config.infer ^ name)
else CMethod_trans.create_procdesc_with_pointer context pointer None name tp in
let address_of_function = not context.CContext.is_callee_expression in
(* If we are not translating a callee expression, then the address of the function is being taken.*)
(* If we are not translating a callee expression, *)
(* then the address of the function is being taken.*)
(* As e.g. in fun_ptr = foo; *)
let non_mangled_func_name =
if name = CFrontend_config.malloc &&
@ -338,13 +338,11 @@ struct
if address_of_function then Cfg.set_procname_priority context.cfg pname;
{ empty_res_trans with exps = [(Sil.Const (Sil.Cfun pname), typ)] }
end
) else (
| `Var | `ImplicitParam | `ParmVar ->
let pvar =
if not (Utils.string_is_prefix CFrontend_config.pointer_prefix stmt_info.Clang_ast_t.si_pointer) then
try
CContext.LocalVars.find_var_with_pointer context stmt_info.Clang_ast_t.si_pointer
with _ -> assert false
else Sil.mk_pvar (Mangled.from_string name) procname in
match decl_ref_expr_info.Clang_ast_t.drti_decl_ref with
| Some decl_ref -> CVar_decl.sil_var_of_decl_ref context decl_ref procname
| None -> assert false in
let e = Sil.Lvar pvar in
let exps =
if Self.is_var_self pvar (CContext.is_objc_method context) then
@ -358,7 +356,16 @@ struct
else [(e, typ)] in
Printing.log_out "\n\n PVAR ='%s'\n\n" (Sil.pvar_to_string pvar);
{ empty_res_trans with exps = exps }
)
| _ ->
let print_error decl_kind =
Printing.log_stats
"Warning: Decl ref expression %s with pointer %s still needs to be translated "
(Clang_ast_j.string_of_decl_kind decl_kind)
pointer in
match decl_kind with
| `CXXMethod -> print_error decl_kind; assert false
| _ -> print_error decl_kind; assert false
let cxxThisExpr_trans trans_state stmt_info expr_info =
let context = trans_state.context in
@ -431,6 +438,7 @@ struct
and binaryOperator_trans trans_state binary_operator_info stmt_info expr_info stmt_list =
let open Clang_ast_t in
let procname = Cfg.Procdesc.get_proc_name trans_state.context.CContext.procdesc in
let bok = (Clang_ast_j.string_of_binary_operator_kind binary_operator_info.Clang_ast_t.boi_kind) in
Printing.log_out " BinaryOperator '%s' " bok;
Printing.log_out " priority node free = '%s'\n@."
@ -442,10 +450,11 @@ struct
let typ = CTypes_decl.type_ptr_to_sil_type context.CContext.tenv expr_info.Clang_ast_t.ei_type_ptr in
(match stmt_list with
| [s1; ImplicitCastExpr (stmt, [CompoundLiteralExpr (cle_stmt_info, stmts, expr_info)], _, cast_expr_info)] ->
let di, line_number = get_decl_ref_info s1 parent_line_number in
let decl_ref, line_number = get_decl_ref_info s1 parent_line_number in
let line_number = CLocation.get_line cle_stmt_info line_number in
let trans_state' = { trans_state with parent_line_number = line_number } in
let res_trans_tmp = initListExpr_trans trans_state' stmt_info expr_info di stmts in
let pvar = CVar_decl.sil_var_of_decl_ref context decl_ref procname in
let res_trans_tmp = initListExpr_trans trans_state' stmt_info expr_info stmts pvar in
{ res_trans_tmp with leaf_nodes =[]}
| [s1; s2] -> (* Assumption: We expect precisely 2 stmt corresponding to the 2 operands*)
let rhs_owning_method = CTrans_utils.is_owning_method s2 in
@ -756,7 +765,6 @@ struct
Printing.log_out "\n Call to a dispatch function treated as special case...\n";
let procname = Cfg.Procdesc.get_proc_name trans_state.context.CContext.procdesc in
let pvar = CFrontend_utils.General_utils.get_next_block_pvar procname in
CContext.LocalVars.add_pointer_var stmt_info.Clang_ast_t.si_pointer pvar trans_state.context;
let transformed_stmt, tp =
Ast_expressions.translate_dispatch_function (Sil.pvar_to_string pvar) stmt_info stmt_list ei n in
let typ = CTypes_decl.type_ptr_to_sil_type trans_state.context.CContext.tenv tp in
@ -771,8 +779,6 @@ struct
and block_enumeration_trans trans_state stmt_info stmt_list ei =
let declare_nullify_vars loc res_state roots preds (pvar, typ) =
(* Add declare locals to the first node *)
list_iter (fun n -> Cfg.Node.prepend_instrs_temps n [Sil.Declare_locals([(pvar, typ)], loc)] []) roots;
(* Add nullify of the temp block var to the last node (predecessor or the successor nodes)*)
list_iter (fun n -> Cfg.Node.append_instrs_temps n [Sil.Nullify(pvar, loc, true)] []) preds in
@ -784,7 +790,6 @@ struct
let pvars_types = list_map (fun (v, pointer, tp) ->
let pvar = Sil.mk_pvar (Mangled.from_string v) procname in
let typ = CTypes_decl.type_ptr_to_sil_type trans_state.context.CContext.tenv tp in
CContext.LocalVars.add_pointer_var pointer pvar trans_state.context;
(pvar, typ)) vars_to_register in
let loc = CLocation.get_sil_location stmt_info trans_state.parent_line_number trans_state.context in
let res_state = instruction trans_state transformed_stmt in
@ -1217,6 +1222,9 @@ struct
{ empty_res_trans with root_nodes = root_nodes; leaf_nodes = leaf_nodes }
and objCForCollectionStmt_trans trans_state item items body stmt_info =
let _ = instruction trans_state item in
(* Here we do ast transformation, so we don't need the value of the translation of the *)
(* variable item but we still need to add the variable to the locals *)
let bin_op = Ast_expressions.make_next_object_exp stmt_info item items in
let while_kind = Loops.While (bin_op, body) in
let root_nodes, leaf_nodes = loop_instruction trans_state while_kind stmt_info in
@ -1274,7 +1282,7 @@ struct
exps = exp_to_parent' }
| _ -> assert false) (* Compound assign statement should have two operands*)
and initListExpr_trans trans_state stmt_info expr_info di_pointer stmts =
and initListExpr_trans trans_state stmt_info expr_info stmts pvar =
let context = trans_state.context in
let succ_nodes = trans_state.succ_nodes in
let rec collect_right_hand_exprs ts stmt = match stmt with
@ -1319,7 +1327,6 @@ struct
| _ -> [ [(e, typ)] ] in
let trans_state_pri = PriorityNode.try_claim_priority_node trans_state stmt_info in
let var_type = CTypes_decl.type_ptr_to_sil_type context.CContext.tenv expr_info.Clang_ast_t.ei_type_ptr in
let pvar = CContext.LocalVars.find_var_with_pointer context di_pointer in
let lh = list_flatten (collect_left_hand_exprs (Sil.Lvar pvar) var_type Utils.StringSet.empty) in
let rh = list_flatten (list_map (collect_right_hand_exprs trans_state_pri) stmts ) in
if (list_length rh != list_length lh) then (
@ -1369,8 +1376,14 @@ struct
and collect_all_decl trans_state var_decls next_nodes stmt_info =
let open Clang_ast_t in
let context = trans_state.context in
let procdesc = context.CContext.procdesc in
let procname = Cfg.Procdesc.get_proc_name procdesc in
let pln = trans_state.parent_line_number in
let do_var_dec (di, var_name, type_ptr, vdi) next_node =
let var_decl = VarDecl (di, var_name, type_ptr, vdi) in
let pvar = CVar_decl.sil_var_of_decl context var_decl procname in
let typ = CTypes_decl.type_ptr_to_sil_type context.CContext.tenv type_ptr in
CVar_decl.add_var_to_locals procdesc var_decl typ pvar;
match vdi.Clang_ast_t.vdi_init_expr with
| None -> { empty_res_trans with root_nodes = next_node } (* Nothing to do if no init expression *)
| Some (ImplicitValueInitExpr (_, stmt_list, _)) ->
@ -1382,7 +1395,7 @@ struct
{ empty_res_trans with root_nodes = next_node }
| Some (InitListExpr (stmt_info , stmts , expr_info))
| Some (ExprWithCleanups (_, [InitListExpr (stmt_info , stmts , expr_info)], _, _)) ->
initListExpr_trans trans_state stmt_info expr_info di.Clang_ast_t.di_pointer stmts
initListExpr_trans trans_state stmt_info expr_info stmts pvar
| Some ie -> (*For init expr, translate how to compute it and assign to the var*)
let sil_loc = CLocation.get_sil_location stmt_info pln context in
let trans_state_pri = PriorityNode.try_claim_priority_node trans_state stmt_info in
@ -1393,7 +1406,6 @@ struct
Cfg.Node.set_succs_exn node next_node [];
[node]
) else next_node in
let pvar = CContext.LocalVars.find_var_with_pointer context di.Clang_ast_t.di_pointer in
let line_number = CLocation.get_line stmt_info pln in
(* if ie is a block the translation need to be done with the block special cases by exec_with_block_priority*)
let res_trans_ie =
@ -1706,7 +1718,7 @@ struct
let sil_loc = CLocation.get_sil_location stmt_info trans_state.parent_line_number trans_state.context in
let fname = SymExec.ModelBuiltins.__objc_release_autorelease_pool in
let ret_id = Ident.create_fresh Ident.knormal in
let autorelease_pool_vars = compute_autorelease_pool_vars trans_state.context stmts in
let autorelease_pool_vars = CVar_decl.compute_autorelease_pool_vars trans_state.context stmts in
let stmt_call = Sil.Call([ret_id], (Sil.Const (Sil.Cfun fname)), autorelease_pool_vars, sil_loc, Sil.cf_default) in
let node_kind = Cfg.Node.Stmt_node ("Release the autorelease pool") in
let call_node = create_node node_kind ([ret_id]) ([stmt_call]) sil_loc trans_state.context in
@ -1759,23 +1771,19 @@ struct
(* We need to set the explicit dependency between the newly created block and the *)
(* defining procedure. We add an edge in the call graph.*)
Cg.add_edge context.cg procname block_pname;
let static_locals = list_filter (fun (v, t, s) -> s = true) context.local_vars in
(*list_iter (fun (v, _, _) -> L.err "Static Locals %s@." (Mangled.to_string v)) static_locals;*)
let static_formals = list_filter (fun (v, t, s) -> s = true) context.captured_vars in
(*list_iter (fun (v, _, _) -> L.err "Formal Static %s@." (Mangled.to_string v)) static_formals;*)
let static_vars = static_locals @ static_formals in
let captured_vars =
(CMethod_trans.captured_vars_from_block_info context block_decl_info.Clang_ast_t.bdi_captured_variables) in
let all_captured_vars = captured_vars @ static_vars in
let ids_instrs = list_map assign_captured_var all_captured_vars in
let captured_block_vars = block_decl_info.Clang_ast_t.bdi_captured_variables in
let captured_vars = CVar_decl.captured_vars_from_block_info context captured_block_vars in
let ids_instrs = list_map assign_captured_var captured_vars in
let ids, instrs = list_split ids_instrs in
let block_data = (context, type_ptr, block_pname, all_captured_vars) in
let block_data = (context, type_ptr, block_pname, captured_vars) in
CContext.add_block context block_pname;
M.function_decl context.tenv context.cfg context.cg context.namespace decl (Some block_data);
Cfg.set_procname_priority context.cfg block_pname;
let captured_exps = list_map (fun id -> Sil.Var id) ids in
let tu = Sil.Ctuple ((Sil.Const (Sil.Cfun block_pname)) :: captured_exps) in
let alloc_block_instr, ids_block = allocate_block trans_state (Procname.to_string block_pname) all_captured_vars loc in
let block_name = Procname.to_string block_pname in
let alloc_block_instr, ids_block =
allocate_block trans_state block_name captured_vars loc in
{ empty_res_trans with ids = ids_block @ ids; instrs = alloc_block_instr @ instrs; exps = [(Sil.Const tu, typ)]}
| _ -> assert false

@ -622,13 +622,16 @@ let rec is_method_call s =
let rec get_decl_ref_info s parent_line_number =
match s with
| Clang_ast_t.DeclRefExpr (stmt_info, stmt_list, expr_info, decl_ref_expr_info) ->
let line_number = CLocation.get_line stmt_info parent_line_number in
stmt_info.Clang_ast_t.si_pointer, line_number
| _ -> (match Clang_ast_proj.get_stmt_tuple s with
(let line_number = CLocation.get_line stmt_info parent_line_number in
match decl_ref_expr_info.Clang_ast_t.drti_decl_ref with
| Some decl_ref -> decl_ref, line_number
| None -> assert false)
| _ ->
match Clang_ast_proj.get_stmt_tuple s with
| stmt_info, [] -> assert false
| stmt_info, s'':: _ ->
let line_number = CLocation.get_line stmt_info parent_line_number in
get_decl_ref_info s'' line_number)
get_decl_ref_info s'' line_number
let rec contains_opaque_value_expr s =
match s with
@ -637,25 +640,6 @@ let rec contains_opaque_value_expr s =
| [] -> false
| s'':: _ -> contains_opaque_value_expr s''
let rec compute_autorelease_pool_vars context stmts =
match stmts with
| [] -> []
| Clang_ast_t.DeclRefExpr (si, sl, ei, drei):: stmts' ->
let name = get_name_decl_ref_exp_info drei si in
let procname = Cfg.Procdesc.get_proc_name context.CContext.procdesc in
let local_vars = Cfg.Procdesc.get_locals context.CContext.procdesc in
let mname = try
list_filter (fun (m, t) -> Mangled.to_string m = name) local_vars
with _ -> [] in
(match mname with
| [(m, t)] ->
CFrontend_utils.General_utils.append_no_duplicated_pvars
[(Sil.Lvar (Sil.mk_pvar m procname), t)] (compute_autorelease_pool_vars context stmts')
| _ -> compute_autorelease_pool_vars context stmts')
| s :: stmts' ->
let sl = snd(Clang_ast_proj.get_stmt_tuple s) in
compute_autorelease_pool_vars context (sl @ stmts')
(* checks if a unary operator is a logic negation applied to integers*)
let is_logical_negation_of_int tenv ei uoi =
match CTypes_decl.type_ptr_to_sil_type tenv ei.Clang_ast_t.ei_type_ptr, uoi.Clang_ast_t.uoi_kind with

@ -97,7 +97,7 @@ val is_method_call : Clang_ast_t.stmt -> bool
val contains_opaque_value_expr : Clang_ast_t.stmt -> bool
val get_decl_ref_info : Clang_ast_t.stmt -> int -> string * int
val get_decl_ref_info : Clang_ast_t.stmt -> int -> Clang_ast_t.decl_ref * int
val builtin_trans : trans_state -> Location.t -> Clang_ast_t.stmt_info ->
Sil.typ -> Procname.t option -> trans_result option
@ -209,8 +209,6 @@ sig
val is_var_self : Sil.pvar -> bool -> bool
end
val compute_autorelease_pool_vars : CContext.t -> Clang_ast_t.stmt list -> (Sil.exp * Sil.typ) list
val is_logical_negation_of_int : Sil.tenv -> Clang_ast_t.expr_info -> Clang_ast_t.unary_operator_info -> bool
val is_dispatch_function : Clang_ast_t.stmt list -> int option

@ -16,32 +16,6 @@ module L = Logging
let get_type_from_expr_info ei =
ei.Clang_ast_t.ei_type_ptr
let lookup_var_type context pvar =
let formals = Cfg.Procdesc.get_formals context.CContext.procdesc in
let locals = Cfg.Procdesc.get_locals context.CContext.procdesc in
try
let s, t = list_find (fun (s, t) -> s = (Sil.pvar_to_string pvar)) formals in
Printing.log_out "When looking for type of variable '%s' " (Sil.pvar_to_string pvar);
Printing.log_out "found '%s' in formals.@." (Sil.typ_to_string t);
t
with Not_found ->
try
let s, t = list_find (fun (s, t) -> Mangled.equal (Sil.pvar_get_name pvar) s) locals in
Printing.log_out "When looking for type of variable '%s' " (Sil.pvar_to_string pvar);
Printing.log_out "found '%s' in locals.@." (Sil.typ_to_string t);
t
with Not_found ->
try
let typ = CGlobal_vars.var_get_typ (CGlobal_vars.find (Sil.pvar_get_name pvar)) in
Printing.log_out "When looking for type of variable '%s'" (Sil.pvar_to_string pvar);
Printing.log_out " found '%s' in globals.@." (Sil.typ_to_string typ);
typ
with Not_found ->
Printing.log_err
"WARNING: Variable '%s' not found in local+formal when looking for its type. Returning void.\n%!"
(Sil.pvar_to_string pvar);
Sil.Tvoid
let get_name_from_struct s =
match s with
| Sil.Tstruct(_, _, _, Some n, _, _, _) -> n

@ -9,8 +9,6 @@
(** Utility module for retrieving types *)
val lookup_var_type : CContext.t -> Sil.pvar -> Sil.typ
val add_pointer_to_typ : Sil.typ -> Sil.typ
val search_enum_type_by_name : Sil.tenv -> string -> Sil.const option

@ -15,160 +15,89 @@ open CFrontend_utils
module L = Logging
(* For a variable declaration it return/construct the type *)
let get_var_type tenv name t =
let typ = CTypes_decl.type_ptr_to_sil_type tenv t in
Printing.log_out " Getting/Defining type for variable '%s'" name;
Printing.log_out " as sil type '%s'\n" (Sil.typ_to_string typ);
typ
let is_custom_var_pointer pointer =
Utils.string_is_prefix CFrontend_config.pointer_prefix pointer
(* NOTE: Currently we use this function to avoid certain C++ global variable definition defined *)
(* in traits and config files.*)
(* We recogneze them because these declaration have di_parent_pointer and di_previous_decl defined*)
let global_to_be_added di =
(di.Clang_ast_t.di_parent_pointer = None) && (di.Clang_ast_t.di_previous_decl =`None)
let global_var_decl tenv namespace decl_info name t =
Printing.log_out "PASSING: VarDecl for '%s' to global procdesc" name;
Printing.log_out " pointer= '%s'\n" decl_info.Clang_ast_t.di_pointer;
if global_to_be_added decl_info then (
let typ = get_var_type tenv name t in
Printing.log_out " >>> Adding entry to global procdesc: ('%s', " name;
Printing.log_out "'%s')\n" (Sil.typ_to_string typ);
CGlobal_vars.add name typ)
else Printing.log_out "SKIPPING VarDecl for '%s'\n" name
let rec lookup_ahead_for_vardecl context pointer var_name kind decl_list =
match decl_list with
| [] -> Printing.log_out " Failing when looking ahead for variable '%s'\n" var_name;
assert false (* nothing has been found ahead, maybe something bad in the AST *)
| Clang_ast_t.VarDecl (decl_info, var_info, t, _) :: rest
when var_name = var_info.Clang_ast_t.ni_name ->
let var_name' = var_info.Clang_ast_t.ni_name in
if global_to_be_added decl_info then (
let tenv = CContext.get_tenv context in
Printing.log_out "ADDING (later-defined): VarDecl '%s' to global procdesc\n" var_name';
let typ = get_var_type tenv var_name' t in
Printing.log_out " >>> Adding (later-defined) entry to global procdesc: ('%s', " var_name';
Printing.log_out "'%s')\n" (Sil.typ_to_string typ);
CGlobal_vars.add var_name' typ;
let mangled_var_name = Mangled.from_string var_name' in
let global_var = CGlobal_vars.find mangled_var_name in
CGlobal_vars.var_get_name global_var)
else (Printing.log_out "SKIPPING VarDecl for '%s'\n" var_name;
lookup_ahead_for_vardecl context pointer var_name kind rest)
| _ :: rest ->
lookup_ahead_for_vardecl context pointer var_name kind rest
let lookup_var_static_globals context name =
let remove_separator s =
match Str.split (Str.regexp_string Config.anonymous_block_num_sep) s with
| s'':: _ -> s''
| _ -> assert false in
let remove_block_prefix s =
match Str.split (Str.regexp_string Config.anonymous_block_prefix) s with
| [_; s''] -> s''
| [s''] -> s''
| _ -> assert false in
let remove_block_name pname =
let s = Procname.to_string pname in
let s'= remove_block_prefix s in
let s'' = if s'= s then s'
else remove_separator s' in
s'' in
let pname = Cfg.Procdesc.get_proc_name context.CContext.procdesc in
let str_pname = remove_block_name pname in
let static_name = Sil.mk_static_local_name str_pname name in
Printing.log_out " ...Looking for variable '%s' in static globals...\n" static_name;
let var_name = Mangled.from_string static_name in
let global_var = CGlobal_vars.find var_name in
let var = CGlobal_vars.var_get_name global_var in
Printing.log_out " ...Variable '%s' found in static globals!!\n" (Sil.pvar_to_string var);
var
let sil_var_of_decl context var_decl procname =
let outer_procname = CContext.get_outer_procname context in
let open Clang_ast_t in
match var_decl with
| VarDecl (decl_info, name_info, type_ptr, var_decl_info) ->
let shoud_be_mangled =
not (is_custom_var_pointer decl_info.Clang_ast_t.di_pointer) in
let var_decl_details = Some (decl_info, type_ptr, var_decl_info, shoud_be_mangled) in
General_utils.mk_sil_var name_info var_decl_details procname outer_procname
| ParmVarDecl (decl_info, name_info, type_ptr, var_decl_info) ->
let var_decl_details = Some (decl_info, type_ptr, var_decl_info, false) in
General_utils.mk_sil_var name_info var_decl_details procname outer_procname
| _ -> assert false
let lookup_var stmt_info context pointer var_name kind =
let pvar = CContext.LocalVars.lookup_var context stmt_info.Clang_ast_t.si_pointer var_name kind in
match pvar with
| Some var -> var
| None ->
try
lookup_var_static_globals context var_name
with Not_found ->
(Printing.log_out "Looking on later-defined decls for '%s' with pointer '%s' \n" var_name stmt_info.Clang_ast_t.si_pointer;
let decl_list = !CFrontend_config.global_translation_unit_decls in
lookup_ahead_for_vardecl context pointer var_name kind decl_list )
let sil_var_of_decl_ref context decl_ref procname =
let name =
match decl_ref.Clang_ast_t.dr_name with
| Some name_info -> name_info
| None -> assert false in
let pointer = decl_ref.Clang_ast_t.dr_decl_pointer in
match decl_ref.Clang_ast_t.dr_kind with
| `ImplicitParam ->
let outer_procname = CContext.get_outer_procname context in
General_utils.mk_sil_var name None procname outer_procname
| _ ->
if is_custom_var_pointer pointer then
Sil.mk_pvar (Mangled.from_string name.Clang_ast_t.ni_name) procname
else match Ast_utils.get_decl decl_ref.Clang_ast_t.dr_decl_pointer with
| Some var_decl -> sil_var_of_decl context var_decl procname
| None -> assert false
(* Traverses the body of the method top down and collects the *)
(* variable definitions in a map in the context. To be able to find the right variable name *)
(* in the reference instructions, all the variable names are also saved in a map from pointers *)
(* to variable names to be used in the translation of the method's body. *)
let rec get_variables_stmt context (stmt : Clang_ast_t.stmt) : unit =
let add_var_to_locals procdesc var_decl sil_typ pvar =
let open Clang_ast_t in
match stmt with
| DeclStmt (_, lstmt, decl_list) ->
get_variables_decls context decl_list;
get_fun_locals context lstmt;
| DeclRefExpr (stmt_info, stmt_list, expr_info, decl_ref_expr_info) ->
(* Notice that DeclRefExpr is the reference to a declared var/function/enum... *)
(* so no declaration here *)
Printing.log_out "Collecting variables, passing from DeclRefExpr '%s'\n"
stmt_info.Clang_ast_t.si_pointer;
let var_name = CTrans_utils.get_name_decl_ref_exp_info decl_ref_expr_info stmt_info in
let kind = CTrans_utils.get_decl_kind decl_ref_expr_info in
(match kind with
| `EnumConstant | `ObjCIvar | `CXXMethod | `ObjCProperty -> ()
| _ ->
let pvar = lookup_var stmt_info context stmt_info.Clang_ast_t.si_pointer var_name kind in
CContext.LocalVars.add_pointer_var stmt_info.Clang_ast_t.si_pointer pvar context)
| CompoundStmt (stmt_info, lstmt) ->
Printing.log_out "Collecting variables, passing from CompoundStmt '%s'\n"
stmt_info.Clang_ast_t.si_pointer;
CContext.LocalVars.enter_and_leave_scope context get_fun_locals lstmt
| ForStmt (stmt_info, lstmt) ->
Printing.log_out "Collecting variables, passing from ForStmt '%s'\n"
stmt_info.Clang_ast_t.si_pointer;
CContext.LocalVars.enter_and_leave_scope context get_fun_locals lstmt
| _ ->
let lstmt = Ast_utils.get_stmts_from_stmt stmt in
get_fun_locals context lstmt
match var_decl with
| VarDecl (di, var_name, type_ptr, vdi) ->
let is_block_var =
match var_name.Clang_ast_t.ni_qual_name with
| [name; qual_name] -> qual_name = CFrontend_config.block
| _ -> false in
if not vdi.Clang_ast_t.vdi_is_global && not is_block_var then
Cfg.Procdesc.append_locals procdesc [(Sil.pvar_get_name pvar, sil_typ)]
| _ -> assert false
and get_fun_locals context (stmts : Clang_ast_t.stmt list) : unit =
let rec compute_autorelease_pool_vars context stmts =
let procname = Cfg.Procdesc.get_proc_name context.CContext.procdesc in
match stmts with
| [] -> ()
| stmt:: rest ->
(get_variables_stmt context stmt);
(get_fun_locals context rest)
| [] -> []
| Clang_ast_t.DeclRefExpr (si, sl, ei, drei):: stmts' ->
(let res = compute_autorelease_pool_vars context stmts' in
match drei.Clang_ast_t.drti_decl_ref with
| Some decl_ref ->
(match decl_ref.Clang_ast_t.dr_type_ptr with
| Some type_ptr when decl_ref.Clang_ast_t.dr_kind = `Var ->
let typ = CTypes_decl.type_ptr_to_sil_type context.CContext.tenv type_ptr in
let pvar = sil_var_of_decl_ref context decl_ref procname in
if Sil.pvar_is_local pvar then
General_utils.append_no_duplicated_pvars [(Sil.Lvar pvar, typ)] res
else res
| _ -> res)
| _ -> res)
| s :: stmts' ->
let sl = snd (Clang_ast_proj.get_stmt_tuple s) in
compute_autorelease_pool_vars context (sl @ stmts')
(* Collects the local of a function. *)
and get_variables_decls context (decl_list : Clang_ast_t.decl list) : unit =
let do_one_decl decl =
let open Clang_ast_t in
match decl with
| VarDecl (decl_info, name_info, type_ptr, var_decl_info) ->
Printing.log_out "Collecting variables, passing from VarDecl '%s'\n" decl_info.Clang_ast_t.di_pointer;
let name = name_info.Clang_ast_t.ni_name in
let typ = get_var_type context.CContext.tenv name type_ptr in
(match var_decl_info.Clang_ast_t.vdi_storage_class with
| Some "static" ->
let pname = Cfg.Procdesc.get_proc_name context.CContext.procdesc in
let static_name = (Procname.to_string pname)^"_"^name in
CGlobal_vars.add static_name typ;
let var = Sil.mk_pvar_global (Mangled.from_string static_name) in
CContext.LocalVars.add_pointer_var decl_info.Clang_ast_t.di_pointer var context
| _ ->
CContext.LocalVars.add_local_var context name typ decl_info.Clang_ast_t.di_pointer
(CFrontend_utils.General_utils.is_static_var var_decl_info))
| CXXRecordDecl _ | RecordDecl _ ->
let typ = CTypes_decl.get_declaration_type context.CContext.tenv context.CContext.namespace decl in
CTypes_decl.add_struct_to_tenv context.CContext.tenv typ
| TypedefDecl (decl_info, name_info, opt_type, _, typedef_decl_info) ->
Printing.log_out "%s" "Skipping typedef. Will expand the type in its occurrences."
| StaticAssertDecl decl_info -> (* We do not treat Assertions. *)
Printing.log_out
"WARNING: When collecting variables, passing from StaticAssertDecl '%s'. Skipped.\n"
decl_info.Clang_ast_t.di_pointer
| _ -> Printing.log_out
"!!! When collecting locals of a function found '%s'. Cannot continue\n\n"
(Clang_ast_j.string_of_decl decl);
assert false in
list_iter do_one_decl decl_list
(* Returns a list of captured variables as sil variables. *)
let captured_vars_from_block_info context cvl =
let procname = Cfg.Procdesc.get_proc_name context.CContext.procdesc in
let sil_var_of_captured_var cv vars =
match cv.Clang_ast_t.bcv_variable with
| Some dr ->
(match dr.Clang_ast_t.dr_name, dr.Clang_ast_t.dr_type_ptr with
| Some name_info, Some type_ptr ->
let n = name_info.Clang_ast_t.ni_name in
if n = CFrontend_config.self && not (CContext.is_objc_instance context) then
vars
else
let pvar = sil_var_of_decl_ref context dr procname in
let typ = CTypes_decl.type_ptr_to_sil_type context.CContext.tenv type_ptr in
(Sil.pvar_get_name pvar, typ, false) :: vars
| _ -> assert false)
| _ -> assert false in
list_fold_right sil_var_of_captured_var cvl []

@ -10,8 +10,13 @@
(** Process variable declarations by saving them as local or global variables. *)
(** Computes the local variables of a function or method to be added to the procdesc *)
val get_fun_locals : CContext.t -> Clang_ast_t.stmt list -> unit
val sil_var_of_decl : CContext.t -> Clang_ast_t.decl -> Procname.t -> Sil.pvar
val global_var_decl : Sil.tenv -> string option -> Clang_ast_t.decl_info -> string ->
Clang_ast_t.type_ptr -> unit
val sil_var_of_decl_ref : CContext.t -> Clang_ast_t.decl_ref -> Procname.t -> Sil.pvar
val add_var_to_locals : Cfg.Procdesc.t -> Clang_ast_t.decl -> Sil.typ -> Sil.pvar -> unit
val compute_autorelease_pool_vars : CContext.t -> Clang_ast_t.stmt list -> (Sil.exp * Sil.typ) list
val captured_vars_from_block_info : CContext.t -> Clang_ast_t.block_captured_variable list ->
(Mangled.t * Sil.typ * bool) list

@ -54,7 +54,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: x:double b:int \n DECLARE_LOCALS(&return,&x,&b); [line 10]\n NULLIFY(&b,false); [line 10]\n NULLIFY(&x,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: b:int x:double \n DECLARE_LOCALS(&return,&b,&x); [line 10]\n NULLIFY(&b,false); [line 10]\n NULLIFY(&x,false); [line 10]\n " color=yellow style=filled]
1 -> 15 ;

@ -18,7 +18,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: a:int b:int * c:float * d:long double large_int:int overflow_int:int \n DECLARE_LOCALS(&return,&a,&b,&c,&d,&large_int,&overflow_int); [line 10]\n NULLIFY(&a,false); [line 10]\n NULLIFY(&b,false); [line 10]\n NULLIFY(&c,false); [line 10]\n NULLIFY(&d,false); [line 10]\n NULLIFY(&large_int,false); [line 10]\n NULLIFY(&overflow_int,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: overflow_int:int large_int:int d:long double c:float * b:int * a:int \n DECLARE_LOCALS(&return,&overflow_int,&large_int,&d,&c,&b,&a); [line 10]\n NULLIFY(&a,false); [line 10]\n NULLIFY(&b,false); [line 10]\n NULLIFY(&c,false); [line 10]\n NULLIFY(&d,false); [line 10]\n NULLIFY(&large_int,false); [line 10]\n NULLIFY(&overflow_int,false); [line 10]\n " color=yellow style=filled]
1 -> 6 ;

@ -14,7 +14,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: x:int z:int \n DECLARE_LOCALS(&return,&x,&z); [line 10]\n NULLIFY(&x,false); [line 10]\n NULLIFY(&z,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: z:int x:int \n DECLARE_LOCALS(&return,&z,&x); [line 10]\n NULLIFY(&x,false); [line 10]\n NULLIFY(&z,false); [line 10]\n " color=yellow style=filled]
1 -> 5 ;

@ -54,7 +54,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: x:int y:int a:int b:int * \n DECLARE_LOCALS(&return,&x,&y,&a,&b); [line 10]\n NULLIFY(&b,false); [line 10]\n NULLIFY(&x,false); [line 10]\n NULLIFY(&y,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: b:int * a:int y:int x:int \n DECLARE_LOCALS(&return,&b,&a,&y,&x); [line 10]\n NULLIFY(&b,false); [line 10]\n NULLIFY(&x,false); [line 10]\n NULLIFY(&y,false); [line 10]\n " color=yellow style=filled]
1 -> 15 ;

@ -22,7 +22,7 @@ digraph iCFG {
14 [label="14: Exit comma_3 \n " color=yellow style=filled]
13 [label="13: Start comma_3\nFormals: \nLocals: a:int b:int c:int d:int \n DECLARE_LOCALS(&return,&a,&b,&c,&d); [line 22]\n NULLIFY(&a,false); [line 22]\n NULLIFY(&b,false); [line 22]\n NULLIFY(&c,false); [line 22]\n NULLIFY(&d,false); [line 22]\n " color=yellow style=filled]
13 [label="13: Start comma_3\nFormals: \nLocals: d:int c:int b:int a:int \n DECLARE_LOCALS(&return,&d,&c,&b,&a); [line 22]\n NULLIFY(&a,false); [line 22]\n NULLIFY(&b,false); [line 22]\n NULLIFY(&c,false); [line 22]\n NULLIFY(&d,false); [line 22]\n " color=yellow style=filled]
13 -> 19 ;
@ -45,7 +45,7 @@ digraph iCFG {
8 [label="8: Exit comma_2 \n " color=yellow style=filled]
7 [label="7: Start comma_2\nFormals: \nLocals: a:int b:int d:int \n DECLARE_LOCALS(&return,&a,&b,&d); [line 16]\n NULLIFY(&a,false); [line 16]\n NULLIFY(&b,false); [line 16]\n NULLIFY(&d,false); [line 16]\n " color=yellow style=filled]
7 [label="7: Start comma_2\nFormals: \nLocals: d:int b:int a:int \n DECLARE_LOCALS(&return,&d,&b,&a); [line 16]\n NULLIFY(&a,false); [line 16]\n NULLIFY(&b,false); [line 16]\n NULLIFY(&d,false); [line 16]\n " color=yellow style=filled]
7 -> 12 ;
@ -68,7 +68,7 @@ digraph iCFG {
2 [label="2: Exit comma_1 \n " color=yellow style=filled]
1 [label="1: Start comma_1\nFormals: \nLocals: a:int b:int d:int \n DECLARE_LOCALS(&return,&a,&b,&d); [line 10]\n NULLIFY(&a,false); [line 10]\n NULLIFY(&b,false); [line 10]\n NULLIFY(&d,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start comma_1\nFormals: \nLocals: d:int b:int a:int \n DECLARE_LOCALS(&return,&d,&b,&a); [line 10]\n NULLIFY(&a,false); [line 10]\n NULLIFY(&b,false); [line 10]\n NULLIFY(&d,false); [line 10]\n " color=yellow style=filled]
1 -> 6 ;

@ -193,7 +193,7 @@ digraph iCFG {
2 [label="2: Exit binop_with_side_effects \n " color=yellow style=filled]
1 [label="1: Start binop_with_side_effects\nFormals: z:int \nLocals: x1:int x2:int x3:int y1:int y2:int y3:int \n DECLARE_LOCALS(&return,&x1,&x2,&x3,&y1,&y2,&y3); [line 10]\n NULLIFY(&x1,false); [line 10]\n NULLIFY(&x2,false); [line 10]\n NULLIFY(&x3,false); [line 10]\n NULLIFY(&y1,false); [line 10]\n NULLIFY(&y2,false); [line 10]\n NULLIFY(&y3,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start binop_with_side_effects\nFormals: z:int \nLocals: y3:int y2:int y1:int x3:int x2:int x1:int \n DECLARE_LOCALS(&return,&y3,&y2,&y1,&x3,&x2,&x1); [line 10]\n NULLIFY(&x1,false); [line 10]\n NULLIFY(&x2,false); [line 10]\n NULLIFY(&x3,false); [line 10]\n NULLIFY(&y1,false); [line 10]\n NULLIFY(&y2,false); [line 10]\n NULLIFY(&y3,false); [line 10]\n " color=yellow style=filled]
1 -> 44 ;

@ -81,7 +81,7 @@ digraph iCFG {
38 [label="38: Exit bar \n " color=yellow style=filled]
37 [label="37: Start bar\nFormals: \nLocals: x:int y:int \n DECLARE_LOCALS(&return,&x,&y); [line 21]\n NULLIFY(&x,false); [line 21]\n NULLIFY(&y,false); [line 21]\n " color=yellow style=filled]
37 [label="37: Start bar\nFormals: \nLocals: y:int x:int \n DECLARE_LOCALS(&return,&y,&x); [line 21]\n NULLIFY(&x,false); [line 21]\n NULLIFY(&y,false); [line 21]\n " color=yellow style=filled]
37 -> 52 ;
@ -231,7 +231,7 @@ digraph iCFG {
2 [label="2: Exit foo \n " color=yellow style=filled]
1 [label="1: Start foo\nFormals: \nLocals: x:int y:int n:int \n DECLARE_LOCALS(&return,&x,&y,&n); [line 10]\n NULLIFY(&n,false); [line 10]\n NULLIFY(&x,false); [line 10]\n NULLIFY(&y,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start foo\nFormals: \nLocals: n:int y:int x:int \n DECLARE_LOCALS(&return,&n,&y,&x); [line 10]\n NULLIFY(&n,false); [line 10]\n NULLIFY(&x,false); [line 10]\n NULLIFY(&y,false); [line 10]\n " color=yellow style=filled]
1 -> 36 ;

@ -137,7 +137,7 @@ digraph iCFG {
61 [label="61: Exit main \n " color=yellow style=filled]
60 [label="60: Start main\nFormals: \nLocals: spec:char * block_size:char * \n DECLARE_LOCALS(&return,&spec,&block_size); [line 46]\n NULLIFY(&block_size,false); [line 46]\n NULLIFY(&spec,false); [line 46]\n " color=yellow style=filled]
60 [label="60: Start main\nFormals: \nLocals: block_size:char * spec:char * \n DECLARE_LOCALS(&return,&block_size,&spec); [line 46]\n NULLIFY(&block_size,false); [line 46]\n NULLIFY(&spec,false); [line 46]\n " color=yellow style=filled]
60 -> 93 ;
@ -254,7 +254,7 @@ digraph iCFG {
33 [label="33: Exit test_loop \n " color=yellow style=filled]
32 [label="32: Start test_loop\nFormals: \nLocals: spec:char * block_size:char * \n DECLARE_LOCALS(&return,&spec,&block_size); [line 28]\n NULLIFY(&block_size,false); [line 28]\n NULLIFY(&spec,false); [line 28]\n " color=yellow style=filled]
32 [label="32: Start test_loop\nFormals: \nLocals: block_size:char * spec:char * \n DECLARE_LOCALS(&return,&block_size,&spec); [line 28]\n NULLIFY(&block_size,false); [line 28]\n NULLIFY(&spec,false); [line 28]\n " color=yellow style=filled]
32 -> 59 ;

@ -76,7 +76,7 @@ digraph iCFG {
2 [label="2: Exit dereference_ifthenelse \n " color=yellow style=filled]
1 [label="1: Start dereference_ifthenelse\nFormals: p:int *\nLocals: x:int y:int \n DECLARE_LOCALS(&return,&x,&y); [line 10]\n NULLIFY(&x,false); [line 10]\n NULLIFY(&y,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start dereference_ifthenelse\nFormals: p:int *\nLocals: y:int x:int \n DECLARE_LOCALS(&return,&y,&x); [line 10]\n NULLIFY(&x,false); [line 10]\n NULLIFY(&y,false); [line 10]\n " color=yellow style=filled]
1 -> 16 ;

@ -26,7 +26,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: today:enum { (sunday, 0) (monday, 1) (tuesday, 2) (wednesday, 0) (thursday, 3) (friday, 4) (saturday, 5) } i:int \n DECLARE_LOCALS(&return,&today,&i); [line 12]\n NULLIFY(&i,false); [line 12]\n NULLIFY(&today,false); [line 12]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: i:int today:enum { (sunday, 0) (monday, 1) (tuesday, 2) (wednesday, 0) (thursday, 3) (friday, 4) (saturday, 5) } \n DECLARE_LOCALS(&return,&i,&today); [line 12]\n NULLIFY(&i,false); [line 12]\n NULLIFY(&today,false); [line 12]\n " color=yellow style=filled]
1 -> 8 ;

@ -127,7 +127,7 @@ digraph iCFG {
222 [label="222: Exit g8 \n " color=yellow style=filled]
221 [label="221: Start g8\nFormals: q:int \nLocals: i:int j:int k:int v:int \n DECLARE_LOCALS(&return,&i,&j,&k,&v); [line 180]\n NULLIFY(&i,false); [line 180]\n NULLIFY(&j,false); [line 180]\n NULLIFY(&k,false); [line 180]\n NULLIFY(&v,false); [line 180]\n " color=yellow style=filled]
221 [label="221: Start g8\nFormals: q:int \nLocals: v:int k:int j:int i:int \n DECLARE_LOCALS(&return,&v,&k,&j,&i); [line 180]\n NULLIFY(&i,false); [line 180]\n NULLIFY(&j,false); [line 180]\n NULLIFY(&k,false); [line 180]\n NULLIFY(&v,false); [line 180]\n " color=yellow style=filled]
221 -> 252 ;
@ -246,7 +246,7 @@ digraph iCFG {
193 [label="193: Exit g7 \n " color=yellow style=filled]
192 [label="192: Start g7\nFormals: \nLocals: i:int j:int k:int v:int \n DECLARE_LOCALS(&return,&i,&j,&k,&v); [line 156]\n NULLIFY(&i,false); [line 156]\n NULLIFY(&j,false); [line 156]\n NULLIFY(&k,false); [line 156]\n NULLIFY(&v,false); [line 156]\n " color=yellow style=filled]
192 [label="192: Start g7\nFormals: \nLocals: v:int k:int j:int i:int \n DECLARE_LOCALS(&return,&v,&k,&j,&i); [line 156]\n NULLIFY(&i,false); [line 156]\n NULLIFY(&j,false); [line 156]\n NULLIFY(&k,false); [line 156]\n NULLIFY(&v,false); [line 156]\n " color=yellow style=filled]
192 -> 220 ;

@ -6,7 +6,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: z:int a:int [2][3] \n DECLARE_LOCALS(&return,&z,&a); [line 10]\n NULLIFY(&a,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: a:int [2][3] z:int \n DECLARE_LOCALS(&return,&a,&z); [line 10]\n NULLIFY(&a,false); [line 10]\n " color=yellow style=filled]
1 -> 3 ;

@ -35,7 +35,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: a:int b:int \n DECLARE_LOCALS(&return,&a,&b); [line 10]\n NULLIFY(&a,false); [line 10]\n NULLIFY(&b,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: b:int a:int \n DECLARE_LOCALS(&return,&b,&a); [line 10]\n NULLIFY(&a,false); [line 10]\n NULLIFY(&b,false); [line 10]\n " color=yellow style=filled]
1 -> 10 ;

@ -35,7 +35,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: a:int b:int \n DECLARE_LOCALS(&return,&a,&b); [line 10]\n NULLIFY(&a,false); [line 10]\n NULLIFY(&b,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: b:int a:int \n DECLARE_LOCALS(&return,&b,&a); [line 10]\n NULLIFY(&a,false); [line 10]\n NULLIFY(&b,false); [line 10]\n " color=yellow style=filled]
1 -> 10 ;

@ -56,7 +56,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: a:int b:int \n DECLARE_LOCALS(&return,&a,&b); [line 10]\n NULLIFY(&a,false); [line 10]\n NULLIFY(&b,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: b:int a:int \n DECLARE_LOCALS(&return,&b,&a); [line 10]\n NULLIFY(&a,false); [line 10]\n NULLIFY(&b,false); [line 10]\n " color=yellow style=filled]
1 -> 15 ;

@ -43,7 +43,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: j:int i:int b:int \n DECLARE_LOCALS(&return,&j,&i,&b); [line 10]\n NULLIFY(&b,false); [line 10]\n NULLIFY(&i,false); [line 10]\n NULLIFY(&j,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: b:int i:int j:int \n DECLARE_LOCALS(&return,&b,&i,&j); [line 10]\n NULLIFY(&b,false); [line 10]\n NULLIFY(&i,false); [line 10]\n NULLIFY(&j,false); [line 10]\n " color=yellow style=filled]
1 -> 12 ;

@ -64,7 +64,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: k:int i:int j:int \n DECLARE_LOCALS(&return,&k,&i,&j); [line 10]\n NULLIFY(&i,false); [line 10]\n NULLIFY(&j,false); [line 10]\n NULLIFY(&k,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: i:int j:int k:int \n DECLARE_LOCALS(&return,&i,&j,&k); [line 10]\n NULLIFY(&i,false); [line 10]\n NULLIFY(&j,false); [line 10]\n NULLIFY(&k,false); [line 10]\n " color=yellow style=filled]
1 -> 17 ;

@ -35,7 +35,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: j:int b:int \n DECLARE_LOCALS(&return,&j,&b); [line 10]\n NULLIFY(&b,false); [line 10]\n NULLIFY(&j,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: b:int j:int \n DECLARE_LOCALS(&return,&b,&j); [line 10]\n NULLIFY(&b,false); [line 10]\n NULLIFY(&j,false); [line 10]\n " color=yellow style=filled]
1 -> 10 ;

@ -31,7 +31,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: j:int b:int \n DECLARE_LOCALS(&return,&j,&b); [line 10]\n NULLIFY(&b,false); [line 10]\n NULLIFY(&j,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: b:int j:int \n DECLARE_LOCALS(&return,&b,&j); [line 10]\n NULLIFY(&b,false); [line 10]\n NULLIFY(&j,false); [line 10]\n " color=yellow style=filled]
1 -> 9 ;

@ -39,7 +39,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: j:int i:int \n DECLARE_LOCALS(&return,&j,&i); [line 10]\n NULLIFY(&i,false); [line 10]\n NULLIFY(&j,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: i:int j:int \n DECLARE_LOCALS(&return,&i,&j); [line 10]\n NULLIFY(&i,false); [line 10]\n NULLIFY(&j,false); [line 10]\n " color=yellow style=filled]
1 -> 11 ;

@ -56,7 +56,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: k:int i:int \n DECLARE_LOCALS(&return,&k,&i); [line 10]\n NULLIFY(&i,false); [line 10]\n NULLIFY(&k,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: i:int k:int \n DECLARE_LOCALS(&return,&i,&k); [line 10]\n NULLIFY(&i,false); [line 10]\n NULLIFY(&k,false); [line 10]\n " color=yellow style=filled]
1 -> 15 ;

@ -56,7 +56,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: i:int k:int \n DECLARE_LOCALS(&return,&i,&k); [line 10]\n NULLIFY(&i,false); [line 10]\n NULLIFY(&k,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: k:int i:int \n DECLARE_LOCALS(&return,&k,&i); [line 10]\n NULLIFY(&i,false); [line 10]\n NULLIFY(&k,false); [line 10]\n " color=yellow style=filled]
1 -> 15 ;

@ -14,7 +14,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: y:int X:int \n DECLARE_LOCALS(&return,&y,&X); [line 10]\n NULLIFY(&y,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: X:int y:int \n DECLARE_LOCALS(&return,&X,&y); [line 10]\n NULLIFY(&y,false); [line 10]\n " color=yellow style=filled]
1 -> 5 ;

@ -30,7 +30,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: x:double q:double r:double s:double t:double \n DECLARE_LOCALS(&return,&x,&q,&r,&s,&t); [line 10]\n NULLIFY(&q,false); [line 10]\n NULLIFY(&x,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: t:double s:double r:double q:double x:double \n DECLARE_LOCALS(&return,&t,&s,&r,&q,&x); [line 10]\n NULLIFY(&q,false); [line 10]\n NULLIFY(&x,false); [line 10]\n " color=yellow style=filled]
1 -> 9 ;

@ -211,7 +211,7 @@ digraph iCFG {
144 [label="144: Exit m8 \n " color=yellow style=filled]
143 [label="143: Start m8\nFormals: \nLocals: value:int something:int z:int a:int \n DECLARE_LOCALS(&return,&value,&something,&z,&a); [line 176]\n NULLIFY(&a,false); [line 176]\n NULLIFY(&something,false); [line 176]\n NULLIFY(&value,false); [line 176]\n NULLIFY(&z,false); [line 176]\n " color=yellow style=filled]
143 [label="143: Start m8\nFormals: \nLocals: a:int z:int something:int value:int \n DECLARE_LOCALS(&return,&a,&z,&something,&value); [line 176]\n NULLIFY(&a,false); [line 176]\n NULLIFY(&something,false); [line 176]\n NULLIFY(&value,false); [line 176]\n NULLIFY(&z,false); [line 176]\n " color=yellow style=filled]
143 -> 171 ;
@ -282,7 +282,7 @@ digraph iCFG {
127 [label="127: Exit m7 \n " color=yellow style=filled]
126 [label="126: Start m7\nFormals: \nLocals: value:int something:int z:int \n DECLARE_LOCALS(&return,&value,&something,&z); [line 156]\n NULLIFY(&something,false); [line 156]\n NULLIFY(&value,false); [line 156]\n NULLIFY(&z,false); [line 156]\n " color=yellow style=filled]
126 [label="126: Start m7\nFormals: \nLocals: z:int something:int value:int \n DECLARE_LOCALS(&return,&z,&something,&value); [line 156]\n NULLIFY(&something,false); [line 156]\n NULLIFY(&value,false); [line 156]\n NULLIFY(&z,false); [line 156]\n " color=yellow style=filled]
126 -> 142 ;
@ -389,7 +389,7 @@ digraph iCFG {
101 [label="101: Exit m6 \n " color=yellow style=filled]
100 [label="100: Start m6\nFormals: \nLocals: value:int something:int z:int \n DECLARE_LOCALS(&return,&value,&something,&z); [line 130]\n NULLIFY(&something,false); [line 130]\n NULLIFY(&value,false); [line 130]\n NULLIFY(&z,false); [line 130]\n " color=yellow style=filled]
100 [label="100: Start m6\nFormals: \nLocals: z:int something:int value:int \n DECLARE_LOCALS(&return,&z,&something,&value); [line 130]\n NULLIFY(&something,false); [line 130]\n NULLIFY(&value,false); [line 130]\n NULLIFY(&z,false); [line 130]\n " color=yellow style=filled]
100 -> 122 ;
@ -450,7 +450,7 @@ digraph iCFG {
86 [label="86: Exit m5 \n " color=yellow style=filled]
85 [label="85: Start m5\nFormals: \nLocals: value:int x:int \n DECLARE_LOCALS(&return,&value,&x); [line 112]\n NULLIFY(&value,false); [line 112]\n NULLIFY(&x,false); [line 112]\n " color=yellow style=filled]
85 [label="85: Start m5\nFormals: \nLocals: x:int value:int \n DECLARE_LOCALS(&return,&x,&value); [line 112]\n NULLIFY(&value,false); [line 112]\n NULLIFY(&x,false); [line 112]\n " color=yellow style=filled]
85 -> 99 ;
@ -541,7 +541,7 @@ digraph iCFG {
64 [label="64: Exit m4 \n " color=yellow style=filled]
63 [label="63: Start m4\nFormals: \nLocals: value:int x:int z:int something:int \n DECLARE_LOCALS(&return,&value,&x,&z,&something); [line 85]\n NULLIFY(&something,false); [line 85]\n NULLIFY(&value,false); [line 85]\n NULLIFY(&x,false); [line 85]\n NULLIFY(&z,false); [line 85]\n " color=yellow style=filled]
63 [label="63: Start m4\nFormals: \nLocals: something:int z:int x:int value:int \n DECLARE_LOCALS(&return,&something,&z,&x,&value); [line 85]\n NULLIFY(&something,false); [line 85]\n NULLIFY(&value,false); [line 85]\n NULLIFY(&x,false); [line 85]\n NULLIFY(&z,false); [line 85]\n " color=yellow style=filled]
63 -> 84 ;
@ -612,7 +612,7 @@ digraph iCFG {
47 [label="47: Exit m3 \n " color=yellow style=filled]
46 [label="46: Start m3\nFormals: \nLocals: value:int something:int z:int \n DECLARE_LOCALS(&return,&value,&something,&z); [line 64]\n NULLIFY(&something,false); [line 64]\n NULLIFY(&value,false); [line 64]\n NULLIFY(&z,false); [line 64]\n " color=yellow style=filled]
46 [label="46: Start m3\nFormals: \nLocals: z:int something:int value:int \n DECLARE_LOCALS(&return,&z,&something,&value); [line 64]\n NULLIFY(&something,false); [line 64]\n NULLIFY(&value,false); [line 64]\n NULLIFY(&z,false); [line 64]\n " color=yellow style=filled]
46 -> 62 ;
@ -703,7 +703,7 @@ digraph iCFG {
25 [label="25: Exit m2 \n " color=yellow style=filled]
24 [label="24: Start m2\nFormals: \nLocals: value:int x:int z:int something:int \n DECLARE_LOCALS(&return,&value,&x,&z,&something); [line 37]\n NULLIFY(&something,false); [line 37]\n NULLIFY(&value,false); [line 37]\n NULLIFY(&x,false); [line 37]\n NULLIFY(&z,false); [line 37]\n " color=yellow style=filled]
24 [label="24: Start m2\nFormals: \nLocals: something:int z:int x:int value:int \n DECLARE_LOCALS(&return,&something,&z,&x,&value); [line 37]\n NULLIFY(&something,false); [line 37]\n NULLIFY(&value,false); [line 37]\n NULLIFY(&x,false); [line 37]\n NULLIFY(&z,false); [line 37]\n " color=yellow style=filled]
24 -> 45 ;
@ -798,7 +798,7 @@ digraph iCFG {
2 [label="2: Exit m1 \n " color=yellow style=filled]
1 [label="1: Start m1\nFormals: \nLocals: value:int x:int \n DECLARE_LOCALS(&return,&value,&x); [line 12]\n NULLIFY(&value,false); [line 12]\n NULLIFY(&x,false); [line 12]\n " color=yellow style=filled]
1 [label="1: Start m1\nFormals: \nLocals: x:int value:int \n DECLARE_LOCALS(&return,&x,&value); [line 12]\n NULLIFY(&value,false); [line 12]\n NULLIFY(&x,false); [line 12]\n " color=yellow style=filled]
1 -> 23 ;

@ -18,7 +18,7 @@ digraph iCFG {
2 [label="2: Exit test \n " color=yellow style=filled]
1 [label="1: Start test\nFormals: \nLocals: x:int i:int * \n DECLARE_LOCALS(&return,&x,&i); [line 10]\n NULLIFY(&i,false); [line 10]\n NULLIFY(&x,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start test\nFormals: \nLocals: i:int * x:int \n DECLARE_LOCALS(&return,&i,&x); [line 10]\n NULLIFY(&i,false); [line 10]\n NULLIFY(&x,false); [line 10]\n " color=yellow style=filled]
1 -> 6 ;

@ -6,7 +6,7 @@ digraph iCFG {
2 [label="2: Exit stat_cast \n " color=yellow style=filled]
1 [label="1: Start stat_cast\nFormals: \nLocals: a:int la:long long \n DECLARE_LOCALS(&return,&a,&la); [line 10]\n NULLIFY(&la,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start stat_cast\nFormals: \nLocals: la:long long a:int \n DECLARE_LOCALS(&return,&la,&a); [line 10]\n NULLIFY(&la,false); [line 10]\n " color=yellow style=filled]
1 -> 3 ;

@ -38,7 +38,7 @@ digraph iCFG {
11 [label="11: Exit call_static_methods \n " color=yellow style=filled]
10 [label="10: Start call_static_methods\nFormals: \nLocals: b:class Base * s1:class Base * s2:class Sub * \n DECLARE_LOCALS(&return,&b,&s1,&s2); [line 21]\n NULLIFY(&b,false); [line 21]\n NULLIFY(&s1,false); [line 21]\n NULLIFY(&s2,false); [line 21]\n " color=yellow style=filled]
10 [label="10: Start call_static_methods\nFormals: \nLocals: s2:class Sub * s1:class Base * b:class Base * \n DECLARE_LOCALS(&return,&s2,&s1,&b); [line 21]\n NULLIFY(&b,false); [line 21]\n NULLIFY(&s1,false); [line 21]\n NULLIFY(&s2,false); [line 21]\n " color=yellow style=filled]
10 -> 20 ;

@ -18,7 +18,7 @@ digraph iCFG {
2 [label="2: Exit test \n " color=yellow style=filled]
1 [label="1: Start test\nFormals: \nLocals: xs:struct X_struct * xc:class X_class * \n DECLARE_LOCALS(&return,&xs,&xc); [line 12]\n " color=yellow style=filled]
1 [label="1: Start test\nFormals: \nLocals: xc:class X_class * xs:struct X_struct * \n DECLARE_LOCALS(&return,&xc,&xs); [line 12]\n " color=yellow style=filled]
1 -> 6 ;

@ -18,7 +18,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: person:class EOCPerson * x:int * \n DECLARE_LOCALS(&return,&person,&x); [line 12]\n NULLIFY(&person,false); [line 12]\n NULLIFY(&x,false); [line 12]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: x:int * person:class EOCPerson * \n DECLARE_LOCALS(&return,&x,&person); [line 12]\n NULLIFY(&person,false); [line 12]\n NULLIFY(&x,false); [line 12]\n " color=yellow style=filled]
1 -> 6 ;

@ -18,7 +18,7 @@ digraph iCFG {
37 [label="37: Exit test3 \n " color=yellow style=filled]
36 [label="36: Start test3\nFormals: \nLocals: pool:class NSAutoreleasePool * string:class NSString * c:class NSString * \n DECLARE_LOCALS(&return,&pool,&string,&c); [line 59]\n NULLIFY(&c,false); [line 59]\n NULLIFY(&pool,false); [line 59]\n NULLIFY(&string,false); [line 59]\n " color=yellow style=filled]
36 [label="36: Start test3\nFormals: \nLocals: c:class NSString * string:class NSString * pool:class NSAutoreleasePool * \n DECLARE_LOCALS(&return,&c,&string,&pool); [line 59]\n NULLIFY(&c,false); [line 59]\n NULLIFY(&pool,false); [line 59]\n NULLIFY(&string,false); [line 59]\n " color=yellow style=filled]
36 -> 41 ;
@ -57,7 +57,7 @@ digraph iCFG {
27 [label="27: Exit test2 \n " color=yellow style=filled]
26 [label="26: Start test2\nFormals: \nLocals: s1:class A * s2:class A * s3:class A * \n DECLARE_LOCALS(&return,&s1,&s2,&s3); [line 47]\n " color=yellow style=filled]
26 [label="26: Start test2\nFormals: \nLocals: s3:class A * s2:class A * s1:class A * \n DECLARE_LOCALS(&return,&s3,&s2,&s1); [line 47]\n " color=yellow style=filled]
26 -> 35 ;
@ -100,7 +100,7 @@ digraph iCFG {
16 [label="16: Exit test1 \n " color=yellow style=filled]
15 [label="15: Start test1\nFormals: \nLocals: s1:class A * s2:class A * s3:class A * \n DECLARE_LOCALS(&return,&s1,&s2,&s3); [line 34]\n " color=yellow style=filled]
15 [label="15: Start test1\nFormals: \nLocals: s3:class A * s2:class A * s1:class A * \n DECLARE_LOCALS(&return,&s3,&s2,&s1); [line 34]\n " color=yellow style=filled]
15 -> 25 ;

@ -70,7 +70,7 @@ digraph iCFG {
30 [label="30: Exit MemoryLeakExample_createCloseCrossGlyphNoLeak: \n " color=yellow style=filled]
29 [label="29: Start MemoryLeakExample_createCloseCrossGlyphNoLeak:\nFormals: rect:struct CGRect \nLocals: lineThickness:double path1:struct CGPath * \n DECLARE_LOCALS(&return,&lineThickness,&path1); [line 65]\n NULLIFY(&lineThickness,false); [line 65]\n NULLIFY(&path1,false); [line 65]\n " color=yellow style=filled]
29 [label="29: Start MemoryLeakExample_createCloseCrossGlyphNoLeak:\nFormals: rect:struct CGRect \nLocals: path1:struct CGPath * lineThickness:double \n DECLARE_LOCALS(&return,&path1,&lineThickness); [line 65]\n NULLIFY(&lineThickness,false); [line 65]\n NULLIFY(&path1,false); [line 65]\n " color=yellow style=filled]
29 -> 33 ;
@ -85,7 +85,7 @@ digraph iCFG {
26 [label="26: Exit MemoryLeakExample_createCloseCrossGlyph: \n " color=yellow style=filled]
25 [label="25: Start MemoryLeakExample_createCloseCrossGlyph:\nFormals: rect:struct CGRect \nLocals: lineThickness:double path1:struct CGPath * \n DECLARE_LOCALS(&return,&lineThickness,&path1); [line 57]\n NULLIFY(&lineThickness,false); [line 57]\n NULLIFY(&path1,false); [line 57]\n " color=yellow style=filled]
25 [label="25: Start MemoryLeakExample_createCloseCrossGlyph:\nFormals: rect:struct CGRect \nLocals: path1:struct CGPath * lineThickness:double \n DECLARE_LOCALS(&return,&path1,&lineThickness); [line 57]\n NULLIFY(&lineThickness,false); [line 57]\n NULLIFY(&path1,false); [line 57]\n " color=yellow style=filled]
25 -> 28 ;
@ -175,7 +175,7 @@ digraph iCFG {
2 [label="2: Exit MemoryLeakExample_layoutSubviews \n " color=yellow style=filled]
1 [label="1: Start MemoryLeakExample_layoutSubviews\nFormals: self:class MemoryLeakExample *\nLocals: attachmentContainerView:class UIView * shadowPath:struct CGPath * \n DECLARE_LOCALS(&return,&attachmentContainerView,&shadowPath); [line 19]\n NULLIFY(&attachmentContainerView,false); [line 19]\n NULLIFY(&self,false); [line 19]\n NULLIFY(&shadowPath,false); [line 19]\n " color=yellow style=filled]
1 [label="1: Start MemoryLeakExample_layoutSubviews\nFormals: self:class MemoryLeakExample *\nLocals: shadowPath:struct CGPath * attachmentContainerView:class UIView * \n DECLARE_LOCALS(&return,&shadowPath,&attachmentContainerView); [line 19]\n NULLIFY(&attachmentContainerView,false); [line 19]\n NULLIFY(&self,false); [line 19]\n NULLIFY(&shadowPath,false); [line 19]\n " color=yellow style=filled]
1 -> 6 ;

@ -36,7 +36,7 @@ digraph iCFG {
10 [label="10: Exit TollBridgeExample_brideRetained \n " color=yellow style=filled]
9 [label="9: Start TollBridgeExample_brideRetained\nFormals: self:class TollBridgeExample *\nLocals: observer:struct objc_object * a:struct __CFLocale * \n DECLARE_LOCALS(&return,&observer,&a); [line 31]\n NULLIFY(&a,false); [line 31]\n NULLIFY(&observer,false); [line 31]\n NULLIFY(&self,false); [line 31]\n " color=yellow style=filled]
9 [label="9: Start TollBridgeExample_brideRetained\nFormals: self:class TollBridgeExample *\nLocals: a:struct __CFLocale * observer:struct objc_object * \n DECLARE_LOCALS(&return,&a,&observer); [line 31]\n NULLIFY(&a,false); [line 31]\n NULLIFY(&observer,false); [line 31]\n NULLIFY(&self,false); [line 31]\n " color=yellow style=filled]
9 -> 12 ;
@ -51,7 +51,7 @@ digraph iCFG {
6 [label="6: Exit TollBridgeExample_bridge \n " color=yellow style=filled]
5 [label="5: Start TollBridgeExample_bridge\nFormals: self:class TollBridgeExample *\nLocals: nameRef:struct __CFLocale * a:class NSLocale * \n DECLARE_LOCALS(&return,&nameRef,&a); [line 25]\n NULLIFY(&a,false); [line 25]\n NULLIFY(&nameRef,false); [line 25]\n NULLIFY(&self,false); [line 25]\n " color=yellow style=filled]
5 [label="5: Start TollBridgeExample_bridge\nFormals: self:class TollBridgeExample *\nLocals: a:class NSLocale * nameRef:struct __CFLocale * \n DECLARE_LOCALS(&return,&a,&nameRef); [line 25]\n NULLIFY(&a,false); [line 25]\n NULLIFY(&nameRef,false); [line 25]\n NULLIFY(&self,false); [line 25]\n " color=yellow style=filled]
5 -> 8 ;
@ -66,7 +66,7 @@ digraph iCFG {
2 [label="2: Exit TollBridgeExample_bridgeTransfer \n " color=yellow style=filled]
1 [label="1: Start TollBridgeExample_bridgeTransfer\nFormals: self:class TollBridgeExample *\nLocals: nameRef:struct __CFLocale * a:class NSLocale * \n DECLARE_LOCALS(&return,&nameRef,&a); [line 20]\n NULLIFY(&a,false); [line 20]\n NULLIFY(&nameRef,false); [line 20]\n NULLIFY(&self,false); [line 20]\n " color=yellow style=filled]
1 [label="1: Start TollBridgeExample_bridgeTransfer\nFormals: self:class TollBridgeExample *\nLocals: a:class NSLocale * nameRef:struct __CFLocale * \n DECLARE_LOCALS(&return,&a,&nameRef); [line 20]\n NULLIFY(&a,false); [line 20]\n NULLIFY(&nameRef,false); [line 20]\n NULLIFY(&self,false); [line 20]\n " color=yellow style=filled]
1 -> 4 ;

@ -22,7 +22,7 @@ digraph iCFG {
10 [label="10: Exit main \n " color=yellow style=filled]
9 [label="9: Start main\nFormals: \nLocals: a1:class A * aa:class A * a2:class A * ab:class A * \n DECLARE_LOCALS(&return,&a1,&aa,&a2,&ab); [line 35]\n NULLIFY(&a1,false); [line 35]\n NULLIFY(&a2,false); [line 35]\n NULLIFY(&aa,false); [line 35]\n NULLIFY(&ab,false); [line 35]\n " color=yellow style=filled]
9 [label="9: Start main\nFormals: \nLocals: ab:class A * a2:class A * aa:class A * a1:class A * \n DECLARE_LOCALS(&return,&ab,&a2,&aa,&a1); [line 35]\n NULLIFY(&a1,false); [line 35]\n NULLIFY(&a2,false); [line 35]\n NULLIFY(&aa,false); [line 35]\n NULLIFY(&ab,false); [line 35]\n " color=yellow style=filled]
9 -> 15 ;

@ -59,7 +59,7 @@ digraph iCFG {
5 [label="5: Exit C_initWithCoder:and: \n " color=yellow style=filled]
4 [label="4: Start C_initWithCoder:and:\nFormals: self:class C * aDecoder:class NSString * a:class A *\nLocals: a1:class A * y:int \n DECLARE_LOCALS(&return,&a1,&y); [line 37]\n NULLIFY(&a1,false); [line 37]\n NULLIFY(&aDecoder,false); [line 37]\n NULLIFY(&y,false); [line 37]\n " color=yellow style=filled]
4 [label="4: Start C_initWithCoder:and:\nFormals: self:class C * aDecoder:class NSString * a:class A *\nLocals: y:int a1:class A * \n DECLARE_LOCALS(&return,&y,&a1); [line 37]\n NULLIFY(&a1,false); [line 37]\n NULLIFY(&aDecoder,false); [line 37]\n NULLIFY(&y,false); [line 37]\n " color=yellow style=filled]
4 -> 9 ;

@ -126,7 +126,7 @@ digraph iCFG {
93 [label="93: Exit test2 \n " color=yellow style=filled]
92 [label="92: Start test2\nFormals: target:class A *\nLocals: __assert_fn__:class NSString * __assert_file__:class NSString * \n DECLARE_LOCALS(&return,&__assert_fn__,&__assert_file__); [line 35]\n NULLIFY(&__assert_file__,false); [line 35]\n NULLIFY(&__assert_fn__,false); [line 35]\n " color=yellow style=filled]
92 [label="92: Start test2\nFormals: target:class A *\nLocals: __assert_file__:class NSString * __assert_fn__:class NSString * \n DECLARE_LOCALS(&return,&__assert_file__,&__assert_fn__); [line 35]\n NULLIFY(&__assert_file__,false); [line 35]\n NULLIFY(&__assert_fn__,false); [line 35]\n " color=yellow style=filled]
92 -> 98 ;
@ -250,7 +250,7 @@ digraph iCFG {
60 [label="60: Exit test1 \n " color=yellow style=filled]
59 [label="59: Start test1\nFormals: target:class A *\nLocals: __assert_fn__:class NSString * __assert_file__:class NSString * \n DECLARE_LOCALS(&return,&__assert_fn__,&__assert_file__); [line 30]\n NULLIFY(&__assert_file__,false); [line 30]\n NULLIFY(&__assert_fn__,false); [line 30]\n " color=yellow style=filled]
59 [label="59: Start test1\nFormals: target:class A *\nLocals: __assert_file__:class NSString * __assert_fn__:class NSString * \n DECLARE_LOCALS(&return,&__assert_file__,&__assert_fn__); [line 30]\n NULLIFY(&__assert_file__,false); [line 30]\n NULLIFY(&__assert_fn__,false); [line 30]\n " color=yellow style=filled]
59 -> 65 ;

@ -14,7 +14,7 @@ digraph iCFG {
9 [label="9: Exit __objc_anonymous_block_BlockVar_navigateToURLInBackground:resolver:______1 \n " color=yellow style=filled]
8 [label="8: Start __objc_anonymous_block_BlockVar_navigateToURLInBackground:resolver:______1\nFormals: a:int b:int \nLocals: error:class NSError * res:int \n DECLARE_LOCALS(&return,&error,&res); [line 21]\n NULLIFY(&error,false); [line 21]\n NULLIFY(&res,false); [line 21]\n " color=yellow style=filled]
8 [label="8: Start __objc_anonymous_block_BlockVar_navigateToURLInBackground:resolver:______1\nFormals: a:int b:int \nLocals: res:int error:class NSError * \n DECLARE_LOCALS(&return,&res,&error); [line 21]\n NULLIFY(&error,false); [line 21]\n NULLIFY(&res,false); [line 21]\n " color=yellow style=filled]
8 -> 12 ;

@ -100,7 +100,7 @@ digraph iCFG {
28 [label="28: Exit MyBlock_array_trans \n " color=yellow style=filled]
27 [label="27: Start MyBlock_array_trans\nFormals: self:class MyBlock *\nLocals: a:class NSArray * objects:class NSArray * enumerateObjectsUsingBlock:_fn_ (*) stop:_Bool * idx:unsigned long object:struct objc_object * \n DECLARE_LOCALS(&return,&a,&objects,&enumerateObjectsUsingBlock,&stop,&idx,&object); [line 28]\n NULLIFY(&a,false); [line 28]\n NULLIFY(&enumerateObjectsUsingBlock,false); [line 28]\n NULLIFY(&idx,false); [line 28]\n NULLIFY(&object,false); [line 28]\n NULLIFY(&objects,false); [line 28]\n NULLIFY(&self,false); [line 28]\n NULLIFY(&stop,false); [line 28]\n " color=yellow style=filled]
27 [label="27: Start MyBlock_array_trans\nFormals: self:class MyBlock *\nLocals: idx:unsigned long object:struct objc_object * stop:_Bool * enumerateObjectsUsingBlock:_fn_ (*) objects:class NSArray * a:class NSArray * \n DECLARE_LOCALS(&return,&idx,&object,&stop,&enumerateObjectsUsingBlock,&objects,&a); [line 28]\n NULLIFY(&a,false); [line 28]\n NULLIFY(&enumerateObjectsUsingBlock,false); [line 28]\n NULLIFY(&idx,false); [line 28]\n NULLIFY(&object,false); [line 28]\n NULLIFY(&objects,false); [line 28]\n NULLIFY(&self,false); [line 28]\n NULLIFY(&stop,false); [line 28]\n " color=yellow style=filled]
27 -> 52 ;
@ -108,7 +108,7 @@ digraph iCFG {
26 -> 25 ;
25 [label="25: DeclStmt \n DECLARE_LOCALS(&infer___objc_anonymous_block_MyBlock_array______1); [line 15]\n DECLARE_LOCALS(&objects); [line 15]\n DECLARE_LOCALS(&stop); [line 15]\n DECLARE_LOCALS(&idx); [line 15]\n DECLARE_LOCALS(&object); [line 15]\n n$21=*&a:class NSArray * [line 15]\n *&objects:class NSArray *=n$21 [line 15]\n REMOVE_TEMPS(n$21); [line 15]\n NULLIFY(&a,false); [line 15]\n " shape="box"]
25 [label="25: DeclStmt \n n$21=*&a:class NSArray * [line 15]\n *&objects:class NSArray *=n$21 [line 15]\n REMOVE_TEMPS(n$21); [line 15]\n NULLIFY(&a,false); [line 15]\n " shape="box"]
25 -> 18 ;
@ -148,7 +148,7 @@ digraph iCFG {
16 -> 5 ;
15 [label="15: DeclStmt \n n$14=*&objects:class NSArray * [line 15]\n n$15=*&idx:unsigned long [line 15]\n n$13=_fun_NSArray_objectAtIndexedSubscript:(n$14:class NSArray *,n$15:unsigned long ) virtual [line 15]\n *&object:struct objc_object *=n$13 [line 15]\n REMOVE_TEMPS(n$13,n$14,n$15); [line 15]\n " shape="box"]
15 [label="15: DeclStmt \n n$14=*&objects:class NSArray * [line 15]\n n$15=*&idx:unsigned long [line 15]\n n$13=_fun_NSArray_objectAtIndexedSubscript:(n$14:class NSArray *,n$15:unsigned long ) virtual [line 15]\n *&object:struct objc_object *=n$13 [line 15]\n REMOVE_TEMPS(n$13,n$14,n$15); [line 15]\n NULLIFY(&object,false); [line 15]\n " shape="box"]
15 -> 14 ;
@ -198,14 +198,14 @@ digraph iCFG {
4 -> 7 ;
3 [label="3: Call _fun_free \n n$0=*&stop:_Bool * [line 15]\n n$1=_fun_free(n$0:void *) [line 15]\n NULLIFY(&object,true); [line 15]\n NULLIFY(&idx,true); [line 15]\n NULLIFY(&stop,true); [line 15]\n NULLIFY(&objects,true); [line 15]\n REMOVE_TEMPS(n$0,n$1); [line 15]\n NULLIFY(&__objc_anonymous_block_MyBlock_array______1,true); [line 15]\n NULLIFY(&infer___objc_anonymous_block_MyBlock_array______1,true); [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"]
3 [label="3: Call _fun_free \n NULLIFY(&idx,false); [line 15]\n NULLIFY(&infer___objc_anonymous_block_MyBlock_array______1,false); [line 15]\n NULLIFY(&objects,false); [line 15]\n n$0=*&stop:_Bool * [line 15]\n n$1=_fun_free(n$0:void *) [line 15]\n NULLIFY(&object,true); [line 15]\n NULLIFY(&idx,true); [line 15]\n NULLIFY(&stop,true); [line 15]\n NULLIFY(&objects,true); [line 15]\n REMOVE_TEMPS(n$0,n$1); [line 15]\n NULLIFY(&__objc_anonymous_block_MyBlock_array______1,true); [line 15]\n NULLIFY(&infer___objc_anonymous_block_MyBlock_array______1,true); [line 15]\n NULLIFY(&idx,false); [line 15]\n NULLIFY(&infer___objc_anonymous_block_MyBlock_array______1,false); [line 15]\n NULLIFY(&objects,false); [line 15]\n NULLIFY(&stop,false); [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"]
3 -> 2 ;
2 [label="2: Exit MyBlock_array \n " color=yellow style=filled]
1 [label="1: Start MyBlock_array\nFormals: self:class MyBlock *\nLocals: a:class NSArray * \n DECLARE_LOCALS(&return,&a); [line 12]\n NULLIFY(&a,false); [line 12]\n NULLIFY(&self,false); [line 12]\n " color=yellow style=filled]
1 [label="1: Start MyBlock_array\nFormals: self:class MyBlock *\nLocals: idx:unsigned long object:struct objc_object * stop:_Bool * infer___objc_anonymous_block_MyBlock_array______1:_fn_ (*) objects:class NSArray * a:class NSArray * \n DECLARE_LOCALS(&return,&idx,&object,&stop,&infer___objc_anonymous_block_MyBlock_array______1,&objects,&a); [line 12]\n NULLIFY(&a,false); [line 12]\n NULLIFY(&idx,false); [line 12]\n NULLIFY(&infer___objc_anonymous_block_MyBlock_array______1,false); [line 12]\n NULLIFY(&object,false); [line 12]\n NULLIFY(&objects,false); [line 12]\n NULLIFY(&self,false); [line 12]\n NULLIFY(&stop,false); [line 12]\n " color=yellow style=filled]
1 -> 26 ;

@ -52,7 +52,7 @@ digraph iCFG {
12 [label="12: Exit __objc_anonymous_block_main1______2 \n " color=yellow style=filled]
11 [label="11: Start __objc_anonymous_block_main1______2\nFormals: x:int c:int d:int \nLocals: addblock2:_fn_ (*) add2:int bla:int \nCaptured: x:int \n DECLARE_LOCALS(&return,&addblock2,&add2,&bla); [line 19]\n NULLIFY(&add2,false); [line 19]\n NULLIFY(&addblock2,false); [line 19]\n NULLIFY(&d,false); [line 19]\n " color=yellow style=filled]
11 [label="11: Start __objc_anonymous_block_main1______2\nFormals: x:int c:int d:int \nLocals: bla:int add2:int addblock2:_fn_ (*)\nCaptured: x:int \n DECLARE_LOCALS(&return,&bla,&add2,&addblock2); [line 19]\n NULLIFY(&add2,false); [line 19]\n NULLIFY(&addblock2,false); [line 19]\n NULLIFY(&d,false); [line 19]\n " color=yellow style=filled]
11 -> 19 ;
@ -90,7 +90,7 @@ digraph iCFG {
2 [label="2: Exit main1 \n " color=yellow style=filled]
1 [label="1: Start main1\nFormals: y:int \nLocals: x:int add1:int add2:int addblock:_fn_ (*) \n DECLARE_LOCALS(&return,&x,&add1,&add2,&addblock); [line 10]\n NULLIFY(&add1,false); [line 10]\n NULLIFY(&add2,false); [line 10]\n NULLIFY(&addblock,false); [line 10]\n NULLIFY(&y,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main1\nFormals: y:int \nLocals: addblock:_fn_ (*) add2:int add1:int x:int \n DECLARE_LOCALS(&return,&addblock,&add2,&add1,&x); [line 10]\n NULLIFY(&add1,false); [line 10]\n NULLIFY(&add2,false); [line 10]\n NULLIFY(&addblock,false); [line 10]\n NULLIFY(&y,false); [line 10]\n " color=yellow style=filled]
1 -> 22 ;

@ -33,7 +33,7 @@ digraph iCFG {
2 [label="2: Exit My_manager_my_mehtod \n " color=yellow style=filled]
1 [label="1: Start My_manager_my_mehtod\nFormals: self:class My_manager *\nLocals: b:_fn_ (*) z:int \n DECLARE_LOCALS(&return,&b,&z); [line 21]\n NULLIFY(&b,false); [line 21]\n NULLIFY(&self,false); [line 21]\n " color=yellow style=filled]
1 [label="1: Start My_manager_my_mehtod\nFormals: self:class My_manager *\nLocals: z:int b:_fn_ (*) \n DECLARE_LOCALS(&return,&z,&b); [line 21]\n NULLIFY(&b,false); [line 21]\n NULLIFY(&self,false); [line 21]\n " color=yellow style=filled]
1 -> 10 ;

@ -71,7 +71,7 @@ digraph iCFG {
2 [label="2: Exit My_manager_my_mehtod \n " color=yellow style=filled]
1 [label="1: Start My_manager_my_mehtod\nFormals: self:class My_manager *\nLocals: b:_fn_ (*) z:int context:struct CGContext * newImage:struct CGImage * \n DECLARE_LOCALS(&return,&b,&z,&context,&newImage); [line 22]\n NULLIFY(&b,false); [line 22]\n NULLIFY(&context,false); [line 22]\n NULLIFY(&self,false); [line 22]\n NULLIFY(&z,false); [line 22]\n " color=yellow style=filled]
1 [label="1: Start My_manager_my_mehtod\nFormals: self:class My_manager *\nLocals: newImage:struct CGImage * context:struct CGContext * z:int b:_fn_ (*) \n DECLARE_LOCALS(&return,&newImage,&context,&z,&b); [line 22]\n NULLIFY(&b,false); [line 22]\n NULLIFY(&context,false); [line 22]\n NULLIFY(&self,false); [line 22]\n NULLIFY(&z,false); [line 22]\n " color=yellow style=filled]
1 -> 19 ;

@ -93,7 +93,7 @@ digraph iCFG {
2 [label="2: Exit Boxing_getIntExp \n " color=yellow style=filled]
1 [label="1: Start Boxing_getIntExp\nFormals: self:class Boxing *\nLocals: x:int y:int n:class NSNumber * \n DECLARE_LOCALS(&return,&x,&y,&n); [line 14]\n NULLIFY(&n,false); [line 14]\n NULLIFY(&self,false); [line 14]\n NULLIFY(&x,false); [line 14]\n NULLIFY(&y,false); [line 14]\n " color=yellow style=filled]
1 [label="1: Start Boxing_getIntExp\nFormals: self:class Boxing *\nLocals: n:class NSNumber * y:int x:int \n DECLARE_LOCALS(&return,&n,&y,&x); [line 14]\n NULLIFY(&n,false); [line 14]\n NULLIFY(&self,false); [line 14]\n NULLIFY(&x,false); [line 14]\n NULLIFY(&y,false); [line 14]\n " color=yellow style=filled]
1 -> 6 ;

@ -35,7 +35,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: s:class NSString * germanCars:class NSArray * item:class NSString * \n DECLARE_LOCALS(&return,&s,&germanCars,&item); [line 14]\n NULLIFY(&germanCars,false); [line 14]\n NULLIFY(&item,false); [line 14]\n NULLIFY(&s,false); [line 14]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: item:class NSString * germanCars:class NSArray * s:class NSString * \n DECLARE_LOCALS(&return,&item,&germanCars,&s); [line 14]\n NULLIFY(&germanCars,false); [line 14]\n NULLIFY(&item,false); [line 14]\n NULLIFY(&s,false); [line 14]\n " color=yellow style=filled]
1 -> 10 ;

@ -35,7 +35,7 @@ digraph iCFG {
11 [label="11: Exit A_while_loop: \n " color=yellow style=filled]
10 [label="10: Start A_while_loop:\nFormals: self:class A * items:class NSArray *\nLocals: size:int item:class NSArray * \n DECLARE_LOCALS(&return,&size,&item); [line 25]\n NULLIFY(&item,false); [line 25]\n NULLIFY(&self,false); [line 25]\n NULLIFY(&size,false); [line 25]\n " color=yellow style=filled]
10 [label="10: Start A_while_loop:\nFormals: self:class A * items:class NSArray *\nLocals: item:class NSArray * size:int \n DECLARE_LOCALS(&return,&item,&size); [line 25]\n NULLIFY(&item,false); [line 25]\n NULLIFY(&self,false); [line 25]\n NULLIFY(&size,false); [line 25]\n " color=yellow style=filled]
10 -> 19 ;
@ -71,7 +71,7 @@ digraph iCFG {
2 [label="2: Exit A_fast_loop: \n " color=yellow style=filled]
1 [label="1: Start A_fast_loop:\nFormals: self:class A * items:class NSArray *\nLocals: size:int item:class NSArray * \n DECLARE_LOCALS(&return,&size,&item); [line 17]\n NULLIFY(&item,false); [line 17]\n NULLIFY(&self,false); [line 17]\n NULLIFY(&size,false); [line 17]\n " color=yellow style=filled]
1 [label="1: Start A_fast_loop:\nFormals: self:class A * items:class NSArray *\nLocals: item:class NSArray * size:int \n DECLARE_LOCALS(&return,&item,&size); [line 17]\n NULLIFY(&item,false); [line 17]\n NULLIFY(&self,false); [line 17]\n NULLIFY(&size,false); [line 17]\n " color=yellow style=filled]
1 -> 9 ;

@ -52,7 +52,7 @@ digraph iCFG {
2 [label="2: Exit MyClass_aMethod \n " color=yellow style=filled]
1 [label="1: Start MyClass_aMethod\nFormals: self:class MyClass *\nLocals: i:int j:int \n DECLARE_LOCALS(&return,&i,&j); [line 18]\n NULLIFY(&i,false); [line 18]\n NULLIFY(&j,false); [line 18]\n NULLIFY(&self,false); [line 18]\n " color=yellow style=filled]
1 [label="1: Start MyClass_aMethod\nFormals: self:class MyClass *\nLocals: j:int i:int \n DECLARE_LOCALS(&return,&j,&i); [line 18]\n NULLIFY(&i,false); [line 18]\n NULLIFY(&j,false); [line 18]\n NULLIFY(&self,false); [line 18]\n " color=yellow style=filled]
1 -> 14 ;

@ -50,7 +50,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: aWeakRef:class A __weak * aStrongRef:class A * anUnsafeUnretRef:class A __unsafe_unretained * anAutoRelRef:class A __autoreleasing * aStdRef:class A * \n DECLARE_LOCALS(&return,&aWeakRef,&aStrongRef,&anUnsafeUnretRef,&anAutoRelRef,&aStdRef); [line 20]\n NULLIFY(&aStdRef,false); [line 20]\n NULLIFY(&aStrongRef,false); [line 20]\n NULLIFY(&aWeakRef,false); [line 20]\n NULLIFY(&anAutoRelRef,false); [line 20]\n NULLIFY(&anUnsafeUnretRef,false); [line 20]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: aStdRef:class A * anAutoRelRef:class A __autoreleasing * anUnsafeUnretRef:class A __unsafe_unretained * aStrongRef:class A * aWeakRef:class A __weak * \n DECLARE_LOCALS(&return,&aStdRef,&anAutoRelRef,&anUnsafeUnretRef,&aStrongRef,&aWeakRef); [line 20]\n NULLIFY(&aStdRef,false); [line 20]\n NULLIFY(&aStrongRef,false); [line 20]\n NULLIFY(&aWeakRef,false); [line 20]\n NULLIFY(&anAutoRelRef,false); [line 20]\n NULLIFY(&anUnsafeUnretRef,false); [line 20]\n " color=yellow style=filled]
1 -> 14 ;

@ -43,7 +43,7 @@ digraph iCFG {
14 [label="14: Exit main \n " color=yellow style=filled]
13 [label="13: Start main\nFormals: \nLocals: x:int o:class AClass * \n DECLARE_LOCALS(&return,&x,&o); [line 41]\n NULLIFY(&o,false); [line 41]\n NULLIFY(&x,false); [line 41]\n " color=yellow style=filled]
13 [label="13: Start main\nFormals: \nLocals: o:class AClass * x:int \n DECLARE_LOCALS(&return,&o,&x); [line 41]\n NULLIFY(&o,false); [line 41]\n NULLIFY(&x,false); [line 41]\n " color=yellow style=filled]
13 -> 24 ;

@ -14,7 +14,7 @@ digraph iCFG {
5 [label="5: Exit test \n " color=yellow style=filled]
4 [label="4: Start test\nFormals: \nLocals: c1:class C * c2:class C * a:class C *[3] \n DECLARE_LOCALS(&return,&c1,&c2,&a); [line 21]\n NULLIFY(&a,false); [line 21]\n NULLIFY(&c1,false); [line 21]\n NULLIFY(&c2,false); [line 21]\n " color=yellow style=filled]
4 [label="4: Start test\nFormals: \nLocals: a:class C *[3] c2:class C * c1:class C * \n DECLARE_LOCALS(&return,&a,&c2,&c1); [line 21]\n NULLIFY(&a,false); [line 21]\n NULLIFY(&c1,false); [line 21]\n NULLIFY(&c2,false); [line 21]\n " color=yellow style=filled]
4 -> 8 ;
@ -25,7 +25,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: z:int a:int [2][3] \n DECLARE_LOCALS(&return,&z,&a); [line 12]\n NULLIFY(&a,false); [line 12]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: a:int [2][3] z:int \n DECLARE_LOCALS(&return,&a,&z); [line 12]\n NULLIFY(&a,false); [line 12]\n " color=yellow style=filled]
1 -> 3 ;

@ -10,7 +10,7 @@ digraph iCFG {
2 [label="2: Exit main \n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: a:int b:int \n DECLARE_LOCALS(&return,&a,&b); [line 10]\n NULLIFY(&a,false); [line 10]\n NULLIFY(&b,false); [line 10]\n " color=yellow style=filled]
1 [label="1: Start main\nFormals: \nLocals: b:int a:int \n DECLARE_LOCALS(&return,&b,&a); [line 10]\n NULLIFY(&a,false); [line 10]\n NULLIFY(&b,false); [line 10]\n " color=yellow style=filled]
1 -> 4 ;

Loading…
Cancel
Save