[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,19 +1128,26 @@ let report_unsafe_accesses ~is_file_threadsafe aggregated_access_map =
else
match snd (TraceElem.kind access), pre with
| Access.Write, AccessPrecondition.Unprotected _ ->
if threaded
then
reported_acc
else
begin
(* unprotected write. warn. *)
report_thread_safety_violation
tenv
pdesc
~make_description:make_unprotected_write_description
access;
update_reported access pname reported_acc
end
begin
match Procdesc.get_proc_name pdesc with
| Java _ ->
if threaded
then
reported_acc
else
begin
(* unprotected write. warn. *)
report_thread_safety_violation
tenv
pdesc
~make_description:make_unprotected_write_description
access;
update_reported access pname reported_acc
end
| _ ->
(* Do not report unprotected writes for ObjC_Cpp *)
reported_acc
end
| Access.Write, AccessPrecondition.Protected _ ->
(* protected write, do nothing *)
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_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_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