Skip to content

Commit

Permalink
Discriminate top level data with the same name
Browse files Browse the repository at this point in the history
  • Loading branch information
RA-Kooi committed Dec 26, 2021
1 parent 647e94c commit 0ada041
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions DwarfOne2C/Parsing/CompilationUnit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,33 @@ void Recurse(Tag parent, int depth)
}

Recurse(allTags[0], 0);

// Discriminate global symbols with the same name
List<string> sameNames = new();

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

0 comments on commit 0ada041

Please sign in to comment.