From 9f98dea27a2bd2a42d3f5755142ed0e7bab9d4e5 Mon Sep 17 00:00:00 2001 From: Dulma Churchill Date: Thu, 17 Oct 2024 07:15:56 -0700 Subject: [PATCH] [paramNotNull] Do not add autofix when the location comes form a macro Reviewed By: geralt-encore Differential Revision: D64535376 fbshipit-source-id: 15bf3a603856236719eb7020d0f17fbd46fa131b --- infer/src/checkers/ParameterNotNullChecked.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/infer/src/checkers/ParameterNotNullChecked.ml b/infer/src/checkers/ParameterNotNullChecked.ml index 0cc1393a4a5..e5eccc8c2bf 100644 --- a/infer/src/checkers/ParameterNotNullChecked.ml +++ b/infer/src/checkers/ParameterNotNullChecked.ml @@ -138,7 +138,8 @@ module Mem = struct in let autofix = match Config.objc_block_execution_macro with - | Some objc_block_execution_macro -> + | Some objc_block_execution_macro + when Option.is_none (Location.get_macro_file_line_opt loc) -> let original = Some (F.asprintf "%s(" (Mangled.to_string name)) in let comma = if List.is_empty args then "" else ", " in let replacement = @@ -146,7 +147,7 @@ module Mem = struct (F.asprintf "%s(%s%s" objc_block_execution_macro (Mangled.to_string name) comma) in Some {Jsonbug_j.original; replacement; additional= None} - | None -> + | _ -> None in Reporting.log_issue proc_desc err_log ~ltr ~loc ?autofix ParameterNotNullChecked