@ -28,22 +28,30 @@ let compute_key (bug_type : string) (proc_name : Procname.t) (filename : string)
String . concat ~ sep : " | " [ base_filename ; simple_procedure_name ; bug_type ]
String . concat ~ sep : " | " [ base_filename ; simple_procedure_name ; bug_type ]
let compute_hash ~ ( severity : string ) ~ ( bug_type : string ) ~ ( proc_name : Procname . t )
let compute_hash =
~ ( file : string ) ~ ( qualifier : string ) =
let num_regexp = Re . Str . regexp " \\ (: \\ )[0-9]+ " in
let qualifier_regexp = Re . Str . regexp " \\ (line \\ |column \\ |: \\ |parameter \\ | \\ $ \\ )[0-9]+ " in
fun ~ ( severity : string ) ~ ( bug_type : string ) ~ ( proc_name : Procname . t ) ~ ( file : string )
~ ( qualifier : string ) ->
let base_filename = Filename . basename file in
let base_filename = Filename . basename file in
let hashable_procedure_name = Procname . hashable_name proc_name in
let hashable_procedure_name = Procname . hashable_name proc_name in
let location_independent_proc_name =
Re . Str . global_replace num_regexp " $_ " hashable_procedure_name
in
let location_independent_qualifier =
let location_independent_qualifier =
(* Removing the line,column, line and column in lambda's name
(* Removing the line,column, line and column in lambda's name
( e . g . test :: lambda . cpp : 10 : 15 :: operator () ) ,
( e . g . test :: lambda . cpp : 10 : 15 :: operator () ) ,
and infer temporary variable ( e . g . , n $ 67 ) information from the
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
error message as well as the index of the annonymmous class to make the hash invariant
when moving the source code in the file * )
when moving the source code in the file * )
Str . global_replace
Re . Str . global_replace qualifier_regexp " $_ " qualifier
( Str . regexp " \\ (line \\ |column \\ |: \\ |parameter \\ | \\ $ \\ )[0-9]+ " )
" $_ " qualifier
in
in
Utils . better_hash
Utils . better_hash
( severity , bug_type , hashable_procedure_name , base_filename , location_independent_qualifier )
( severity
, bug_type
, location_independent_proc_name
, base_filename
, location_independent_qualifier )
| > Caml . Digest . to_hex
| > Caml . Digest . to_hex