[threadsafety] Consider certain init() methods as constructors

Reviewed By: jvillard

Differential Revision: D4046903

fbshipit-source-id: 0183b0c
master
Peter O'Hearn 8 years ago committed by Facebook Github Bot
parent ef8e76bdec
commit 25a688bdbe

@ -7,11 +7,6 @@
* of patent rights can be found in the PATENTS file in the same directory.
*)
(** I want to use various powersets instead of just variables like Var.Set
For example to track the analogues of attributes
I will do this running forwards later, but backwards for now.
*)
open! Utils
module F = Format
@ -109,7 +104,8 @@ module ResultsTableType = Map.Make (struct
let compare (_, _, pn1, _) (_,_,pn2,_) = Procname.compare pn1 pn2
end)
let should_analyze_proc (_,_,proc_name,proc_desc) =
let should_analyze_proc (_,tenv,proc_name,proc_desc) =
not (FbThreadSafety.is_custom_init tenv proc_name) &&
not (Procname.java_is_autogen_method proc_name) &&
not (Procname.is_constructor proc_name) &&
not (Procname.is_class_initializer proc_name) &&
@ -132,6 +128,7 @@ let make_results_table file_env =
in
map_post_computation_over_procs compute_post_for_procedure procs_to_analyze
let report_thread_safety_errors ( _, tenv, pname, pdesc) writestate =
let report_one_error access_path =
let description =
@ -148,6 +145,7 @@ let report_thread_safety_errors ( _, tenv, pname, pdesc) writestate =
in
IList.iter report_one_error (IList.map snd (PathDomain.elements writestate))
(* For now, just checks if there is one active element amongst the posts of the analyzed methods.
This indicates that the method races with itself. To be refined later. *)
let process_results_table tab =

@ -0,0 +1,12 @@
(*
* Copyright (c) 2016 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*)
open! Utils
let is_custom_init _ _ = false

@ -0,0 +1,12 @@
(*
* Copyright (c) 2016 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*)
open! Utils
val is_custom_init : Tenv.t -> Procname.t -> bool
Loading…
Cancel
Save