Summary: Currently, we report on all functions that are not config checked. However, the aim of the analysis is to only report on these for specific functions. Moreover, this has performance implications in practice. This diff instead reports on functions that occur on a json file that is passed by the command line option `config-data-file`. Reviewed By: skcho Differential Revision: D26666336 fbshipit-source-id: 290cd3adamaster
parent
92ad9f1ed9
commit
7f9d56b1b5
@ -0,0 +1,12 @@
|
||||
(*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
type config_item = {
|
||||
method_name: string;
|
||||
class_name: string
|
||||
}
|
||||
type config_data = config_item list
|
@ -0,0 +1,40 @@
|
||||
(*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
open! IStd
|
||||
module L = Logging
|
||||
|
||||
module ConfigProcnameSet = Caml.Set.Make (struct
|
||||
(* workaround: since there is no way to have @@deriving directive
|
||||
in atd declaration, we redefine the type *)
|
||||
type t = Config_impact_data_t.config_item = {method_name: string; class_name: string}
|
||||
[@@deriving compare]
|
||||
end)
|
||||
|
||||
let read_file_config_data fname =
|
||||
let config_list =
|
||||
try Atdgen_runtime.Util.Json.from_file Config_impact_data_j.read_config_data fname
|
||||
with e ->
|
||||
L.user_warning "Failed to read file '%s': %s@." fname (Exn.to_string e) ;
|
||||
[]
|
||||
in
|
||||
List.fold config_list ~init:ConfigProcnameSet.empty ~f:(fun acc itm ->
|
||||
ConfigProcnameSet.add itm acc )
|
||||
|
||||
|
||||
let is_in_config_data_file =
|
||||
let config_data =
|
||||
Option.value_map Config.config_impact_data_file ~default:ConfigProcnameSet.empty
|
||||
~f:read_file_config_data
|
||||
in
|
||||
fun proc_name ->
|
||||
ConfigProcnameSet.exists
|
||||
(fun {method_name; class_name} ->
|
||||
String.equal method_name (Procname.get_method proc_name)
|
||||
&& String.equal class_name (Procname.get_class_name proc_name |> Option.value ~default:"")
|
||||
)
|
||||
config_data
|
@ -0,0 +1,10 @@
|
||||
(*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
open! IStd
|
||||
|
||||
val is_in_config_data_file : Procname.t -> bool
|
@ -1 +1,3 @@
|
||||
../../facebook/skel/infer/tests/codetoanalyze/objc/fb-config-impact/Basic.m, qe_unchecked_bad, 4, CONFIG_IMPACT, no_bucket, ADVICE, [callee2 is called]
|
||||
../../facebook/skel/infer/tests/codetoanalyze/objc/fb-config-impact/ClassTest.m, MyClass.call_log_bad:data:, 4, CONFIG_IMPACT, no_bucket, ADVICE, [__objc_alloc_no_fail is called]
|
||||
../../facebook/skel/infer/tests/codetoanalyze/objc/fb-config-impact/ClassTest.m, MyClass.call_log_bad:data:, 4, CONFIG_IMPACT, no_bucket, ADVICE, [NSKeyedUnarchiver.initForReadingFromData:error: is called]
|
||||
|
Loading…
Reference in new issue