From 2fd1d5e9e9ac471b33f9867c9fd665c1a6731f8f Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Sun, 21 May 2023 21:55:20 -0700 Subject: [PATCH] Fix pairing of functions by type. Change `Differ::MatchFunctions` to use `GroupIdsAndMatchByMappedId`, instead of calling `GroupIdsAndMatch` with `Differ::GroupIdsHelperGetTypeId`, which is never correct: doing so compares src and dst type ids directly, rather than consulting the established mapping. Fixes #5226. --- source/diff/diff.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/diff/diff.cpp b/source/diff/diff.cpp index 70dd329e9c..6f280f0914 100644 --- a/source/diff/diff.cpp +++ b/source/diff/diff.cpp @@ -2444,7 +2444,7 @@ void Differ::MatchFunctions() { // If there are multiple functions with the same name, group them by // type, and match only if the types match (and are unique). - GroupIdsAndMatch(src_group, dst_group, 0, + GroupIdsAndMatchByMappedId(src_group, dst_group, &Differ::GroupIdsHelperGetTypeId, [this](const IdGroup& src_group_by_type_id, const IdGroup& dst_group_by_type_id) { @@ -2489,8 +2489,8 @@ void Differ::MatchFunctions() { } // Best effort match functions with matching type. - GroupIdsAndMatch( - src_func_ids, dst_func_ids, 0, &Differ::GroupIdsHelperGetTypeId, + GroupIdsAndMatchByMappedId( + src_func_ids, dst_func_ids, &Differ::GroupIdsHelperGetTypeId, [this](const IdGroup& src_group_by_type_id, const IdGroup& dst_group_by_type_id) {