[filtering/dedup] add deduplicate flag and disambiguate filtering

Summary:
The documentation and uses of filtering disagree.  One typical usage is deduplication.
Split that where obvious, add comments where not obvious, and leave alone when obviously unrelated to deduplication.

Reviewed By: mityal

Differential Revision: D17715329

fbshipit-source-id: ec757927b
master
Nikos Gorogiannis 5 years ago committed by Facebook Github Bot
parent 41729410ac
commit 965bf52bf8

@ -96,6 +96,10 @@ OPTIONS
Debug level for the linters. See --debug-level for accepted Debug level for the linters. See --debug-level for accepted
values. values.
--no-deduplicate
Deactivates: Apply issue-specific deduplication during analysis
and/or reporting. (Conversely: --deduplicate)
--no-default-checkers --no-default-checkers
Deactivates: Default checkers: --biabduction, Deactivates: Default checkers: --biabduction,
--fragment-retains-view, --inefficient-keyset-iterator, --linters, --fragment-retains-view, --inefficient-keyset-iterator, --linters,

@ -296,6 +296,11 @@ OPTIONS
infer-events(1), infer-report(1), infer-reportdiff(1), and infer-events(1), infer-report(1), infer-reportdiff(1), and
infer-run(1). infer-run(1).
--no-deduplicate
Deactivates: Apply issue-specific deduplication during analysis
and/or reporting. (Conversely: --deduplicate) See also infer-analyze(1), infer-report(1), and
infer-reportdiff(1).
--no-default-checkers --no-default-checkers
Deactivates: Default checkers: --biabduction, Deactivates: Default checkers: --biabduction,
--fragment-retains-view, --inefficient-keyset-iterator, --linters, --fragment-retains-view, --inefficient-keyset-iterator, --linters,
@ -1277,8 +1282,9 @@ INTERNAL OPTIONS
--debug-exceptions --debug-exceptions
Activates: Generate lightweight debugging information: just print Activates: Generate lightweight debugging information: just print
the internal exceptions during analysis (also sets the internal exceptions during analysis (also sets
--developer-mode, --no-filtering, --print-buckets, --developer-mode, --no-filtering, --no-deduplicate,
--reports-include-ml-loc) (Conversely: --no-debug-exceptions) --print-buckets, --reports-include-ml-loc) (Conversely:
--no-debug-exceptions)
--debug-level-reset --debug-level-reset
Cancel the effect of --debug-level. Cancel the effect of --debug-level.

@ -60,6 +60,10 @@ OPTIONS
Debug level for the linters. See --debug-level for accepted Debug level for the linters. See --debug-level for accepted
values. values.
--no-deduplicate
Deactivates: Apply issue-specific deduplication during analysis
and/or reporting. (Conversely: --deduplicate)
--differential-filter-files string --differential-filter-files string
Specify the file containing the list of source files for which a Specify the file containing the list of source files for which a
differential report is desired. Source files should be specified differential report is desired. Source files should be specified

@ -51,6 +51,10 @@ OPTIONS
Debug level for the linters. See --debug-level for accepted Debug level for the linters. See --debug-level for accepted
values. values.
--no-deduplicate
Deactivates: Apply issue-specific deduplication during analysis
and/or reporting. (Conversely: --deduplicate)
--file-renamings path --file-renamings path
JSON with a list of file renamings to use while computing JSON with a list of file renamings to use while computing
differential reports differential reports

@ -296,6 +296,11 @@ OPTIONS
infer-events(1), infer-report(1), infer-reportdiff(1), and infer-events(1), infer-report(1), infer-reportdiff(1), and
infer-run(1). infer-run(1).
--no-deduplicate
Deactivates: Apply issue-specific deduplication during analysis
and/or reporting. (Conversely: --deduplicate) See also infer-analyze(1), infer-report(1), and
infer-reportdiff(1).
--no-default-checkers --no-default-checkers
Deactivates: Default checkers: --biabduction, Deactivates: Default checkers: --biabduction,
--fragment-retains-view, --inefficient-keyset-iterator, --linters, --fragment-retains-view, --inefficient-keyset-iterator, --linters,

