diff --git a/build/CodeGen/ResultCodegen.cs b/build/CodeGen/ResultCodegen.cs index 6ca773b2..6a4ffc51 100644 --- a/build/CodeGen/ResultCodegen.cs +++ b/build/CodeGen/ResultCodegen.cs @@ -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(); + + 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)