mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Check for duplicate Results when doing codegen
This commit is contained in:
parent
1f4c904b04
commit
84cb7cd6b1
1 changed files with 19 additions and 0 deletions
|
@ -25,6 +25,7 @@ namespace LibHacBuild.CodeGen
|
||||||
|
|
||||||
SetEmptyResultValues(modules);
|
SetEmptyResultValues(modules);
|
||||||
ValidateResults(modules);
|
ValidateResults(modules);
|
||||||
|
CheckForDuplicates(modules);
|
||||||
ValidateHierarchy(modules);
|
ValidateHierarchy(modules);
|
||||||
CheckIfAggressiveInliningNeeded(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)
|
private static void ValidateHierarchy(ModuleInfo[] modules)
|
||||||
{
|
{
|
||||||
foreach (ModuleInfo module in modules)
|
foreach (ModuleInfo module in modules)
|
||||||
|
|
Loading…
Reference in a new issue