@ -19,6 +19,7 @@ module LocListSet = struct
end end
let is_duplicate_report end_locs reported_ends = let is_duplicate_report end_locs reported_ends =
(* FIXME(T54950303) replace use of filtering with deduplicate *)
Config.filtering && LocListSet.mem reported_ends end_locs Config.filtering && LocListSet.mem reported_ends end_locs

@ -38,6 +38,7 @@ type t_ignore_duplicates = t =
de-duplicating. *) de-duplicating. *)
let sort_filter_issues issues = let sort_filter_issues issues =
let issues' = let issues' =
(* FIXME(T54950303) replace use of filtering with deduplicate *)
let compare = if Config.filtering then compare_t_ignore_duplicates else compare in let compare = if Config.filtering then compare_t_ignore_duplicates else compare in
List.dedup_and_sort ~compare issues List.dedup_and_sort ~compare issues
in in

@ -1136,6 +1136,7 @@ and custom_symbols =
and ( biabduction_models_mode and ( biabduction_models_mode
, bo_debug , bo_debug
, deduplicate
, developer_mode , developer_mode
, debug , debug
, debug_exceptions , debug_exceptions
@ -1168,6 +1169,12 @@ and ( biabduction_models_mode
CLOpt.mk_int ~default:0 ~long:"bo-debug" CLOpt.mk_int ~default:0 ~long:"bo-debug"
~in_help:InferCommand.[(Analyze, manual_buffer_overrun)] ~in_help:InferCommand.[(Analyze, manual_buffer_overrun)]
"Debug level for buffer-overrun checker (0-4)" "Debug level for buffer-overrun checker (0-4)"
and deduplicate =
CLOpt.mk_bool ~long:"deduplicate" ~default:true
~in_help:
InferCommand.
[(Analyze, manual_generic); (Report, manual_generic); (ReportDiff, manual_generic)]
"Apply issue-specific deduplication during analysis and/or reporting."
and debug_level_analysis = and debug_level_analysis =
CLOpt.mk_int ~long:"debug-level-analysis" ~default:0 ~in_help:all_generic_manuals CLOpt.mk_int ~long:"debug-level-analysis" ~default:0 ~in_help:all_generic_manuals
"Debug level for the analysis. See $(b,--debug-level) for accepted values." "Debug level for the analysis. See $(b,--debug-level) for accepted values."
@ -1248,10 +1255,10 @@ and ( biabduction_models_mode
and debug_exceptions = and debug_exceptions =
CLOpt.mk_bool_group ~long:"debug-exceptions" CLOpt.mk_bool_group ~long:"debug-exceptions"
"Generate lightweight debugging information: just print the internal exceptions during \ "Generate lightweight debugging information: just print the internal exceptions during \
analysis (also sets $(b,--developer-mode), $(b,--no-filtering), $(b,--print-buckets), \ analysis (also sets $(b,--developer-mode), $(b,--no-filtering), $(b,--no-deduplicate), \
$(b,--reports-include-ml-loc))" $(b,--print-buckets), $(b,--reports-include-ml-loc))"
[developer_mode; print_buckets; reports_include_ml_loc] [developer_mode; print_buckets; reports_include_ml_loc]
[filtering; keep_going] [filtering; keep_going; deduplicate]
and default_linters = and default_linters =
CLOpt.mk_bool ~long:"default-linters" CLOpt.mk_bool ~long:"default-linters"
~in_help:InferCommand.[(Capture, manual_clang_linters)] ~in_help:InferCommand.[(Capture, manual_clang_linters)]
@ -1285,6 +1292,7 @@ and ( biabduction_models_mode
in in
( biabduction_models_mode ( biabduction_models_mode
, bo_debug , bo_debug
, deduplicate
, developer_mode , developer_mode
, debug , debug
, debug_exceptions , debug_exceptions
@ -2837,6 +2845,8 @@ and debug_exceptions = !debug_exceptions
and debug_mode = !debug and debug_mode = !debug
and deduplicate = !deduplicate
and default_linters = !default_linters and default_linters = !default_linters
and dependency_mode = !dependencies and dependency_mode = !dependencies

@ -312,6 +312,8 @@ val cxx : bool
val cxx_scope_guards : Yojson.Basic.t val cxx_scope_guards : Yojson.Basic.t
val deduplicate : bool
val debug_exceptions : bool val debug_exceptions : bool
val debug_level_analysis : int val debug_level_analysis : int

@ -242,6 +242,7 @@ let report_siof summary trace gname loc =
Reporting.log_error summary ~loc ~ltr IssueType.static_initialization_order_fiasco description Reporting.log_error summary ~loc ~ltr IssueType.static_initialization_order_fiasco description
in in
let reportable_paths = SiofTrace.get_reportable_sink_paths trace ~trace_of_pname in let reportable_paths = SiofTrace.get_reportable_sink_paths trace ~trace_of_pname in
(* FIXME(T54950303) replace use of filtering with deduplicate *)
if Config.filtering then List.hd reportable_paths |> Option.iter ~f:report_one_path if Config.filtering then List.hd reportable_paths |> Option.iter ~f:report_one_path
else List.iter ~f:report_one_path reportable_paths else List.iter ~f:report_one_path reportable_paths

@ -1000,7 +1000,7 @@ let report_unsafe_accesses ~issue_log classname (aggregated_access_map : ReportM
({reported_sites; reported_writes; reported_reads; reported_unannotated_calls}, _) = ({reported_sites; reported_writes; reported_reads; reported_unannotated_calls}, _) =
let pname = Procdesc.get_proc_name procdesc in let pname = Procdesc.get_proc_name procdesc in
let call_site = CallSite.make pname (TraceElem.get_loc snapshot.access) in let call_site = CallSite.make pname (TraceElem.get_loc snapshot.access) in
if Config.filtering then if Config.deduplicate then
CallSite.Set.mem call_site reported_sites CallSite.Set.mem call_site reported_sites
|| ||
match snapshot.access.TraceElem.elem with match snapshot.access.TraceElem.elem with
@ -1013,7 +1013,7 @@ let report_unsafe_accesses ~issue_log classname (aggregated_access_map : ReportM
else false else false
in in
let update_reported ({snapshot; procdesc} : reported_access) reported = let update_reported ({snapshot; procdesc} : reported_access) reported =
if Config.filtering then if Config.deduplicate then
let pname = Procdesc.get_proc_name procdesc in let pname = Procdesc.get_proc_name procdesc in
let call_site = CallSite.make pname (TraceElem.get_loc snapshot.access) in let call_site = CallSite.make pname (TraceElem.get_loc snapshot.access) in
let reported_sites = CallSite.Set.add call_site reported.reported_sites in let reported_sites = CallSite.Set.add call_site reported.reported_sites in

@ -21,6 +21,7 @@ let reportdiff ~current_report:current_report_fname ~previous_report:previous_re
let unfiltered_diff = let unfiltered_diff =
Differential.of_reports ~current_report ~previous_report ~current_costs ~previous_costs Differential.of_reports ~current_report ~previous_report ~current_costs ~previous_costs
in in
(* FIXME(T54950303) replace use of filtering with deduplicate *)
if Config.filtering then if Config.filtering then
let file_renamings = let file_renamings =
match Config.file_renamings with match Config.file_renamings with

@ -73,6 +73,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
let is_conflicting_report summary report_location = let is_conflicting_report summary report_location =
(* FIXME(T54950303) replace use of filtering with deduplicate *)
if not Config.filtering then false if not Config.filtering then false
else else
Errlog.fold Errlog.fold

Loading…
Cancel
Save