[racerd] ignore autogenerated methods

Summary: Autogenerated methods sometimes lead to false positives. Also, clean up a little the models file.

Reviewed By: da319

Differential Revision: D27393933

fbshipit-source-id: f79b1a6eb
master
Nikos Gorogiannis 4 years ago committed by Facebook GitHub Bot
parent aff237306f
commit 4f9c113acb

@ -160,33 +160,6 @@ let is_container_read tenv pn =
false false
(** holds of procedure names which should not be analyzed in order to avoid known sources of
inaccuracy *)
let should_skip =
let matcher =
lazy
(QualifiedCppName.Match.of_fuzzy_qual_names ~prefix:true
[ "folly::AtomicStruct"
; "folly::fbstring_core"
; "folly::Future"
; "folly::futures"
; "folly::LockedPtr"
; "folly::Optional"
; "folly::Promise"
; "folly::ThreadLocal"
; "folly::detail::SingletonHolder"
; "std::atomic"
; "std::vector" ])
in
function
| Procname.ObjC_Cpp cpp_pname as pname ->
Procname.ObjC_Cpp.is_destructor cpp_pname
|| QualifiedCppName.Match.match_qualifiers (Lazy.force matcher)
(Procname.get_qualifiers pname)
| _ ->
false
let has_return_annot predicate pn = Annotations.pname_has_return_annot pn predicate let has_return_annot predicate pn = Annotations.pname_has_return_annot pn predicate
let is_functional pname = let is_functional pname =
@ -337,19 +310,40 @@ let is_assumed_thread_safe tenv pname =
(* return true if we should compute a summary for the procedure. if this returns false, we won't (* return true if we should compute a summary for the procedure. if this returns false, we won't
analyze the procedure or report any warnings on it *) analyze the procedure or report any warnings on it *)
(* note: in the future, we will want to analyze the procedures in all of these cases in order to let should_analyze_proc =
find more bugs. this is just a temporary measure to avoid obvious false positives *) (* holds of procedure names which should not be analyzed in order to avoid known sources of
let should_analyze_proc tenv pn = inaccuracy *)
(not let should_skip =
( match pn with let matcher =
| Procname.Java java_pname -> lazy
Typ.Name.Java.is_external (Procname.Java.get_class_type_name java_pname) (QualifiedCppName.Match.of_fuzzy_qual_names ~prefix:true
(* third party code may be hard to change, not useful to report races there *) [ "folly::AtomicStruct"
| _ -> ; "folly::fbstring_core"
false )) ; "folly::Future"
&& (not (FbThreadSafety.is_logging_method pn)) ; "folly::futures"
&& (not (is_assumed_thread_safe tenv pn)) ; "folly::LockedPtr"
&& not (should_skip pn) ; "folly::Optional"
; "folly::Promise"
; "folly::ThreadLocal"
; "folly::detail::SingletonHolder"
; "std::atomic"
; "std::vector" ])
in
function
| Procname.ObjC_Cpp cpp_pname as pname ->
Procname.ObjC_Cpp.is_destructor cpp_pname
|| QualifiedCppName.Match.match_qualifiers (Lazy.force matcher)
(Procname.get_qualifiers pname)
| Procname.Java java_pname ->
Procname.Java.is_autogen_method java_pname
|| Typ.Name.Java.is_external (Procname.Java.get_class_type_name java_pname)
| _ ->
false
in
fun tenv pn ->
(not (should_skip pn))
&& (not (FbThreadSafety.is_logging_method pn))
&& not (is_assumed_thread_safe tenv pn)
let get_current_class_and_threadsafe_superclasses tenv pname = let get_current_class_and_threadsafe_superclasses tenv pname =

Loading…
Cancel
Save