From 5f925869b6a907dcd9cb2efa83ae34376e6a2835 Mon Sep 17 00:00:00 2001 From: Sungkeun Cho Date: Tue, 27 Nov 2018 04:34:22 -0800 Subject: [PATCH] [infer] Translate more casts (unsigned int) Reviewed By: mbouaziz Differential Revision: D13167384 fbshipit-source-id: 666a52617 --- infer/src/IR/Exp.ml | 5 ++++ infer/src/IR/Exp.mli | 4 +++ infer/src/IR/Typ.ml | 4 +++ infer/src/IR/Typ.mli | 4 +++ .../bufferoverrun/bufferOverrunSemantics.ml | 17 +++++++++--- infer/src/checkers/liveness.ml | 26 ++++++++++++------- infer/src/clang/cTrans_utils.ml | 2 ++ .../c/frontend/enumeration/enum.c.dot | 4 +-- .../c/frontend/enumeration/other_enum.c.dot | 6 ++--- .../tests/codetoanalyze/cpp/errors/issues.exp | 4 +-- .../cpp/shared/templates/sizeof_pack.cpp.dot | 4 +-- .../objc/frontend/boxing/array.m.dot | 2 +- .../fast_enumeration/Fast_enumeration.m.dot | 2 +- .../objc/shared/block/block-it.m.dot | 2 +- .../objc/shared/block/block_release.m.dot | 2 +- .../objc/shared/block/dispatch_examples.m.dot | 4 +-- 16 files changed, 63 insertions(+), 29 deletions(-) diff --git a/infer/src/IR/Exp.ml b/infer/src/IR/Exp.ml index dadb906db..30e819266 100644 --- a/infer/src/IR/Exp.ml +++ b/infer/src/IR/Exp.ml @@ -318,3 +318,8 @@ let zero_of_type typ = let zero_of_type_exn typ = Option.value_exn (zero_of_type typ) + +let rec ignore_cast e = match e with Cast (_, e) -> ignore_cast e | _ -> e + +let rec ignore_integer_cast e = + match e with Cast (t, e) when Typ.is_int t -> ignore_integer_cast e | _ -> e diff --git a/infer/src/IR/Exp.mli b/infer/src/IR/Exp.mli index 3ee3c4059..5e5992345 100644 --- a/infer/src/IR/Exp.mli +++ b/infer/src/IR/Exp.mli @@ -139,3 +139,7 @@ val zero_of_type : Typ.t -> t option (** Returns the zero value of a type, for int, float and ptr types *) val zero_of_type_exn : Typ.t -> t + +val ignore_cast : t -> t + +val ignore_integer_cast : t -> t diff --git a/infer/src/IR/Typ.ml b/infer/src/IR/Typ.ml index 7f3045a78..96ccdc5e2 100644 --- a/infer/src/IR/Typ.ml +++ b/infer/src/IR/Typ.ml @@ -548,6 +548,10 @@ let is_pointer_to_void typ = match typ.desc with Tptr ({desc= Tvoid}, _) -> true let is_pointer_to_int typ = match typ.desc with Tptr ({desc= Tint _}, _) -> true | _ -> false +let is_int typ = match typ.desc with Tint _ -> true | _ -> false + +let is_unsigned_int typ = match typ.desc with Tint ikind -> ikind_is_unsigned ikind | _ -> false + let has_block_prefix s = match Str.split_delim (Str.regexp_string Config.anonymous_block_prefix) s with | _ :: _ :: _ -> diff --git a/infer/src/IR/Typ.mli b/infer/src/IR/Typ.mli index e15189269..05412c690 100644 --- a/infer/src/IR/Typ.mli +++ b/infer/src/IR/Typ.mli @@ -293,6 +293,10 @@ val is_reference : t -> bool val is_struct : t -> bool +val is_int : t -> bool + +val is_unsigned_int : t -> bool + val has_block_prefix : string -> bool val unsome : string -> t option -> t diff --git a/infer/src/bufferoverrun/bufferOverrunSemantics.ml b/infer/src/bufferoverrun/bufferOverrunSemantics.ml index fc347b607..dbfdfeeca 100644 --- a/infer/src/bufferoverrun/bufferOverrunSemantics.ml +++ b/infer/src/bufferoverrun/bufferOverrunSemantics.ml @@ -428,6 +428,8 @@ module Prune = struct let rec prune_binop_left : Typ.IntegerWidths.t -> Exp.t -> t -> t = fun integer_type_widths e ({mem} as astate) -> match e with + | Exp.BinOp (comp, Exp.Cast (_, e1), e2) -> + prune_binop_left integer_type_widths (Exp.BinOp (comp, e1, e2)) astate | Exp.BinOp ((Binop.Lt as comp), Exp.Var x, e') | Exp.BinOp ((Binop.Gt as comp), Exp.Var x, e') | Exp.BinOp ((Binop.Le as comp), Exp.Var x, e') @@ -513,11 +515,18 @@ module Prune = struct |> prune_binop_left integer_type_widths e |> prune_binop_right integer_type_widths e in + let is_const_zero x = + match Exp.ignore_integer_cast x with + | Exp.Const (Const.Cint i) -> + IntLit.iszero i + | _ -> + false + in match e with - | Exp.BinOp (Binop.Ne, e, Exp.Const (Const.Cint i)) when IntLit.iszero i -> - prune_helper integer_type_widths e astate - | Exp.BinOp (Binop.Eq, e, Exp.Const (Const.Cint i)) when IntLit.iszero i -> - prune_helper integer_type_widths (Exp.UnOp (Unop.LNot, e, None)) astate + | Exp.BinOp (Binop.Ne, e1, e2) when is_const_zero e2 -> + prune_helper integer_type_widths e1 astate + | Exp.BinOp (Binop.Eq, e1, e2) when is_const_zero e2 -> + prune_helper integer_type_widths (Exp.UnOp (Unop.LNot, e1, None)) astate | Exp.UnOp (Unop.Neg, Exp.Var x, _) -> prune_helper integer_type_widths (Exp.Var x) astate | Exp.BinOp (Binop.LAnd, e1, e2) -> diff --git a/infer/src/checkers/liveness.ml b/infer/src/checkers/liveness.ml index 5e1da1091..903de7eee 100644 --- a/infer/src/checkers/liveness.ml +++ b/infer/src/checkers/liveness.ml @@ -34,13 +34,14 @@ module TransferFunctions (CFG : ProcCfg.S) = struct let add_live_actuals actuals call_exp live_acc = let add_live_actuals_ exps acc = - List.fold exps ~f:(fun acc_ (exp, _) -> exp_add_live exp acc_) ~init:acc + List.fold exps ~f:(fun acc_ exp -> exp_add_live exp acc_) ~init:acc in - match call_exp with + let actuals = List.map actuals ~f:(fun (e, _) -> Exp.ignore_cast e) in + match Exp.ignore_cast call_exp with | Exp.Const (Cfun (Typ.Procname.ObjC_Cpp _ as pname)) when Typ.Procname.is_constructor pname -> ( (* first actual passed to a C++ constructor is actually written, not read *) match actuals with - | (Exp.Lvar pvar, _) :: exps -> + | Exp.Lvar pvar :: exps -> Domain.remove (Var.of_pvar pvar) live_acc |> add_live_actuals_ exps | exps -> add_live_actuals_ exps live_acc ) @@ -103,7 +104,7 @@ module CapturedByRefTransferFunctions (CFG : ProcCfg.S) = struct ~f:(fun acc exp -> Exp.fold_captured exp ~f:(fun acc exp -> - match exp with + match Exp.ignore_cast exp with | Exp.Lvar pvar -> (* captured by reference, add *) Domain.add (Var.of_pvar pvar) acc @@ -133,7 +134,9 @@ let checker {Callbacks.tenv; summary; proc_desc} : Summary.t = (* we don't want to report in harmless cases like int i = 0; if (...) { i = ... } else { i = ... } that create an intentional dead store as an attempt to imitate default value semantics. use dead stores to a "sentinel" value as a heuristic for ignoring this case *) - let is_sentinel_exp = function + let rec is_sentinel_exp = function + | Exp.Cast (_, e) -> + is_sentinel_exp e | Exp.Const (Cint i) -> IntLit.iszero i || IntLit.isnull i | Exp.Const (Cfloat 0.0) -> @@ -180,11 +183,14 @@ let checker {Callbacks.tenv; summary; proc_desc} : Summary.t = when should_report pvar typ live_vars captured_by_ref_vars && not (is_sentinel_exp rhs_exp) -> log_report pvar typ loc - | Sil.Call - (_, Exp.Const (Cfun (Typ.Procname.ObjC_Cpp _ as pname)), (Exp.Lvar pvar, typ) :: _, loc, _) - when Typ.Procname.is_constructor pname - && should_report pvar typ live_vars captured_by_ref_vars -> - log_report pvar typ loc + | Sil.Call (_, e_fun, (arg, typ) :: _, loc, _) -> ( + match (Exp.ignore_cast e_fun, Exp.ignore_cast arg) with + | Exp.Const (Cfun (Typ.Procname.ObjC_Cpp _ as pname)), Exp.Lvar pvar + when Typ.Procname.is_constructor pname + && should_report pvar typ live_vars captured_by_ref_vars -> + log_report pvar typ loc + | _, _ -> + () ) | _ -> () in diff --git a/infer/src/clang/cTrans_utils.ml b/infer/src/clang/cTrans_utils.ml index 6e9bcd63a..24947856f 100644 --- a/infer/src/clang/cTrans_utils.ml +++ b/infer/src/clang/cTrans_utils.ml @@ -483,6 +483,8 @@ let cast_operation cast_kind ((exp, typ) as exp_typ) cast_typ sil_loc = ([], exp_typ) | `BitCast when Typ.is_pointer_to_int cast_typ -> ([], (Exp.Cast (cast_typ, exp), cast_typ)) + | `IntegralCast when Typ.is_unsigned_int cast_typ -> + ([], (Exp.Cast (cast_typ, exp), cast_typ)) | `BitCast | `IntegralCast | `IntegralToBoolean -> (* This is treated as a nop by returning the same expressions exps*) ([], (exp, cast_typ)) diff --git a/infer/tests/codetoanalyze/c/frontend/enumeration/enum.c.dot b/infer/tests/codetoanalyze/c/frontend/enumeration/enum.c.dot index 3b2102af4..cee9b8ec0 100644 --- a/infer/tests/codetoanalyze/c/frontend/enumeration/enum.c.dot +++ b/infer/tests/codetoanalyze/c/frontend/enumeration/enum.c.dot @@ -15,11 +15,11 @@ digraph cfg { "main.fad58de7366495db4650cfefac2fcd61_4" -> "main.fad58de7366495db4650cfefac2fcd61_3" ; -"main.fad58de7366495db4650cfefac2fcd61_5" [label="5: BinaryOperatorStmt: Assign \n *&today:int=(2 + 1) [line 23, column 3]\n NULLIFY(&today); [line 23, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_5" [label="5: BinaryOperatorStmt: Assign \n *&today:int=((unsigned int)2 + (unsigned int)1) [line 23, column 3]\n NULLIFY(&today); [line 23, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_5" -> "main.fad58de7366495db4650cfefac2fcd61_4" ; -"main.fad58de7366495db4650cfefac2fcd61_6" [label="6: BinaryOperatorStmt: Assign \n n$1=*&today:int [line 22, column 11]\n *&today:int=(n$1 + 4) [line 22, column 3]\n REMOVE_TEMPS(n$1); [line 22, column 3]\n NULLIFY(&today); [line 22, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_6" [label="6: BinaryOperatorStmt: Assign \n n$1=*&today:int [line 22, column 11]\n *&today:int=((unsigned int)n$1 + (unsigned int)4) [line 22, column 3]\n REMOVE_TEMPS(n$1); [line 22, column 3]\n NULLIFY(&today); [line 22, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_6" -> "main.fad58de7366495db4650cfefac2fcd61_5" ; diff --git a/infer/tests/codetoanalyze/c/frontend/enumeration/other_enum.c.dot b/infer/tests/codetoanalyze/c/frontend/enumeration/other_enum.c.dot index 7b6f63e03..f0106ef5e 100644 --- a/infer/tests/codetoanalyze/c/frontend/enumeration/other_enum.c.dot +++ b/infer/tests/codetoanalyze/c/frontend/enumeration/other_enum.c.dot @@ -55,15 +55,15 @@ digraph cfg { "other_enum_test.100f3583adf0259001be6c944828c44a_5" -> "other_enum_test.100f3583adf0259001be6c944828c44a_6" ; "other_enum_test.100f3583adf0259001be6c944828c44a_5" -> "other_enum_test.100f3583adf0259001be6c944828c44a_7" ; -"other_enum_test.100f3583adf0259001be6c944828c44a_6" [label="6: Prune (true branch, if) \n PRUNE((n$0 == 12), true); [line 23, column 7]\n REMOVE_TEMPS(n$0); [line 23, column 7]\n " shape="invhouse"] +"other_enum_test.100f3583adf0259001be6c944828c44a_6" [label="6: Prune (true branch, if) \n PRUNE(((unsigned int)n$0 == (unsigned int)12), true); [line 23, column 7]\n REMOVE_TEMPS(n$0); [line 23, column 7]\n " shape="invhouse"] "other_enum_test.100f3583adf0259001be6c944828c44a_6" -> "other_enum_test.100f3583adf0259001be6c944828c44a_8" ; -"other_enum_test.100f3583adf0259001be6c944828c44a_7" [label="7: Prune (false branch, if) \n PRUNE(!(n$0 == 12), false); [line 23, column 7]\n REMOVE_TEMPS(n$0); [line 23, column 7]\n NULLIFY(&foo_a); [line 23, column 7]\n NULLIFY(&foo_g); [line 23, column 7]\n " shape="invhouse"] +"other_enum_test.100f3583adf0259001be6c944828c44a_7" [label="7: Prune (false branch, if) \n PRUNE(!((unsigned int)n$0 == (unsigned int)12), false); [line 23, column 7]\n REMOVE_TEMPS(n$0); [line 23, column 7]\n NULLIFY(&foo_a); [line 23, column 7]\n NULLIFY(&foo_g); [line 23, column 7]\n " shape="invhouse"] "other_enum_test.100f3583adf0259001be6c944828c44a_7" -> "other_enum_test.100f3583adf0259001be6c944828c44a_9" ; -"other_enum_test.100f3583adf0259001be6c944828c44a_8" [label="8: Return Stmt \n n$1=*&foo_g:int [line 24, column 12]\n n$2=*&foo_a:int [line 24, column 20]\n *&return:int=(n$1 / n$2) [line 24, column 5]\n REMOVE_TEMPS(n$1,n$2); [line 24, column 5]\n NULLIFY(&foo_a); [line 24, column 5]\n NULLIFY(&foo_g); [line 24, column 5]\n APPLY_ABSTRACTION; [line 24, column 5]\n " shape="box"] +"other_enum_test.100f3583adf0259001be6c944828c44a_8" [label="8: Return Stmt \n n$1=*&foo_g:int [line 24, column 12]\n n$2=*&foo_a:int [line 24, column 20]\n *&return:int=((unsigned int)n$1 / (unsigned int)n$2) [line 24, column 5]\n REMOVE_TEMPS(n$1,n$2); [line 24, column 5]\n NULLIFY(&foo_a); [line 24, column 5]\n NULLIFY(&foo_g); [line 24, column 5]\n APPLY_ABSTRACTION; [line 24, column 5]\n " shape="box"] "other_enum_test.100f3583adf0259001be6c944828c44a_8" -> "other_enum_test.100f3583adf0259001be6c944828c44a_2" ; diff --git a/infer/tests/codetoanalyze/cpp/errors/issues.exp b/infer/tests/codetoanalyze/cpp/errors/issues.exp index b5eaf0f4b..337f85dc6 100644 --- a/infer/tests/codetoanalyze/cpp/errors/issues.exp +++ b/infer/tests/codetoanalyze/cpp/errors/issues.exp @@ -232,7 +232,7 @@ codetoanalyze/cpp/shared/constructors/constructor_init.cpp, f2_div0, 2, DIVIDE_B codetoanalyze/cpp/shared/constructors/constructor_init.cpp, f_div0, 2, DIVIDE_BY_ZERO, no_bucket, ERROR, [start of procedure f_div0(),start of procedure B,start of procedure A,return from a call to A_A,start of procedure T,return from a call to B::T_T,return from a call to B_B] codetoanalyze/cpp/shared/constructors/constructor_init.cpp, t_div0, 2, DIVIDE_BY_ZERO, no_bucket, ERROR, [start of procedure t_div0(),start of procedure B,start of procedure A,return from a call to A_A,start of procedure T,return from a call to B::T_T,return from a call to B_B] codetoanalyze/cpp/shared/constructors/constructor_new.cpp, constructor_new::array_of_class_with_not_constant_size, 2, MEMORY_LEAK, CPP, ERROR, [start of procedure constructor_new::array_of_class_with_not_constant_size(),start of procedure constructor_new::getValue(),return from a call to constructor_new::getValue,Condition is true,return from a call to constructor_new::array_of_class_with_not_constant_size] -codetoanalyze/cpp/shared/constructors/constructor_new.cpp, constructor_new::array_of_person_with_constant_size, 0, MEMORY_LEAK, CPP, ERROR, [start of procedure constructor_new::array_of_person_with_constant_size(),start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,return from a call to constructor_new::array_of_person_with_constant_size] +codetoanalyze/cpp/shared/constructors/constructor_new.cpp, constructor_new::array_of_person_with_constant_size, 0, MEMORY_LEAK, CPP, ERROR, [start of procedure constructor_new::array_of_person_with_constant_size(),return from a call to constructor_new::array_of_person_with_constant_size] codetoanalyze/cpp/shared/constructors/constructor_new.cpp, constructor_new::constructor_1_arg_new_div0, 2, DIVIDE_BY_ZERO, no_bucket, ERROR, [start of procedure constructor_new::constructor_1_arg_new_div0(),start of procedure Person,return from a call to constructor_new::Person_Person] codetoanalyze/cpp/shared/constructors/constructor_new.cpp, constructor_new::constructor_1_arg_new_div0, 3, MEMORY_LEAK, CPP, ERROR, [start of procedure constructor_new::constructor_1_arg_new_div0(),start of procedure Person,return from a call to constructor_new::Person_Person,return from a call to constructor_new::constructor_1_arg_new_div0] codetoanalyze/cpp/shared/constructors/constructor_new.cpp, constructor_new::constructor_3_args_new_div0, 2, DIVIDE_BY_ZERO, no_bucket, ERROR, [start of procedure constructor_new::constructor_3_args_new_div0(),start of procedure Person,return from a call to constructor_new::Person_Person] @@ -255,7 +255,7 @@ codetoanalyze/cpp/shared/constructors/constructor_new.cpp, constructor_new::int_ codetoanalyze/cpp/shared/constructors/constructor_new.cpp, constructor_new::int_init_nodes, 5, MEMORY_LEAK, CPP, ERROR, [start of procedure constructor_new::int_init_nodes(),start of procedure constructor_new::getValue(),return from a call to constructor_new::getValue,start of procedure constructor_new::getValue(),return from a call to constructor_new::getValue,Condition is false,return from a call to constructor_new::int_init_nodes] codetoanalyze/cpp/shared/constructors/constructor_new.cpp, constructor_new::int_init_number, 2, DIVIDE_BY_ZERO, no_bucket, ERROR, [start of procedure constructor_new::int_init_number()] codetoanalyze/cpp/shared/constructors/constructor_new.cpp, constructor_new::int_init_number, 3, MEMORY_LEAK, CPP, ERROR, [start of procedure constructor_new::int_init_number(),return from a call to constructor_new::int_init_number] -codetoanalyze/cpp/shared/constructors/constructor_new.cpp, constructor_new::matrix_of_person, 3, MEMORY_LEAK, CPP, ERROR, [start of procedure constructor_new::matrix_of_person(),start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,start of procedure Person,return from a call to constructor_new::Person_Person,return from a call to constructor_new::matrix_of_person] +codetoanalyze/cpp/shared/constructors/constructor_new.cpp, constructor_new::matrix_of_person, 3, MEMORY_LEAK, CPP, ERROR, [start of procedure constructor_new::matrix_of_person(),return from a call to constructor_new::matrix_of_person] codetoanalyze/cpp/shared/constructors/constructor_with_body.cpp, constructor_with_body::test_div0, 2, DIVIDE_BY_ZERO, no_bucket, ERROR, [start of procedure constructor_with_body::test_div0(),start of procedure X,start of procedure init,return from a call to constructor_with_body::X_init,return from a call to constructor_with_body::X_X,start of procedure div] codetoanalyze/cpp/shared/constructors/constructor_with_body.cpp, constructor_with_body::test_div0_default_constructor, 2, DIVIDE_BY_ZERO, no_bucket, ERROR, [start of procedure constructor_with_body::test_div0_default_constructor(),start of procedure X,start of procedure init,return from a call to constructor_with_body::X_init,return from a call to constructor_with_body::X_X,start of procedure div] codetoanalyze/cpp/shared/constructors/copy_array_field.cpp, copy_array_field::npe, 4, NULL_DEREFERENCE, B1, ERROR, [start of procedure copy_array_field::npe(),start of procedure X,return from a call to copy_array_field::X_X,start of procedure X,return from a call to copy_array_field::X_X] diff --git a/infer/tests/codetoanalyze/cpp/shared/templates/sizeof_pack.cpp.dot b/infer/tests/codetoanalyze/cpp/shared/templates/sizeof_pack.cpp.dot index d98e3f498..b9e603193 100644 --- a/infer/tests/codetoanalyze/cpp/shared/templates/sizeof_pack.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/shared/templates/sizeof_pack.cpp.dot @@ -26,11 +26,11 @@ digraph cfg { "hash_combine_generic#343026119801841589.3016efe6a900b985af0e18a37325385b_4" -> "hash_combine_generic#343026119801841589.3016efe6a900b985af0e18a37325385b_3" ; -"hash_combine_generic#343026119801841589.3016efe6a900b985af0e18a37325385b_5" [label="5: Prune (true branch, if) \n PRUNE((_t$0 == 0), true); [line 15, column 7]\n REMOVE_TEMPS(_t$0); [line 15, column 7]\n " shape="invhouse"] +"hash_combine_generic#343026119801841589.3016efe6a900b985af0e18a37325385b_5" [label="5: Prune (true branch, if) \n PRUNE((_t$0 == (unsigned long)0), true); [line 15, column 7]\n REMOVE_TEMPS(_t$0); [line 15, column 7]\n " shape="invhouse"] "hash_combine_generic#343026119801841589.3016efe6a900b985af0e18a37325385b_5" -> "hash_combine_generic#343026119801841589.3016efe6a900b985af0e18a37325385b_7" ; -"hash_combine_generic#343026119801841589.3016efe6a900b985af0e18a37325385b_6" [label="6: Prune (false branch, if) \n PRUNE(!(_t$0 == 0), false); [line 15, column 7]\n REMOVE_TEMPS(_t$0); [line 15, column 7]\n NULLIFY(&seed); [line 15, column 7]\n " shape="invhouse"] +"hash_combine_generic#343026119801841589.3016efe6a900b985af0e18a37325385b_6" [label="6: Prune (false branch, if) \n PRUNE(!(_t$0 == (unsigned long)0), false); [line 15, column 7]\n REMOVE_TEMPS(_t$0); [line 15, column 7]\n NULLIFY(&seed); [line 15, column 7]\n " shape="invhouse"] "hash_combine_generic#343026119801841589.3016efe6a900b985af0e18a37325385b_6" -> "hash_combine_generic#343026119801841589.3016efe6a900b985af0e18a37325385b_4" ; diff --git a/infer/tests/codetoanalyze/objc/frontend/boxing/array.m.dot b/infer/tests/codetoanalyze/objc/frontend/boxing/array.m.dot index b7d107aeb..458464ca1 100644 --- a/infer/tests/codetoanalyze/objc/frontend/boxing/array.m.dot +++ b/infer/tests/codetoanalyze/objc/frontend/boxing/array.m.dot @@ -40,7 +40,7 @@ digraph cfg { "main.fad58de7366495db4650cfefac2fcd61_10" -> "main.fad58de7366495db4650cfefac2fcd61_4" ; -"main.fad58de7366495db4650cfefac2fcd61_11" [label="11: BinaryOperatorStmt: Assign \n n$9=*&germanCars:NSArray* [line 22, column 7]\n n$10=_fun_NSArray_objectAtIndexedSubscript:(n$9:NSArray*,3:unsigned long) virtual [line 22, column 7]\n *&s:NSString*=n$10 [line 22, column 3]\n REMOVE_TEMPS(n$9,n$10); [line 22, column 3]\n NULLIFY(&s); [line 22, column 3]\n " shape="box"] +"main.fad58de7366495db4650cfefac2fcd61_11" [label="11: BinaryOperatorStmt: Assign \n n$9=*&germanCars:NSArray* [line 22, column 7]\n n$10=_fun_NSArray_objectAtIndexedSubscript:(n$9:NSArray*,(unsigned long)3:unsigned long) virtual [line 22, column 7]\n *&s:NSString*=n$10 [line 22, column 3]\n REMOVE_TEMPS(n$9,n$10); [line 22, column 3]\n NULLIFY(&s); [line 22, column 3]\n " shape="box"] "main.fad58de7366495db4650cfefac2fcd61_11" -> "main.fad58de7366495db4650cfefac2fcd61_10" ; diff --git a/infer/tests/codetoanalyze/objc/frontend/fast_enumeration/Fast_enumeration.m.dot b/infer/tests/codetoanalyze/objc/frontend/fast_enumeration/Fast_enumeration.m.dot index 97f2a35ea..8bc8e0d18 100644 --- a/infer/tests/codetoanalyze/objc/frontend/fast_enumeration/Fast_enumeration.m.dot +++ b/infer/tests/codetoanalyze/objc/frontend/fast_enumeration/Fast_enumeration.m.dot @@ -99,7 +99,7 @@ digraph cfg { "while_loop:#A(class NSArray)#instance.225f55f19f886cfaa14fc056eca2399b_4" -> "while_loop:#A(class NSArray)#instance.225f55f19f886cfaa14fc056eca2399b_5" ; -"while_loop:#A(class NSArray)#instance.225f55f19f886cfaa14fc056eca2399b_5" [label="5: BinaryOperatorStmt: Assign \n n$12=*&items:NSArray* [line 30, column 19]\n n$13=_fun_NSArray_objectAtIndex:(n$12:NSArray*,3:unsigned long) virtual [line 30, column 18]\n *&item:NSArray*=n$13 [line 30, column 11]\n n$14=*&item:NSArray* [line 30, column 11]\n REMOVE_TEMPS(n$12,n$13); [line 30, column 11]\n " shape="box"] +"while_loop:#A(class NSArray)#instance.225f55f19f886cfaa14fc056eca2399b_5" [label="5: BinaryOperatorStmt: Assign \n n$12=*&items:NSArray* [line 30, column 19]\n n$13=_fun_NSArray_objectAtIndex:(n$12:NSArray*,(unsigned long)3:unsigned long) virtual [line 30, column 18]\n *&item:NSArray*=n$13 [line 30, column 11]\n n$14=*&item:NSArray* [line 30, column 11]\n REMOVE_TEMPS(n$12,n$13); [line 30, column 11]\n " shape="box"] "while_loop:#A(class NSArray)#instance.225f55f19f886cfaa14fc056eca2399b_5" -> "while_loop:#A(class NSArray)#instance.225f55f19f886cfaa14fc056eca2399b_6" ; diff --git a/infer/tests/codetoanalyze/objc/shared/block/block-it.m.dot b/infer/tests/codetoanalyze/objc/shared/block/block-it.m.dot index 43c6e3605..7d5641671 100644 --- a/infer/tests/codetoanalyze/objc/shared/block/block-it.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/block/block-it.m.dot @@ -86,7 +86,7 @@ digraph cfg { "array_trans#MyBlock#instance.13289a590560d0628a3ae5174e716a32_4" -> "array_trans#MyBlock#instance.13289a590560d0628a3ae5174e716a32_7" ; -"array_trans#MyBlock#instance.13289a590560d0628a3ae5174e716a32_5" [label="5: DeclStmt \n n$12=_fun___variable_initialization(&idx:unsigned long) [line 48, column 8]\n *&idx:unsigned long=0 [line 48, column 8]\n REMOVE_TEMPS(n$12); [line 48, column 8]\n APPLY_ABSTRACTION; [line 48, column 8]\n " shape="box"] +"array_trans#MyBlock#instance.13289a590560d0628a3ae5174e716a32_5" [label="5: DeclStmt \n n$12=_fun___variable_initialization(&idx:unsigned long) [line 48, column 8]\n *&idx:unsigned long=(unsigned long)0 [line 48, column 8]\n REMOVE_TEMPS(n$12); [line 48, column 8]\n APPLY_ABSTRACTION; [line 48, column 8]\n " shape="box"] "array_trans#MyBlock#instance.13289a590560d0628a3ae5174e716a32_5" -> "array_trans#MyBlock#instance.13289a590560d0628a3ae5174e716a32_4" ; diff --git a/infer/tests/codetoanalyze/objc/shared/block/block_release.m.dot b/infer/tests/codetoanalyze/objc/shared/block/block_release.m.dot index 5ed08c11f..400ca4da1 100644 --- a/infer/tests/codetoanalyze/objc/shared/block/block_release.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/block/block_release.m.dot @@ -68,7 +68,7 @@ digraph cfg { "blockReleaseNoLeak#My_manager#instance.0c48f80f024250b18a529440f1313af6_10" -> "blockReleaseNoLeak#My_manager#instance.0c48f80f024250b18a529440f1313af6_9" ; -"blockReleaseNoLeak#My_manager#instance.0c48f80f024250b18a529440f1313af6_11" [label="11: DeclStmt \n n$19=_fun___variable_initialization(&context:CGContext*) [line 21, column 3]\n n$18=_fun_CGBitmapContextCreate(null:void*,0:unsigned long,0:unsigned long,8:unsigned long,0:unsigned long,null:CGColorSpace*,0:unsigned int) [line 21, column 26]\n *&context:CGContext*=n$18 [line 21, column 3]\n REMOVE_TEMPS(n$18,n$19); [line 21, column 3]\n " shape="box"] +"blockReleaseNoLeak#My_manager#instance.0c48f80f024250b18a529440f1313af6_11" [label="11: DeclStmt \n n$19=_fun___variable_initialization(&context:CGContext*) [line 21, column 3]\n n$18=_fun_CGBitmapContextCreate(null:void*,(unsigned long)0:unsigned long,(unsigned long)0:unsigned long,(unsigned long)8:unsigned long,(unsigned long)0:unsigned long,null:CGColorSpace*,(unsigned int)0:unsigned int) [line 21, column 26]\n *&context:CGContext*=n$18 [line 21, column 3]\n REMOVE_TEMPS(n$18,n$19); [line 21, column 3]\n " shape="box"] "blockReleaseNoLeak#My_manager#instance.0c48f80f024250b18a529440f1313af6_11" -> "blockReleaseNoLeak#My_manager#instance.0c48f80f024250b18a529440f1313af6_10" ; diff --git a/infer/tests/codetoanalyze/objc/shared/block/dispatch_examples.m.dot b/infer/tests/codetoanalyze/objc/shared/block/dispatch_examples.m.dot index 8a7f7e839..a8c297a9f 100644 --- a/infer/tests/codetoanalyze/objc/shared/block/dispatch_examples.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/block/dispatch_examples.m.dot @@ -101,7 +101,7 @@ digraph cfg { "dispatch_after_example#DispatchEx#class.1d25856bd99eb1ef683c8f65ff46d05d_3" -> "dispatch_after_example#DispatchEx#class.1d25856bd99eb1ef683c8f65ff46d05d_2" ; -"dispatch_after_example#DispatchEx#class.1d25856bd99eb1ef683c8f65ff46d05d_4" [label="4: Call _fun_dispatch_after \n n$18=_fun_dispatch_time(0:unsigned long long,(2 * 1000000000):long long) [line 46, column 18]\n n$19=_fun_dispatch_get_main_queue() [line 47, column 18]\n n$23=_fun_dispatch_after(n$18:unsigned long long,n$19:NSObject*,(_fun_objc_blockDispatchEx_dispatch_after_example_3):_fn_(*)) block_params [line 46, column 3]\n REMOVE_TEMPS(n$18,n$19,n$23); [line 46, column 3]\n " shape="box"] +"dispatch_after_example#DispatchEx#class.1d25856bd99eb1ef683c8f65ff46d05d_4" [label="4: Call _fun_dispatch_after \n n$18=_fun_dispatch_time(0:unsigned long long,((unsigned long long)2 * 1000000000):long long) [line 46, column 18]\n n$19=_fun_dispatch_get_main_queue() [line 47, column 18]\n n$23=_fun_dispatch_after(n$18:unsigned long long,n$19:NSObject*,(_fun_objc_blockDispatchEx_dispatch_after_example_3):_fn_(*)) block_params [line 46, column 3]\n REMOVE_TEMPS(n$18,n$19,n$23); [line 46, column 3]\n " shape="box"] "dispatch_after_example#DispatchEx#class.1d25856bd99eb1ef683c8f65ff46d05d_4" -> "dispatch_after_example#DispatchEx#class.1d25856bd99eb1ef683c8f65ff46d05d_3" ; @@ -120,7 +120,7 @@ digraph cfg { "dispatch_async_example#DispatchEx#class.5c5d7347be2a9654ad7e32514189fe54_3" -> "dispatch_async_example#DispatchEx#class.5c5d7347be2a9654ad7e32514189fe54_2" ; -"dispatch_async_example#DispatchEx#class.5c5d7347be2a9654ad7e32514189fe54_4" [label="4: Call _fun_dispatch_async \n n$10=_fun_dispatch_get_global_queue(0:long,0:unsigned long) [line 36, column 18]\n n$14=_fun_dispatch_async(n$10:NSObject*,(_fun_objc_blockDispatchEx_dispatch_async_example_2):_fn_(*)) block_params [line 36, column 3]\n REMOVE_TEMPS(n$10,n$14); [line 36, column 3]\n " shape="box"] +"dispatch_async_example#DispatchEx#class.5c5d7347be2a9654ad7e32514189fe54_4" [label="4: Call _fun_dispatch_async \n n$10=_fun_dispatch_get_global_queue(0:long,(unsigned long)0:unsigned long) [line 36, column 18]\n n$14=_fun_dispatch_async(n$10:NSObject*,(_fun_objc_blockDispatchEx_dispatch_async_example_2):_fn_(*)) block_params [line 36, column 3]\n REMOVE_TEMPS(n$10,n$14); [line 36, column 3]\n " shape="box"] "dispatch_async_example#DispatchEx#class.5c5d7347be2a9654ad7e32514189fe54_4" -> "dispatch_async_example#DispatchEx#class.5c5d7347be2a9654ad7e32514189fe54_3" ;