mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-10-09 07:42:21 +03:00
rose: remap reports to program offsets
This commit is contained in:
committed by
Matthew Barr
parent
f40aa6bd40
commit
611579511c
@@ -50,6 +50,7 @@
|
||||
#include "util/make_unique.h"
|
||||
#include "util/multibit_build.h"
|
||||
#include "util/multibit_internal.h"
|
||||
#include "util/report_manager.h"
|
||||
#include "util/ue2_containers.h"
|
||||
#include "util/verify_types.h"
|
||||
#include "grey.h"
|
||||
@@ -990,4 +991,29 @@ unique_ptr<NGHolder> makeHolder(const CastleProto &proto, nfa_kind kind,
|
||||
return g;
|
||||
}
|
||||
|
||||
static
|
||||
void remapReportsToPrograms(PureRepeat &pr, const ReportManager &rm) {
|
||||
if (pr.reports.empty()) {
|
||||
return;
|
||||
}
|
||||
auto old_reports = pr.reports;
|
||||
pr.reports.clear();
|
||||
for (const auto &r : old_reports) {
|
||||
pr.reports.insert(rm.getProgramOffset(r));
|
||||
}
|
||||
}
|
||||
|
||||
void remapReportsToPrograms(CastleProto &castle, const ReportManager &rm) {
|
||||
for (auto &m : castle.repeats) {
|
||||
remapReportsToPrograms(m.second, rm);
|
||||
}
|
||||
|
||||
auto old_report_map = castle.report_map;
|
||||
castle.report_map.clear();
|
||||
for (auto &m : old_report_map) {
|
||||
u32 program = rm.getProgramOffset(m.first);
|
||||
castle.report_map[program].insert(begin(m.second), end(m.second));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ue2
|
||||
|
Reference in New Issue
Block a user