Output: Annotate unmanaged type usages with 'unsafe' keyword

This commit is contained in:
Katy Coe
2019-11-10 18:53:07 +01:00
parent 54d03b9f0f
commit 5bf6e2c7c3
5 changed files with 13 additions and 0 deletions

View File

@@ -128,6 +128,8 @@ namespace Il2CppInspector.Reflection {
public string GetModifierString() {
var modifiers = new StringBuilder(GetAccessModifierString());
if (FieldType.RequiresUnsafeContext || GetCustomAttributes("System.Runtime.CompilerServices.FixedBufferAttribute").Any())
modifiers.Append("unsafe ");
if (IsLiteral)
modifiers.Append("const ");
// All const fields are also static by implication