diff --git a/infer/src/concurrency/RacerDModels.ml b/infer/src/concurrency/RacerDModels.ml index 263c85099..a43ea6a57 100644 --- a/infer/src/concurrency/RacerDModels.ml +++ b/infer/src/concurrency/RacerDModels.ml @@ -160,33 +160,6 @@ let is_container_read tenv pn = 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 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 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 - find more bugs. this is just a temporary measure to avoid obvious false positives *) -let should_analyze_proc tenv pn = - (not - ( match pn with - | Procname.Java java_pname -> - Typ.Name.Java.is_external (Procname.Java.get_class_type_name java_pname) - (* third party code may be hard to change, not useful to report races there *) - | _ -> - false )) - && (not (FbThreadSafety.is_logging_method pn)) - && (not (is_assumed_thread_safe tenv pn)) - && not (should_skip pn) +let should_analyze_proc = + (* 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) + | 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 =