TBTR: Add template replacement index validation to CheckCaches
This commit is contained in:
@@ -35,6 +35,8 @@
|
||||
|
||||
#include "3rdparty/robin_hood/robin_hood.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
TemplatePool _template_pool("TemplatePool");
|
||||
@@ -330,3 +332,21 @@ void ReindexTemplateReplacementsRecursive()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string ValidateTemplateReplacementCaches()
|
||||
{
|
||||
robin_hood::unordered_flat_map<GroupID, TemplateID> saved_template_replacement_index = std::move(_template_replacement_index);
|
||||
robin_hood::unordered_flat_map<GroupID, TemplateID> saved_template_replacement_index_recursive = std::move(_template_replacement_index_recursive);
|
||||
|
||||
ReindexTemplateReplacements();
|
||||
|
||||
bool match = (saved_template_replacement_index == _template_replacement_index);
|
||||
bool match_recursive = (saved_template_replacement_index_recursive == _template_replacement_index_recursive);
|
||||
_template_replacement_index = std::move(saved_template_replacement_index);
|
||||
_template_replacement_index_recursive = std::move(saved_template_replacement_index_recursive);
|
||||
|
||||
if (!match) return "Index cache does not match";
|
||||
if (!match_recursive) return "Recursive index cache does not match";
|
||||
|
||||
return "";
|
||||
}
|
||||
|
Reference in New Issue
Block a user