From 89fa74bc9b19dfd814142fa210db378b294748bf Mon Sep 17 00:00:00 2001 From: Sam Blackshear Date: Tue, 23 Aug 2016 17:47:07 -0700 Subject: [PATCH] make @OnBind an alias for @NoAllocation Reviewed By: jvillard Differential Revision: D3760579 fbshipit-source-id: 5f00f5d --- infer/src/checkers/annotationReachability.ml | 11 ++++++----- infer/src/checkers/annotations.ml | 2 +- infer/src/checkers/annotations.mli | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/infer/src/checkers/annotationReachability.ml b/infer/src/checkers/annotationReachability.ml index 0717c3fe0..d23b076d5 100644 --- a/infer/src/checkers/annotationReachability.ml +++ b/infer/src/checkers/annotationReachability.ml @@ -25,7 +25,7 @@ let src_snk_pairs () = let specs = [ ([Annotations.performance_critical], Annotations.expensive); - ([Annotations.no_allocation], dummy_constructor_annot); + ([Annotations.no_allocation; Annotations.on_bind], dummy_constructor_annot); ] in IList.map (fun (src_annot_str_list, snk_annot_str) -> @@ -202,14 +202,15 @@ let update_trace loc trace = let string_of_pname = Procname.to_simplified_string ~withclass:true -let report_allocation_stack pname fst_call_loc trace stack_str constructor_pname call_loc = +let report_allocation_stack + src_annot pname fst_call_loc trace stack_str constructor_pname call_loc = let final_trace = IList.rev (update_trace call_loc trace) in let constr_str = string_of_pname constructor_pname in let description = Printf.sprintf "Method `%s` annotated with `@%s` allocates `%s` via `%s%s`" (Procname.to_simplified_string pname) - Annotations.no_allocation + src_annot constr_str stack_str ("new "^constr_str) in @@ -218,8 +219,8 @@ let report_allocation_stack pname fst_call_loc trace stack_str constructor_pname Reporting.log_error pname ~loc: (Some fst_call_loc) ~ltr: (Some final_trace) exn let report_annotation_stack src_annot snk_annot src_pname loc trace stack_str snk_pname call_loc = - if src_annot = Annotations.no_allocation - then report_allocation_stack src_pname loc trace stack_str snk_pname call_loc + if snk_annot = dummy_constructor_annot + then report_allocation_stack src_annot src_pname loc trace stack_str snk_pname call_loc else let final_trace = IList.rev (update_trace call_loc trace) in let exp_pname_str = string_of_pname snk_pname in diff --git a/infer/src/checkers/annotations.ml b/infer/src/checkers/annotations.ml index cb1f2ee5a..cd56b3814 100644 --- a/infer/src/checkers/annotations.ml +++ b/infer/src/checkers/annotations.ml @@ -115,6 +115,7 @@ let false_on_null = "FalseOnNull" let mutable_ = "Mutable" let nullable = "Nullable" let nonnull = "Nonnull" +let on_bind = "OnBind" let camel_nonnull = "NonNull" let notnull = "NotNull" let present = "Present" @@ -126,7 +127,6 @@ let performance_critical = "PerformanceCritical" let no_allocation = "NoAllocation" let ignore_allocations = "IgnoreAllocations" - let suppress_warnings = "SuppressWarnings" let privacy_source = "PrivacySource" let privacy_sink = "PrivacySink" diff --git a/infer/src/checkers/annotations.mli b/infer/src/checkers/annotations.mli index eaa0103cf..23629eb62 100644 --- a/infer/src/checkers/annotations.mli +++ b/infer/src/checkers/annotations.mli @@ -16,6 +16,7 @@ val suppressLint : string val expensive : string val performance_critical : string val no_allocation : string +val on_bind : string val suppress_warnings : string type annotation =