diff --git a/infer/src/integration/IssuesTest.ml b/infer/src/integration/IssuesTest.ml index 1c8d17b3564..2848246ddef 100644 --- a/infer/src/integration/IssuesTest.ml +++ b/infer/src/integration/IssuesTest.ml @@ -115,20 +115,20 @@ let pp_custom_of_report fmt report fields = transitive_missed_captures ) | Autofix -> let escape s = Escape.escape_double_quotes s |> Escape.escape_line_space in - let pp_autofix fmt (original, replacement) = - F.fprintf fmt "\"%s\"=>\"%s\"" (escape original) (escape replacement) + let pp_autofix fmt (original, replacement, line, col) = + F.fprintf fmt "\"%s\"=>\"%s\"@%d:%d" (escape original) (escape replacement) line col in - let pp_autofix_opt fmt (original, replacement) = + let pp_autofix_opt fmt (original, replacement, line, col) = if Option.is_some original || Option.is_some replacement then pp_autofix fmt - (Option.value ~default:"" original, Option.value ~default:"" replacement) + (Option.value ~default:"" original, Option.value ~default:"" replacement, line, col) in Option.iter issue.autofix ~f:(fun {original; replacement; additional} -> F.pp_print_string fmt (comma_separator index) ; - pp_autofix_opt fmt (original, replacement) ; + F.fprintf fmt "%a" pp_autofix_opt (original, replacement, issue.line, issue.column) ; Option.iter additional ~f:(fun additional -> List.iter additional ~f:(fun {line; column; original; replacement} -> - F.fprintf fmt "+%a@%d:%d" pp_autofix (original, replacement) line column ) ) ) + F.fprintf fmt "+%a" pp_autofix (original, replacement, line, column) ) ) ) in List.iteri ~f:pp_field fields ; F.fprintf fmt "@." diff --git a/infer/tests/codetoanalyze/cpp/pulse-17/issues.exp b/infer/tests/codetoanalyze/cpp/pulse-17/issues.exp index 3875231a9b2..972b02e415c 100644 --- a/infer/tests/codetoanalyze/cpp/pulse-17/issues.exp +++ b/infer/tests/codetoanalyze/cpp/pulse-17/issues.exp @@ -1,6 +1,6 @@ codetoanalyze/cpp/pulse-17/closures.cpp, generic_lambda_ok_FP, 5, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] -codetoanalyze/cpp/pulse-17/make_shared.cpp, make_shared_ptr::SharedPtr::SharedPtr, 0, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `std::shared_ptr&`)], "s_ptr0 = _s_ptr;"=>"s_ptr0 = std::move(_s_ptr);" -codetoanalyze/cpp/pulse-17/make_shared.cpp, make_shared_ptr::SharedPtr::SharedPtr, 0, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `std::shared_ptr&`)], "s_ptr1(_s_ptr)"=>"s_ptr1(std::move(_s_ptr))" +codetoanalyze/cpp/pulse-17/make_shared.cpp, make_shared_ptr::SharedPtr::SharedPtr, 0, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `std::shared_ptr&`)], "s_ptr0 = _s_ptr;"=>"s_ptr0 = std::move(_s_ptr);"@40:44 +codetoanalyze/cpp/pulse-17/make_shared.cpp, make_shared_ptr::SharedPtr::SharedPtr, 0, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `std::shared_ptr&`)], "s_ptr1(_s_ptr)"=>"s_ptr1(std::move(_s_ptr))"@41:46 codetoanalyze/cpp/pulse-17/make_shared.cpp, make_shared_ptr::make_shared0_bad, 5, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] codetoanalyze/cpp/pulse-17/make_shared.cpp, make_shared_ptr::make_shared1_bad, 7, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] codetoanalyze/cpp/pulse-17/make_shared.cpp, make_shared_ptr::make_shared2_bad, 5, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] diff --git a/infer/tests/codetoanalyze/cpp/pulse/issues.exp b/infer/tests/codetoanalyze/cpp/pulse/issues.exp index c39dde93549..24a02736162 100644 --- a/infer/tests/codetoanalyze/cpp/pulse/issues.exp +++ b/infer/tests/codetoanalyze/cpp/pulse/issues.exp @@ -41,7 +41,7 @@ codetoanalyze/cpp/pulse/closures.cpp, struct_capture_by_val_bad, 7, NULLPTR_DERE codetoanalyze/cpp/pulse/closures.cpp, struct_capture_by_val_ok_FP, 7, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] codetoanalyze/cpp/pulse/closures.cpp, call_argument, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter f with type `std::function<_fn_>`] codetoanalyze/cpp/pulse/closures.cpp, FP_update_inside_lambda_visible_outside_ok, 10, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] -codetoanalyze/cpp/pulse/conditional_temporaries.cpp, condtemp::Counter::Counter, 1, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `std::basic_string,std::allocator>&`)], "name(name_)"=>"name(std::move(name_))" +codetoanalyze/cpp/pulse/conditional_temporaries.cpp, condtemp::Counter::Counter, 1, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `std::basic_string,std::allocator>&`)], "name(name_)"=>"name(std::move(name_))"@21:9 codetoanalyze/cpp/pulse/conditional_temporaries.cpp, condtemp::X::__infer_inner_destructor_~X, 1, NULLPTR_DEREFERENCE_LATENT, no_bucket, ERROR, [*** SUPPRESSED ***,source of the null value part of the trace starts here,is assigned to the null pointer,null pointer dereference part of the trace starts here,parameter `this` of condtemp::X::__infer_inner_destructor_~X,when calling `condtemp::X::name` here,parameter `this` of condtemp::X::name,invalid access occurs here] codetoanalyze/cpp/pulse/conditional_temporaries.cpp, condtemp::FP_track_copy_operations_one_copy_ok, 17, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] codetoanalyze/cpp/pulse/conditional_temporaries.cpp, condtemp::FP_track_copy_operations_complex_ok, 16, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] @@ -129,7 +129,7 @@ codetoanalyze/cpp/pulse/leaks.cpp, leaks::unknown_wrapper_alloc_then_leak_bad, 3 codetoanalyze/cpp/pulse/max_disjuncts.cpp, max_disjuncts::call_join_full_disjs1_bad, 3, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] codetoanalyze/cpp/pulse/max_disjuncts.cpp, max_disjuncts::call_join_full_disjs2_bad, 3, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] codetoanalyze/cpp/pulse/max_disjuncts.cpp, max_disjuncts::call_join_full_disjs3_bad, 3, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] -codetoanalyze/cpp/pulse/max_disjuncts.cpp, max_disjuncts::FullDisjsInLoop::full_disjs_in_loop_ok2_FP, 5, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `max_disjuncts::Arr&`)], "arr = x;"=>"arr = std::move(x);" +codetoanalyze/cpp/pulse/max_disjuncts.cpp, max_disjuncts::FullDisjsInLoop::full_disjs_in_loop_ok2_FP, 5, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `max_disjuncts::Arr&`)], "arr = x;"=>"arr = std::move(x);"@155:7 codetoanalyze/cpp/pulse/nullptr.cpp, A::this_notnull_bad, 3, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] codetoanalyze/cpp/pulse/nullptr.cpp, A::call_null_arg_bad, 0, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,when calling `A::expect_notnull_ok` here,parameter `a` of A::expect_notnull_ok,invalid access occurs here] codetoanalyze/cpp/pulse/nullptr.cpp, deref_nullptr_bad, 2, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] @@ -163,7 +163,7 @@ codetoanalyze/cpp/pulse/path.cpp, FP_only_bad_on_42_latent, 2, NULLPTR_DEREFEREN codetoanalyze/cpp/pulse/path.cpp, FN_faulty_call_bad, 0, NULLPTR_DEREFERENCE, no_bucket, ERROR, [when calling `FP_only_bad_on_42_latent` here,in call to `may_return_null`,is assigned to the null pointer,returned,return from call to `may_return_null`,assigned,invalid access occurs here] codetoanalyze/cpp/pulse/readonly_shared_ptr_param.cpp, read_shared_ptr_param_bad, 0, PULSE_READONLY_SHARED_PTR_PARAM, no_bucket, ERROR, [Parameter x with type `std::shared_ptr`,used] codetoanalyze/cpp/pulse/readonly_shared_ptr_param.cpp, read_shared_ptr_param_cond_bad, 0, PULSE_READONLY_SHARED_PTR_PARAM, no_bucket, ERROR, [Parameter x with type `std::shared_ptr`,used,used] -codetoanalyze/cpp/pulse/readonly_shared_ptr_param.cpp, SharedPtrField1_Bad::SharedPtrField1_Bad, 0, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `std::shared_ptr&`)], "field = x;"=>"field = std::move(x);" +codetoanalyze/cpp/pulse/readonly_shared_ptr_param.cpp, SharedPtrField1_Bad::SharedPtrField1_Bad, 0, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `std::shared_ptr&`)], "field = x;"=>"field = std::move(x);"@32:49 codetoanalyze/cpp/pulse/readonly_shared_ptr_param.cpp, copy_raw_ptr_to_global_bad, 0, PULSE_READONLY_SHARED_PTR_PARAM, no_bucket, ERROR, [Parameter x with type `std::shared_ptr`,used] codetoanalyze/cpp/pulse/readonly_shared_ptr_param.cpp, copy_shared_ptr_to_global_bad, 1, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `std::shared_ptr&`)] codetoanalyze/cpp/pulse/reference_stability.cpp, folly_fastmap_bad, 9, PULSE_REFERENCE_STABILITY, no_bucket, ERROR, [invalidation part of the trace starts here,variable `map` declared here,in call to `folly::F14FastMap::emplace` (modelled),was potentially invalidated by `folly::F14FastMap::emplace`,use-after-lifetime part of the trace starts here,variable `map` declared here,in call to `folly::F14FastMap::begin` (modelled),in call to `folly::f14::detail::ValueContainerIterator::operator->` (modelled),assigned,invalid access occurs here] @@ -509,7 +509,7 @@ codetoanalyze/cpp/pulse/unnecessary_copy.cpp, copy_assignment_bad, 0, PULSE_CONS codetoanalyze/cpp/pulse/unnecessary_copy.cpp, copy_assignment_bad, 2, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `std::set,std::allocator>&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, copy_and_move_bad, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter source with type `std::set,std::allocator>`] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, copy_and_move_bad, 1, PULSE_UNNECESSARY_COPY, no_bucket, ERROR, [copied here (with type `std::set,std::allocator>&`)] -codetoanalyze/cpp/pulse/unnecessary_copy.cpp, WrapperArr::WrapperArr, 0, PULSE_UNNECESSARY_COPY_MOVABLE, no_bucket, ERROR, [copied here (with type `Arr&&`)], "hidden_arr_(internal_arr)"=>"hidden_arr_(std::move(internal_arr))" +codetoanalyze/cpp/pulse/unnecessary_copy.cpp, WrapperArr::WrapperArr, 0, PULSE_UNNECESSARY_COPY_MOVABLE, no_bucket, ERROR, [copied here (with type `Arr&&`)], "hidden_arr_(internal_arr)"=>"hidden_arr_(std::move(internal_arr))"@391:45 codetoanalyze/cpp/pulse/unnecessary_copy.cpp, WrapperArr::unnecessary_copy_moveable_bad, 1, PULSE_UNNECESSARY_COPY_ASSIGNMENT_MOVABLE, no_bucket, ERROR, [copy assigned here (with type `Arr&&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, WrapperArr::unnecessary_copy_moveable_copy_mod_bad, 1, PULSE_UNNECESSARY_COPY_ASSIGNMENT_MOVABLE, no_bucket, ERROR, [copy assigned here (with type `Arr&&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, unnecessary_copy_initializer_list, 2, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `std::vector>&`)] @@ -520,13 +520,13 @@ codetoanalyze/cpp/pulse/unnecessary_copy.cpp, call_get_arr_implicit_cpy_bad, 1, codetoanalyze/cpp/pulse/unnecessary_copy.cpp, ClassWithoutConstructDef::field_setter_bad, 1, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `std::vector>&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, foo, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter my_vec with type `std::vector>`] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, foo, 0, PULSE_UNNECESSARY_COPY, no_bucket, ERROR, [macro expanded here,copied here (with type `std::vector>&`)] -codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopiedToField1_Bad::CopiedToField1_Bad, 0, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)], "field(a)"=>"field(std::move(a))" -codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopiedToField2_Bad::CopiedToField2_Bad, 0, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `Arr&`)], "field = a;"=>"field = std::move(a);" +codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopiedToField1_Bad::CopiedToField1_Bad, 0, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)], "field(a)"=>"field(std::move(a))"@549:31 +codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopiedToField2_Bad::CopiedToField2_Bad, 0, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `Arr&`)], "field = a;"=>"field = std::move(a);"@563:31 codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopiedToField3_Last_Bad::CopiedToField3_Last_Bad, 2, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `Arr&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, PassedToUnknown_Bad::PassedToUnknown_Bad, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter a with type `Arr`] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, PassedToUnknown_Bad::PassedToUnknown_Bad, 0, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, PassedToUnknownRef_Bad::PassedToUnknownRef_Bad, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter a with type `Arr`] -codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopiedToMultipleField_Last_Bad::CopiedToMultipleField_Last_Bad, 0, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)], "field2(a)"=>"field2(std::move(a))" +codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopiedToMultipleField_Last_Bad::CopiedToMultipleField_Last_Bad, 0, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)], "field2(a)"=>"field2(std::move(a))"@626:54 codetoanalyze/cpp/pulse/unnecessary_copy.cpp, intermediate_copy_modified_unused_bad, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter input with type `std::vector>`] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, intermediate_copy_modified_unused_bad, 1, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `std::vector>&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, intermediate_copy_modified_used_ok, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter input with type `std::vector>`] @@ -537,18 +537,18 @@ codetoanalyze/cpp/pulse/unnecessary_copy.cpp, intermediate_copy_assignment_const codetoanalyze/cpp/pulse/unnecessary_copy.cpp, intermediate_copy_assignment_const_value_bad, 1, PULSE_UNNECESSARY_COPY_INTERMEDIATE_CONST, no_bucket, ERROR, [copied here (with type `Arr const &`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, FieldCopyClass::copy_assign_bad, 0, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `NonTrivialCopyClass&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, copy_from_global_bad, 0, PULSE_UNNECESSARY_COPY, no_bucket, ERROR, [copied here (with type `Arr&`)] -codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopyConstructFromRefBad1::CopyConstructFromRefBad1, 0, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)], "my_arr(arr)"=>"my_arr(std::move(arr))" -codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopyConstructFromRefBad2::CopyConstructFromRefBad2, 0, PULSE_UNNECESSARY_COPY_MOVABLE, no_bucket, ERROR, [copied here (with type `Arr&&`)], "my_arr(arr)"=>"my_arr(std::move(arr))" +codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopyConstructFromRefBad1::CopyConstructFromRefBad1, 0, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)], "my_arr(arr)"=>"my_arr(std::move(arr))"@806:39 +codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopyConstructFromRefBad2::CopyConstructFromRefBad2, 0, PULSE_UNNECESSARY_COPY_MOVABLE, no_bucket, ERROR, [copied here (with type `Arr&&`)], "my_arr(arr)"=>"my_arr(std::move(arr))"@813:41 codetoanalyze/cpp/pulse/unnecessary_copy.cpp, copy_assignment_from_lvalue_ref_ok_intermediate_bad, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter arr with type `Arr`] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, copy_assignment_from_lvalue_ref_ok_intermediate_bad, 5, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, normal_copy_from_lvalue_ref_bad, 1, PULSE_UNNECESSARY_COPY, no_bucket, ERROR, [copied here (with type `std::basic_string,std::allocator>&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, NonDisjJoin_ok::NonDisjJoin_ok, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter myStr with type `std::basic_string,std::allocator>`] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, NonDisjJoinLoop_ok_FP::NonDisjJoinLoop_ok_FP, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter myStr with type `std::basic_string,std::allocator>`] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, UnownedTest::copy_assignment_copy_of_global_bad, 1, PULSE_UNNECESSARY_COPY, no_bucket, ERROR, [copied here (with type `Arr&`)] -codetoanalyze/cpp/pulse/unnecessary_copy.cpp, UnownedTest::copy_assignment_copy_of_global_bad, 2, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `Arr&`)], "field = ref;"=>"field = std::move(ref);" +codetoanalyze/cpp/pulse/unnecessary_copy.cpp, UnownedTest::copy_assignment_copy_of_global_bad, 2, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `Arr&`)], "field = ref;"=>"field = std::move(ref);"@903:5 codetoanalyze/cpp/pulse/unnecessary_copy.cpp, UnownedTest::intermediate_copy_copy_of_global_bad, 1, PULSE_UNNECESSARY_COPY, no_bucket, ERROR, [copied here (with type `Arr&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, UnownedTest::intermediate_copy_copy_of_global_bad, 2, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)] -codetoanalyze/cpp/pulse/unnecessary_copy.cpp, UnownedTest::copy_assignment_copy_ptr_bad, 3, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `Ptr&`)], "ptr_field = c;"=>"ptr_field = std::move(c);" +codetoanalyze/cpp/pulse/unnecessary_copy.cpp, UnownedTest::copy_assignment_copy_ptr_bad, 3, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `Ptr&`)], "ptr_field = c;"=>"ptr_field = std::move(c);"@941:5 codetoanalyze/cpp/pulse/use_after_delete.cpp, deref_deleted_bad, 3, USE_AFTER_DELETE, no_bucket, ERROR, [invalidation part of the trace starts here,allocated by call to `new` (modelled),assigned,was invalidated by `delete`,use-after-lifetime part of the trace starts here,allocated by call to `new` (modelled),assigned,when calling `Simple::Simple` here,parameter `__param_0` of Simple::Simple,invalid access occurs here] codetoanalyze/cpp/pulse/use_after_delete.cpp, reassign_field_of_deleted_bad, 3, USE_AFTER_DELETE, no_bucket, ERROR, [invalidation part of the trace starts here,allocated by call to `new` (modelled),assigned,was invalidated by `delete`,use-after-lifetime part of the trace starts here,allocated by call to `new` (modelled),assigned,invalid access occurs here] codetoanalyze/cpp/pulse/use_after_delete.cpp, double_delete_bad, 3, USE_AFTER_DELETE, no_bucket, ERROR, [invalidation part of the trace starts here,allocated by call to `new` (modelled),assigned,was invalidated by `delete`,use-after-lifetime part of the trace starts here,allocated by call to `new` (modelled),assigned,invalid access occurs here] diff --git a/infer/tests/codetoanalyze/cpp/pulse/issues.exp-11 b/infer/tests/codetoanalyze/cpp/pulse/issues.exp-11 index 78ec2c5490c..2469ceb0809 100644 --- a/infer/tests/codetoanalyze/cpp/pulse/issues.exp-11 +++ b/infer/tests/codetoanalyze/cpp/pulse/issues.exp-11 @@ -54,7 +54,7 @@ codetoanalyze/cpp/pulse/closures.cpp, update_inside_lambda_capture_only_ok, 1, N codetoanalyze/cpp/pulse/closures.cpp, call_argument, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter f with type `std::function<_fn_>`] codetoanalyze/cpp/pulse/closures.cpp, update_inside_lambda_as_argument_ok, 1, NULLPTR_DEREFERENCE, no_bucket, ERROR, [in call to `update_inside_lambda_as_argument`,is assigned to the null pointer,assigned,returned,return from call to `update_inside_lambda_as_argument`,invalid access occurs here] codetoanalyze/cpp/pulse/closures.cpp, FP_update_inside_lambda_visible_outside_ok, 10, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] -codetoanalyze/cpp/pulse/conditional_temporaries.cpp, condtemp::Counter::Counter, 1, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `std::basic_string,std::allocator>&`)], "name(name_)"=>"name(std::move(name_))" +codetoanalyze/cpp/pulse/conditional_temporaries.cpp, condtemp::Counter::Counter, 1, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `std::basic_string,std::allocator>&`)], "name(name_)"=>"name(std::move(name_))"@21:9 codetoanalyze/cpp/pulse/conditional_temporaries.cpp, condtemp::X::__infer_inner_destructor_~X, 1, NULLPTR_DEREFERENCE_LATENT, no_bucket, ERROR, [*** SUPPRESSED ***,source of the null value part of the trace starts here,is assigned to the null pointer,null pointer dereference part of the trace starts here,parameter `this` of condtemp::X::__infer_inner_destructor_~X,when calling `condtemp::X::name` here,parameter `this` of condtemp::X::name,invalid access occurs here] codetoanalyze/cpp/pulse/conditional_temporaries.cpp, condtemp::FP_track_copy_operations_one_copy_ok, 3, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `condtemp::X&`)] codetoanalyze/cpp/pulse/conditionals.cpp, add_test3_bad, 3, USE_AFTER_FREE, no_bucket, ERROR, [invalidation part of the trace starts here,parameter `x` of add_test3_bad,was invalidated by call to `free()`,use-after-lifetime part of the trace starts here,parameter `x` of add_test3_bad,invalid access occurs here] @@ -142,7 +142,7 @@ codetoanalyze/cpp/pulse/leaks.cpp, leaks::capture_alloc_return_ok, 2, MEMORY_LEA codetoanalyze/cpp/pulse/max_disjuncts.cpp, max_disjuncts::call_join_full_disjs1_bad, 3, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] codetoanalyze/cpp/pulse/max_disjuncts.cpp, max_disjuncts::call_join_full_disjs2_bad, 3, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] codetoanalyze/cpp/pulse/max_disjuncts.cpp, max_disjuncts::call_join_full_disjs3_bad, 3, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] -codetoanalyze/cpp/pulse/max_disjuncts.cpp, max_disjuncts::FullDisjsInLoop::full_disjs_in_loop_ok2_FP, 5, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `max_disjuncts::Arr&`)], "arr = x;"=>"arr = std::move(x);" +codetoanalyze/cpp/pulse/max_disjuncts.cpp, max_disjuncts::FullDisjsInLoop::full_disjs_in_loop_ok2_FP, 5, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `max_disjuncts::Arr&`)], "arr = x;"=>"arr = std::move(x);"@155:7 codetoanalyze/cpp/pulse/nullptr.cpp, A::this_notnull_bad, 3, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] codetoanalyze/cpp/pulse/nullptr.cpp, A::call_null_arg_bad, 0, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,when calling `A::expect_notnull_ok` here,parameter `a` of A::expect_notnull_ok,invalid access occurs here] codetoanalyze/cpp/pulse/nullptr.cpp, deref_nullptr_bad, 2, NULLPTR_DEREFERENCE, no_bucket, ERROR, [is assigned to the null pointer,assigned,invalid access occurs here] @@ -176,7 +176,7 @@ codetoanalyze/cpp/pulse/path.cpp, FP_only_bad_on_42_latent, 2, NULLPTR_DEREFEREN codetoanalyze/cpp/pulse/path.cpp, FN_faulty_call_bad, 0, NULLPTR_DEREFERENCE, no_bucket, ERROR, [when calling `FP_only_bad_on_42_latent` here,in call to `may_return_null`,is assigned to the null pointer,returned,return from call to `may_return_null`,assigned,invalid access occurs here] codetoanalyze/cpp/pulse/readonly_shared_ptr_param.cpp, read_shared_ptr_param_bad, 0, PULSE_READONLY_SHARED_PTR_PARAM, no_bucket, ERROR, [Parameter x with type `std::shared_ptr`,used] codetoanalyze/cpp/pulse/readonly_shared_ptr_param.cpp, read_shared_ptr_param_cond_bad, 0, PULSE_READONLY_SHARED_PTR_PARAM, no_bucket, ERROR, [Parameter x with type `std::shared_ptr`,used,used] -codetoanalyze/cpp/pulse/readonly_shared_ptr_param.cpp, SharedPtrField1_Bad::SharedPtrField1_Bad, 0, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `std::shared_ptr&`)], "field = x;"=>"field = std::move(x);" +codetoanalyze/cpp/pulse/readonly_shared_ptr_param.cpp, SharedPtrField1_Bad::SharedPtrField1_Bad, 0, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `std::shared_ptr&`)], "field = x;"=>"field = std::move(x);"@32:49 codetoanalyze/cpp/pulse/readonly_shared_ptr_param.cpp, copy_raw_ptr_to_global_bad, 0, PULSE_READONLY_SHARED_PTR_PARAM, no_bucket, ERROR, [Parameter x with type `std::shared_ptr`,used] codetoanalyze/cpp/pulse/readonly_shared_ptr_param.cpp, copy_shared_ptr_to_global_bad, 1, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `std::shared_ptr&`)] codetoanalyze/cpp/pulse/reference_stability.cpp, folly_fastmap_bad, 9, PULSE_REFERENCE_STABILITY, no_bucket, ERROR, [invalidation part of the trace starts here,variable `map` declared here,in call to `folly::F14FastMap::emplace` (modelled),was potentially invalidated by `folly::F14FastMap::emplace`,use-after-lifetime part of the trace starts here,variable `map` declared here,in call to `folly::F14FastMap::begin` (modelled),in call to `folly::f14::detail::ValueContainerIterator::operator->` (modelled),assigned,invalid access occurs here] @@ -523,7 +523,7 @@ codetoanalyze/cpp/pulse/unnecessary_copy.cpp, copy_assignment_bad, 0, PULSE_CONS codetoanalyze/cpp/pulse/unnecessary_copy.cpp, copy_assignment_bad, 2, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `std::set,std::allocator>&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, copy_and_move_bad, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter source with type `std::set,std::allocator>`] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, copy_and_move_bad, 1, PULSE_UNNECESSARY_COPY, no_bucket, ERROR, [copied here (with type `std::set,std::allocator>&`)] -codetoanalyze/cpp/pulse/unnecessary_copy.cpp, WrapperArr::WrapperArr, 0, PULSE_UNNECESSARY_COPY_MOVABLE, no_bucket, ERROR, [copied here (with type `Arr&&`)], "hidden_arr_(internal_arr)"=>"hidden_arr_(std::move(internal_arr))" +codetoanalyze/cpp/pulse/unnecessary_copy.cpp, WrapperArr::WrapperArr, 0, PULSE_UNNECESSARY_COPY_MOVABLE, no_bucket, ERROR, [copied here (with type `Arr&&`)], "hidden_arr_(internal_arr)"=>"hidden_arr_(std::move(internal_arr))"@391:45 codetoanalyze/cpp/pulse/unnecessary_copy.cpp, WrapperArr::unnecessary_copy_moveable_bad, 1, PULSE_UNNECESSARY_COPY_ASSIGNMENT_MOVABLE, no_bucket, ERROR, [copy assigned here (with type `Arr&&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, WrapperArr::unnecessary_copy_moveable_copy_mod_bad, 1, PULSE_UNNECESSARY_COPY_ASSIGNMENT_MOVABLE, no_bucket, ERROR, [copy assigned here (with type `Arr&&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, unnecessary_copy_initializer_list, 2, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `std::vector>&`)] @@ -531,13 +531,13 @@ codetoanalyze/cpp/pulse/unnecessary_copy.cpp, MyValueOr::suppress_intentional_cp codetoanalyze/cpp/pulse/unnecessary_copy.cpp, ClassWithoutConstructDef::field_setter_bad, 1, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `std::vector>&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, foo, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter my_vec with type `std::vector>`] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, foo, 0, PULSE_UNNECESSARY_COPY, no_bucket, ERROR, [macro expanded here,copied here (with type `std::vector>&`)] -codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopiedToField1_Bad::CopiedToField1_Bad, 0, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)], "field(a)"=>"field(std::move(a))" -codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopiedToField2_Bad::CopiedToField2_Bad, 0, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `Arr&`)], "field = a;"=>"field = std::move(a);" +codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopiedToField1_Bad::CopiedToField1_Bad, 0, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)], "field(a)"=>"field(std::move(a))"@549:31 +codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopiedToField2_Bad::CopiedToField2_Bad, 0, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `Arr&`)], "field = a;"=>"field = std::move(a);"@563:31 codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopiedToField3_Last_Bad::CopiedToField3_Last_Bad, 2, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `Arr&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, PassedToUnknown_Bad::PassedToUnknown_Bad, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter a with type `Arr`] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, PassedToUnknown_Bad::PassedToUnknown_Bad, 0, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, PassedToUnknownRef_Bad::PassedToUnknownRef_Bad, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter a with type `Arr`] -codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopiedToMultipleField_Last_Bad::CopiedToMultipleField_Last_Bad, 0, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)], "field2(a)"=>"field2(std::move(a))" +codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopiedToMultipleField_Last_Bad::CopiedToMultipleField_Last_Bad, 0, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)], "field2(a)"=>"field2(std::move(a))"@626:54 codetoanalyze/cpp/pulse/unnecessary_copy.cpp, intermediate_copy_modified_unused_bad, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter input with type `std::vector>`] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, intermediate_copy_modified_unused_bad, 1, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `std::vector>&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, intermediate_copy_modified_used_ok, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter input with type `std::vector>`] @@ -548,18 +548,18 @@ codetoanalyze/cpp/pulse/unnecessary_copy.cpp, intermediate_copy_assignment_const codetoanalyze/cpp/pulse/unnecessary_copy.cpp, intermediate_copy_assignment_const_value_bad, 1, PULSE_UNNECESSARY_COPY_INTERMEDIATE_CONST, no_bucket, ERROR, [copied here (with type `Arr const &`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, FieldCopyClass::copy_assign_bad, 0, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `NonTrivialCopyClass&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, copy_from_global_bad, 0, PULSE_UNNECESSARY_COPY, no_bucket, ERROR, [copied here (with type `Arr&`)] -codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopyConstructFromRefBad1::CopyConstructFromRefBad1, 0, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)], "my_arr(arr)"=>"my_arr(std::move(arr))" -codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopyConstructFromRefBad2::CopyConstructFromRefBad2, 0, PULSE_UNNECESSARY_COPY_MOVABLE, no_bucket, ERROR, [copied here (with type `Arr&&`)], "my_arr(arr)"=>"my_arr(std::move(arr))" +codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopyConstructFromRefBad1::CopyConstructFromRefBad1, 0, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)], "my_arr(arr)"=>"my_arr(std::move(arr))"@806:39 +codetoanalyze/cpp/pulse/unnecessary_copy.cpp, CopyConstructFromRefBad2::CopyConstructFromRefBad2, 0, PULSE_UNNECESSARY_COPY_MOVABLE, no_bucket, ERROR, [copied here (with type `Arr&&`)], "my_arr(arr)"=>"my_arr(std::move(arr))"@813:41 codetoanalyze/cpp/pulse/unnecessary_copy.cpp, copy_assignment_from_lvalue_ref_ok_intermediate_bad, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter arr with type `Arr`] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, copy_assignment_from_lvalue_ref_ok_intermediate_bad, 5, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, normal_copy_from_lvalue_ref_bad, 1, PULSE_UNNECESSARY_COPY, no_bucket, ERROR, [copied here (with type `std::basic_string,std::allocator>&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, NonDisjJoin_ok::NonDisjJoin_ok, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter myStr with type `std::basic_string,std::allocator>`] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, NonDisjJoinLoop_ok_FP::NonDisjJoinLoop_ok_FP, 0, PULSE_CONST_REFABLE, no_bucket, ERROR, [Parameter myStr with type `std::basic_string,std::allocator>`] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, UnownedTest::copy_assignment_copy_of_global_bad, 1, PULSE_UNNECESSARY_COPY, no_bucket, ERROR, [copied here (with type `Arr&`)] -codetoanalyze/cpp/pulse/unnecessary_copy.cpp, UnownedTest::copy_assignment_copy_of_global_bad, 2, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `Arr&`)], "field = ref;"=>"field = std::move(ref);" +codetoanalyze/cpp/pulse/unnecessary_copy.cpp, UnownedTest::copy_assignment_copy_of_global_bad, 2, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `Arr&`)], "field = ref;"=>"field = std::move(ref);"@903:5 codetoanalyze/cpp/pulse/unnecessary_copy.cpp, UnownedTest::intermediate_copy_copy_of_global_bad, 1, PULSE_UNNECESSARY_COPY, no_bucket, ERROR, [copied here (with type `Arr&`)] codetoanalyze/cpp/pulse/unnecessary_copy.cpp, UnownedTest::intermediate_copy_copy_of_global_bad, 2, PULSE_UNNECESSARY_COPY_INTERMEDIATE, no_bucket, ERROR, [copied here (with type `Arr&`)] -codetoanalyze/cpp/pulse/unnecessary_copy.cpp, UnownedTest::copy_assignment_copy_ptr_bad, 3, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `Ptr&`)], "ptr_field = c;"=>"ptr_field = std::move(c);" +codetoanalyze/cpp/pulse/unnecessary_copy.cpp, UnownedTest::copy_assignment_copy_ptr_bad, 3, PULSE_UNNECESSARY_COPY_ASSIGNMENT, no_bucket, ERROR, [copy assigned here (with type `Ptr&`)], "ptr_field = c;"=>"ptr_field = std::move(c);"@941:5 codetoanalyze/cpp/pulse/use_after_delete.cpp, deref_deleted_bad, 3, USE_AFTER_DELETE, no_bucket, ERROR, [invalidation part of the trace starts here,allocated by call to `new` (modelled),assigned,was invalidated by `delete`,use-after-lifetime part of the trace starts here,allocated by call to `new` (modelled),assigned,when calling `Simple::Simple` here,parameter `__param_0` of Simple::Simple,invalid access occurs here] codetoanalyze/cpp/pulse/use_after_delete.cpp, reassign_field_of_deleted_bad, 3, USE_AFTER_DELETE, no_bucket, ERROR, [invalidation part of the trace starts here,allocated by call to `new` (modelled),assigned,was invalidated by `delete`,use-after-lifetime part of the trace starts here,allocated by call to `new` (modelled),assigned,invalid access occurs here] codetoanalyze/cpp/pulse/use_after_delete.cpp, double_delete_bad, 3, USE_AFTER_DELETE, no_bucket, ERROR, [invalidation part of the trace starts here,allocated by call to `new` (modelled),assigned,was invalidated by `delete`,use-after-lifetime part of the trace starts here,allocated by call to `new` (modelled),assigned,invalid access occurs here] diff --git a/infer/tests/codetoanalyze/objc/parameter-not-null-checked/issues.exp b/infer/tests/codetoanalyze/objc/parameter-not-null-checked/issues.exp index 8552cb07a13..d9315ee7aa8 100644 --- a/infer/tests/codetoanalyze/objc/parameter-not-null-checked/issues.exp +++ b/infer/tests/codetoanalyze/objc/parameter-not-null-checked/issues.exp @@ -1,7 +1,7 @@ -codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.blockNotCheckedBad:and:, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block` of Blocks_as_parameters.blockNotCheckedBad:and:,Executing `block`], "block("=>"BLOCK_CALL_SAFE(block" -codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.blockNotCheckedBad1:and:, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block` of Blocks_as_parameters.blockNotCheckedBad1:and:,Executing `block`], "block("=>"BLOCK_CALL_SAFE(block, " -codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.twoBlocksNotCheckedBad:and:and:, 2, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block1` of Blocks_as_parameters.twoBlocksNotCheckedBad:and:and:,Executing `block1`], "block1("=>"BLOCK_CALL_SAFE(block1" -codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.twoBlocksNotCheckedBad:and:and:, 3, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block2` of Blocks_as_parameters.twoBlocksNotCheckedBad:and:and:,Executing `block2`], "block2("=>"BLOCK_CALL_SAFE(block2" -codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.nonnullBlockTwoBlocksBad:and:and:, 4, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block2` of Blocks_as_parameters.nonnullBlockTwoBlocksBad:and:and:,Executing `block2`], "block2("=>"BLOCK_CALL_SAFE(block2" -codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.blockCheckedAssignNULLBad:and:, 3, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block` of Blocks_as_parameters.blockCheckedAssignNULLBad:and:,Checking `block` for nil,Assigned,Executing `block`], "block("=>"BLOCK_CALL_SAFE(block" -codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, objc_block_Blocks_as_parameters.m:109, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `completion` of Blocks_as_parameters.uploadTaskWithRequestBad:fromFile:delegate:delegateQueue:completion:,Executing `completion`], "completion("=>"BLOCK_CALL_SAFE(completion" +codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.blockNotCheckedBad:and:, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block` of Blocks_as_parameters.blockNotCheckedBad:and:,Executing `block`], "block("=>"BLOCK_CALL_SAFE(block"@20:3 +codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.blockNotCheckedBad1:and:, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block` of Blocks_as_parameters.blockNotCheckedBad1:and:,Executing `block`], "block("=>"BLOCK_CALL_SAFE(block, "@24:3 +codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.twoBlocksNotCheckedBad:and:and:, 2, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block1` of Blocks_as_parameters.twoBlocksNotCheckedBad:and:and:,Executing `block1`], "block1("=>"BLOCK_CALL_SAFE(block1"@41:5 +codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.twoBlocksNotCheckedBad:and:and:, 3, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block2` of Blocks_as_parameters.twoBlocksNotCheckedBad:and:and:,Executing `block2`], "block2("=>"BLOCK_CALL_SAFE(block2"@42:5 +codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.nonnullBlockTwoBlocksBad:and:and:, 4, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block2` of Blocks_as_parameters.nonnullBlockTwoBlocksBad:and:and:,Executing `block2`], "block2("=>"BLOCK_CALL_SAFE(block2"@70:3 +codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, Blocks_as_parameters.blockCheckedAssignNULLBad:and:, 3, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `block` of Blocks_as_parameters.blockCheckedAssignNULLBad:and:,Checking `block` for nil,Assigned,Executing `block`], "block("=>"BLOCK_CALL_SAFE(block"@76:5 +codetoanalyze/objc/parameter-not-null-checked/Blocks_as_parameters.m, objc_block_Blocks_as_parameters.m:109, 1, BLOCK_PARAMETER_NOT_NULL_CHECKED, no_bucket, WARNING, [Parameter `completion` of Blocks_as_parameters.uploadTaskWithRequestBad:fromFile:delegate:delegateQueue:completion:,Executing `completion`], "completion("=>"BLOCK_CALL_SAFE(completion"@110:5 diff --git a/infer/tests/codetoanalyze/objc/self-in-block/issues.exp b/infer/tests/codetoanalyze/objc/self-in-block/issues.exp index fcea4a0e1b8..0ffd10668cf 100644 --- a/infer/tests/codetoanalyze/objc/self-in-block/issues.exp +++ b/infer/tests/codetoanalyze/objc/self-in-block/issues.exp @@ -4,7 +4,7 @@ codetoanalyze/objc/self-in-block/NoescapeBlock.m, objc_block_NoescapeBlock.m:35, codetoanalyze/objc/self-in-block/NoescapeBlock.m, objc_block_NoescapeBlock.m:89, 1, WEAK_SELF_IN_NO_ESCAPE_BLOCK, no_bucket, ERROR, [Using &weakSelf] codetoanalyze/objc/self-in-block/SelfInBlockPassedToInit.m, objc_block_SelfInBlockPassedToInit.m:17, 1, SELF_IN_BLOCK_PASSED_TO_INIT, no_bucket, ERROR, [Using captured &self,Using captured &self] codetoanalyze/objc/self-in-block/SelfInBlockPassedToInit.m, objc_block_SelfInBlockPassedToInit.m:17, 2, SELF_IN_BLOCK_PASSED_TO_INIT, no_bucket, ERROR, [Using captured &self,Using captured &self] -codetoanalyze/objc/self-in-block/StrongSelf.m, objc_block_StrongSelf.m:58, 4, MIXED_SELF_WEAKSELF, no_bucket, ERROR, [Using &weakSelf,Using &self,Using &self], "self"=>"strongSelf" +codetoanalyze/objc/self-in-block/StrongSelf.m, objc_block_StrongSelf.m:58, 4, MIXED_SELF_WEAKSELF, no_bucket, ERROR, [Using &weakSelf,Using &self,Using &self], "self"=>"strongSelf"@62:15 codetoanalyze/objc/self-in-block/StrongSelf.m, objc_block_StrongSelf.m:71, 1, CAPTURED_STRONG_SELF, no_bucket, ERROR, [Using captured &weakSelf] codetoanalyze/objc/self-in-block/StrongSelf.m, objc_block_StrongSelf.m:99, 6, STRONG_SELF_NOT_CHECKED, no_bucket, ERROR, [&strongSelf assigned here,Using &strongSelf not checked for null,Using &strongSelf not checked for null], +""=>"\n if (!strongSelf) { return; }"@100:0 codetoanalyze/objc/self-in-block/StrongSelf.m, objc_block_StrongSelf.m:114, 6, STRONG_SELF_NOT_CHECKED, no_bucket, ERROR, [&strongSelf assigned here,Using &strongSelf not checked for null,Using &strongSelf not checked for null] @@ -14,6 +14,6 @@ codetoanalyze/objc/self-in-block/StrongSelf.m, objc_block_StrongSelf.m:203, 1, M codetoanalyze/objc/self-in-block/StrongSelf.m, objc_block_StrongSelf.m:224, 2, MULTIPLE_WEAKSELF, no_bucket, ERROR, [Using &weakSelf,Using &weakSelf] codetoanalyze/objc/self-in-block/StrongSelf.m, objc_block_StrongSelf.m:238, 1, CAPTURED_STRONG_SELF, no_bucket, ERROR, [Using captured &strongSelf,Using captured &strongSelf] codetoanalyze/objc/self-in-block/StrongSelf.m, objc_block_StrongSelf.m:238, 2, CAPTURED_STRONG_SELF, no_bucket, ERROR, [Using captured &strongSelf,Using captured &strongSelf] -codetoanalyze/objc/self-in-block/StrongSelf.m, objc_block_StrongSelf.m:278, 4, MIXED_SELF_WEAKSELF, no_bucket, ERROR, [Using &weakSelf,Using &self], "self"=>"strongSelf" -codetoanalyze/objc/self-in-block/StrongSelf.m, objc_block_StrongSelf.m:291, 1, MIXED_SELF_WEAKSELF, no_bucket, ERROR, [Using &self,Using &weakSelf], "self"=>"strongSelf" -codetoanalyze/objc/self-in-block/StrongSelf.m, objc_block_StrongSelf.m:327, 3, MIXED_SELF_WEAKSELF, no_bucket, ERROR, [macro expanded here,Using &weakSelf,Using &self], "self"=>"null_unspecified_ptr" +codetoanalyze/objc/self-in-block/StrongSelf.m, objc_block_StrongSelf.m:278, 4, MIXED_SELF_WEAKSELF, no_bucket, ERROR, [Using &weakSelf,Using &self], "self"=>"strongSelf"@282:17 +codetoanalyze/objc/self-in-block/StrongSelf.m, objc_block_StrongSelf.m:291, 1, MIXED_SELF_WEAKSELF, no_bucket, ERROR, [Using &self,Using &weakSelf], "self"=>"strongSelf"@292:6 +codetoanalyze/objc/self-in-block/StrongSelf.m, objc_block_StrongSelf.m:327, 3, MIXED_SELF_WEAKSELF, no_bucket, ERROR, [macro expanded here,Using &weakSelf,Using &self], "self"=>"null_unspecified_ptr"@330:6