diff --git a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs index 01532b6c..084cd4c0 100644 --- a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs +++ b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs @@ -872,7 +872,7 @@ private void VisitIndirectFieldDecl(IndirectFieldDecl indirectFieldDecl) return; } - if (IsPrevContextDecl(out var prevContext, out _) && prevContext.IsAnonymous) + if (IsPrevContextDecl(out var prevContext, out _) && prevContext.IsAnonymousStructOrUnion) { // We shouldn't process indirect fields where the prev context is an anonymous record decl return; @@ -887,7 +887,7 @@ private void VisitIndirectFieldDecl(IndirectFieldDecl indirectFieldDecl) var contextNameParts = new Stack(); var contextTypeParts = new Stack(); - while (rootRecordDecl.IsAnonymous && (rootRecordDecl.Parent is RecordDecl parentRecordDecl)) + while (rootRecordDecl.IsAnonymousStructOrUnion && (rootRecordDecl.Parent is RecordDecl parentRecordDecl)) { // The name of a field of an anonymous type should be same as the type's name minus the // type kind tag at the end and the leading `_`. @@ -1390,7 +1390,7 @@ private void VisitRecordDecl(RecordDecl recordDecl) var maxAlignm = recordDecl.Fields.Any() ? recordDecl.Fields.Max((fieldDecl) => Math.Max(fieldDecl.Type.Handle.AlignOf, 1)) : alignment; var isTopLevelStruct = _config.WithTypes.TryGetValue(name, out var withType) && withType.Equals("struct", StringComparison.Ordinal); - var generateTestsClass = !recordDecl.IsAnonymous && recordDecl.DeclContext is not RecordDecl; + var generateTestsClass = !recordDecl.IsAnonymousStructOrUnion && recordDecl.DeclContext is not RecordDecl; var testOutputStarted = false; var nullableUuid = (Guid?)null; diff --git a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs index d81ab249..1826f279 100644 --- a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs +++ b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs @@ -3210,7 +3210,7 @@ private string GetRemappedCursorName(NamedDecl namedDecl, out string nativeTypeN } else if ((namedDecl is FieldDecl fieldDecl) && name.StartsWith("__AnonymousFieldDecl_", StringComparison.Ordinal)) { - if (fieldDecl.Type.AsCXXRecordDecl?.IsAnonymous == true) + if (fieldDecl.Type.AsCXXRecordDecl?.IsAnonymousStructOrUnion == true) { // For fields of anonymous types, use the name of the type but clean off the type // kind tag at the end. @@ -3242,12 +3242,72 @@ private string GetRemappedCursorName(NamedDecl namedDecl, out string nativeTypeN return remappedName; } + private static int GetAnonymousRecordIndex(RecordDecl recordDecl, RecordDecl parentRecordDecl) + { + var index = -1; + var parentAnonRecordCount = parentRecordDecl.AnonymousRecords.Count; + + if (parentAnonRecordCount != 0) + { + index = parentRecordDecl.AnonymousRecords.IndexOf(recordDecl); + + if (index != -1) + { + if (parentAnonRecordCount > 1) + { + index++; + } + + if (parentRecordDecl.Parent is RecordDecl grandParentRecordDecl) + { + var parentIndex = GetAnonymousRecordIndex(parentRecordDecl, grandParentRecordDecl); + + // We can't have the nested anonymous record have the same name as the parent + // so skip that index and just go one higher instead. This could still conflict + // with another anonymous record at a different level, but that is less likely + // and will still be unambiguous in total. + + if (parentIndex == index) + { + if (recordDecl.IsUnion == parentRecordDecl.IsUnion) + { + index++; + } + } + else if ((parentIndex != 0) && (index > parentIndex)) + { + if (recordDecl.IsUnion == parentRecordDecl.AnonymousRecords[parentIndex].IsUnion) + { + index++; + } + } + } + } + } + + return index; + } + private string GetRemappedNameForAnonymousRecord(RecordDecl recordDecl) { if (recordDecl.Parent is RecordDecl parentRecordDecl) { var remappedNameBuilder = new StringBuilder(); - var matchingField = parentRecordDecl.Fields.Where((fieldDecl) => fieldDecl.Type.CanonicalType == recordDecl.TypeForDecl.CanonicalType).FirstOrDefault(); + var matchingField = null as FieldDecl; + + if (!recordDecl.IsAnonymousStructOrUnion) + { + matchingField = parentRecordDecl.Fields.Where((fieldDecl) => { + var fieldType = fieldDecl.Type.CanonicalType; + + if (fieldType is ArrayType arrayType) + { + fieldType = arrayType.ElementType.CanonicalType; + } + + return fieldType == recordDecl.TypeForDecl.CanonicalType; + }).FirstOrDefault(); + } if ((matchingField is not null) && !matchingField.IsAnonymousField) { @@ -3258,28 +3318,11 @@ private string GetRemappedNameForAnonymousRecord(RecordDecl recordDecl) { _ = remappedNameBuilder.Append("_Anonymous"); - // If there is more than one anonymous type, then add a numeral to differentiate. - if (parentRecordDecl.AnonymousRecords.Count > 1) - { - var index = parentRecordDecl.AnonymousRecords.IndexOf(recordDecl) + 1; - Debug.Assert(index > 0); - _ = remappedNameBuilder.Append(index); - } + var index = GetAnonymousRecordIndex(recordDecl, parentRecordDecl); - // C# doesn't allow a nested type to have the same name as the parent, so if the - // parent is also anonymous, add the nesting depth as a way to avoid conflicts with - // the parent's name. - if (parentRecordDecl.IsAnonymous) + if (index != 0) { - var depth = 1; - var currentParent = parentRecordDecl.Parent; - while ((currentParent is RecordDecl currentParentRecordDecl) && currentParentRecordDecl.IsAnonymous) - { - depth++; - currentParent = currentParentRecordDecl.Parent; - } - _ = remappedNameBuilder.Append('_'); - _ = remappedNameBuilder.Append(depth); + _ = remappedNameBuilder.Append(index); } } @@ -4625,7 +4668,7 @@ private bool HasBaseField(CXXRecordDecl cxxRecordDecl) private bool HasField(RecordDecl recordDecl) { - var hasField = recordDecl.Fields.Any() || recordDecl.Decls.Any((decl) => (decl is RecordDecl nestedRecordDecl) && nestedRecordDecl.IsAnonymous && HasField(nestedRecordDecl)); + var hasField = recordDecl.Fields.Any() || recordDecl.Decls.Any((decl) => (decl is RecordDecl nestedRecordDecl) && nestedRecordDecl.IsAnonymousStructOrUnion && HasField(nestedRecordDecl)); if (!hasField && (recordDecl is CXXRecordDecl cxxRecordDecl)) { @@ -5170,7 +5213,7 @@ bool IsEmptyRecord(RecordDecl recordDecl) foreach (var decl in recordDecl.Decls) { - if ((decl is RecordDecl nestedRecordDecl) && nestedRecordDecl.IsAnonymous && !IsEmptyRecord(nestedRecordDecl)) + if ((decl is RecordDecl nestedRecordDecl) && nestedRecordDecl.IsAnonymousStructOrUnion && !IsEmptyRecord(nestedRecordDecl)) { return false; } @@ -6195,7 +6238,7 @@ private bool IsUnsafe(RecordDecl recordDecl) { return true; } - else if ((decl is RecordDecl nestedRecordDecl) && nestedRecordDecl.IsAnonymous && (IsUnsafe(nestedRecordDecl) || Config.GenerateCompatibleCode)) + else if ((decl is RecordDecl nestedRecordDecl) && nestedRecordDecl.IsAnonymousStructOrUnion && (IsUnsafe(nestedRecordDecl) || Config.GenerateCompatibleCode)) { return true; } diff --git a/sources/ClangSharp/Cursors/Decls/RecordDecl.cs b/sources/ClangSharp/Cursors/Decls/RecordDecl.cs index 43edca79..f92e00d1 100644 --- a/sources/ClangSharp/Cursors/Decls/RecordDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/RecordDecl.cs @@ -36,12 +36,12 @@ private protected RecordDecl(CXCursor handle, CXCursorKind expectedCursorKind, C _fields = LazyList.Create(Handle.NumFields, (i) => TranslationUnit.GetOrCreate(Handle.GetField(unchecked((uint)i)))); _anonymousFields = new ValueLazy>(() => [.. Decls.OfType().Where(decl => decl.IsAnonymousField)]); - _anonymousRecords = new ValueLazy>(() => [.. Decls.OfType().Where(decl => decl.IsAnonymous && !decl.IsInjectedClassName)]); + _anonymousRecords = new ValueLazy>(() => [.. Decls.OfType().Where(decl => decl.IsAnonymousStructOrUnion && !decl.IsInjectedClassName)]); _indirectFields = new ValueLazy>(() => [.. Decls.OfType()]); _injectedClassName = new ValueLazy(() => Decls.OfType().Where(decl => decl.IsInjectedClassName).SingleOrDefault()); } - public bool IsAnonymous => Handle.IsAnonymous; + public bool IsAnonymousStructOrUnion => Handle.IsAnonymousStructOrUnion; public IReadOnlyList AnonymousFields => _anonymousFields.Value; diff --git a/sources/ClangSharpPInvokeGenerator/Properties/launchSettings.json b/sources/ClangSharpPInvokeGenerator/Properties/launchSettings.json index 027d49f5..cef15055 100644 --- a/sources/ClangSharpPInvokeGenerator/Properties/launchSettings.json +++ b/sources/ClangSharpPInvokeGenerator/Properties/launchSettings.json @@ -12,7 +12,7 @@ "GenerateLocal": { "commandName": "Project", "commandLineArgs": "@generate.rsp", - "workingDirectory": "D:\\Users\\tagoo\\source\\repos\\terrafx.interop.windows\\generation\\Windows\\um\\sapi" + "workingDirectory": "D:\\repos\\terrafx.interop.windows\\generation\\DirectX\\um\\dcommon" } } } diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/StructDeclarationTest.cs index 67053b19..a3aa64ce 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/StructDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/StructDeclarationTest.cs @@ -1161,7 +1161,7 @@ public ref {expectedManagedType} value1 {{ get {{ - fixed (_Anonymous_e__Struct._Anonymous2_1_e__Struct* pField = &Anonymous.Anonymous2_1) + fixed (_Anonymous_e__Struct._Anonymous1_e__Struct* pField = &Anonymous.Anonymous1) {{ return ref pField->value1; }} @@ -1172,7 +1172,7 @@ public ref {expectedManagedType} value {{ get {{ - fixed (_Anonymous_e__Struct._Anonymous2_1_e__Struct._Anonymous_2_e__Struct* pField = &Anonymous.Anonymous2_1.Anonymous_2) + fixed (_Anonymous_e__Struct._Anonymous1_e__Struct._Anonymous_e__Struct* pField = &Anonymous.Anonymous1.Anonymous) {{ return ref pField->value; }} @@ -1183,7 +1183,7 @@ public ref {expectedManagedType} value2 {{ get {{ - fixed (_Anonymous_e__Struct._Anonymous3_1_e__Union* pField = &Anonymous.Anonymous3_1) + fixed (_Anonymous_e__Struct._Anonymous2_e__Union* pField = &Anonymous.Anonymous2) {{ return ref pField->value2; }} @@ -1231,10 +1231,10 @@ public unsafe partial struct _Anonymous_e__Struct public _w_e__Struct w; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L19_C9"")] - public _Anonymous2_1_e__Struct Anonymous2_1; + public _Anonymous1_e__Struct Anonymous1; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L29_C9"")] - public _Anonymous3_1_e__Union Anonymous3_1; + public _Anonymous2_e__Union Anonymous2; public MyUnion u; @@ -1249,21 +1249,21 @@ public partial struct _w_e__Struct public {expectedManagedType} value; }} - public unsafe partial struct _Anonymous2_1_e__Struct + public unsafe partial struct _Anonymous1_e__Struct {{ public {expectedManagedType} value1; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L23_C13"")] - public _Anonymous_2_e__Struct Anonymous_2; + public _Anonymous_e__Struct Anonymous; - public partial struct _Anonymous_2_e__Struct + public partial struct _Anonymous_e__Struct {{ public {expectedManagedType} value; }} }} [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous3_1_e__Union + public partial struct _Anonymous2_e__Union {{ [FieldOffset(0)] public {expectedManagedType} value2; @@ -1342,7 +1342,7 @@ public ref int w { get { - fixed (_Anonymous_e__Struct._Anonymous_1_e__Struct* pField = &Anonymous.Anonymous_1) + fixed (_Anonymous_e__Struct._Anonymous1_e__Struct* pField = &Anonymous.Anonymous1) { return ref pField->w; } @@ -1353,12 +1353,12 @@ public int o0_b0_16 { get { - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; } set { - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; } } @@ -1366,12 +1366,12 @@ public int o0_b16_4 { get { - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; } set { - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; } } @@ -1380,9 +1380,9 @@ public unsafe partial struct _Anonymous_e__Struct public int z; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L10_C9"")] - public _Anonymous_1_e__Struct Anonymous_1; + public _Anonymous1_e__Struct Anonymous1; - public partial struct _Anonymous_1_e__Struct + public partial struct _Anonymous1_e__Struct { public int w; @@ -2032,7 +2032,7 @@ struct { int Second; } MyArray[2]; public unsafe partial struct _MyStruct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L3_C5"")] - public _Anonymous1_e__Struct Anonymous1; + public _Anonymous_e__Struct Anonymous; [NativeTypeName(""struct (anonymous struct at ClangUnsavedFile.h:4:5)[2]"")] public _MyArray_e__FixedBuffer MyArray; @@ -2041,33 +2041,33 @@ public ref int First { get { - fixed (_Anonymous1_e__Struct* pField = &Anonymous1) + fixed (_Anonymous_e__Struct* pField = &Anonymous) { return ref pField->First; } } } - public partial struct _Anonymous1_e__Struct + public partial struct _Anonymous_e__Struct { public int First; } - public partial struct _Anonymous2_e__Struct + public partial struct _MyArray_e__Struct { public int Second; } public partial struct _MyArray_e__FixedBuffer { - public _Anonymous2_e__Struct e0; - public _Anonymous2_e__Struct e1; + public _MyArray_e__Struct e0; + public _MyArray_e__Struct e1; - public unsafe ref _Anonymous2_e__Struct this[int index] + public unsafe ref _MyArray_e__Struct this[int index] { get { - fixed (_Anonymous2_e__Struct* pThis = &e0) + fixed (_MyArray_e__Struct* pThis = &e0) { return ref pThis[index]; } @@ -2102,7 +2102,7 @@ public ref int Value1 { get { - fixed (_Anonymous_e__Struct._Anonymous_1_e__Struct._Anonymous1_2_e__Struct* pField = &Anonymous.Anonymous_1.Anonymous1_2) + fixed (_Anonymous_e__Struct._Anonymous1_e__Struct._Anonymous2_e__Struct* pField = &Anonymous.Anonymous1.Anonymous2) { return ref pField->Value1; } @@ -2113,7 +2113,7 @@ public ref int Value2 { get { - fixed (_Anonymous_e__Struct._Anonymous_1_e__Struct._Anonymous2_2_e__Struct* pField = &Anonymous.Anonymous_1.Anonymous2_2) + fixed (_Anonymous_e__Struct._Anonymous1_e__Struct._Anonymous3_e__Struct* pField = &Anonymous.Anonymous1.Anonymous3) { return ref pField->Value2; } @@ -2123,22 +2123,22 @@ public ref int Value2 public unsafe partial struct _Anonymous_e__Struct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L3_C14"")] - public _Anonymous_1_e__Struct Anonymous_1; + public _Anonymous1_e__Struct Anonymous1; - public unsafe partial struct _Anonymous_1_e__Struct + public unsafe partial struct _Anonymous1_e__Struct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L4_C9"")] - public _Anonymous1_2_e__Struct Anonymous1_2; + public _Anonymous2_e__Struct Anonymous2; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L5_C9"")] - public _Anonymous2_2_e__Struct Anonymous2_2; + public _Anonymous3_e__Struct Anonymous3; - public partial struct _Anonymous1_2_e__Struct + public partial struct _Anonymous2_e__Struct { public int Value1; } - public partial struct _Anonymous2_2_e__Struct + public partial struct _Anonymous3_e__Struct { public int Value2; } diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/UnionDeclarationTest.cs index 873019f8..0202a10e 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/UnionDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/UnionDeclarationTest.cs @@ -918,7 +918,7 @@ public ref int w { get { - fixed (_Anonymous_e__Union._Anonymous_1_e__Union* pField = &Anonymous.Anonymous_1) + fixed (_Anonymous_e__Union._Anonymous1_e__Union* pField = &Anonymous.Anonymous1) { return ref pField->w; } @@ -929,12 +929,12 @@ public int o0_b0_16 { get { - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; } set { - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; } } @@ -942,12 +942,12 @@ public int o0_b16_4 { get { - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; } set { - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; } } @@ -959,10 +959,10 @@ public unsafe partial struct _Anonymous_e__Union [FieldOffset(0)] [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L10_C9"")] - public _Anonymous_1_e__Union Anonymous_1; + public _Anonymous1_e__Union Anonymous1; [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous_1_e__Union + public partial struct _Anonymous1_e__Union { [FieldOffset(0)] public int w; @@ -1504,22 +1504,22 @@ public ref IntPtr First }} }} - public ref _Anonymous_e__Struct._Anonymous_1_e__Union._A_e__Struct A + public ref _Anonymous_e__Struct._Anonymous_e__Union._A_e__Struct A {{ get {{ - fixed (_Anonymous_e__Struct._Anonymous_1_e__Union* pField = &Anonymous.Anonymous_1) + fixed (_Anonymous_e__Struct._Anonymous_e__Union* pField = &Anonymous.Anonymous) {{ return ref pField->A; }} }} }} - public ref _Anonymous_e__Struct._Anonymous_1_e__Union._B_e__Struct B + public ref _Anonymous_e__Struct._Anonymous_e__Union._B_e__Struct B {{ get {{ - fixed (_Anonymous_e__Struct._Anonymous_1_e__Union* pField = &Anonymous.Anonymous_1) + fixed (_Anonymous_e__Struct._Anonymous_e__Union* pField = &Anonymous.Anonymous) {{ return ref pField->B; }} @@ -1532,10 +1532,10 @@ public unsafe partial struct _Anonymous_e__Struct public IntPtr First; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L7_C9"")] - public _Anonymous_1_e__Union Anonymous_1; + public _Anonymous_e__Union Anonymous; [StructLayout(LayoutKind.Explicit)] - public unsafe partial struct _Anonymous_1_e__Union + public partial struct _Anonymous_e__Union {{ [FieldOffset(0)] [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L9_C13"")] diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/StructDeclarationTest.cs index 495d50d6..f3b68211 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/StructDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/StructDeclarationTest.cs @@ -1169,7 +1169,7 @@ public ref {expectedManagedType} value1 {{ get {{ - fixed (_Anonymous_e__Struct._Anonymous2_1_e__Struct* pField = &Anonymous.Anonymous2_1) + fixed (_Anonymous_e__Struct._Anonymous1_e__Struct* pField = &Anonymous.Anonymous1) {{ return ref pField->value1; }} @@ -1180,7 +1180,7 @@ public ref {expectedManagedType} value {{ get {{ - fixed (_Anonymous_e__Struct._Anonymous2_1_e__Struct._Anonymous_2_e__Struct* pField = &Anonymous.Anonymous2_1.Anonymous_2) + fixed (_Anonymous_e__Struct._Anonymous1_e__Struct._Anonymous_e__Struct* pField = &Anonymous.Anonymous1.Anonymous) {{ return ref pField->value; }} @@ -1191,7 +1191,7 @@ public ref {expectedManagedType} value2 {{ get {{ - fixed (_Anonymous_e__Struct._Anonymous3_1_e__Union* pField = &Anonymous.Anonymous3_1) + fixed (_Anonymous_e__Struct._Anonymous2_e__Union* pField = &Anonymous.Anonymous2) {{ return ref pField->value2; }} @@ -1239,10 +1239,10 @@ public unsafe partial struct _Anonymous_e__Struct public _w_e__Struct w; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L19_C9"")] - public _Anonymous2_1_e__Struct Anonymous2_1; + public _Anonymous1_e__Struct Anonymous1; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L29_C9"")] - public _Anonymous3_1_e__Union Anonymous3_1; + public _Anonymous2_e__Union Anonymous2; public MyUnion u; @@ -1257,21 +1257,21 @@ public partial struct _w_e__Struct public {expectedManagedType} value; }} - public unsafe partial struct _Anonymous2_1_e__Struct + public unsafe partial struct _Anonymous1_e__Struct {{ public {expectedManagedType} value1; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L23_C13"")] - public _Anonymous_2_e__Struct Anonymous_2; + public _Anonymous_e__Struct Anonymous; - public partial struct _Anonymous_2_e__Struct + public partial struct _Anonymous_e__Struct {{ public {expectedManagedType} value; }} }} [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous3_1_e__Union + public partial struct _Anonymous2_e__Union {{ [FieldOffset(0)] public {expectedManagedType} value2; @@ -1350,7 +1350,7 @@ public ref int w { get { - fixed (_Anonymous_e__Struct._Anonymous_1_e__Struct* pField = &Anonymous.Anonymous_1) + fixed (_Anonymous_e__Struct._Anonymous1_e__Struct* pField = &Anonymous.Anonymous1) { return ref pField->w; } @@ -1361,12 +1361,12 @@ public int o0_b0_16 { get { - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; } set { - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; } } @@ -1374,12 +1374,12 @@ public int o0_b16_4 { get { - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; } set { - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; } } @@ -1388,9 +1388,9 @@ public unsafe partial struct _Anonymous_e__Struct public int z; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L10_C9"")] - public _Anonymous_1_e__Struct Anonymous_1; + public _Anonymous1_e__Struct Anonymous1; - public partial struct _Anonymous_1_e__Struct + public partial struct _Anonymous1_e__Struct { public int w; @@ -2038,7 +2038,7 @@ struct { int Second; } MyArray[2]; public unsafe partial struct _MyStruct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L3_C5"")] - public _Anonymous1_e__Struct Anonymous1; + public _Anonymous_e__Struct Anonymous; [NativeTypeName(""struct (anonymous struct at ClangUnsavedFile.h:4:5)[2]"")] public _MyArray_e__FixedBuffer MyArray; @@ -2047,33 +2047,33 @@ public ref int First { get { - fixed (_Anonymous1_e__Struct* pField = &Anonymous1) + fixed (_Anonymous_e__Struct* pField = &Anonymous) { return ref pField->First; } } } - public partial struct _Anonymous1_e__Struct + public partial struct _Anonymous_e__Struct { public int First; } - public partial struct _Anonymous2_e__Struct + public partial struct _MyArray_e__Struct { public int Second; } public partial struct _MyArray_e__FixedBuffer { - public _Anonymous2_e__Struct e0; - public _Anonymous2_e__Struct e1; + public _MyArray_e__Struct e0; + public _MyArray_e__Struct e1; - public unsafe ref _Anonymous2_e__Struct this[int index] + public unsafe ref _MyArray_e__Struct this[int index] { get { - fixed (_Anonymous2_e__Struct* pThis = &e0) + fixed (_MyArray_e__Struct* pThis = &e0) { return ref pThis[index]; } @@ -2108,7 +2108,7 @@ public ref int Value1 { get { - fixed (_Anonymous_e__Struct._Anonymous_1_e__Struct._Anonymous1_2_e__Struct* pField = &Anonymous.Anonymous_1.Anonymous1_2) + fixed (_Anonymous_e__Struct._Anonymous1_e__Struct._Anonymous2_e__Struct* pField = &Anonymous.Anonymous1.Anonymous2) { return ref pField->Value1; } @@ -2119,7 +2119,7 @@ public ref int Value2 { get { - fixed (_Anonymous_e__Struct._Anonymous_1_e__Struct._Anonymous2_2_e__Struct* pField = &Anonymous.Anonymous_1.Anonymous2_2) + fixed (_Anonymous_e__Struct._Anonymous1_e__Struct._Anonymous3_e__Struct* pField = &Anonymous.Anonymous1.Anonymous3) { return ref pField->Value2; } @@ -2129,22 +2129,22 @@ public ref int Value2 public unsafe partial struct _Anonymous_e__Struct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L3_C14"")] - public _Anonymous_1_e__Struct Anonymous_1; + public _Anonymous1_e__Struct Anonymous1; - public unsafe partial struct _Anonymous_1_e__Struct + public unsafe partial struct _Anonymous1_e__Struct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L4_C9"")] - public _Anonymous1_2_e__Struct Anonymous1_2; + public _Anonymous2_e__Struct Anonymous2; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L5_C9"")] - public _Anonymous2_2_e__Struct Anonymous2_2; + public _Anonymous3_e__Struct Anonymous3; - public partial struct _Anonymous1_2_e__Struct + public partial struct _Anonymous2_e__Struct { public int Value1; } - public partial struct _Anonymous2_2_e__Struct + public partial struct _Anonymous3_e__Struct { public int Value2; } diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/UnionDeclarationTest.cs index 2bbdbdc3..372e97f2 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/UnionDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/UnionDeclarationTest.cs @@ -925,7 +925,7 @@ public ref int w { get { - fixed (_Anonymous_e__Union._Anonymous_1_e__Union* pField = &Anonymous.Anonymous_1) + fixed (_Anonymous_e__Union._Anonymous1_e__Union* pField = &Anonymous.Anonymous1) { return ref pField->w; } @@ -936,12 +936,12 @@ public int o0_b0_16 { get { - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; } set { - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; } } @@ -949,12 +949,12 @@ public int o0_b16_4 { get { - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; } set { - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; } } @@ -966,10 +966,10 @@ public unsafe partial struct _Anonymous_e__Union [FieldOffset(0)] [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L10_C9"")] - public _Anonymous_1_e__Union Anonymous_1; + public _Anonymous1_e__Union Anonymous1; [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous_1_e__Union + public partial struct _Anonymous1_e__Union { [FieldOffset(0)] public int w; @@ -1510,22 +1510,22 @@ public ref int First }} }} - public ref _Anonymous_e__Struct._Anonymous_1_e__Union._A_e__Struct A + public ref _Anonymous_e__Struct._Anonymous_e__Union._A_e__Struct A {{ get {{ - fixed (_Anonymous_e__Struct._Anonymous_1_e__Union* pField = &Anonymous.Anonymous_1) + fixed (_Anonymous_e__Struct._Anonymous_e__Union* pField = &Anonymous.Anonymous) {{ return ref pField->A; }} }} }} - public ref _Anonymous_e__Struct._Anonymous_1_e__Union._B_e__Struct B + public ref _Anonymous_e__Struct._Anonymous_e__Union._B_e__Struct B {{ get {{ - fixed (_Anonymous_e__Struct._Anonymous_1_e__Union* pField = &Anonymous.Anonymous_1) + fixed (_Anonymous_e__Struct._Anonymous_e__Union* pField = &Anonymous.Anonymous) {{ return ref pField->B; }} @@ -1538,10 +1538,10 @@ public unsafe partial struct _Anonymous_e__Struct public int First; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L7_C9"")] - public _Anonymous_1_e__Union Anonymous_1; + public _Anonymous_e__Union Anonymous; [StructLayout(LayoutKind.Explicit)] - public unsafe partial struct _Anonymous_1_e__Union + public partial struct _Anonymous_e__Union {{ [FieldOffset(0)] [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L9_C13"")] diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultUnix/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultUnix/StructDeclarationTest.cs index ff9ca176..a15705ab 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultUnix/StructDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultUnix/StructDeclarationTest.cs @@ -1163,7 +1163,7 @@ public ref {expectedManagedType} value1 {{ get {{ - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous2_1.value1, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.value1, 1)); }} }} @@ -1171,7 +1171,7 @@ public ref {expectedManagedType} value {{ get {{ - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous2_1.Anonymous_2.value, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.Anonymous.value, 1)); }} }} @@ -1179,7 +1179,7 @@ public ref {expectedManagedType} value2 {{ get {{ - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous3_1.value2, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous2.value2, 1)); }} }} @@ -1215,10 +1215,10 @@ public unsafe partial struct _Anonymous_e__Struct public _w_e__Struct w; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L19_C9"")] - public _Anonymous2_1_e__Struct Anonymous2_1; + public _Anonymous1_e__Struct Anonymous1; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L29_C9"")] - public _Anonymous3_1_e__Union Anonymous3_1; + public _Anonymous2_e__Union Anonymous2; public MyUnion u; @@ -1233,21 +1233,21 @@ public partial struct _w_e__Struct public {expectedManagedType} value; }} - public partial struct _Anonymous2_1_e__Struct + public partial struct _Anonymous1_e__Struct {{ public {expectedManagedType} value1; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L23_C13"")] - public _Anonymous_2_e__Struct Anonymous_2; + public _Anonymous_e__Struct Anonymous; - public partial struct _Anonymous_2_e__Struct + public partial struct _Anonymous_e__Struct {{ public {expectedManagedType} value; }} }} [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous3_1_e__Union + public partial struct _Anonymous2_e__Union {{ [FieldOffset(0)] public {expectedManagedType} value2; @@ -1324,7 +1324,7 @@ public ref int w { get { - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.w, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.w, 1)); } } @@ -1332,12 +1332,12 @@ public int o0_b0_16 { readonly get { - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; } set { - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; } } @@ -1345,12 +1345,12 @@ public int o0_b16_4 { readonly get { - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; } set { - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; } } @@ -1359,9 +1359,9 @@ public partial struct _Anonymous_e__Struct public int z; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L10_C9"")] - public _Anonymous_1_e__Struct Anonymous_1; + public _Anonymous1_e__Struct Anonymous1; - public partial struct _Anonymous_1_e__Struct + public partial struct _Anonymous1_e__Struct { public int w; @@ -2012,7 +2012,7 @@ namespace ClangSharp.Test public partial struct _MyStruct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L3_C5"")] - public _Anonymous1_e__Struct Anonymous1; + public _Anonymous_e__Struct Anonymous; [NativeTypeName(""struct (anonymous struct at ClangUnsavedFile.h:4:5)[2]"")] public _MyArray_e__FixedBuffer MyArray; @@ -2021,26 +2021,26 @@ public ref int First { get { - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous1.First, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.First, 1)); } } - public partial struct _Anonymous1_e__Struct + public partial struct _Anonymous_e__Struct { public int First; } - public partial struct _Anonymous2_e__Struct + public partial struct _MyArray_e__Struct { public int Second; } public partial struct _MyArray_e__FixedBuffer { - public _Anonymous2_e__Struct e0; - public _Anonymous2_e__Struct e1; + public _MyArray_e__Struct e0; + public _MyArray_e__Struct e1; - public ref _Anonymous2_e__Struct this[int index] + public ref _MyArray_e__Struct this[int index] { get { @@ -2048,7 +2048,7 @@ public ref _Anonymous2_e__Struct this[int index] } } - public Span<_Anonymous2_e__Struct> AsSpan() => MemoryMarshal.CreateSpan(ref e0, 2); + public Span<_MyArray_e__Struct> AsSpan() => MemoryMarshal.CreateSpan(ref e0, 2); } } } @@ -2080,7 +2080,7 @@ public ref int Value1 { get { - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.Anonymous1_2.Value1, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.Anonymous2.Value1, 1)); } } @@ -2088,29 +2088,29 @@ public ref int Value2 { get { - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.Anonymous2_2.Value2, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.Anonymous3.Value2, 1)); } } public partial struct _Anonymous_e__Struct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L3_C14"")] - public _Anonymous_1_e__Struct Anonymous_1; + public _Anonymous1_e__Struct Anonymous1; - public partial struct _Anonymous_1_e__Struct + public partial struct _Anonymous1_e__Struct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L4_C9"")] - public _Anonymous1_2_e__Struct Anonymous1_2; + public _Anonymous2_e__Struct Anonymous2; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L5_C9"")] - public _Anonymous2_2_e__Struct Anonymous2_2; + public _Anonymous3_e__Struct Anonymous3; - public partial struct _Anonymous1_2_e__Struct + public partial struct _Anonymous2_e__Struct { public int Value1; } - public partial struct _Anonymous2_2_e__Struct + public partial struct _Anonymous3_e__Struct { public int Value2; } diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultUnix/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultUnix/UnionDeclarationTest.cs index 7ae3ffc3..6319eafe 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultUnix/UnionDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultUnix/UnionDeclarationTest.cs @@ -908,7 +908,7 @@ public ref int w { get { - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.w, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.w, 1)); } } @@ -916,12 +916,12 @@ public int o0_b0_16 { readonly get { - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; } set { - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; } } @@ -929,12 +929,12 @@ public int o0_b16_4 { readonly get { - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; } set { - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; } } @@ -946,10 +946,10 @@ public partial struct _Anonymous_e__Union [FieldOffset(0)] [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L10_C9"")] - public _Anonymous_1_e__Union Anonymous_1; + public _Anonymous1_e__Union Anonymous1; [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous_1_e__Union + public partial struct _Anonymous1_e__Union { [FieldOffset(0)] public int w; @@ -1485,19 +1485,19 @@ public ref nint First }} }} - public ref _Anonymous_e__Struct._Anonymous_1_e__Union._A_e__Struct A + public ref _Anonymous_e__Struct._Anonymous_e__Union._A_e__Struct A {{ get {{ - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.A, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous.A, 1)); }} }} - public ref _Anonymous_e__Struct._Anonymous_1_e__Union._B_e__Struct B + public ref _Anonymous_e__Struct._Anonymous_e__Union._B_e__Struct B {{ get {{ - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.B, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous.B, 1)); }} }} @@ -1507,10 +1507,10 @@ public partial struct _Anonymous_e__Struct public nint First; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L7_C9"")] - public _Anonymous_1_e__Union Anonymous_1; + public _Anonymous_e__Union Anonymous; [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous_1_e__Union + public partial struct _Anonymous_e__Union {{ [FieldOffset(0)] [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L9_C13"")] diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultWindows/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultWindows/StructDeclarationTest.cs index 784090e1..79efd657 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultWindows/StructDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultWindows/StructDeclarationTest.cs @@ -1171,7 +1171,7 @@ public ref {expectedManagedType} value1 {{ get {{ - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous2_1.value1, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.value1, 1)); }} }} @@ -1179,7 +1179,7 @@ public ref {expectedManagedType} value {{ get {{ - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous2_1.Anonymous_2.value, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.Anonymous.value, 1)); }} }} @@ -1187,7 +1187,7 @@ public ref {expectedManagedType} value2 {{ get {{ - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous3_1.value2, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous2.value2, 1)); }} }} @@ -1223,10 +1223,10 @@ public unsafe partial struct _Anonymous_e__Struct public _w_e__Struct w; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L19_C9"")] - public _Anonymous2_1_e__Struct Anonymous2_1; + public _Anonymous1_e__Struct Anonymous1; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L29_C9"")] - public _Anonymous3_1_e__Union Anonymous3_1; + public _Anonymous2_e__Union Anonymous2; public MyUnion u; @@ -1241,21 +1241,21 @@ public partial struct _w_e__Struct public {expectedManagedType} value; }} - public partial struct _Anonymous2_1_e__Struct + public partial struct _Anonymous1_e__Struct {{ public {expectedManagedType} value1; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L23_C13"")] - public _Anonymous_2_e__Struct Anonymous_2; + public _Anonymous_e__Struct Anonymous; - public partial struct _Anonymous_2_e__Struct + public partial struct _Anonymous_e__Struct {{ public {expectedManagedType} value; }} }} [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous3_1_e__Union + public partial struct _Anonymous2_e__Union {{ [FieldOffset(0)] public {expectedManagedType} value2; @@ -1332,7 +1332,7 @@ public ref int w { get { - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.w, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.w, 1)); } } @@ -1340,12 +1340,12 @@ public int o0_b0_16 { readonly get { - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; } set { - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; } } @@ -1353,12 +1353,12 @@ public int o0_b16_4 { readonly get { - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; } set { - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; } } @@ -1367,9 +1367,9 @@ public partial struct _Anonymous_e__Struct public int z; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L10_C9"")] - public _Anonymous_1_e__Struct Anonymous_1; + public _Anonymous1_e__Struct Anonymous1; - public partial struct _Anonymous_1_e__Struct + public partial struct _Anonymous1_e__Struct { public int w; @@ -2018,7 +2018,7 @@ namespace ClangSharp.Test public partial struct _MyStruct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L3_C5"")] - public _Anonymous1_e__Struct Anonymous1; + public _Anonymous_e__Struct Anonymous; [NativeTypeName(""struct (anonymous struct at ClangUnsavedFile.h:4:5)[2]"")] public _MyArray_e__FixedBuffer MyArray; @@ -2027,26 +2027,26 @@ public ref int First { get { - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous1.First, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.First, 1)); } } - public partial struct _Anonymous1_e__Struct + public partial struct _Anonymous_e__Struct { public int First; } - public partial struct _Anonymous2_e__Struct + public partial struct _MyArray_e__Struct { public int Second; } public partial struct _MyArray_e__FixedBuffer { - public _Anonymous2_e__Struct e0; - public _Anonymous2_e__Struct e1; + public _MyArray_e__Struct e0; + public _MyArray_e__Struct e1; - public ref _Anonymous2_e__Struct this[int index] + public ref _MyArray_e__Struct this[int index] { get { @@ -2054,7 +2054,7 @@ public ref _Anonymous2_e__Struct this[int index] } } - public Span<_Anonymous2_e__Struct> AsSpan() => MemoryMarshal.CreateSpan(ref e0, 2); + public Span<_MyArray_e__Struct> AsSpan() => MemoryMarshal.CreateSpan(ref e0, 2); } } } @@ -2086,7 +2086,7 @@ public ref int Value1 { get { - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.Anonymous1_2.Value1, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.Anonymous2.Value1, 1)); } } @@ -2094,29 +2094,29 @@ public ref int Value2 { get { - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.Anonymous2_2.Value2, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.Anonymous3.Value2, 1)); } } public partial struct _Anonymous_e__Struct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L3_C14"")] - public _Anonymous_1_e__Struct Anonymous_1; + public _Anonymous1_e__Struct Anonymous1; - public partial struct _Anonymous_1_e__Struct + public partial struct _Anonymous1_e__Struct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L4_C9"")] - public _Anonymous1_2_e__Struct Anonymous1_2; + public _Anonymous2_e__Struct Anonymous2; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L5_C9"")] - public _Anonymous2_2_e__Struct Anonymous2_2; + public _Anonymous3_e__Struct Anonymous3; - public partial struct _Anonymous1_2_e__Struct + public partial struct _Anonymous2_e__Struct { public int Value1; } - public partial struct _Anonymous2_2_e__Struct + public partial struct _Anonymous3_e__Struct { public int Value2; } diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultWindows/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultWindows/UnionDeclarationTest.cs index 443169e0..4a7c46fe 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultWindows/UnionDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpDefaultWindows/UnionDeclarationTest.cs @@ -914,7 +914,7 @@ public ref int w { get { - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.w, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.w, 1)); } } @@ -922,12 +922,12 @@ public int o0_b0_16 { readonly get { - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; } set { - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; } } @@ -935,12 +935,12 @@ public int o0_b16_4 { readonly get { - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; } set { - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; } } @@ -952,10 +952,10 @@ public partial struct _Anonymous_e__Union [FieldOffset(0)] [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L10_C9"")] - public _Anonymous_1_e__Union Anonymous_1; + public _Anonymous1_e__Union Anonymous1; [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous_1_e__Union + public partial struct _Anonymous1_e__Union { [FieldOffset(0)] public int w; @@ -1490,19 +1490,19 @@ public ref int First }} }} - public ref _Anonymous_e__Struct._Anonymous_1_e__Union._A_e__Struct A + public ref _Anonymous_e__Struct._Anonymous_e__Union._A_e__Struct A {{ get {{ - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.A, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous.A, 1)); }} }} - public ref _Anonymous_e__Struct._Anonymous_1_e__Union._B_e__Struct B + public ref _Anonymous_e__Struct._Anonymous_e__Union._B_e__Struct B {{ get {{ - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.B, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous.B, 1)); }} }} @@ -1512,10 +1512,10 @@ public partial struct _Anonymous_e__Struct public int First; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L7_C9"")] - public _Anonymous_1_e__Union Anonymous_1; + public _Anonymous_e__Union Anonymous; [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous_1_e__Union + public partial struct _Anonymous_e__Union {{ [FieldOffset(0)] [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L9_C13"")] diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/StructDeclarationTest.cs index cc69a079..936165db 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/StructDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/StructDeclarationTest.cs @@ -1134,7 +1134,7 @@ public ref {expectedManagedType} value1 {{ get {{ - return ref Anonymous.Anonymous2_1.value1; + return ref Anonymous.Anonymous1.value1; }} }} @@ -1143,7 +1143,7 @@ public ref {expectedManagedType} value {{ get {{ - return ref Anonymous.Anonymous2_1.Anonymous_2.value; + return ref Anonymous.Anonymous1.Anonymous.value; }} }} @@ -1152,7 +1152,7 @@ public ref {expectedManagedType} value2 {{ get {{ - return ref Anonymous.Anonymous3_1.value2; + return ref Anonymous.Anonymous2.value2; }} }} @@ -1191,10 +1191,10 @@ public partial struct _Anonymous_e__Struct public _w_e__Struct w; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L19_C9"")] - public _Anonymous2_1_e__Struct Anonymous2_1; + public _Anonymous1_e__Struct Anonymous1; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L29_C9"")] - public _Anonymous3_1_e__Union Anonymous3_1; + public _Anonymous2_e__Union Anonymous2; public MyUnion u; @@ -1209,21 +1209,21 @@ public partial struct _w_e__Struct public {expectedManagedType} value; }} - public partial struct _Anonymous2_1_e__Struct + public partial struct _Anonymous1_e__Struct {{ public {expectedManagedType} value1; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L23_C13"")] - public _Anonymous_2_e__Struct Anonymous_2; + public _Anonymous_e__Struct Anonymous; - public partial struct _Anonymous_2_e__Struct + public partial struct _Anonymous_e__Struct {{ public {expectedManagedType} value; }} }} [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous3_1_e__Union + public partial struct _Anonymous2_e__Union {{ [FieldOffset(0)] public {expectedManagedType} value2; @@ -1296,7 +1296,7 @@ public ref int w { get { - return ref Anonymous.Anonymous_1.w; + return ref Anonymous.Anonymous1.w; } } @@ -1304,12 +1304,12 @@ public int o0_b0_16 { readonly get { - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; } set { - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; } } @@ -1317,12 +1317,12 @@ public int o0_b16_4 { readonly get { - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; } set { - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; } } @@ -1331,9 +1331,9 @@ public partial struct _Anonymous_e__Struct public int z; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L10_C9"")] - public _Anonymous_1_e__Struct Anonymous_1; + public _Anonymous1_e__Struct Anonymous1; - public partial struct _Anonymous_1_e__Struct + public partial struct _Anonymous1_e__Struct { public int w; @@ -1976,7 +1976,7 @@ namespace ClangSharp.Test public partial struct _MyStruct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L3_C5"")] - public _Anonymous1_e__Struct Anonymous1; + public _Anonymous_e__Struct Anonymous; [NativeTypeName(""struct (anonymous struct at ClangUnsavedFile.h:4:5)[2]"")] public _MyArray_e__FixedBuffer MyArray; @@ -1986,16 +1986,16 @@ public ref int First { get { - return ref Anonymous1.First; + return ref Anonymous.First; } } - public partial struct _Anonymous1_e__Struct + public partial struct _Anonymous_e__Struct { public int First; } - public partial struct _Anonymous2_e__Struct + public partial struct _MyArray_e__Struct { public int Second; } @@ -2003,7 +2003,7 @@ public partial struct _Anonymous2_e__Struct [InlineArray(2)] public partial struct _MyArray_e__FixedBuffer { - public _Anonymous2_e__Struct e0; + public _MyArray_e__Struct e0; } } } @@ -2036,7 +2036,7 @@ public ref int Value1 { get { - return ref Anonymous.Anonymous_1.Anonymous1_2.Value1; + return ref Anonymous.Anonymous1.Anonymous2.Value1; } } @@ -2045,29 +2045,29 @@ public ref int Value2 { get { - return ref Anonymous.Anonymous_1.Anonymous2_2.Value2; + return ref Anonymous.Anonymous1.Anonymous3.Value2; } } public partial struct _Anonymous_e__Struct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L3_C14"")] - public _Anonymous_1_e__Struct Anonymous_1; + public _Anonymous1_e__Struct Anonymous1; - public partial struct _Anonymous_1_e__Struct + public partial struct _Anonymous1_e__Struct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L4_C9"")] - public _Anonymous1_2_e__Struct Anonymous1_2; + public _Anonymous2_e__Struct Anonymous2; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L5_C9"")] - public _Anonymous2_2_e__Struct Anonymous2_2; + public _Anonymous3_e__Struct Anonymous3; - public partial struct _Anonymous1_2_e__Struct + public partial struct _Anonymous2_e__Struct { public int Value1; } - public partial struct _Anonymous2_2_e__Struct + public partial struct _Anonymous3_e__Struct { public int Value2; } diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/UnionDeclarationTest.cs index 849143f5..64f424df 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/UnionDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/UnionDeclarationTest.cs @@ -867,7 +867,7 @@ public ref int w { get { - return ref Anonymous.Anonymous_1.w; + return ref Anonymous.Anonymous1.w; } } @@ -875,12 +875,12 @@ public int o0_b0_16 { readonly get { - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; } set { - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; } } @@ -888,12 +888,12 @@ public int o0_b16_4 { readonly get { - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; } set { - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; } } @@ -905,10 +905,10 @@ public partial struct _Anonymous_e__Union [FieldOffset(0)] [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L10_C9"")] - public _Anonymous_1_e__Union Anonymous_1; + public _Anonymous1_e__Union Anonymous1; [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous_1_e__Union + public partial struct _Anonymous1_e__Union { [FieldOffset(0)] public int w; @@ -1449,20 +1449,20 @@ public ref nint First }} [UnscopedRef] - public ref _Anonymous_e__Struct._Anonymous_1_e__Union._A_e__Struct A + public ref _Anonymous_e__Struct._Anonymous_e__Union._A_e__Struct A {{ get {{ - return ref Anonymous.Anonymous_1.A; + return ref Anonymous.Anonymous.A; }} }} [UnscopedRef] - public ref _Anonymous_e__Struct._Anonymous_1_e__Union._B_e__Struct B + public ref _Anonymous_e__Struct._Anonymous_e__Union._B_e__Struct B {{ get {{ - return ref Anonymous.Anonymous_1.B; + return ref Anonymous.Anonymous.B; }} }} @@ -1472,10 +1472,10 @@ public partial struct _Anonymous_e__Struct public nint First; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L7_C9"")] - public _Anonymous_1_e__Union Anonymous_1; + public _Anonymous_e__Union Anonymous; [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous_1_e__Union + public partial struct _Anonymous_e__Union {{ [FieldOffset(0)] [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L9_C13"")] diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/StructDeclarationTest.cs index af091c6d..9661e535 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/StructDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/StructDeclarationTest.cs @@ -1142,7 +1142,7 @@ public ref {expectedManagedType} value1 {{ get {{ - return ref Anonymous.Anonymous2_1.value1; + return ref Anonymous.Anonymous1.value1; }} }} @@ -1151,7 +1151,7 @@ public ref {expectedManagedType} value {{ get {{ - return ref Anonymous.Anonymous2_1.Anonymous_2.value; + return ref Anonymous.Anonymous1.Anonymous.value; }} }} @@ -1160,7 +1160,7 @@ public ref {expectedManagedType} value2 {{ get {{ - return ref Anonymous.Anonymous3_1.value2; + return ref Anonymous.Anonymous2.value2; }} }} @@ -1199,10 +1199,10 @@ public partial struct _Anonymous_e__Struct public _w_e__Struct w; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L19_C9"")] - public _Anonymous2_1_e__Struct Anonymous2_1; + public _Anonymous1_e__Struct Anonymous1; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L29_C9"")] - public _Anonymous3_1_e__Union Anonymous3_1; + public _Anonymous2_e__Union Anonymous2; public MyUnion u; @@ -1217,21 +1217,21 @@ public partial struct _w_e__Struct public {expectedManagedType} value; }} - public partial struct _Anonymous2_1_e__Struct + public partial struct _Anonymous1_e__Struct {{ public {expectedManagedType} value1; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L23_C13"")] - public _Anonymous_2_e__Struct Anonymous_2; + public _Anonymous_e__Struct Anonymous; - public partial struct _Anonymous_2_e__Struct + public partial struct _Anonymous_e__Struct {{ public {expectedManagedType} value; }} }} [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous3_1_e__Union + public partial struct _Anonymous2_e__Union {{ [FieldOffset(0)] public {expectedManagedType} value2; @@ -1304,7 +1304,7 @@ public ref int w { get { - return ref Anonymous.Anonymous_1.w; + return ref Anonymous.Anonymous1.w; } } @@ -1312,12 +1312,12 @@ public int o0_b0_16 { readonly get { - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; } set { - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; } } @@ -1325,12 +1325,12 @@ public int o0_b16_4 { readonly get { - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; } set { - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; } } @@ -1339,9 +1339,9 @@ public partial struct _Anonymous_e__Struct public int z; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L10_C9"")] - public _Anonymous_1_e__Struct Anonymous_1; + public _Anonymous1_e__Struct Anonymous1; - public partial struct _Anonymous_1_e__Struct + public partial struct _Anonymous1_e__Struct { public int w; @@ -1982,7 +1982,7 @@ namespace ClangSharp.Test public partial struct _MyStruct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L3_C5"")] - public _Anonymous1_e__Struct Anonymous1; + public _Anonymous_e__Struct Anonymous; [NativeTypeName(""struct (anonymous struct at ClangUnsavedFile.h:4:5)[2]"")] public _MyArray_e__FixedBuffer MyArray; @@ -1992,16 +1992,16 @@ public ref int First { get { - return ref Anonymous1.First; + return ref Anonymous.First; } } - public partial struct _Anonymous1_e__Struct + public partial struct _Anonymous_e__Struct { public int First; } - public partial struct _Anonymous2_e__Struct + public partial struct _MyArray_e__Struct { public int Second; } @@ -2009,7 +2009,7 @@ public partial struct _Anonymous2_e__Struct [InlineArray(2)] public partial struct _MyArray_e__FixedBuffer { - public _Anonymous2_e__Struct e0; + public _MyArray_e__Struct e0; } } } @@ -2042,7 +2042,7 @@ public ref int Value1 { get { - return ref Anonymous.Anonymous_1.Anonymous1_2.Value1; + return ref Anonymous.Anonymous1.Anonymous2.Value1; } } @@ -2051,29 +2051,29 @@ public ref int Value2 { get { - return ref Anonymous.Anonymous_1.Anonymous2_2.Value2; + return ref Anonymous.Anonymous1.Anonymous3.Value2; } } public partial struct _Anonymous_e__Struct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L3_C14"")] - public _Anonymous_1_e__Struct Anonymous_1; + public _Anonymous1_e__Struct Anonymous1; - public partial struct _Anonymous_1_e__Struct + public partial struct _Anonymous1_e__Struct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L4_C9"")] - public _Anonymous1_2_e__Struct Anonymous1_2; + public _Anonymous2_e__Struct Anonymous2; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L5_C9"")] - public _Anonymous2_2_e__Struct Anonymous2_2; + public _Anonymous3_e__Struct Anonymous3; - public partial struct _Anonymous1_2_e__Struct + public partial struct _Anonymous2_e__Struct { public int Value1; } - public partial struct _Anonymous2_2_e__Struct + public partial struct _Anonymous3_e__Struct { public int Value2; } diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/UnionDeclarationTest.cs index 84003513..72bbf228 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/UnionDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/UnionDeclarationTest.cs @@ -873,7 +873,7 @@ public ref int w { get { - return ref Anonymous.Anonymous_1.w; + return ref Anonymous.Anonymous1.w; } } @@ -881,12 +881,12 @@ public int o0_b0_16 { readonly get { - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; } set { - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; } } @@ -894,12 +894,12 @@ public int o0_b16_4 { readonly get { - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; } set { - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; } } @@ -911,10 +911,10 @@ public partial struct _Anonymous_e__Union [FieldOffset(0)] [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L10_C9"")] - public _Anonymous_1_e__Union Anonymous_1; + public _Anonymous1_e__Union Anonymous1; [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous_1_e__Union + public partial struct _Anonymous1_e__Union { [FieldOffset(0)] public int w; @@ -1455,20 +1455,20 @@ public ref int First }} [UnscopedRef] - public ref _Anonymous_e__Struct._Anonymous_1_e__Union._A_e__Struct A + public ref _Anonymous_e__Struct._Anonymous_e__Union._A_e__Struct A {{ get {{ - return ref Anonymous.Anonymous_1.A; + return ref Anonymous.Anonymous.A; }} }} [UnscopedRef] - public ref _Anonymous_e__Struct._Anonymous_1_e__Union._B_e__Struct B + public ref _Anonymous_e__Struct._Anonymous_e__Union._B_e__Struct B {{ get {{ - return ref Anonymous.Anonymous_1.B; + return ref Anonymous.Anonymous.B; }} }} @@ -1478,10 +1478,10 @@ public partial struct _Anonymous_e__Struct public int First; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L7_C9"")] - public _Anonymous_1_e__Union Anonymous_1; + public _Anonymous_e__Union Anonymous; [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous_1_e__Union + public partial struct _Anonymous_e__Union {{ [FieldOffset(0)] [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L9_C13"")] diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewUnix/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewUnix/StructDeclarationTest.cs index 2c3cf62b..4e438509 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewUnix/StructDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewUnix/StructDeclarationTest.cs @@ -1134,7 +1134,7 @@ public ref {expectedManagedType} value1 {{ get {{ - return ref Anonymous.Anonymous2_1.value1; + return ref Anonymous.Anonymous1.value1; }} }} @@ -1143,7 +1143,7 @@ public ref {expectedManagedType} value {{ get {{ - return ref Anonymous.Anonymous2_1.Anonymous_2.value; + return ref Anonymous.Anonymous1.Anonymous.value; }} }} @@ -1152,7 +1152,7 @@ public ref {expectedManagedType} value2 {{ get {{ - return ref Anonymous.Anonymous3_1.value2; + return ref Anonymous.Anonymous2.value2; }} }} @@ -1191,10 +1191,10 @@ public partial struct _Anonymous_e__Struct public _w_e__Struct w; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L19_C9"")] - public _Anonymous2_1_e__Struct Anonymous2_1; + public _Anonymous1_e__Struct Anonymous1; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L29_C9"")] - public _Anonymous3_1_e__Union Anonymous3_1; + public _Anonymous2_e__Union Anonymous2; public MyUnion u; @@ -1209,21 +1209,21 @@ public partial struct _w_e__Struct public {expectedManagedType} value; }} - public partial struct _Anonymous2_1_e__Struct + public partial struct _Anonymous1_e__Struct {{ public {expectedManagedType} value1; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L23_C13"")] - public _Anonymous_2_e__Struct Anonymous_2; + public _Anonymous_e__Struct Anonymous; - public partial struct _Anonymous_2_e__Struct + public partial struct _Anonymous_e__Struct {{ public {expectedManagedType} value; }} }} [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous3_1_e__Union + public partial struct _Anonymous2_e__Union {{ [FieldOffset(0)] public {expectedManagedType} value2; @@ -1296,7 +1296,7 @@ public ref int w { get { - return ref Anonymous.Anonymous_1.w; + return ref Anonymous.Anonymous1.w; } } @@ -1304,12 +1304,12 @@ public int o0_b0_16 { readonly get { - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; } set { - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; } } @@ -1317,12 +1317,12 @@ public int o0_b16_4 { readonly get { - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; } set { - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; } } @@ -1331,9 +1331,9 @@ public partial struct _Anonymous_e__Struct public int z; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L10_C9"")] - public _Anonymous_1_e__Struct Anonymous_1; + public _Anonymous1_e__Struct Anonymous1; - public partial struct _Anonymous_1_e__Struct + public partial struct _Anonymous1_e__Struct { public int w; @@ -1975,7 +1975,7 @@ namespace ClangSharp.Test public partial struct _MyStruct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L3_C5"")] - public _Anonymous1_e__Struct Anonymous1; + public _Anonymous_e__Struct Anonymous; [NativeTypeName(""struct (anonymous struct at ClangUnsavedFile.h:4:5)[2]"")] public _MyArray_e__FixedBuffer MyArray; @@ -1985,16 +1985,16 @@ public ref int First { get { - return ref Anonymous1.First; + return ref Anonymous.First; } } - public partial struct _Anonymous1_e__Struct + public partial struct _Anonymous_e__Struct { public int First; } - public partial struct _Anonymous2_e__Struct + public partial struct _MyArray_e__Struct { public int Second; } @@ -2002,7 +2002,7 @@ public partial struct _Anonymous2_e__Struct [InlineArray(2)] public partial struct _MyArray_e__FixedBuffer { - public _Anonymous2_e__Struct e0; + public _MyArray_e__Struct e0; } } } @@ -2035,7 +2035,7 @@ public ref int Value1 { get { - return ref Anonymous.Anonymous_1.Anonymous1_2.Value1; + return ref Anonymous.Anonymous1.Anonymous2.Value1; } } @@ -2044,29 +2044,29 @@ public ref int Value2 { get { - return ref Anonymous.Anonymous_1.Anonymous2_2.Value2; + return ref Anonymous.Anonymous1.Anonymous3.Value2; } } public partial struct _Anonymous_e__Struct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L3_C14"")] - public _Anonymous_1_e__Struct Anonymous_1; + public _Anonymous1_e__Struct Anonymous1; - public partial struct _Anonymous_1_e__Struct + public partial struct _Anonymous1_e__Struct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L4_C9"")] - public _Anonymous1_2_e__Struct Anonymous1_2; + public _Anonymous2_e__Struct Anonymous2; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L5_C9"")] - public _Anonymous2_2_e__Struct Anonymous2_2; + public _Anonymous3_e__Struct Anonymous3; - public partial struct _Anonymous1_2_e__Struct + public partial struct _Anonymous2_e__Struct { public int Value1; } - public partial struct _Anonymous2_2_e__Struct + public partial struct _Anonymous3_e__Struct { public int Value2; } diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewUnix/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewUnix/UnionDeclarationTest.cs index f5434e8e..4d0ae17f 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewUnix/UnionDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewUnix/UnionDeclarationTest.cs @@ -867,7 +867,7 @@ public ref int w { get { - return ref Anonymous.Anonymous_1.w; + return ref Anonymous.Anonymous1.w; } } @@ -875,12 +875,12 @@ public int o0_b0_16 { readonly get { - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; } set { - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; } } @@ -888,12 +888,12 @@ public int o0_b16_4 { readonly get { - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; } set { - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; } } @@ -905,10 +905,10 @@ public partial struct _Anonymous_e__Union [FieldOffset(0)] [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L10_C9"")] - public _Anonymous_1_e__Union Anonymous_1; + public _Anonymous1_e__Union Anonymous1; [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous_1_e__Union + public partial struct _Anonymous1_e__Union { [FieldOffset(0)] public int w; @@ -1449,20 +1449,20 @@ public ref nint First }} [UnscopedRef] - public ref _Anonymous_e__Struct._Anonymous_1_e__Union._A_e__Struct A + public ref _Anonymous_e__Struct._Anonymous_e__Union._A_e__Struct A {{ get {{ - return ref Anonymous.Anonymous_1.A; + return ref Anonymous.Anonymous.A; }} }} [UnscopedRef] - public ref _Anonymous_e__Struct._Anonymous_1_e__Union._B_e__Struct B + public ref _Anonymous_e__Struct._Anonymous_e__Union._B_e__Struct B {{ get {{ - return ref Anonymous.Anonymous_1.B; + return ref Anonymous.Anonymous.B; }} }} @@ -1472,10 +1472,10 @@ public partial struct _Anonymous_e__Struct public nint First; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L7_C9"")] - public _Anonymous_1_e__Union Anonymous_1; + public _Anonymous_e__Union Anonymous; [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous_1_e__Union + public partial struct _Anonymous_e__Union {{ [FieldOffset(0)] [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L9_C13"")] diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/StructDeclarationTest.cs index ecd7a0ef..d3e05c78 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/StructDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/StructDeclarationTest.cs @@ -1142,7 +1142,7 @@ public ref {expectedManagedType} value1 {{ get {{ - return ref Anonymous.Anonymous2_1.value1; + return ref Anonymous.Anonymous1.value1; }} }} @@ -1151,7 +1151,7 @@ public ref {expectedManagedType} value {{ get {{ - return ref Anonymous.Anonymous2_1.Anonymous_2.value; + return ref Anonymous.Anonymous1.Anonymous.value; }} }} @@ -1160,7 +1160,7 @@ public ref {expectedManagedType} value2 {{ get {{ - return ref Anonymous.Anonymous3_1.value2; + return ref Anonymous.Anonymous2.value2; }} }} @@ -1199,10 +1199,10 @@ public partial struct _Anonymous_e__Struct public _w_e__Struct w; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L19_C9"")] - public _Anonymous2_1_e__Struct Anonymous2_1; + public _Anonymous1_e__Struct Anonymous1; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L29_C9"")] - public _Anonymous3_1_e__Union Anonymous3_1; + public _Anonymous2_e__Union Anonymous2; public MyUnion u; @@ -1217,21 +1217,21 @@ public partial struct _w_e__Struct public {expectedManagedType} value; }} - public partial struct _Anonymous2_1_e__Struct + public partial struct _Anonymous1_e__Struct {{ public {expectedManagedType} value1; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L23_C13"")] - public _Anonymous_2_e__Struct Anonymous_2; + public _Anonymous_e__Struct Anonymous; - public partial struct _Anonymous_2_e__Struct + public partial struct _Anonymous_e__Struct {{ public {expectedManagedType} value; }} }} [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous3_1_e__Union + public partial struct _Anonymous2_e__Union {{ [FieldOffset(0)] public {expectedManagedType} value2; @@ -1304,7 +1304,7 @@ public ref int w { get { - return ref Anonymous.Anonymous_1.w; + return ref Anonymous.Anonymous1.w; } } @@ -1312,12 +1312,12 @@ public int o0_b0_16 { readonly get { - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; } set { - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; } } @@ -1325,12 +1325,12 @@ public int o0_b16_4 { readonly get { - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; } set { - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; } } @@ -1339,9 +1339,9 @@ public partial struct _Anonymous_e__Struct public int z; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L10_C9"")] - public _Anonymous_1_e__Struct Anonymous_1; + public _Anonymous1_e__Struct Anonymous1; - public partial struct _Anonymous_1_e__Struct + public partial struct _Anonymous1_e__Struct { public int w; @@ -1981,7 +1981,7 @@ namespace ClangSharp.Test public partial struct _MyStruct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L3_C5"")] - public _Anonymous1_e__Struct Anonymous1; + public _Anonymous_e__Struct Anonymous; [NativeTypeName(""struct (anonymous struct at ClangUnsavedFile.h:4:5)[2]"")] public _MyArray_e__FixedBuffer MyArray; @@ -1991,16 +1991,16 @@ public ref int First { get { - return ref Anonymous1.First; + return ref Anonymous.First; } } - public partial struct _Anonymous1_e__Struct + public partial struct _Anonymous_e__Struct { public int First; } - public partial struct _Anonymous2_e__Struct + public partial struct _MyArray_e__Struct { public int Second; } @@ -2008,7 +2008,7 @@ public partial struct _Anonymous2_e__Struct [InlineArray(2)] public partial struct _MyArray_e__FixedBuffer { - public _Anonymous2_e__Struct e0; + public _MyArray_e__Struct e0; } } } @@ -2041,7 +2041,7 @@ public ref int Value1 { get { - return ref Anonymous.Anonymous_1.Anonymous1_2.Value1; + return ref Anonymous.Anonymous1.Anonymous2.Value1; } } @@ -2050,29 +2050,29 @@ public ref int Value2 { get { - return ref Anonymous.Anonymous_1.Anonymous2_2.Value2; + return ref Anonymous.Anonymous1.Anonymous3.Value2; } } public partial struct _Anonymous_e__Struct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L3_C14"")] - public _Anonymous_1_e__Struct Anonymous_1; + public _Anonymous1_e__Struct Anonymous1; - public partial struct _Anonymous_1_e__Struct + public partial struct _Anonymous1_e__Struct { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L4_C9"")] - public _Anonymous1_2_e__Struct Anonymous1_2; + public _Anonymous2_e__Struct Anonymous2; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L5_C9"")] - public _Anonymous2_2_e__Struct Anonymous2_2; + public _Anonymous3_e__Struct Anonymous3; - public partial struct _Anonymous1_2_e__Struct + public partial struct _Anonymous2_e__Struct { public int Value1; } - public partial struct _Anonymous2_2_e__Struct + public partial struct _Anonymous3_e__Struct { public int Value2; } diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/UnionDeclarationTest.cs index 195a8d91..1cca78ca 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/UnionDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/UnionDeclarationTest.cs @@ -873,7 +873,7 @@ public ref int w { get { - return ref Anonymous.Anonymous_1.w; + return ref Anonymous.Anonymous1.w; } } @@ -881,12 +881,12 @@ public int o0_b0_16 { readonly get { - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; } set { - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; } } @@ -894,12 +894,12 @@ public int o0_b16_4 { readonly get { - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; } set { - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; } } @@ -911,10 +911,10 @@ public partial struct _Anonymous_e__Union [FieldOffset(0)] [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L10_C9"")] - public _Anonymous_1_e__Union Anonymous_1; + public _Anonymous1_e__Union Anonymous1; [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous_1_e__Union + public partial struct _Anonymous1_e__Union { [FieldOffset(0)] public int w; @@ -1455,20 +1455,20 @@ public ref int First }} [UnscopedRef] - public ref _Anonymous_e__Struct._Anonymous_1_e__Union._A_e__Struct A + public ref _Anonymous_e__Struct._Anonymous_e__Union._A_e__Struct A {{ get {{ - return ref Anonymous.Anonymous_1.A; + return ref Anonymous.Anonymous.A; }} }} [UnscopedRef] - public ref _Anonymous_e__Struct._Anonymous_1_e__Union._B_e__Struct B + public ref _Anonymous_e__Struct._Anonymous_e__Union._B_e__Struct B {{ get {{ - return ref Anonymous.Anonymous_1.B; + return ref Anonymous.Anonymous.B; }} }} @@ -1478,10 +1478,10 @@ public partial struct _Anonymous_e__Struct public int First; [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L7_C9"")] - public _Anonymous_1_e__Union Anonymous_1; + public _Anonymous_e__Union Anonymous; [StructLayout(LayoutKind.Explicit)] - public partial struct _Anonymous_1_e__Union + public partial struct _Anonymous_e__Union {{ [FieldOffset(0)] [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L9_C13"")] diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CTest.cs index c700b595..b386482a 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CTest.cs @@ -197,7 +197,7 @@ public partial struct __anonymousStructField1_e__Struct } } - public unsafe partial struct _MyStructWithAnonymousUnion + public partial struct _MyStructWithAnonymousUnion { [NativeTypeName(""__AnonymousRecord_ClangUnsavedFile_L21_C5"")] public _union1_e__Union union1; @@ -450,4 +450,4 @@ public static partial class Methods return ValidateGeneratedCSharpLatestUnixBindingsAsync(inputContents, expectedOutputContents, commandLineArgs: DefaultCClangCommandLineArgs, language: "c", languageStandard: DefaultCStandard); } -} \ No newline at end of file +} diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/StructDeclarationTest.cs index 54f56e1d..daca2be6 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/StructDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/StructDeclarationTest.cs @@ -1280,7 +1280,7 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() ref int - fixed (_Anonymous_e__Struct._Anonymous_1_e__Struct* pField = &Anonymous.Anonymous_1) + fixed (_Anonymous_e__Struct._Anonymous1_e__Struct* pField = &Anonymous.Anonymous1) { return ref pField->w; } @@ -1289,29 +1289,29 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() int - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; int - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; int - - _Anonymous_1_e__Struct + + _Anonymous1_e__Struct - + int @@ -1996,45 +1996,45 @@ struct { int Second; } MyArray[2]; - - _Anonymous1_e__Struct + + _Anonymous_e__Struct - _Anonymous2_e__Struct + _MyArray_e__Struct ref int - fixed (_Anonymous1_e__Struct* pField = &Anonymous1) + fixed (_Anonymous_e__Struct* pField = &Anonymous) { return ref pField->First; } - + int - + int - _Anonymous2_e__Struct + _MyArray_e__Struct - _Anonymous2_e__Struct + _MyArray_e__Struct - ref _Anonymous2_e__Struct + ref _MyArray_e__Struct int - fixed (_Anonymous2_e__Struct* pThis = &e0) + fixed (_MyArray_e__Struct* pThis = &e0) { return ref pThis[index]; } @@ -2069,7 +2069,7 @@ struct { int Value2; }; ref int - fixed (_Anonymous_e__Struct._Anonymous_1_e__Struct._Anonymous1_2_e__Struct* pField = &Anonymous.Anonymous_1.Anonymous1_2) + fixed (_Anonymous_e__Struct._Anonymous1_e__Struct._Anonymous2_e__Struct* pField = &Anonymous.Anonymous1.Anonymous2) { return ref pField->Value1; } @@ -2078,29 +2078,29 @@ struct { int Value2; }; ref int - fixed (_Anonymous_e__Struct._Anonymous_1_e__Struct._Anonymous2_2_e__Struct* pField = &Anonymous.Anonymous_1.Anonymous2_2) + fixed (_Anonymous_e__Struct._Anonymous1_e__Struct._Anonymous3_e__Struct* pField = &Anonymous.Anonymous1.Anonymous3) { return ref pField->Value2; } - - _Anonymous_1_e__Struct + + _Anonymous1_e__Struct - - - _Anonymous1_2_e__Struct + + + _Anonymous2_e__Struct - - _Anonymous2_2_e__Struct + + _Anonymous3_e__Struct - + int - + int diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/UnionDeclarationTest.cs index 4015963e..31e57bb9 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/UnionDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/UnionDeclarationTest.cs @@ -868,7 +868,7 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() ref int - fixed (_Anonymous_e__Union._Anonymous_1_e__Union* pField = &Anonymous.Anonymous_1) + fixed (_Anonymous_e__Union._Anonymous1_e__Union* pField = &Anonymous.Anonymous1) { return ref pField->w; } @@ -877,29 +877,29 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() int - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; int - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; int - - _Anonymous_1_e__Union + + _Anonymous1_e__Union - + int @@ -1386,18 +1386,18 @@ protected override Task UnionWithAnonStructWithAnonUnionImpl() - ref _Anonymous_e__Struct._Anonymous_1_e__Union._A_e__Struct + ref _Anonymous_e__Struct._Anonymous_e__Union._A_e__Struct - fixed (_Anonymous_e__Struct._Anonymous_1_e__Union* pField = &Anonymous.Anonymous_1) + fixed (_Anonymous_e__Struct._Anonymous_e__Union* pField = &Anonymous.Anonymous) {{ return ref pField->A; }} - ref _Anonymous_e__Struct._Anonymous_1_e__Union._B_e__Struct + ref _Anonymous_e__Struct._Anonymous_e__Union._B_e__Struct - fixed (_Anonymous_e__Struct._Anonymous_1_e__Union* pField = &Anonymous.Anonymous_1) + fixed (_Anonymous_e__Struct._Anonymous_e__Union* pField = &Anonymous.Anonymous) {{ return ref pField->B; }} @@ -1407,10 +1407,10 @@ protected override Task UnionWithAnonStructWithAnonUnionImpl() IntPtr - - _Anonymous_1_e__Union + + _Anonymous_e__Union - + _A_e__Struct diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/StructDeclarationTest.cs index 3b6cf393..c443c420 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/StructDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/StructDeclarationTest.cs @@ -1292,7 +1292,7 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() ref int - fixed (_Anonymous_e__Struct._Anonymous_1_e__Struct* pField = &Anonymous.Anonymous_1) + fixed (_Anonymous_e__Struct._Anonymous1_e__Struct* pField = &Anonymous.Anonymous1) { return ref pField->w; } @@ -1301,29 +1301,29 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() int - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; int - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; int - - _Anonymous_1_e__Struct + + _Anonymous1_e__Struct - + int @@ -2005,45 +2005,45 @@ struct { int Second; } MyArray[2]; - - _Anonymous1_e__Struct + + _Anonymous_e__Struct - _Anonymous2_e__Struct + _MyArray_e__Struct ref int - fixed (_Anonymous1_e__Struct* pField = &Anonymous1) + fixed (_Anonymous_e__Struct* pField = &Anonymous) { return ref pField->First; } - + int - + int - _Anonymous2_e__Struct + _MyArray_e__Struct - _Anonymous2_e__Struct + _MyArray_e__Struct - ref _Anonymous2_e__Struct + ref _MyArray_e__Struct int - fixed (_Anonymous2_e__Struct* pThis = &e0) + fixed (_MyArray_e__Struct* pThis = &e0) { return ref pThis[index]; } @@ -2078,7 +2078,7 @@ struct { int Value2; }; ref int - fixed (_Anonymous_e__Struct._Anonymous_1_e__Struct._Anonymous1_2_e__Struct* pField = &Anonymous.Anonymous_1.Anonymous1_2) + fixed (_Anonymous_e__Struct._Anonymous1_e__Struct._Anonymous2_e__Struct* pField = &Anonymous.Anonymous1.Anonymous2) { return ref pField->Value1; } @@ -2087,29 +2087,29 @@ struct { int Value2; }; ref int - fixed (_Anonymous_e__Struct._Anonymous_1_e__Struct._Anonymous2_2_e__Struct* pField = &Anonymous.Anonymous_1.Anonymous2_2) + fixed (_Anonymous_e__Struct._Anonymous1_e__Struct._Anonymous3_e__Struct* pField = &Anonymous.Anonymous1.Anonymous3) { return ref pField->Value2; } - - _Anonymous_1_e__Struct + + _Anonymous1_e__Struct - - - _Anonymous1_2_e__Struct + + + _Anonymous2_e__Struct - - _Anonymous2_2_e__Struct + + _Anonymous3_e__Struct - + int - + int diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/UnionDeclarationTest.cs index 88a911bd..13f0d054 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/UnionDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/UnionDeclarationTest.cs @@ -874,7 +874,7 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() ref int - fixed (_Anonymous_e__Union._Anonymous_1_e__Union* pField = &Anonymous.Anonymous_1) + fixed (_Anonymous_e__Union._Anonymous1_e__Union* pField = &Anonymous.Anonymous1) { return ref pField->w; } @@ -883,29 +883,29 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() int - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; int - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; int - - _Anonymous_1_e__Union + + _Anonymous1_e__Union - + int @@ -1392,18 +1392,18 @@ protected override Task UnionWithAnonStructWithAnonUnionImpl() - ref _Anonymous_e__Struct._Anonymous_1_e__Union._A_e__Struct + ref _Anonymous_e__Struct._Anonymous_e__Union._A_e__Struct - fixed (_Anonymous_e__Struct._Anonymous_1_e__Union* pField = &Anonymous.Anonymous_1) + fixed (_Anonymous_e__Struct._Anonymous_e__Union* pField = &Anonymous.Anonymous) {{ return ref pField->A; }} - ref _Anonymous_e__Struct._Anonymous_1_e__Union._B_e__Struct + ref _Anonymous_e__Struct._Anonymous_e__Union._B_e__Struct - fixed (_Anonymous_e__Struct._Anonymous_1_e__Union* pField = &Anonymous.Anonymous_1) + fixed (_Anonymous_e__Struct._Anonymous_e__Union* pField = &Anonymous.Anonymous) {{ return ref pField->B; }} @@ -1413,10 +1413,10 @@ protected override Task UnionWithAnonStructWithAnonUnionImpl() int - - _Anonymous_1_e__Union + + _Anonymous_e__Union - + _A_e__Struct diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultUnix/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultUnix/StructDeclarationTest.cs index c9022cdb..636a6b0e 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultUnix/StructDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultUnix/StructDeclarationTest.cs @@ -1267,35 +1267,35 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() ref int - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.w, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.w, 1)); int - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; int - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; int - - _Anonymous_1_e__Struct + + _Anonymous1_e__Struct - + int @@ -1977,37 +1977,37 @@ struct { int Second; } MyArray[2]; - - _Anonymous1_e__Struct + + _Anonymous_e__Struct - _Anonymous2_e__Struct + _MyArray_e__Struct ref int - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous1.First, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.First, 1)); - + int - + int - _Anonymous2_e__Struct + _MyArray_e__Struct - _Anonymous2_e__Struct + _MyArray_e__Struct - ref _Anonymous2_e__Struct + ref _MyArray_e__Struct int @@ -2016,7 +2016,7 @@ struct { int Second; } MyArray[2]; - Span<_Anonymous2_e__Struct> + Span<_MyArray_e__Struct> MemoryMarshal.CreateSpan(ref e0, 2); @@ -2048,32 +2048,32 @@ struct { int Value2; }; ref int - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.Anonymous1_2.Value1, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.Anonymous2.Value1, 1)); ref int - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.Anonymous2_2.Value2, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.Anonymous3.Value2, 1)); - - _Anonymous_1_e__Struct + + _Anonymous1_e__Struct - - - _Anonymous1_2_e__Struct + + + _Anonymous2_e__Struct - - _Anonymous2_2_e__Struct + + _Anonymous3_e__Struct - + int - + int diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultUnix/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultUnix/UnionDeclarationTest.cs index 759f8ca0..803d5397 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultUnix/UnionDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultUnix/UnionDeclarationTest.cs @@ -860,35 +860,35 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() ref int - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.w, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.w, 1)); int - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; int - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; int - - _Anonymous_1_e__Union + + _Anonymous1_e__Union - + int @@ -1369,25 +1369,25 @@ protected override Task UnionWithAnonStructWithAnonUnionImpl() - ref _Anonymous_e__Struct._Anonymous_1_e__Union._A_e__Struct + ref _Anonymous_e__Struct._Anonymous_e__Union._A_e__Struct - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.A, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous.A, 1)); - ref _Anonymous_e__Struct._Anonymous_1_e__Union._B_e__Struct + ref _Anonymous_e__Struct._Anonymous_e__Union._B_e__Struct - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.B, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous.B, 1)); nint - - _Anonymous_1_e__Union + + _Anonymous_e__Union - + _A_e__Struct diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultWindows/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultWindows/StructDeclarationTest.cs index a1633f78..85b792f7 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultWindows/StructDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultWindows/StructDeclarationTest.cs @@ -1279,35 +1279,35 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() ref int - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.w, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.w, 1)); int - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; int - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; int - - _Anonymous_1_e__Struct + + _Anonymous1_e__Struct - + int @@ -1987,37 +1987,37 @@ struct { int Second; } MyArray[2]; - - _Anonymous1_e__Struct + + _Anonymous_e__Struct - _Anonymous2_e__Struct + _MyArray_e__Struct ref int - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous1.First, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.First, 1)); - + int - + int - _Anonymous2_e__Struct + _MyArray_e__Struct - _Anonymous2_e__Struct + _MyArray_e__Struct - ref _Anonymous2_e__Struct + ref _MyArray_e__Struct int @@ -2026,7 +2026,7 @@ struct { int Second; } MyArray[2]; - Span<_Anonymous2_e__Struct> + Span<_MyArray_e__Struct> MemoryMarshal.CreateSpan(ref e0, 2); @@ -2058,32 +2058,32 @@ struct { int Value2; }; ref int - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.Anonymous1_2.Value1, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.Anonymous2.Value1, 1)); ref int - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.Anonymous2_2.Value2, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.Anonymous3.Value2, 1)); - - _Anonymous_1_e__Struct + + _Anonymous1_e__Struct - - - _Anonymous1_2_e__Struct + + + _Anonymous2_e__Struct - - _Anonymous2_2_e__Struct + + _Anonymous3_e__Struct - + int - + int diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultWindows/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultWindows/UnionDeclarationTest.cs index ea283874..933d956d 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultWindows/UnionDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlDefaultWindows/UnionDeclarationTest.cs @@ -866,35 +866,35 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() ref int - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.w, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous1.w, 1)); int - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; int - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; int - - _Anonymous_1_e__Union + + _Anonymous1_e__Union - + int @@ -1375,25 +1375,25 @@ protected override Task UnionWithAnonStructWithAnonUnionImpl() - ref _Anonymous_e__Struct._Anonymous_1_e__Union._A_e__Struct + ref _Anonymous_e__Struct._Anonymous_e__Union._A_e__Struct - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.A, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous.A, 1)); - ref _Anonymous_e__Struct._Anonymous_1_e__Union._B_e__Struct + ref _Anonymous_e__Struct._Anonymous_e__Union._B_e__Struct - return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous_1.B, 1)); + return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Anonymous.B, 1)); int - - _Anonymous_1_e__Union + + _Anonymous_e__Union - + _A_e__Struct diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/StructDeclarationTest.cs index 0c2bb56b..5fd0fe60 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/StructDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/StructDeclarationTest.cs @@ -1156,35 +1156,35 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() ref int - return ref Anonymous.Anonymous_1.w; + return ref Anonymous.Anonymous1.w; int - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; int - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; int - - _Anonymous_1_e__Struct + + _Anonymous1_e__Struct - + int @@ -1852,24 +1852,24 @@ struct { int Second; } MyArray[2]; - - _Anonymous1_e__Struct + + _Anonymous_e__Struct - _Anonymous2_e__Struct + _MyArray_e__Struct ref int - return ref Anonymous1.First; + return ref Anonymous.First; - + int - + int @@ -1877,7 +1877,7 @@ struct { int Second; } MyArray[2]; InlineArray(2) - _Anonymous2_e__Struct + _MyArray_e__Struct @@ -1909,32 +1909,32 @@ struct { int Value2; }; ref int - return ref Anonymous.Anonymous_1.Anonymous1_2.Value1; + return ref Anonymous.Anonymous1.Anonymous2.Value1; ref int - return ref Anonymous.Anonymous_1.Anonymous2_2.Value2; + return ref Anonymous.Anonymous1.Anonymous3.Value2; - - _Anonymous_1_e__Struct + + _Anonymous1_e__Struct - - - _Anonymous1_2_e__Struct + + + _Anonymous2_e__Struct - - _Anonymous2_2_e__Struct + + _Anonymous3_e__Struct - + int - + int diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/UnionDeclarationTest.cs index ff57349b..16ab4377 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/UnionDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/UnionDeclarationTest.cs @@ -749,35 +749,35 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() ref int - return ref Anonymous.Anonymous_1.w; + return ref Anonymous.Anonymous1.w; int - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; int - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; int - - _Anonymous_1_e__Union + + _Anonymous1_e__Union - + int @@ -1258,25 +1258,25 @@ protected override Task UnionWithAnonStructWithAnonUnionImpl() - ref _Anonymous_e__Struct._Anonymous_1_e__Union._A_e__Struct + ref _Anonymous_e__Struct._Anonymous_e__Union._A_e__Struct - return ref Anonymous.Anonymous_1.A; + return ref Anonymous.Anonymous.A; - ref _Anonymous_e__Struct._Anonymous_1_e__Union._B_e__Struct + ref _Anonymous_e__Struct._Anonymous_e__Union._B_e__Struct - return ref Anonymous.Anonymous_1.B; + return ref Anonymous.Anonymous.B; nint - - _Anonymous_1_e__Union + + _Anonymous_e__Union - + _A_e__Struct diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/StructDeclarationTest.cs index 9df5bd6d..b79079b9 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/StructDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/StructDeclarationTest.cs @@ -1168,35 +1168,35 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() ref int - return ref Anonymous.Anonymous_1.w; + return ref Anonymous.Anonymous1.w; int - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; int - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; int - - _Anonymous_1_e__Struct + + _Anonymous1_e__Struct - + int @@ -1862,24 +1862,24 @@ struct { int Second; } MyArray[2]; - - _Anonymous1_e__Struct + + _Anonymous_e__Struct - _Anonymous2_e__Struct + _MyArray_e__Struct ref int - return ref Anonymous1.First; + return ref Anonymous.First; - + int - + int @@ -1887,7 +1887,7 @@ struct { int Second; } MyArray[2]; InlineArray(2) - _Anonymous2_e__Struct + _MyArray_e__Struct @@ -1919,32 +1919,32 @@ struct { int Value2; }; ref int - return ref Anonymous.Anonymous_1.Anonymous1_2.Value1; + return ref Anonymous.Anonymous1.Anonymous2.Value1; ref int - return ref Anonymous.Anonymous_1.Anonymous2_2.Value2; + return ref Anonymous.Anonymous1.Anonymous3.Value2; - - _Anonymous_1_e__Struct + + _Anonymous1_e__Struct - - - _Anonymous1_2_e__Struct + + + _Anonymous2_e__Struct - - _Anonymous2_2_e__Struct + + _Anonymous3_e__Struct - + int - + int diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/UnionDeclarationTest.cs index 6ca7f65a..dcf645cf 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/UnionDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/UnionDeclarationTest.cs @@ -755,35 +755,35 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() ref int - return ref Anonymous.Anonymous_1.w; + return ref Anonymous.Anonymous1.w; int - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; int - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; int - - _Anonymous_1_e__Union + + _Anonymous1_e__Union - + int @@ -1264,25 +1264,25 @@ protected override Task UnionWithAnonStructWithAnonUnionImpl() - ref _Anonymous_e__Struct._Anonymous_1_e__Union._A_e__Struct + ref _Anonymous_e__Struct._Anonymous_e__Union._A_e__Struct - return ref Anonymous.Anonymous_1.A; + return ref Anonymous.Anonymous.A; - ref _Anonymous_e__Struct._Anonymous_1_e__Union._B_e__Struct + ref _Anonymous_e__Struct._Anonymous_e__Union._B_e__Struct - return ref Anonymous.Anonymous_1.B; + return ref Anonymous.Anonymous.B; int - - _Anonymous_1_e__Union + + _Anonymous_e__Union - + _A_e__Struct diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/StructDeclarationTest.cs index 524c2eb5..4c4c8307 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/StructDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/StructDeclarationTest.cs @@ -1156,35 +1156,35 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() ref int - return ref Anonymous.Anonymous_1.w; + return ref Anonymous.Anonymous1.w; int - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; int - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; int - - _Anonymous_1_e__Struct + + _Anonymous1_e__Struct - + int @@ -1851,24 +1851,24 @@ struct { int Second; } MyArray[2]; - - _Anonymous1_e__Struct + + _Anonymous_e__Struct - _Anonymous2_e__Struct + _MyArray_e__Struct ref int - return ref Anonymous1.First; + return ref Anonymous.First; - + int - + int @@ -1876,7 +1876,7 @@ struct { int Second; } MyArray[2]; InlineArray(2) - _Anonymous2_e__Struct + _MyArray_e__Struct @@ -1907,32 +1907,32 @@ struct { int Value2; }; ref int - return ref Anonymous.Anonymous_1.Anonymous1_2.Value1; + return ref Anonymous.Anonymous1.Anonymous2.Value1; ref int - return ref Anonymous.Anonymous_1.Anonymous2_2.Value2; + return ref Anonymous.Anonymous1.Anonymous3.Value2; - - _Anonymous_1_e__Struct + + _Anonymous1_e__Struct - - - _Anonymous1_2_e__Struct + + + _Anonymous2_e__Struct - - _Anonymous2_2_e__Struct + + _Anonymous3_e__Struct - + int - + int diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/UnionDeclarationTest.cs index 37ef8238..11c40cec 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/UnionDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/UnionDeclarationTest.cs @@ -749,35 +749,35 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() ref int - return ref Anonymous.Anonymous_1.w; + return ref Anonymous.Anonymous1.w; int - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; int - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; int - - _Anonymous_1_e__Union + + _Anonymous1_e__Union - + int @@ -1258,25 +1258,25 @@ protected override Task UnionWithAnonStructWithAnonUnionImpl() - ref _Anonymous_e__Struct._Anonymous_1_e__Union._A_e__Struct + ref _Anonymous_e__Struct._Anonymous_e__Union._A_e__Struct - return ref Anonymous.Anonymous_1.A; + return ref Anonymous.Anonymous.A; - ref _Anonymous_e__Struct._Anonymous_1_e__Union._B_e__Struct + ref _Anonymous_e__Struct._Anonymous_e__Union._B_e__Struct - return ref Anonymous.Anonymous_1.B; + return ref Anonymous.Anonymous.B; nint - - _Anonymous_1_e__Union + + _Anonymous_e__Union - + _A_e__Struct diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/StructDeclarationTest.cs index 5e938aeb..3bb5c851 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/StructDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/StructDeclarationTest.cs @@ -1168,35 +1168,35 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() ref int - return ref Anonymous.Anonymous_1.w; + return ref Anonymous.Anonymous1.w; int - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; int - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; int - - _Anonymous_1_e__Struct + + _Anonymous1_e__Struct - + int @@ -1861,24 +1861,24 @@ struct { int Second; } MyArray[2]; - - _Anonymous1_e__Struct + + _Anonymous_e__Struct - _Anonymous2_e__Struct + _MyArray_e__Struct ref int - return ref Anonymous1.First; + return ref Anonymous.First; - + int - + int @@ -1886,7 +1886,7 @@ struct { int Second; } MyArray[2]; InlineArray(2) - _Anonymous2_e__Struct + _MyArray_e__Struct @@ -1917,32 +1917,32 @@ struct { int Value2; }; ref int - return ref Anonymous.Anonymous_1.Anonymous1_2.Value1; + return ref Anonymous.Anonymous1.Anonymous2.Value1; ref int - return ref Anonymous.Anonymous_1.Anonymous2_2.Value2; + return ref Anonymous.Anonymous1.Anonymous3.Value2; - - _Anonymous_1_e__Struct + + _Anonymous1_e__Struct - - - _Anonymous1_2_e__Struct + + + _Anonymous2_e__Struct - - _Anonymous2_2_e__Struct + + _Anonymous3_e__Struct - + int - + int diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/UnionDeclarationTest.cs index 5600903f..e24fadc9 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/UnionDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/UnionDeclarationTest.cs @@ -755,35 +755,35 @@ protected override Task NestedAnonymousWithBitfieldTestImpl() ref int - return ref Anonymous.Anonymous_1.w; + return ref Anonymous.Anonymous1.w; int - return Anonymous.Anonymous_1.o0_b0_16; + return Anonymous.Anonymous1.o0_b0_16; - Anonymous.Anonymous_1.o0_b0_16 = value; + Anonymous.Anonymous1.o0_b0_16 = value; int - return Anonymous.Anonymous_1.o0_b16_4; + return Anonymous.Anonymous1.o0_b16_4; - Anonymous.Anonymous_1.o0_b16_4 = value; + Anonymous.Anonymous1.o0_b16_4 = value; int - - _Anonymous_1_e__Union + + _Anonymous1_e__Union - + int @@ -1264,25 +1264,25 @@ protected override Task UnionWithAnonStructWithAnonUnionImpl() - ref _Anonymous_e__Struct._Anonymous_1_e__Union._A_e__Struct + ref _Anonymous_e__Struct._Anonymous_e__Union._A_e__Struct - return ref Anonymous.Anonymous_1.A; + return ref Anonymous.Anonymous.A; - ref _Anonymous_e__Struct._Anonymous_1_e__Union._B_e__Struct + ref _Anonymous_e__Struct._Anonymous_e__Union._B_e__Struct - return ref Anonymous.Anonymous_1.B; + return ref Anonymous.Anonymous.B; int - - _Anonymous_1_e__Union + + _Anonymous_e__Union - + _A_e__Struct