[LockConsistency] Do not analyze/report on destructors

Summary:
Destructors usually do not race with other methods.
We do not want to analyze or report on destructors.

Reviewed By: sblackshear

Differential Revision: D6222145

fbshipit-source-id: 5266622
master
Daiva Naudziuniene 7 years ago committed by Facebook Github Bot
parent 15ffac4e02
commit 2e89bfb4f4

@ -377,9 +377,8 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
["folly::AtomicStruct::load"; "folly::detail::SingletonHolder::createInstance"]) ["folly::AtomicStruct::load"; "folly::detail::SingletonHolder::createInstance"])
in in
fun pname -> fun pname ->
Typ.Procname.is_destructor pname QualifiedCppName.Match.match_qualifiers (Lazy.force matcher)
|| QualifiedCppName.Match.match_qualifiers (Lazy.force matcher) (Typ.Procname.get_qualifiers pname)
(Typ.Procname.get_qualifiers pname)
let get_summary caller_pdesc callee_pname actuals callee_loc tenv = let get_summary caller_pdesc callee_pname actuals callee_loc tenv =
@ -865,8 +864,8 @@ let pdesc_is_assumed_thread_safe pdesc tenv =
find more bugs. this is just a temporary measure to avoid obvious false positives *) find more bugs. this is just a temporary measure to avoid obvious false positives *)
let should_analyze_proc pdesc tenv = let should_analyze_proc pdesc tenv =
let pn = Procdesc.get_proc_name pdesc in let pn = Procdesc.get_proc_name pdesc in
not (Typ.Procname.is_class_initializer pn) && not (FbThreadSafety.is_logging_method pn) not (Typ.Procname.is_destructor pn) && not (Typ.Procname.is_class_initializer pn)
&& not (pdesc_is_assumed_thread_safe pdesc tenv) && not (FbThreadSafety.is_logging_method pn) && not (pdesc_is_assumed_thread_safe pdesc tenv)
let get_current_class_and_threadsafe_superclasses tenv pname = let get_current_class_and_threadsafe_superclasses tenv pname =
@ -920,7 +919,7 @@ let analyze_procedure {Callbacks.proc_desc; get_proc_desc; tenv; summary} =
Typ.Procname.is_constructor proc_name || FbThreadSafety.is_custom_init tenv proc_name Typ.Procname.is_constructor proc_name || FbThreadSafety.is_custom_init tenv proc_name
in in
let open RacerDDomain in let open RacerDDomain in
if should_analyze_proc proc_desc tenv then ( if should_analyze_proc proc_desc tenv then
let formal_map = FormalMap.make proc_desc in let formal_map = FormalMap.make proc_desc in
let proc_data = ProcData.make proc_desc tenv get_proc_desc in let proc_data = ProcData.make proc_desc tenv get_proc_desc in
let initial = let initial =
@ -993,7 +992,7 @@ let analyze_procedure {Callbacks.proc_desc; get_proc_desc; tenv; summary} =
let post = {threads; locks; accesses; return_ownership; return_attributes} in let post = {threads; locks; accesses; return_ownership; return_attributes} in
Summary.update_summary post summary Summary.update_summary post summary
| None -> | None ->
summary ) summary
else Summary.update_summary empty_post summary else Summary.update_summary empty_post summary

Loading…
Cancel
Save