Skip to content

Commit 2bc03a5

Browse files
authored
Merge pull request #477 from soyasoya5/bugfix/ida_keywords
fix certain keywords not allowed by IDA even if prepended by '_'
2 parents 1852783 + 6288cce commit 2bc03a5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Il2CppDumper/Outputs/StructGenerator.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ public class StructGenerator
2727
private StringBuilder methodInfoHeader = new StringBuilder();
2828
private static HashSet<ulong> methodInfoCache = new HashSet<ulong>();
2929
private static HashSet<string> keyword = new HashSet<string>(StringComparer.Ordinal)
30-
{ "klass", "monitor", "register", "_cs", "auto", "friend", "template", "near", "far", "flat", "default", "_ds", "interrupt", "inline",
31-
"unsigned", "signed", "asm", "if", "case", "break", "continue", "do", "new", "_", "short", "union"};
30+
{ "klass", "monitor", "register", "_cs", "auto", "friend", "template", "flat", "default", "_ds", "interrupt",
31+
"unsigned", "signed", "asm", "if", "case", "break", "continue", "do", "new", "_", "short", "union", "class"};
32+
private static HashSet<string> specialKeywords = new HashSet<string>(StringComparer.Ordinal)
33+
{ "inline", "near", "far" };
3234

3335
public StructGenerator(Il2CppExecutor il2CppExecutor)
3436
{
@@ -494,6 +496,11 @@ private static string FixName(string str)
494496
{
495497
str = "_" + str;
496498
}
499+
else if (specialKeywords.Contains(str))
500+
{
501+
str = "_" + str + "_";
502+
}
503+
497504
if (Regex.IsMatch(str, "^[0-9]"))
498505
{
499506
return "_" + str;

0 commit comments

Comments
 (0)