From 9166d60af7db171b17727932936c13405b69e15e Mon Sep 17 00:00:00 2001 From: Daiva Naudziuniene Date: Thu, 5 Nov 2020 02:57:01 -0800 Subject: [PATCH] [bug hash] Ignore line and column in lambda's name when computing bug hash Summary: In cpp, lambda's `operator()` name includes line and column numbers which were not ignore when computing bug hash. Reviewed By: jberdine Differential Revision: D24649125 fbshipit-source-id: 7a235fd3e --- infer/src/integration/JsonReports.ml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/infer/src/integration/JsonReports.ml b/infer/src/integration/JsonReports.ml index 6db151616..005359304 100644 --- a/infer/src/integration/JsonReports.ml +++ b/infer/src/integration/JsonReports.ml @@ -33,10 +33,14 @@ let compute_hash ~(severity : string) ~(bug_type : string) ~(proc_name : Procnam let base_filename = Filename.basename file in let hashable_procedure_name = Procname.hashable_name proc_name in let location_independent_qualifier = - (* Removing the line,column, and infer temporary variable (e.g., n$67) information from the + (* Removing the line,column, line and column in lambda's name + (e.g. test::lambda.cpp:10:15::operator()), + and infer temporary variable (e.g., n$67) information from the error message as well as the index of the annonymmous class to make the hash invariant when moving the source code in the file *) - Str.global_replace (Str.regexp "\\(line \\|column \\|parameter \\|\\$\\)[0-9]+") "$_" qualifier + Str.global_replace + (Str.regexp "\\(line \\|column \\|:\\|parameter \\|\\$\\)[0-9]+") + "$_" qualifier in Utils.better_hash (severity, bug_type, hashable_procedure_name, base_filename, location_independent_qualifier)