Skip to content

Commit

Permalink
Fixup all global name collissions
Browse files Browse the repository at this point in the history
  • Loading branch information
RA-Kooi committed Sep 13, 2022
1 parent 29d6d5d commit ff151ba
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions DwarfOne2C/Parsing/DumpParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,27 +242,32 @@ void Recurse(Tag parent, int depth)
// Discriminate global symbols with the same name
List<string> sameNames = new();

for(Tag tag = allTags[IDToIndex[allTags[0].firstChild]];
tag.sibling != Tag.NoSibling;
tag = allTags[IDToIndex[tag.sibling]])
for(Tag CU = allTags[0];
CU.sibling != Tag.NoSibling;
CU = allTags[IDToIndex[CU.sibling]])
{
switch(tag.tagType)
for(Tag tag = allTags[IDToIndex[CU.firstChild]];
tag.sibling != Tag.NoSibling;
tag = allTags[IDToIndex[tag.sibling]])
{
case TagType.CULocalFunc:
case TagType.Class:
case TagType.Enum:
case TagType.GlobalVar:
case TagType.GlobalFunc:
case TagType.Struct:
case TagType.LocalVar:
{
if(sameNames.Contains(tag.name))
tag.name = $"{tag.name}_0x{tag.ID:X}";
else
sameNames.Add(tag.name);
} break;
default:
continue;
switch(tag.tagType)
{
case TagType.CULocalFunc:
case TagType.Class:
case TagType.Enum:
case TagType.GlobalVar:
case TagType.GlobalFunc:
case TagType.Struct:
case TagType.LocalVar:
{
if(sameNames.Contains(tag.name))
tag.name = $"{tag.name}_0x{tag.ID:X}";
else
sameNames.Add(tag.name);
} break;
default:
continue;
}
}
}
}
Expand Down

0 comments on commit ff151ba

Please sign in to comment.