From c4bfa359365152674608aaab29d10ae18e7d8236 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 8 Apr 2025 12:53:16 +0200 Subject: Result map: include tree-overlay actions to the origin map Now that we generate tree-overlay action identifiers that are disjoint from identifiers of regular actions, having a joint origin map does not cause any confusion. Concerning the numbering of subtasks, we always see tree-overlay actions following the regular actions, even if defined in a different order. In this way, the identifiers for the regular actions don't change. Including tree-overlay actions in the origin map also has the advantage that the origin is properly reported in case of failure (e.g., non-disjointness of the obtained trees). --- src/buildtool/build_engine/target_map/result_map.hpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/buildtool/build_engine/target_map/result_map.hpp b/src/buildtool/build_engine/target_map/result_map.hpp index d38a1d7a..449d8c92 100644 --- a/src/buildtool/build_engine/target_map/result_map.hpp +++ b/src/buildtool/build_engine/target_map/result_map.hpp @@ -204,7 +204,7 @@ class ResultTargetMap { auto& origin_map = progress->OriginMap(); origin_map.clear(); - origin_map.reserve(na); + origin_map.reserve(na + nto); for (const auto& target : targets_) { std::for_each(target.begin(), target.end(), [&](auto const& el) { auto const& actions = el.second->Actions(); @@ -225,6 +225,23 @@ class ResultTargetMap { origin}; } }); + auto const& tree_overlays = el.second->TreeOverlays(); + std::for_each( + tree_overlays.begin(), + tree_overlays.end(), + [&origin_map, &pos, &el](auto const& overlay) { + std::pair origin{ + el.first, pos++}; + auto id = overlay->Id(); + if (origin_map.contains(id)) { + origin_map[id].push_back(origin); + } + else { + origin_map[id] = std::vector< + std::pair>{ + origin}; + } + }); }); // Sort origins to get a reproducible order. We don't expect many // origins for a single action, so the cost of comparison is not -- cgit v1.2.3