[ThreadSafety] Do not report unprotected writes for c++.

Reviewed By: jberdine

Differential Revision: D5172030

fbshipit-source-id: 945acba
master
Daiva Naudziuniene 8 years ago committed by Facebook Github Bot
parent 5bed343280
commit f4b9bb3e3b

@ -1128,6 +1128,9 @@ let report_unsafe_accesses ~is_file_threadsafe aggregated_access_map =
else else
match snd (TraceElem.kind access), pre with match snd (TraceElem.kind access), pre with
| Access.Write, AccessPrecondition.Unprotected _ -> | Access.Write, AccessPrecondition.Unprotected _ ->
begin
match Procdesc.get_proc_name pdesc with
| Java _ ->
if threaded if threaded
then then
reported_acc reported_acc
@ -1141,6 +1144,10 @@ let report_unsafe_accesses ~is_file_threadsafe aggregated_access_map =
access; access;
update_reported access pname reported_acc update_reported access pname reported_acc
end end
| _ ->
(* Do not report unprotected writes for ObjC_Cpp *)
reported_acc
end
| Access.Write, AccessPrecondition.Protected _ -> | Access.Write, AccessPrecondition.Protected _ ->
(* protected write, do nothing *) (* protected write, do nothing *)
reported_acc reported_acc

@ -1,5 +1,3 @@
codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_get2, 3, THREAD_SAFETY_VIOLATION, [access to `suspiciously_written`] codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_get2, 3, THREAD_SAFETY_VIOLATION, [access to `suspiciously_written`]
codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_get3, 0, THREAD_SAFETY_VIOLATION, [<Beginning of read trace>,access to `not_guarded`,<Beginning of write trace>,access to `not_guarded`] codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_get3, 0, THREAD_SAFETY_VIOLATION, [<Beginning of read trace>,access to `not_guarded`,<Beginning of write trace>,access to `not_guarded`]
codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_get4, 0, THREAD_SAFETY_VIOLATION, [<Beginning of read trace>,access to `suspiciously_read`,<Beginning of write trace>,access to `suspiciously_read`] codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_get4, 0, THREAD_SAFETY_VIOLATION, [<Beginning of read trace>,access to `suspiciously_read`,<Beginning of write trace>,access to `suspiciously_read`]
codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_set, 1, THREAD_SAFETY_VIOLATION, [access to `not_guarded`]
codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_set, 6, THREAD_SAFETY_VIOLATION, [access to `suspiciously_written`]

Loading…
Cancel
Save