mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2025-02-09 13:14:46 +01:00
Check for duplicate Results when doing codegen
This commit is contained in:
parent
1f4c904b04
commit
84cb7cd6b1
@ -25,6 +25,7 @@ namespace LibHacBuild.CodeGen
|
||||
|
||||
SetEmptyResultValues(modules);
|
||||
ValidateResults(modules);
|
||||
CheckForDuplicates(modules);
|
||||
ValidateHierarchy(modules);
|
||||
CheckIfAggressiveInliningNeeded(modules);
|
||||
|
||||
@ -119,6 +120,24 @@ namespace LibHacBuild.CodeGen
|
||||
}
|
||||
}
|
||||
|
||||
private static void CheckForDuplicates(ModuleInfo[] modules)
|
||||
{
|
||||
foreach (ModuleInfo module in modules)
|
||||
{
|
||||
var set = new HashSet<long>();
|
||||
|
||||
foreach (ResultInfo result in module.Results)
|
||||
{
|
||||
long description = (long)result.DescriptionStart << 32 | (uint)result.DescriptionEnd;
|
||||
|
||||
if (!set.Add(description))
|
||||
{
|
||||
throw new InvalidDataException($"Duplicate result {result.Module}-{result.DescriptionStart}-{result.DescriptionEnd}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void ValidateHierarchy(ModuleInfo[] modules)
|
||||
{
|
||||
foreach (ModuleInfo module in modules)
|
||||
|
Loading…
x
Reference in New Issue
Block a user