From ebe6b8a4154d0c8f18ce4f66ca1c9a3a28c35680 Mon Sep 17 00:00:00 2001 From: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Wed, 18 Oct 2023 04:47:13 +0200 Subject: [PATCH 01/37] Fix value type out parameters --- src/Generator/Generators/CSharp/CSharpMarshal.cs | 11 +++++++---- src/Generator/Generators/CSharp/CSharpSources.cs | 2 +- tests/dotnet/CSharp/CSharp.Tests.cs | 7 +++++++ tests/dotnet/CSharp/CSharp.cpp | 5 +++++ tests/dotnet/CSharp/CSharp.h | 7 +++++++ 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpMarshal.cs b/src/Generator/Generators/CSharp/CSharpMarshal.cs index dedd8a9be..df793b567 100644 --- a/src/Generator/Generators/CSharp/CSharpMarshal.cs +++ b/src/Generator/Generators/CSharp/CSharpMarshal.cs @@ -634,17 +634,20 @@ public override bool VisitPointerType(PointerType pointer, TypeQualifiers quals) { if (Context.Parameter.Usage == ParameterUsage.Out) { - var qualifiedIdentifier = (@class.OriginalClass ?? @class).Visit(typePrinter); - Context.Before.WriteLine("var {0} = new {1}.{2}();", - arg, qualifiedIdentifier, Helpers.InternalStruct); + Context.Before.WriteLine("fixed ({0}.{1}* {2} = &{3}.{4})", + Context.Parameter.QualifiedType, Helpers.InternalStruct, + arg, Context.Parameter.Name, Helpers.InstanceIdentifier); + Context.Before.WriteOpenBraceAndIndent(); + Context.Return.Write($"new {typePrinter.IntPtrType}({arg})"); + Context.Cleanup.UnindentAndWriteCloseBrace(); } else { Context.Before.WriteLine("var {0} = {1}.{2};", arg, Context.Parameter.Name, Helpers.InstanceIdentifier); + Context.Return.Write($"new {typePrinter.IntPtrType}(&{arg})"); } - Context.Return.Write($"new {typePrinter.IntPtrType}(&{arg})"); return true; } diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index 30145f003..1540de3f2 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -413,7 +413,7 @@ public override bool VisitClassDecl(Class @class) if (@class.IsValueType) { WriteLine($"private {@class.Name}.{Helpers.InternalStruct} {Helpers.InstanceField};"); - WriteLine($"internal {@class.Name}.{Helpers.InternalStruct} {Helpers.InstanceIdentifier} => {Helpers.InstanceField};"); + WriteLine($"internal ref {@class.Name}.{Helpers.InternalStruct} {Helpers.InstanceIdentifier} => ref {Helpers.InstanceField};"); } else { diff --git a/tests/dotnet/CSharp/CSharp.Tests.cs b/tests/dotnet/CSharp/CSharp.Tests.cs index d35eb6ff7..1f3a64c26 100644 --- a/tests/dotnet/CSharp/CSharp.Tests.cs +++ b/tests/dotnet/CSharp/CSharp.Tests.cs @@ -1995,4 +1995,11 @@ public void TestPointerToClass() Assert.IsTrue(CSharp.CSharp.PointerToClass.IsDefaultInstance); Assert.IsTrue(CSharp.CSharp.PointerToClass.IsValid); } + + [Test] + public void TestValueTypeOutParameter() + { + CSharp.CSharp.ValueTypeOutParameter(out var unionTest); + Assert.AreEqual(2, unionTest.A); + } } diff --git a/tests/dotnet/CSharp/CSharp.cpp b/tests/dotnet/CSharp/CSharp.cpp index cffbff4bd..96144f941 100644 --- a/tests/dotnet/CSharp/CSharp.cpp +++ b/tests/dotnet/CSharp/CSharp.cpp @@ -1791,3 +1791,8 @@ bool PointerTester::IsValid() } PointerTester* PointerToClass = &internalPointerTesterInstance; + +void ValueTypeOutParameter(UnionTester* tester) +{ + tester->a = 2; +} diff --git a/tests/dotnet/CSharp/CSharp.h b/tests/dotnet/CSharp/CSharp.h index 504dd7e2c..68154b719 100644 --- a/tests/dotnet/CSharp/CSharp.h +++ b/tests/dotnet/CSharp/CSharp.h @@ -1603,3 +1603,10 @@ class DLL_API PointerTester }; DLL_API extern PointerTester* PointerToClass; + +union DLL_API UnionTester { + float a; + int b; +}; + +void DLL_API ValueTypeOutParameter(CS_OUT UnionTester* tester); From 20950c5a34ee88f1e2aed93a13fbedb2096adeee Mon Sep 17 00:00:00 2001 From: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Wed, 18 Oct 2023 04:58:38 +0200 Subject: [PATCH 02/37] More stringent test; Fix indentation (of the code itself, not in the generator) --- tests/dotnet/CSharp/CSharp.Tests.cs | 5 +++-- tests/dotnet/CSharp/CSharp.cpp | 5 +++-- tests/dotnet/CSharp/CSharp.h | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/dotnet/CSharp/CSharp.Tests.cs b/tests/dotnet/CSharp/CSharp.Tests.cs index 1f3a64c26..b44b59525 100644 --- a/tests/dotnet/CSharp/CSharp.Tests.cs +++ b/tests/dotnet/CSharp/CSharp.Tests.cs @@ -1999,7 +1999,8 @@ public void TestPointerToClass() [Test] public void TestValueTypeOutParameter() { - CSharp.CSharp.ValueTypeOutParameter(out var unionTest); - Assert.AreEqual(2, unionTest.A); + CSharp.CSharp.ValueTypeOutParameter(out var unionTestA, out var unionTestB); + Assert.AreEqual(2, unionTestA.A); + Assert.AreEqual(2, unionTestB.B); } } diff --git a/tests/dotnet/CSharp/CSharp.cpp b/tests/dotnet/CSharp/CSharp.cpp index 96144f941..fc909ee5d 100644 --- a/tests/dotnet/CSharp/CSharp.cpp +++ b/tests/dotnet/CSharp/CSharp.cpp @@ -1792,7 +1792,8 @@ bool PointerTester::IsValid() PointerTester* PointerToClass = &internalPointerTesterInstance; -void ValueTypeOutParameter(UnionTester* tester) +void ValueTypeOutParameter(UnionTester* testerA, UnionTester* testerB) { - tester->a = 2; + testerA->a = 2; + testerB->b = 2; } diff --git a/tests/dotnet/CSharp/CSharp.h b/tests/dotnet/CSharp/CSharp.h index 68154b719..9d4e669b3 100644 --- a/tests/dotnet/CSharp/CSharp.h +++ b/tests/dotnet/CSharp/CSharp.h @@ -1609,4 +1609,4 @@ union DLL_API UnionTester { int b; }; -void DLL_API ValueTypeOutParameter(CS_OUT UnionTester* tester); +void DLL_API ValueTypeOutParameter(CS_OUT UnionTester* testerA, CS_OUT UnionTester* testerB); From 2a351b7f2212fd209f1d41623c35d5a17407f253 Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Wed, 18 Oct 2023 16:03:36 +0100 Subject: [PATCH 03/37] Update our version to 1.1. --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index 0ea35b1b9..2bb9c8afc 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.0", + "version": "1.1", "publicReleaseRefSpec": [ "^refs/heads/master$", "^refs/tags/v\\d\\.\\d" From 7e6c49225f32009d5b763a714b427e2681c0f956 Mon Sep 17 00:00:00 2001 From: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:08:51 +0200 Subject: [PATCH 04/37] Test fix broken packages --- Directory.Build.props | 1 + 1 file changed, 1 insertion(+) diff --git a/Directory.Build.props b/Directory.Build.props index e6c25f85f..3fe84b36b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -52,6 +52,7 @@ + \ No newline at end of file From a6ef9d90952c6d934d6cde7448edd2a9a23a4dd7 Mon Sep 17 00:00:00 2001 From: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:19:42 +0200 Subject: [PATCH 05/37] Fix source dir --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 3fe84b36b..2a32266a0 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -52,7 +52,7 @@ - + \ No newline at end of file From 0534e33178c8b9dbf8694df708beb1fbd0c6fc0e Mon Sep 17 00:00:00 2001 From: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:35:10 +0200 Subject: [PATCH 06/37] Bump GH actions versions to solve warnings --- .github/workflows/llvm.yml | 2 +- .github/workflows/main.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/llvm.yml b/.github/workflows/llvm.yml index d8b3f10b8..57dc21d4b 100644 --- a/.github/workflows/llvm.yml +++ b/.github/workflows/llvm.yml @@ -22,7 +22,7 @@ jobs: ACTIONS_ALLOW_UNSECURE_COMMANDS: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: lukka/get-cmake@latest - name: Clone LLVM diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d26b7adcb..ea5ec097a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,7 +24,7 @@ jobs: DOTNET_CLI_TELEMETRY_OPTOUT: true steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: '0' @@ -63,7 +63,7 @@ jobs: shell: bash run: build/build.sh prepack -platform $PLATFORM - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: intermediate path: | @@ -82,7 +82,7 @@ jobs: DOTNET_CLI_TELEMETRY_OPTOUT: true steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: '0' @@ -102,7 +102,7 @@ jobs: run: build/build.sh pack - name: Upload package - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: CppSharp.nupkg path: | From 0c60384ea361967162579ac417c2b83397c06d85 Mon Sep 17 00:00:00 2001 From: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:49:41 +0200 Subject: [PATCH 07/37] Additional bump --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ea5ec097a..17079e73d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -89,7 +89,7 @@ jobs: - name: Set version run: nbgv cloud --all-vars - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: intermediate From 7f567b604b973584e5d56a436ec8d2a8b93feb26 Mon Sep 17 00:00:00 2001 From: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Wed, 18 Oct 2023 18:26:03 +0200 Subject: [PATCH 08/37] Fix non-void returning functions with value-type out parameters Also fixes indentation --- src/Generator/Generators/CSharp/CSharpMarshal.cs | 2 +- tests/dotnet/CSharp/CSharp.Tests.cs | 2 +- tests/dotnet/CSharp/CSharp.cpp | 3 ++- tests/dotnet/CSharp/CSharp.h | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpMarshal.cs b/src/Generator/Generators/CSharp/CSharpMarshal.cs index df793b567..771064533 100644 --- a/src/Generator/Generators/CSharp/CSharpMarshal.cs +++ b/src/Generator/Generators/CSharp/CSharpMarshal.cs @@ -637,9 +637,9 @@ public override bool VisitPointerType(PointerType pointer, TypeQualifiers quals) Context.Before.WriteLine("fixed ({0}.{1}* {2} = &{3}.{4})", Context.Parameter.QualifiedType, Helpers.InternalStruct, arg, Context.Parameter.Name, Helpers.InstanceIdentifier); + Context.HasCodeBlock = true; Context.Before.WriteOpenBraceAndIndent(); Context.Return.Write($"new {typePrinter.IntPtrType}({arg})"); - Context.Cleanup.UnindentAndWriteCloseBrace(); } else { diff --git a/tests/dotnet/CSharp/CSharp.Tests.cs b/tests/dotnet/CSharp/CSharp.Tests.cs index b44b59525..ecf73afe9 100644 --- a/tests/dotnet/CSharp/CSharp.Tests.cs +++ b/tests/dotnet/CSharp/CSharp.Tests.cs @@ -1999,7 +1999,7 @@ public void TestPointerToClass() [Test] public void TestValueTypeOutParameter() { - CSharp.CSharp.ValueTypeOutParameter(out var unionTestA, out var unionTestB); + Assert.AreEqual(2, CSharp.CSharp.ValueTypeOutParameter(out var unionTestA, out var unionTestB)); Assert.AreEqual(2, unionTestA.A); Assert.AreEqual(2, unionTestB.B); } diff --git a/tests/dotnet/CSharp/CSharp.cpp b/tests/dotnet/CSharp/CSharp.cpp index fc909ee5d..9a8beb618 100644 --- a/tests/dotnet/CSharp/CSharp.cpp +++ b/tests/dotnet/CSharp/CSharp.cpp @@ -1792,8 +1792,9 @@ bool PointerTester::IsValid() PointerTester* PointerToClass = &internalPointerTesterInstance; -void ValueTypeOutParameter(UnionTester* testerA, UnionTester* testerB) +int ValueTypeOutParameter(UnionTester* testerA, UnionTester* testerB) { testerA->a = 2; testerB->b = 2; + return 2; } diff --git a/tests/dotnet/CSharp/CSharp.h b/tests/dotnet/CSharp/CSharp.h index 9d4e669b3..fcc638f50 100644 --- a/tests/dotnet/CSharp/CSharp.h +++ b/tests/dotnet/CSharp/CSharp.h @@ -1609,4 +1609,4 @@ union DLL_API UnionTester { int b; }; -void DLL_API ValueTypeOutParameter(CS_OUT UnionTester* testerA, CS_OUT UnionTester* testerB); +int DLL_API ValueTypeOutParameter(CS_OUT UnionTester* testerA, CS_OUT UnionTester* testerB); From d7faf5f0637232227ddd3c8b672d2add805910f0 Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Wed, 18 Oct 2023 17:39:49 +0100 Subject: [PATCH 09/37] Fix SDL_PollEvent generation in the SDL example. Fixes https://github.com/mono/CppSharp/issues/978. Thanks to @Saalvage. --- examples/SDL/SDL.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/SDL/SDL.cs b/examples/SDL/SDL.cs index 040673db2..8ab9fd0b9 100644 --- a/examples/SDL/SDL.cs +++ b/examples/SDL/SDL.cs @@ -53,6 +53,8 @@ public void Preprocess(Driver driver, ASTContext ctx) ctx.IgnoreEnumWithMatchingItem("SDL_ENOMEM"); ctx.IgnoreFunctionWithName("SDL_Error"); + + ctx.SetFunctionParameterUsage("SDL_PollEvent", 1, ParameterUsage.Out); } public void Postprocess(Driver driver, ASTContext ctx) From 28000a14b489a8711210cc75f0ba23b34ab7a013 Mon Sep 17 00:00:00 2001 From: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Thu, 19 Oct 2023 01:19:07 +0200 Subject: [PATCH 10/37] Fix #1251 three parameter equality operator - Operators in generic classes do not attempt to generate as extension methods anymore - Empty `...Extensions` classes are no longer generated - `string` as a template argument is correctly cast - `MarshalCharAsManagedChar` option also generates correct casts - Suppress warning regarding returning struct field by ref - Eliminate some tabs that snuck into the test C++ header --- src/AST/TypeExtensions.cs | 16 +++++ .../Generators/CSharp/CSharpMarshal.cs | 18 +++-- .../Generators/CSharp/CSharpSources.cs | 1 + ...izationMethodsWithDependentPointersPass.cs | 9 ++- src/Generator/Types/Std/Stdlib.CSharp.cs | 14 +++- tests/dotnet/CSharp/CSharp.Tests.cs | 21 ++++++ tests/dotnet/CSharp/CSharp.h | 67 ++++++++++++++----- 7 files changed, 120 insertions(+), 26 deletions(-) diff --git a/src/AST/TypeExtensions.cs b/src/AST/TypeExtensions.cs index 32333d6e6..af22e2982 100644 --- a/src/AST/TypeExtensions.cs +++ b/src/AST/TypeExtensions.cs @@ -439,6 +439,22 @@ public static bool IsDependentPointer(this Type type) return false; } + public static bool IsTemplate(this Type type) + { + if (type is TemplateParameterType or TemplateParameterSubstitutionType) + return true; + + var ptr = type; + while (ptr is PointerType pType) + { + ptr = pType.Pointee; + if (ptr is TemplateParameterType or TemplateParameterSubstitutionType) + return true; + } + + return false; + } + public static Module GetModule(this Type type) { Declaration declaration; diff --git a/src/Generator/Generators/CSharp/CSharpMarshal.cs b/src/Generator/Generators/CSharp/CSharpMarshal.cs index 771064533..dea8aa5da 100644 --- a/src/Generator/Generators/CSharp/CSharpMarshal.cs +++ b/src/Generator/Generators/CSharp/CSharpMarshal.cs @@ -601,7 +601,7 @@ public override bool VisitPointerType(PointerType pointer, TypeQualifiers quals) if (Context.Context.Options.MarshalCharAsManagedChar && primitive == PrimitiveType.Char) { - Context.Return.Write($"({typePrinter.PrintNative(pointer)})"); + Context.Return.StringBuilder.Insert(0, $"({typePrinter.PrintNative(pointer)}) "); if (isConst) Context.Return.Write("&"); Context.Return.Write(param.Name); @@ -643,8 +643,13 @@ public override bool VisitPointerType(PointerType pointer, TypeQualifiers quals) } else { - Context.Before.WriteLine("var {0} = {1}.{2};", - arg, Context.Parameter.Name, Helpers.InstanceIdentifier); + Context.Before.Write($"var {arg} = "); + if (pointer.Pointee.IsTemplate()) + Context.Before.Write($"(({Context.Parameter.Type}) (object) {Context.Parameter.Name})"); + else + Context.Before.WriteLine(Context.Parameter.Name); + Context.Before.WriteLine($".{Helpers.InstanceIdentifier};"); + Context.Return.Write($"new {typePrinter.IntPtrType}(&{arg})"); } @@ -805,7 +810,12 @@ private void MarshalRefClass(Class @class) private void MarshalValueClass() { - Context.Return.Write("{0}.{1}", Context.Parameter.Name, Helpers.InstanceIdentifier); + if (Context.Parameter.Type.IsTemplate()) + Context.Return.Write($"(({Context.Parameter.Type}) (object) {Context.Parameter.Name})"); + else + Context.Return.Write(Context.Parameter.Name); + + Context.Return.Write($".{Helpers.InstanceIdentifier}"); } public override bool VisitFieldDecl(Field field) diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index 1540de3f2..7c0ae2940 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -85,6 +85,7 @@ public override void Process() GenerateUsings(); WriteLine("#pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required"); + WriteLine("#pragma warning disable CS9084 // Struct member returns 'this' or other instance members by reference"); NewLine(); if (!string.IsNullOrEmpty(Module.OutputNamespace)) diff --git a/src/Generator/Passes/SpecializationMethodsWithDependentPointersPass.cs b/src/Generator/Passes/SpecializationMethodsWithDependentPointersPass.cs index 07ae0d79f..a027390b4 100644 --- a/src/Generator/Passes/SpecializationMethodsWithDependentPointersPass.cs +++ b/src/Generator/Passes/SpecializationMethodsWithDependentPointersPass.cs @@ -52,6 +52,7 @@ public override bool VisitClassDecl(Class @class) if (!methodsWithDependentPointers.Any()) return false; + var hasMethods = false; var classExtensions = new Class { Name = $"{@class.Name}Extensions", IsStatic = true }; foreach (var specialization in @class.Specializations.Where(s => s.IsGenerated)) foreach (var method in methodsWithDependentPointers.Where( @@ -59,9 +60,11 @@ public override bool VisitClassDecl(Class @class) { var specializedMethod = specialization.Methods.FirstOrDefault( m => m.InstantiatedFrom == method); - if (specializedMethod == null) + if (specializedMethod == null || specializedMethod.IsOperator) continue; + hasMethods = true; + Method extensionMethod = GetExtensionMethodForDependentPointer(specializedMethod); classExtensions.Methods.Add(extensionMethod); extensionMethod.Namespace = classExtensions; @@ -75,6 +78,10 @@ public override bool VisitClassDecl(Class @class) extensionMethod.GenerationKind = GenerationKind.Generate; } } + + if (!hasMethods) + return false; + classExtensions.Namespace = @class.Namespace; classExtensions.OriginalClass = @class; extensions.Add(classExtensions); diff --git a/src/Generator/Types/Std/Stdlib.CSharp.cs b/src/Generator/Types/Std/Stdlib.CSharp.cs index 83df7b1cd..c197a6655 100644 --- a/src/Generator/Types/Std/Stdlib.CSharp.cs +++ b/src/Generator/Types/Std/Stdlib.CSharp.cs @@ -329,7 +329,10 @@ public override void CSharpMarshalToNative(CSharpMarshalContext ctx) ctx.Return.Write($@"{qualifiedBasicString}Extensions.{ Helpers.InternalStruct}.{assign.Name}(new { typePrinter.IntPtrType}(&{ - ctx.ReturnVarName}), {ctx.Parameter.Name})"); + ctx.ReturnVarName}), "); + if (ctx.Parameter.Type.IsTemplate()) + ctx.Return.Write("(string) (object) "); + ctx.Return.Write($"{ctx.Parameter.Name})"); ctx.ReturnVarName = string.Empty; } else @@ -337,8 +340,13 @@ public override void CSharpMarshalToNative(CSharpMarshalContext ctx) var varBasicString = $"__basicString{ctx.ParameterIndex}"; ctx.Before.WriteLine($@"var {varBasicString} = new { basicString.Visit(typePrinter)}();"); - ctx.Before.WriteLine($@"{qualifiedBasicString}Extensions.{ - assign.Name}({varBasicString}, {ctx.Parameter.Name});"); + + ctx.Before.Write($@"{qualifiedBasicString}Extensions.{ + assign.Name}({varBasicString}, "); + if (ctx.Parameter.Type.IsTemplate()) + ctx.Before.Write("(string) (object) "); + ctx.Before.WriteLine($"{ctx.Parameter.Name});"); + ctx.Return.Write($"{varBasicString}.{Helpers.InstanceIdentifier}"); ctx.Cleanup.WriteLine($@"{varBasicString}.Dispose({ (!Type.IsAddress() || ctx.Parameter?.IsIndirect == true ? "disposing: true, callNativeDtor:false" : string.Empty)});"); diff --git a/tests/dotnet/CSharp/CSharp.Tests.cs b/tests/dotnet/CSharp/CSharp.Tests.cs index ecf73afe9..98e080b09 100644 --- a/tests/dotnet/CSharp/CSharp.Tests.cs +++ b/tests/dotnet/CSharp/CSharp.Tests.cs @@ -2003,4 +2003,25 @@ public void TestValueTypeOutParameter() Assert.AreEqual(2, unionTestA.A); Assert.AreEqual(2, unionTestB.B); } + + [TestCase("hi")] + [TestCase(2u)] + public void TestOptional(T value) + { + Assert.That(new CSharp.Optional() != new CSharp.Optional(value)); + Assert.That(new CSharp.Optional() != value); + Assert.That(new CSharp.Optional() == new CSharp.Optional()); + Assert.That(new CSharp.Optional(value) == new CSharp.Optional(value)); + Assert.That(new CSharp.Optional(value) == value); + } + + [Test] + public void TestOptionalIntPtr() + { + Assert.That(new CSharp.Optional() != new CSharp.Optional(IntPtr.MaxValue)); + Assert.That(new CSharp.Optional() != IntPtr.MaxValue); + Assert.That(new CSharp.Optional() == new CSharp.Optional()); + Assert.That(new CSharp.Optional(IntPtr.MaxValue) == new CSharp.Optional(IntPtr.MaxValue)); + Assert.That(new CSharp.Optional(IntPtr.MaxValue) == IntPtr.MaxValue); + } } diff --git a/tests/dotnet/CSharp/CSharp.h b/tests/dotnet/CSharp/CSharp.h index fcc638f50..78a8ea7d4 100644 --- a/tests/dotnet/CSharp/CSharp.h +++ b/tests/dotnet/CSharp/CSharp.h @@ -733,22 +733,22 @@ class DLL_API TestParamToInterfacePassBaseOne class DLL_API TestParamToInterfacePassBaseTwo { - int m; + int m; public: - int getM(); - void setM(int n); - const TestParamToInterfacePassBaseTwo& operator++(); - TestParamToInterfacePassBaseTwo(); - TestParamToInterfacePassBaseTwo(int n); + int getM(); + void setM(int n); + const TestParamToInterfacePassBaseTwo& operator++(); + TestParamToInterfacePassBaseTwo(); + TestParamToInterfacePassBaseTwo(int n); }; class DLL_API TestParamToInterfacePass : public TestParamToInterfacePassBaseOne, public TestParamToInterfacePassBaseTwo { public: - TestParamToInterfacePassBaseTwo addM(TestParamToInterfacePassBaseTwo b); - TestParamToInterfacePassBaseTwo operator+(TestParamToInterfacePassBaseTwo b); - TestParamToInterfacePass(TestParamToInterfacePassBaseTwo b); - TestParamToInterfacePass(); + TestParamToInterfacePassBaseTwo addM(TestParamToInterfacePassBaseTwo b); + TestParamToInterfacePassBaseTwo operator+(TestParamToInterfacePassBaseTwo b); + TestParamToInterfacePass(TestParamToInterfacePassBaseTwo b); + TestParamToInterfacePass(); }; class DLL_API HasProtectedVirtual @@ -973,18 +973,18 @@ class DLL_API ClassWithVirtualBase : public virtual Foo namespace NamespaceA { - CS_VALUE_TYPE class DLL_API A - { - }; + CS_VALUE_TYPE class DLL_API A + { + }; } namespace NamespaceB { - class DLL_API B - { - public: - void Function(CS_OUT NamespaceA::A &a); - }; + class DLL_API B + { + public: + void Function(CS_OUT NamespaceA::A &a); + }; } class DLL_API HasPrivateVirtualProperty @@ -1607,6 +1607,37 @@ DLL_API extern PointerTester* PointerToClass; union DLL_API UnionTester { float a; int b; + inline bool operator ==(const UnionTester& other) const { + return b == other.b; + } }; int DLL_API ValueTypeOutParameter(CS_OUT UnionTester* testerA, CS_OUT UnionTester* testerB); + +template +class Optional { +public: + T m_value; + bool m_hasValue; + + Optional() { + m_hasValue = false; + } + + Optional(T value) { + m_value = std::move(value); + m_hasValue = true; + } + + inline bool operator ==(const Optional& rhs) const { + return (m_hasValue == rhs.m_hasValue && (!m_hasValue || m_value == rhs.m_value)); + } + + inline bool operator ==(const T& rhs) const { + return (m_hasValue && m_value == rhs); + } +}; + +// We just need a method that uses various instantiations of Optional. +inline void DLL_API InstantiateOptionalTemplate(Optional, Optional, + Optional, Optional, Optional) { } From b4f261ea381fffc1708704c59044165668ec11fc Mon Sep 17 00:00:00 2001 From: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Thu, 19 Oct 2023 14:26:00 +0200 Subject: [PATCH 11/37] Simplify `IsTemplateParameterType` --- src/AST/TypeExtensions.cs | 11 +++-------- src/Generator/Generators/CSharp/CSharpMarshal.cs | 4 ++-- src/Generator/Types/Std/Stdlib.CSharp.cs | 4 ++-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/AST/TypeExtensions.cs b/src/AST/TypeExtensions.cs index af22e2982..d94551cf7 100644 --- a/src/AST/TypeExtensions.cs +++ b/src/AST/TypeExtensions.cs @@ -439,18 +439,13 @@ public static bool IsDependentPointer(this Type type) return false; } - public static bool IsTemplate(this Type type) + public static bool IsTemplateParameterType(this Type type) { if (type is TemplateParameterType or TemplateParameterSubstitutionType) return true; - var ptr = type; - while (ptr is PointerType pType) - { - ptr = pType.Pointee; - if (ptr is TemplateParameterType or TemplateParameterSubstitutionType) - return true; - } + if (type is PointerType pt) + return pt.GetFinalPointee() is TemplateParameterType or TemplateParameterSubstitutionType; return false; } diff --git a/src/Generator/Generators/CSharp/CSharpMarshal.cs b/src/Generator/Generators/CSharp/CSharpMarshal.cs index dea8aa5da..eec484e05 100644 --- a/src/Generator/Generators/CSharp/CSharpMarshal.cs +++ b/src/Generator/Generators/CSharp/CSharpMarshal.cs @@ -644,7 +644,7 @@ public override bool VisitPointerType(PointerType pointer, TypeQualifiers quals) else { Context.Before.Write($"var {arg} = "); - if (pointer.Pointee.IsTemplate()) + if (pointer.Pointee.IsTemplateParameterType()) Context.Before.Write($"(({Context.Parameter.Type}) (object) {Context.Parameter.Name})"); else Context.Before.WriteLine(Context.Parameter.Name); @@ -810,7 +810,7 @@ private void MarshalRefClass(Class @class) private void MarshalValueClass() { - if (Context.Parameter.Type.IsTemplate()) + if (Context.Parameter.Type.IsTemplateParameterType()) Context.Return.Write($"(({Context.Parameter.Type}) (object) {Context.Parameter.Name})"); else Context.Return.Write(Context.Parameter.Name); diff --git a/src/Generator/Types/Std/Stdlib.CSharp.cs b/src/Generator/Types/Std/Stdlib.CSharp.cs index c197a6655..a2db882d7 100644 --- a/src/Generator/Types/Std/Stdlib.CSharp.cs +++ b/src/Generator/Types/Std/Stdlib.CSharp.cs @@ -330,7 +330,7 @@ public override void CSharpMarshalToNative(CSharpMarshalContext ctx) Helpers.InternalStruct}.{assign.Name}(new { typePrinter.IntPtrType}(&{ ctx.ReturnVarName}), "); - if (ctx.Parameter.Type.IsTemplate()) + if (ctx.Parameter.Type.IsTemplateParameterType()) ctx.Return.Write("(string) (object) "); ctx.Return.Write($"{ctx.Parameter.Name})"); ctx.ReturnVarName = string.Empty; @@ -343,7 +343,7 @@ public override void CSharpMarshalToNative(CSharpMarshalContext ctx) ctx.Before.Write($@"{qualifiedBasicString}Extensions.{ assign.Name}({varBasicString}, "); - if (ctx.Parameter.Type.IsTemplate()) + if (ctx.Parameter.Type.IsTemplateParameterType()) ctx.Before.Write("(string) (object) "); ctx.Before.WriteLine($"{ctx.Parameter.Name});"); From adffc99bc8bd37dd67d1597c12c9d917910ae295 Mon Sep 17 00:00:00 2001 From: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Thu, 19 Oct 2023 14:51:06 +0200 Subject: [PATCH 12/37] Fix erroneous newline --- src/Generator/Generators/CSharp/CSharpMarshal.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator/Generators/CSharp/CSharpMarshal.cs b/src/Generator/Generators/CSharp/CSharpMarshal.cs index eec484e05..09ced7d11 100644 --- a/src/Generator/Generators/CSharp/CSharpMarshal.cs +++ b/src/Generator/Generators/CSharp/CSharpMarshal.cs @@ -647,7 +647,7 @@ public override bool VisitPointerType(PointerType pointer, TypeQualifiers quals) if (pointer.Pointee.IsTemplateParameterType()) Context.Before.Write($"(({Context.Parameter.Type}) (object) {Context.Parameter.Name})"); else - Context.Before.WriteLine(Context.Parameter.Name); + Context.Before.Write(Context.Parameter.Name); Context.Before.WriteLine($".{Helpers.InstanceIdentifier};"); Context.Return.Write($"new {typePrinter.IntPtrType}(&{arg})"); From 03874e743fc663879a124f3d37dd7b81d4ceedc7 Mon Sep 17 00:00:00 2001 From: Stefan <29021710+Saalvage@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:24:55 +0200 Subject: [PATCH 13/37] Fix Value Type String Member Invalid Codegen (#1778) * Fix code generation * Generate exception on broken struct set op * Remove redundant usings --- src/Generator/Types/Std/Stdlib.CSharp.cs | 22 +++++++++++++++++++--- tests/dotnet/CSharp/CSharp.CSharp.csproj | 1 + tests/dotnet/CSharp/CSharp.Tests.cs | 14 +++++++++++++- tests/dotnet/CSharp/CSharp.h | 9 +++++++++ 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/Generator/Types/Std/Stdlib.CSharp.cs b/src/Generator/Types/Std/Stdlib.CSharp.cs index a2db882d7..9047b97fe 100644 --- a/src/Generator/Types/Std/Stdlib.CSharp.cs +++ b/src/Generator/Types/Std/Stdlib.CSharp.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; @@ -6,6 +7,7 @@ using CppSharp.AST.Extensions; using CppSharp.Generators; using CppSharp.Generators.CSharp; +using Type = CppSharp.AST.Type; namespace CppSharp.Types.Std { @@ -145,7 +147,7 @@ public override void CSharpMarshalToNative(CSharpMarshalContext ctx) // would be really helpful to have ctx hold a Decl property representing the // "appropriate" Decl when we get here. When MarshalKind == NativeField, Decl would // be set to the Field we're operating on. - var fieldName = ctx.ReturnVarName.Substring(ctx.ReturnVarName.LastIndexOf("->") + 2); + var fieldName = ctx.ReturnVarName[Math.Max(ctx.ReturnVarName.LastIndexOf('.') + 1, ctx.ReturnVarName.LastIndexOf("->") + 2)..]; ctx.Before.WriteLine($"if (__{fieldName}_OwnsNativeMemory)"); ctx.Before.WriteLineIndent($"Marshal.FreeHGlobal({ctx.ReturnVarName});"); @@ -326,10 +328,24 @@ public override void CSharpMarshalToNative(CSharpMarshalContext ctx) var assign = basicString.Methods.First(m => m.OriginalName == "assign"); if (ctx.MarshalKind == MarshalKind.NativeField) { + string var; + if (ctx.ReturnVarName.LastIndexOf('.') > ctx.ReturnVarName.LastIndexOf("->")) + { + ctx.Before.WriteLine("throw new NotImplementedException(\"This method cannot currently be called because it would " + + "leave the object in an invalid state. See https://github.com/mono/CppSharp/issues/1777\");"); + + var = Generator.GeneratedIdentifier(ctx.ArgName); + ctx.Before.WriteLine($"fixed (void* {var} = &{ctx.ReturnVarName})"); + ctx.Before.WriteOpenBraceAndIndent(); + ctx.HasCodeBlock = true; + } + else + { + var = $"&{ctx.ReturnVarName}"; + } ctx.Return.Write($@"{qualifiedBasicString}Extensions.{ Helpers.InternalStruct}.{assign.Name}(new { - typePrinter.IntPtrType}(&{ - ctx.ReturnVarName}), "); + typePrinter.IntPtrType}({var}), "); if (ctx.Parameter.Type.IsTemplateParameterType()) ctx.Return.Write("(string) (object) "); ctx.Return.Write($"{ctx.Parameter.Name})"); diff --git a/tests/dotnet/CSharp/CSharp.CSharp.csproj b/tests/dotnet/CSharp/CSharp.CSharp.csproj index 6a6c4bf76..23c154b11 100644 --- a/tests/dotnet/CSharp/CSharp.CSharp.csproj +++ b/tests/dotnet/CSharp/CSharp.CSharp.csproj @@ -1,6 +1,7 @@  0108 + 10 diff --git a/tests/dotnet/CSharp/CSharp.Tests.cs b/tests/dotnet/CSharp/CSharp.Tests.cs index 98e080b09..6f312a7ce 100644 --- a/tests/dotnet/CSharp/CSharp.Tests.cs +++ b/tests/dotnet/CSharp/CSharp.Tests.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Reflection; using System.Runtime.InteropServices; -using System.Text; using CSharp; using NUnit.Framework; @@ -2024,4 +2023,17 @@ public void TestOptionalIntPtr() Assert.That(new CSharp.Optional(IntPtr.MaxValue) == new CSharp.Optional(IntPtr.MaxValue)); Assert.That(new CSharp.Optional(IntPtr.MaxValue) == IntPtr.MaxValue); } + + [Test] + [Ignore("https://github.com/mono/CppSharp/issues/1730")] + public void TestString() + { + var test = new CSharp.ValueType(); + Assert.AreEqual(string.Empty, test.StringMember); + Assert.AreEqual(null, test.CharPtrMember); + test.StringMember = "test"; + test.CharPtrMember = "test2"; + Assert.AreEqual("test", test.StringMember); + Assert.AreEqual("test2", test.CharPtrMember); + } } diff --git a/tests/dotnet/CSharp/CSharp.h b/tests/dotnet/CSharp/CSharp.h index 78a8ea7d4..79bb99c0d 100644 --- a/tests/dotnet/CSharp/CSharp.h +++ b/tests/dotnet/CSharp/CSharp.h @@ -1641,3 +1641,12 @@ class Optional { // We just need a method that uses various instantiations of Optional. inline void DLL_API InstantiateOptionalTemplate(Optional, Optional, Optional, Optional, Optional) { } + +CS_VALUE_TYPE class DLL_API ValueType { +public: + // Parameterless ctors are currently not generated for value types. + ValueType(int) { } + + std::string string_member; + const char* char_ptr_member; +}; From b16e809b9e831324f015ab2dd1fd3c6e64012352 Mon Sep 17 00:00:00 2001 From: Stefan <29021710+Saalvage@users.noreply.github.com> Date: Fri, 20 Oct 2023 18:54:58 +0200 Subject: [PATCH 14/37] Introduce `GenerateFreeStandingFunctionsClassName` option (#1782) * Introduce `GenerateFreeStandingFunctionsClassName` option * Support CLI and fixes --- src/Generator/Generators/CLI/CLIHeaders.cs | 2 +- src/Generator/Generators/CLI/CLISources.cs | 2 +- .../Generators/CLI/CLITypePrinter.cs | 2 +- .../Generators/CSharp/CSharpSources.cs | 2 +- .../Generators/CSharp/CSharpTypePrinter.cs | 2 +- src/Generator/Options.cs | 6 + .../Passes/MoveFunctionToClassPass.cs | 3 +- tests/dotnet/CLI/CLI.Gen.cs | 1 + tests/dotnet/CLI/CLI.Tests.cs | 10 +- tests/dotnet/CSharp/CSharp.Gen.cs | 2 + tests/dotnet/CSharp/CSharp.Tests.cs | 104 +++++++++--------- 11 files changed, 73 insertions(+), 63 deletions(-) diff --git a/src/Generator/Generators/CLI/CLIHeaders.cs b/src/Generator/Generators/CLI/CLIHeaders.cs index 602ff98ab..035324b44 100644 --- a/src/Generator/Generators/CLI/CLIHeaders.cs +++ b/src/Generator/Generators/CLI/CLIHeaders.cs @@ -219,7 +219,7 @@ public void GenerateFunctions(DeclarationContext decl) { PushBlock(BlockKind.FunctionsClass, decl); - WriteLine("public ref class {0}", TranslationUnit.FileNameWithoutExtension); + WriteLine("public ref class {0}", Options.GenerateFreeStandingFunctionsClassName(TranslationUnit)); WriteLine("{"); WriteLine("public:"); Indent(); diff --git a/src/Generator/Generators/CLI/CLISources.cs b/src/Generator/Generators/CLI/CLISources.cs index af55a4cd1..0a8882628 100644 --- a/src/Generator/Generators/CLI/CLISources.cs +++ b/src/Generator/Generators/CLI/CLISources.cs @@ -909,7 +909,7 @@ public void GenerateFunction(Function function, DeclarationContext @namespace) GenerateDeclarationCommon(function); var classSig = string.Format("{0}::{1}", QualifiedIdentifier(@namespace), - TranslationUnit.FileNameWithoutExtension); + Options.GenerateFreeStandingFunctionsClassName(TranslationUnit)); Write("{0} {1}::{2}(", function.ReturnType, classSig, function.Name); diff --git a/src/Generator/Generators/CLI/CLITypePrinter.cs b/src/Generator/Generators/CLI/CLITypePrinter.cs index 69077affe..783a44342 100644 --- a/src/Generator/Generators/CLI/CLITypePrinter.cs +++ b/src/Generator/Generators/CLI/CLITypePrinter.cs @@ -329,7 +329,7 @@ public override TypePrinterResult VisitDeclaration(Declaration decl) var result = string.Join("::", names); var translationUnit = decl.Namespace as TranslationUnit; if (translationUnit != null && translationUnit.HasFunctions && - rootNamespace == translationUnit.FileNameWithoutExtension) + rootNamespace == Options.GenerateFreeStandingFunctionsClassName(translationUnit)) return "::" + result; return result; } diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index 7c0ae2940..617f81932 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -250,7 +250,7 @@ public virtual void GenerateNamespaceFunctionsAndVariables(DeclarationContext co if (!context.Functions.Any(f => f.IsGenerated) && !hasGlobalVariables) return; - var parentName = SafeIdentifier(context.TranslationUnit.FileNameWithoutExtension); + var parentName = SafeIdentifier(Context.Options.GenerateFreeStandingFunctionsClassName(context.TranslationUnit)); var isStruct = EnumerateClasses() .ToList() .FindAll(cls => cls.IsValueType && cls.Name == parentName && context.QualifiedLogicalName == cls.Namespace.QualifiedLogicalName) diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index 727117956..854b4e543 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -575,7 +575,7 @@ specialization.OriginalNamespace is Class && } if (decl is Variable && !(decl.Namespace is Class)) - names.Push(decl.TranslationUnit.FileNameWithoutExtension); + names.Push(Options.GenerateFreeStandingFunctionsClassName(decl.TranslationUnit)); while (!(ctx is TranslationUnit)) { diff --git a/src/Generator/Options.cs b/src/Generator/Options.cs index df924b86f..567153c05 100644 --- a/src/Generator/Options.cs +++ b/src/Generator/Options.cs @@ -172,6 +172,12 @@ public bool DoAllModulesHaveLibraries() => public string IncludePrefix; public Func GenerateName; + /// + /// By default the classes in which free standing functions are contained are named like the header they are in + /// this options allows you to customize this behavior. + /// + public Func GenerateFreeStandingFunctionsClassName = tu => tu.FileNameWithoutExtension; + /// /// Set this option to the kind of comments that you want generated /// in the source code. This overrides the default kind set by the diff --git a/src/Generator/Passes/MoveFunctionToClassPass.cs b/src/Generator/Passes/MoveFunctionToClassPass.cs index 00a2ddc8d..ebfe808ed 100644 --- a/src/Generator/Passes/MoveFunctionToClassPass.cs +++ b/src/Generator/Passes/MoveFunctionToClassPass.cs @@ -57,7 +57,8 @@ private Class FindClassToMoveFunctionTo(Function function) } else { - string name = (function.Namespace as TranslationUnit)?.FileNameWithoutExtension ?? + var tu = function.Namespace as TranslationUnit; + string name = tu != null ? Options.GenerateFreeStandingFunctionsClassName(tu) : function.Namespace.Name; @class = ASTContext.FindClass( name, ignoreCase: true).FirstOrDefault( diff --git a/tests/dotnet/CLI/CLI.Gen.cs b/tests/dotnet/CLI/CLI.Gen.cs index 3b7837edd..3ec8c1dc8 100644 --- a/tests/dotnet/CLI/CLI.Gen.cs +++ b/tests/dotnet/CLI/CLI.Gen.cs @@ -68,6 +68,7 @@ public override void Setup(Driver driver) { driver.Options.GenerateFinalizers = true; driver.Options.GenerateObjectOverrides = true; + driver.Options.GenerateFreeStandingFunctionsClassName = tu => tu.FileNameWithoutExtension + "Cool"; base.Setup(driver); } diff --git a/tests/dotnet/CLI/CLI.Tests.cs b/tests/dotnet/CLI/CLI.Tests.cs index ba58da3ff..54de7959d 100644 --- a/tests/dotnet/CLI/CLI.Tests.cs +++ b/tests/dotnet/CLI/CLI.Tests.cs @@ -78,7 +78,7 @@ public void TestMultipleConstantArraysParamsTestMethod() byte[] bytes2 = Encoding.ASCII.GetBytes("TestMulti2"); sbyte[] sbytes2 = Array.ConvertAll(bytes2, q => Convert.ToSByte(q)); - string s = CLI.CLI.MultipleConstantArraysParamsTestMethod(sbytes, sbytes2); + string s = CLI.CLICool.MultipleConstantArraysParamsTestMethod(sbytes, sbytes2); Assert.AreEqual("TestMultiTestMulti2", s); } @@ -88,7 +88,7 @@ public void TestMultipleConstantArraysParamsTestMethodLongerSourceArray() byte[] bytes = Encoding.ASCII.GetBytes("TestMultipleConstantArraysParamsTestMethodLongerSourceArray"); sbyte[] sbytes = Array.ConvertAll(bytes, q => Convert.ToSByte(q)); - Assert.Throws(() => CLI.CLI.MultipleConstantArraysParamsTestMethod(sbytes, new sbyte[] { })); + Assert.Throws(() => CLI.CLICool.MultipleConstantArraysParamsTestMethod(sbytes, new sbyte[] { })); } [Test] @@ -110,7 +110,7 @@ public void TestStructWithNestedUnionTestMethod() Assert.AreEqual(10, val.NestedUnion.SzText.Length); Assert.AreEqual("TestUnions", val.NestedUnion.SzText); - string ret = CLI.CLI.StructWithNestedUnionTestMethod(val); + string ret = CLI.CLICool.StructWithNestedUnionTestMethod(val); Assert.AreEqual("TestUnions", ret); } @@ -146,7 +146,7 @@ public void TestUnionWithNestedStructTestMethod() Assert.AreEqual(10, unionWithNestedStruct.NestedStruct.SzText.Length); Assert.AreEqual("TestUnions", unionWithNestedStruct.NestedStruct.SzText); - string ret = CLI.CLI.UnionWithNestedStructTestMethod(unionWithNestedStruct); + string ret = CLI.CLICool.UnionWithNestedStructTestMethod(unionWithNestedStruct); Assert.AreEqual("TestUnions", ret); } @@ -172,7 +172,7 @@ public void TestUnionWithNestedStructArrayTestMethod() Assert.AreEqual(2, unionWithNestedStructArray.NestedStructs.Length); - string ret = CLI.CLI.UnionWithNestedStructArrayTestMethod(unionWithNestedStructArray); + string ret = CLI.CLICool.UnionWithNestedStructArrayTestMethod(unionWithNestedStructArray); Assert.AreEqual("TestUnion1TestUnion2", ret); } diff --git a/tests/dotnet/CSharp/CSharp.Gen.cs b/tests/dotnet/CSharp/CSharp.Gen.cs index 3e48a7591..38c2e5d67 100644 --- a/tests/dotnet/CSharp/CSharp.Gen.cs +++ b/tests/dotnet/CSharp/CSharp.Gen.cs @@ -26,6 +26,8 @@ public override void Setup(Driver driver) driver.ParserOptions.UnityBuild = true; driver.ParserOptions.AddSupportedFunctionTemplates("FunctionTemplate"); + + driver.Options.GenerateFreeStandingFunctionsClassName = t => t.FileNameWithoutExtension + "Cool"; } public override void SetupPasses(Driver driver) diff --git a/tests/dotnet/CSharp/CSharp.Tests.cs b/tests/dotnet/CSharp/CSharp.Tests.cs index 6f312a7ce..d2691b165 100644 --- a/tests/dotnet/CSharp/CSharp.Tests.cs +++ b/tests/dotnet/CSharp/CSharp.Tests.cs @@ -85,9 +85,9 @@ public void TestUncompilableCode() { } - CSharp.CSharp.FunctionInsideInlineNamespace(); - CSharp.CSharp.TakeMappedEnum(TestFlag.Flag1); - using (CSharpTemplates.SpecialiseReturnOnly()) + CSharp.CSharpCool.FunctionInsideInlineNamespace(); + CSharp.CSharpCool.TakeMappedEnum(TestFlag.Flag1); + using (CSharpTemplatesCool.SpecialiseReturnOnly()) { } @@ -127,16 +127,16 @@ public void TestDer() [Ignore("https://github.com/mono/CppSharp/issues/1518")] public void TestReturnCharPointer() { - Assert.That(new IntPtr(CSharp.CSharp.ReturnCharPointer()), Is.EqualTo(IntPtr.Zero)); + Assert.That(new IntPtr(CSharp.CSharpCool.ReturnCharPointer()), Is.EqualTo(IntPtr.Zero)); const char z = 'z'; - Assert.That(*CSharp.CSharp.TakeConstCharRef(z), Is.EqualTo(z)); + Assert.That(*CSharp.CSharpCool.TakeConstCharRef(z), Is.EqualTo(z)); } [Test] public void TestTakeCharPointer() { char c = 'c'; - Assert.That(*CSharp.CSharp.TakeCharPointer(&c), Is.EqualTo(c)); + Assert.That(*CSharp.CSharpCool.TakeCharPointer(&c), Is.EqualTo(c)); } [Test] @@ -346,16 +346,16 @@ public void TestDefaultArguments() methodsWithDefaultValues.DefaultOverloadedImplicitCtor(); methodsWithDefaultValues.DefaultWithParamNamedSameAsMethod(5); Assert.That(methodsWithDefaultValues.DefaultIntAssignedAnEnumWithBinaryOperatorAndFlags(), Is.EqualTo((int)(Bar.Items.Item1 | Bar.Items.Item2))); - Assert.That(methodsWithDefaultValues.DefaultWithConstantFlags(), Is.EqualTo(CSharp.CSharp.ConstFlag1 | CSharp.CSharp.ConstFlag2 | CSharp.CSharp.ConstFlag3)); + Assert.That(methodsWithDefaultValues.DefaultWithConstantFlags(), Is.EqualTo(CSharp.CSharpCool.ConstFlag1 | CSharp.CSharpCool.ConstFlag2 | CSharp.CSharpCool.ConstFlag3)); Assert.IsTrue(methodsWithDefaultValues.DefaultWithPointerToEnum()); - Assert.AreEqual(CSharp.CSharp.DefaultSmallPODInstance.__Instance, methodsWithDefaultValues.DefaultWithNonPrimitiveType().__Instance); + Assert.AreEqual(CSharp.CSharpCool.DefaultSmallPODInstance.__Instance, methodsWithDefaultValues.DefaultWithNonPrimitiveType().__Instance); } } [Test] public void TestGenerationOfAnotherUnitInSameFile() { - AnotherUnit.FunctionInAnotherUnit(); + AnotherUnitCool.FunctionInAnotherUnit(); } [Test] @@ -710,9 +710,9 @@ public unsafe void TestSizeOfDerivesFromTemplateInstantiation() public void TestReferenceToArrayWithConstSize() { int[] incorrectlySizedArray = { 1 }; - Assert.Catch(() => CSharp.CSharp.PassConstantArrayRef(incorrectlySizedArray)); + Assert.Catch(() => CSharp.CSharpCool.PassConstantArrayRef(incorrectlySizedArray)); int[] array = { 1, 2 }; - var result = CSharp.CSharp.PassConstantArrayRef(array); + var result = CSharp.CSharpCool.PassConstantArrayRef(array); Assert.That(result, Is.EqualTo(array[0])); } @@ -782,9 +782,9 @@ public void TestGetEnumFromNativePointer() [Test] public void TestStdStringConstant() { - Assert.That(CSharp.HasFreeConstant.AnotherUnit.STD_STRING_CONSTANT, Is.EqualTo("test")); + Assert.That(CSharp.HasFreeConstant.AnotherUnitCool.STD_STRING_CONSTANT, Is.EqualTo("test")); // check a second time to ensure it hasn't been improperly freed - Assert.That(CSharp.HasFreeConstant.AnotherUnit.STD_STRING_CONSTANT, Is.EqualTo("test")); + Assert.That(CSharp.HasFreeConstant.AnotherUnitCool.STD_STRING_CONSTANT, Is.EqualTo("test")); } [Test] @@ -842,10 +842,10 @@ public void TestAlignment() } foreach (var (type, offsets) in new (Type, uint[])[] { - (typeof(ClassCustomTypeAlignment), CSharp.CSharp.ClassCustomTypeAlignmentOffsets), - (typeof(ClassCustomObjectAlignment), CSharp.CSharp.ClassCustomObjectAlignmentOffsets), - (typeof(ClassMicrosoftObjectAlignment), CSharp.CSharp.ClassMicrosoftObjectAlignmentOffsets), - (typeof(StructWithEmbeddedArrayOfStructObjectAlignment), CSharp.CSharp.StructWithEmbeddedArrayOfStructObjectAlignmentOffsets), + (typeof(ClassCustomTypeAlignment), CSharp.CSharpCool.ClassCustomTypeAlignmentOffsets), + (typeof(ClassCustomObjectAlignment), CSharp.CSharpCool.ClassCustomObjectAlignmentOffsets), + (typeof(ClassMicrosoftObjectAlignment), CSharp.CSharpCool.ClassMicrosoftObjectAlignmentOffsets), + (typeof(StructWithEmbeddedArrayOfStructObjectAlignment), CSharp.CSharpCool.StructWithEmbeddedArrayOfStructObjectAlignmentOffsets), }) { var internalType = type.GetNestedType("__Internal"); @@ -884,10 +884,10 @@ public void TestClassSize() [Test] public void TestConstantArray() { - Assert.That(CSharp.CSharp.VariableWithFixedPrimitiveArray[0], Is.EqualTo(5)); - Assert.That(CSharp.CSharp.VariableWithFixedPrimitiveArray[1], Is.EqualTo(10)); - Assert.That(CSharp.CSharp.VariableWithVariablePrimitiveArray[0], Is.EqualTo(15)); - Assert.That(CSharp.CSharp.VariableWithVariablePrimitiveArray[1], Is.EqualTo(20)); + Assert.That(CSharp.CSharpCool.VariableWithFixedPrimitiveArray[0], Is.EqualTo(5)); + Assert.That(CSharp.CSharpCool.VariableWithFixedPrimitiveArray[1], Is.EqualTo(10)); + Assert.That(CSharp.CSharpCool.VariableWithVariablePrimitiveArray[0], Is.EqualTo(15)); + Assert.That(CSharp.CSharpCool.VariableWithVariablePrimitiveArray[1], Is.EqualTo(20)); } [Test] @@ -1489,17 +1489,17 @@ public override Flags HasPointerToEnumInParam(Flags pointerToEnum) [Test] public void TestGenerationOfIncompleteClasses() { - var incompleteStruct = CSharp.CSharp.CreateIncompleteStruct(); + var incompleteStruct = CSharp.CSharpCool.CreateIncompleteStruct(); Assert.IsNotNull(incompleteStruct); - Assert.DoesNotThrow(() => CSharp.CSharp.UseIncompleteStruct(incompleteStruct)); + Assert.DoesNotThrow(() => CSharp.CSharpCool.UseIncompleteStruct(incompleteStruct)); } [Test] public void TestForwardDeclaredStruct() { - using (var forwardDeclaredStruct = CSharp.CSharp.CreateForwardDeclaredStruct(10)) + using (var forwardDeclaredStruct = CSharp.CSharpCool.CreateForwardDeclaredStruct(10)) { - var i = CSharp.CSharp.UseForwardDeclaredStruct(forwardDeclaredStruct); + var i = CSharp.CSharpCool.UseForwardDeclaredStruct(forwardDeclaredStruct); Assert.AreEqual(forwardDeclaredStruct.I, i); } } @@ -1507,8 +1507,8 @@ public void TestForwardDeclaredStruct() [Test, Ignore("The Linux CI (alone) failes to generate these functions.")] public void TestDuplicateDeclaredIncompleteStruct() { - //var duplicateDeclaredIncompleteStruct = CSharp.CSharp.CreateDuplicateDeclaredStruct(10); - //var i = CSharp.CSharp.UseDuplicateDeclaredStruct(duplicateDeclaredIncompleteStruct); + //var duplicateDeclaredIncompleteStruct = CSharp.CSharpCool.CreateDuplicateDeclaredStruct(10); + //var i = CSharp.CSharpCool.UseDuplicateDeclaredStruct(duplicateDeclaredIncompleteStruct); //Assert.AreEqual(10, i); } @@ -1684,7 +1684,7 @@ public void TestVoidPtrReturningIndexer() public void TestFuncWithTypedefedFuncPtrAsParam() { TypedefedFuncPtr function = (a, b) => 5; - Assert.That(CSharp.CSharp.FuncWithTypedefedFuncPtrAsParam(function), Is.EqualTo(5)); + Assert.That(CSharp.CSharpCool.FuncWithTypedefedFuncPtrAsParam(function), Is.EqualTo(5)); } [Test] @@ -1769,14 +1769,14 @@ public void TestVirtualIndirectCallInNative() [Test] public void TestConstCharStarRef() { - Assert.That(CSharp.CSharp.TakeConstCharStarRef("Test"), Is.EqualTo("Test")); + Assert.That(CSharp.CSharpCool.TakeConstCharStarRef("Test"), Is.EqualTo("Test")); } [Test] public void TestRValueReferenceToPointer() { int value = 5; - IntPtr intPtr = CSharp.CSharp.RValueReferenceToPointer((IntPtr*)&value); + IntPtr intPtr = CSharp.CSharpCool.RValueReferenceToPointer((IntPtr*)&value); Assert.That((int)intPtr, Is.EqualTo(value)); } @@ -1785,7 +1785,7 @@ public void TakeRefToPointerToObject() { using (Foo foo = new Foo { A = 25 }) { - Foo returnedFoo = CSharp.CSharp.TakeReturnReferenceToPointer(foo); + Foo returnedFoo = CSharp.CSharpCool.TakeReturnReferenceToPointer(foo); Assert.That(returnedFoo.A, Is.EqualTo(foo.A)); using (Qux qux = new Qux()) { @@ -1832,7 +1832,7 @@ private class OverrideVirtualTemplate : VirtualTemplate [Test] public void TestTypemapTypedefParam() { - Assert.That(CSharp.CSharp.TakeTypemapTypedefParam(false), Is.False); + Assert.That(CSharp.CSharpCool.TakeTypemapTypedefParam(false), Is.False); } [Test] @@ -1866,13 +1866,13 @@ public void TestStringMarshall() foreach (var @string in strings) { var cs = @string; - Assert.That(CSharp.CSharp.TestCSharpString(cs, out var @out), Is.EqualTo(cs)); + Assert.That(CSharp.CSharpCool.TestCSharpString(cs, out var @out), Is.EqualTo(cs)); Assert.That(@out, Is.EqualTo(cs)); - Assert.That(CSharp.CSharp.TestCSharpStringWide(cs, out var outWide), Is.EqualTo(cs)); + Assert.That(CSharp.CSharpCool.TestCSharpStringWide(cs, out var outWide), Is.EqualTo(cs)); Assert.That(outWide, Is.EqualTo(cs)); - Assert.That(CSharp.CSharp.TestCSharpString16(cs, out var out16), Is.EqualTo(cs)); + Assert.That(CSharp.CSharpCool.TestCSharpString16(cs, out var out16), Is.EqualTo(cs)); Assert.That(out16, Is.EqualTo(cs)); - Assert.That(CSharp.CSharp.TestCSharpString32(cs, out var out32), Is.EqualTo(cs)); + Assert.That(CSharp.CSharpCool.TestCSharpString32(cs, out var out32), Is.EqualTo(cs)); Assert.That(out32, Is.EqualTo(cs)); } } @@ -1890,11 +1890,11 @@ public void TestConversionFunction() [Test] public void TestFunctionToStaticMethod() { - Assert.That(CSharp.CSharp.TestFunctionToStaticMethod(new FTIStruct()).A, Is.EqualTo(6)); - Assert.That(CSharp.CSharp.TestFunctionToStaticMethodStruct(new FTIStruct(), new FTIStruct() { A = 6 }), Is.EqualTo(6)); - Assert.That(CSharp.CSharp.TestFunctionToStaticMethodRefStruct(new FTIStruct(), new FTIStruct() { A = 6 }), Is.EqualTo(6)); - Assert.That(CSharp.CSharp.TestFunctionToStaticMethodConstStruct(new FTIStruct(), new FTIStruct() { A = 6 }), Is.EqualTo(6)); - Assert.That(CSharp.CSharp.TestFunctionToStaticMethodConstRefStruct(new FTIStruct(), new FTIStruct() { A = 6 }), Is.EqualTo(6)); + Assert.That(CSharp.CSharpCool.TestFunctionToStaticMethod(new FTIStruct()).A, Is.EqualTo(6)); + Assert.That(CSharp.CSharpCool.TestFunctionToStaticMethodStruct(new FTIStruct(), new FTIStruct() { A = 6 }), Is.EqualTo(6)); + Assert.That(CSharp.CSharpCool.TestFunctionToStaticMethodRefStruct(new FTIStruct(), new FTIStruct() { A = 6 }), Is.EqualTo(6)); + Assert.That(CSharp.CSharpCool.TestFunctionToStaticMethodConstStruct(new FTIStruct(), new FTIStruct() { A = 6 }), Is.EqualTo(6)); + Assert.That(CSharp.CSharpCool.TestFunctionToStaticMethodConstRefStruct(new FTIStruct(), new FTIStruct() { A = 6 }), Is.EqualTo(6)); } [Test] @@ -1914,9 +1914,9 @@ public bool TestClassGenerateNativeToManaged(Type type) [Test] public void TestFunctionTemplate() { - Assert.That(CSharpTemplates.FunctionTemplate(5.0), Is.EqualTo(5 + 4.2)); - Assert.That(CSharpTemplates.FunctionTemplate(6f), Is.EqualTo(6 + 4.1f)); - Assert.That(CSharpTemplates.FunctionTemplate(7), Is.EqualTo(7 + 4)); + Assert.That(CSharpTemplatesCool.FunctionTemplate(5.0), Is.EqualTo(5 + 4.2)); + Assert.That(CSharpTemplatesCool.FunctionTemplate(6f), Is.EqualTo(6 + 4.1f)); + Assert.That(CSharpTemplatesCool.FunctionTemplate(7), Is.EqualTo(7 + 4)); } [Test] @@ -1926,11 +1926,11 @@ public void TestPatialRefSupport() var backup = myclass; myclass.Value = 7; - CSharp.CSharp.ModifyCore(ref myclass); + CSharp.CSharpCool.ModifyCore(ref myclass); Assert.That(myclass.Value, Is.EqualTo(10)); Assert.That(myclass, Is.SameAs(myclass)); - CSharp.CSharp.CreateCore(ref myclass); + CSharp.CSharpCool.CreateCore(ref myclass); Assert.That(myclass.Value, Is.EqualTo(20)); Assert.That(myclass, Is.Not.SameAs(backup)); } @@ -1954,7 +1954,7 @@ public void TestCallByValueCppToCSharpValue() { RuleOfThreeTester.Reset(); CallByValueInterface @interface = new CallByValueInterfaceImpl(); - CSharp.CSharp.CallCallByValueInterfaceValue(@interface); + CSharp.CSharpCool.CallCallByValueInterfaceValue(@interface); Assert.That(RuleOfThreeTester.ConstructorCalls, Is.EqualTo(1)); Assert.That(RuleOfThreeTester.DestructorCalls, Is.EqualTo(2)); @@ -1967,7 +1967,7 @@ public void TestCallByValueCppToCSharpReference() { RuleOfThreeTester.Reset(); CallByValueInterface @interface = new CallByValueInterfaceImpl(); - CSharp.CSharp.CallCallByValueInterfaceReference(@interface); + CSharp.CSharpCool.CallCallByValueInterfaceReference(@interface); Assert.That(RuleOfThreeTester.ConstructorCalls, Is.EqualTo(1)); Assert.That(RuleOfThreeTester.DestructorCalls, Is.EqualTo(1)); @@ -1980,7 +1980,7 @@ public void TestCallByValueCppToCSharpPointer() { RuleOfThreeTester.Reset(); CallByValueInterface @interface = new CallByValueInterfaceImpl(); - CSharp.CSharp.CallCallByValueInterfacePointer(@interface); + CSharp.CSharpCool.CallCallByValueInterfacePointer(@interface); Assert.That(RuleOfThreeTester.ConstructorCalls, Is.EqualTo(1)); Assert.That(RuleOfThreeTester.DestructorCalls, Is.EqualTo(1)); @@ -1991,14 +1991,14 @@ public void TestCallByValueCppToCSharpPointer() [Test] public void TestPointerToClass() { - Assert.IsTrue(CSharp.CSharp.PointerToClass.IsDefaultInstance); - Assert.IsTrue(CSharp.CSharp.PointerToClass.IsValid); + Assert.IsTrue(CSharp.CSharpCool.PointerToClass.IsDefaultInstance); + Assert.IsTrue(CSharp.CSharpCool.PointerToClass.IsValid); } [Test] public void TestValueTypeOutParameter() { - Assert.AreEqual(2, CSharp.CSharp.ValueTypeOutParameter(out var unionTestA, out var unionTestB)); + Assert.AreEqual(2, CSharp.CSharpCool.ValueTypeOutParameter(out var unionTestA, out var unionTestB)); Assert.AreEqual(2, unionTestA.A); Assert.AreEqual(2, unionTestB.B); } From a5afda86036a13f95d2837f8628e6d17a60bfea3 Mon Sep 17 00:00:00 2001 From: Stefan <29021710+Saalvage@users.noreply.github.com> Date: Fri, 20 Oct 2023 21:00:04 +0200 Subject: [PATCH 15/37] Fix parameterless constructors not being generated for structs (#1783) * Fix parameterless constructors not being generated for structs * Fix implicit non-trivial default ctor * Adjust `Ignore` linked issue --- src/Generator/AST/Utils.cs | 2 +- src/Generator/Generators/CLI/CLIHeaders.cs | 3 +- .../Generators/CSharp/CSharpSources.cs | 2 +- src/Generator/Types/Std/Stdlib.CSharp.cs | 3 -- tests/dotnet/CSharp/CSharp.Tests.cs | 28 +++++++++++++++++-- tests/dotnet/CSharp/CSharp.h | 9 ++++-- tests/dotnet/Common/Common.CSharp.csproj | 6 +++- 7 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/Generator/AST/Utils.cs b/src/Generator/AST/Utils.cs index 986b55851..9074614ac 100644 --- a/src/Generator/AST/Utils.cs +++ b/src/Generator/AST/Utils.cs @@ -30,7 +30,7 @@ public static bool CheckIgnoreMethod(Method method) var isEmptyCtor = method.IsConstructor && method.Parameters.Count == 0; var @class = method.Namespace as Class; - if (@class != null && @class.IsValueType && isEmptyCtor) + if (@class != null && @class.IsValueType && isEmptyCtor && !@class.HasNonTrivialDefaultConstructor) return true; if (method.IsDestructor) diff --git a/src/Generator/Generators/CLI/CLIHeaders.cs b/src/Generator/Generators/CLI/CLIHeaders.cs index 035324b44..a143cf4de 100644 --- a/src/Generator/Generators/CLI/CLIHeaders.cs +++ b/src/Generator/Generators/CLI/CLIHeaders.cs @@ -798,7 +798,8 @@ public void GenerateFunction(Function function) public static bool FunctionIgnored(Function function) { return TypeIgnored(function.ReturnType.Type) || - function.Parameters.Any(param => TypeIgnored(param.Type)); + function.Parameters.Any(param => TypeIgnored(param.Type)) || + function is Method { IsConstructor: true, Parameters: { Count: 0 }, Namespace: Class { IsValueType: true } }; } public static bool TypeIgnored(CppSharp.AST.Type type) diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index 617f81932..1abdb262e 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -2678,7 +2678,7 @@ public void GenerateMethod(Method method, Class @class) if (hasBase && !@class.IsValueType) WriteLineIndent($": this({(method != null ? "(void*) null" : "native")})"); - if (@class.IsValueType) + if (@class.IsValueType && method.Parameters.Count > 0) WriteLineIndent(": this()"); } diff --git a/src/Generator/Types/Std/Stdlib.CSharp.cs b/src/Generator/Types/Std/Stdlib.CSharp.cs index 9047b97fe..e394c40c4 100644 --- a/src/Generator/Types/Std/Stdlib.CSharp.cs +++ b/src/Generator/Types/Std/Stdlib.CSharp.cs @@ -331,9 +331,6 @@ public override void CSharpMarshalToNative(CSharpMarshalContext ctx) string var; if (ctx.ReturnVarName.LastIndexOf('.') > ctx.ReturnVarName.LastIndexOf("->")) { - ctx.Before.WriteLine("throw new NotImplementedException(\"This method cannot currently be called because it would " + - "leave the object in an invalid state. See https://github.com/mono/CppSharp/issues/1777\");"); - var = Generator.GeneratedIdentifier(ctx.ArgName); ctx.Before.WriteLine($"fixed (void* {var} = &{ctx.ReturnVarName})"); ctx.Before.WriteOpenBraceAndIndent(); diff --git a/tests/dotnet/CSharp/CSharp.Tests.cs b/tests/dotnet/CSharp/CSharp.Tests.cs index d2691b165..2c14bd92c 100644 --- a/tests/dotnet/CSharp/CSharp.Tests.cs +++ b/tests/dotnet/CSharp/CSharp.Tests.cs @@ -2025,8 +2025,7 @@ public void TestOptionalIntPtr() } [Test] - [Ignore("https://github.com/mono/CppSharp/issues/1730")] - public void TestString() + public void TestValueTypeStringMember() { var test = new CSharp.ValueType(); Assert.AreEqual(string.Empty, test.StringMember); @@ -2036,4 +2035,29 @@ public void TestString() Assert.AreEqual("test", test.StringMember); Assert.AreEqual("test2", test.CharPtrMember); } + + [Test] + [Ignore("https://github.com/mono/CppSharp/issues/1786")] + public void TestValueTypeStringMemberDefaulted() + { + CSharp.ValueType test = default; + Assert.AreEqual(string.Empty, test.StringMember); + Assert.AreEqual(null, test.CharPtrMember); + test.StringMember = "test"; + test.CharPtrMember = "test2"; + Assert.AreEqual("test", test.StringMember); + Assert.AreEqual("test2", test.CharPtrMember); + } + + [Test] + public void TestValueTypeStringMemberDefaultedCtor() + { + var test = new CSharp.ValueTypeNoCtor(); + Assert.AreEqual(string.Empty, test.StringMember); + Assert.AreEqual(null, test.CharPtrMember); + test.StringMember = "test"; + test.CharPtrMember = "test2"; + Assert.AreEqual("test", test.StringMember); + Assert.AreEqual("test2", test.CharPtrMember); + } } diff --git a/tests/dotnet/CSharp/CSharp.h b/tests/dotnet/CSharp/CSharp.h index 79bb99c0d..885244693 100644 --- a/tests/dotnet/CSharp/CSharp.h +++ b/tests/dotnet/CSharp/CSharp.h @@ -1644,9 +1644,14 @@ inline void DLL_API InstantiateOptionalTemplate(Optional, Optional CS_VALUE_TYPE class DLL_API ValueType { public: - // Parameterless ctors are currently not generated for value types. - ValueType(int) { } + ValueType() { } std::string string_member; const char* char_ptr_member; }; + +CS_VALUE_TYPE class DLL_API ValueTypeNoCtor { +public: + std::string string_member; + const char* char_ptr_member; +}; diff --git a/tests/dotnet/Common/Common.CSharp.csproj b/tests/dotnet/Common/Common.CSharp.csproj index a6968989f..ab697a82e 100644 --- a/tests/dotnet/Common/Common.CSharp.csproj +++ b/tests/dotnet/Common/Common.CSharp.csproj @@ -1 +1,5 @@ - \ No newline at end of file + + + 11.0 + + \ No newline at end of file From 3b2a15d9f58c2662d8ec0634c2bcca3aa9404a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Matos?= Date: Sat, 21 Oct 2023 19:33:13 +0100 Subject: [PATCH 16/37] Update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4bf008a25..8c013d326 100644 --- a/README.md +++ b/README.md @@ -74,12 +74,11 @@ Please see the following resources for more information: ## Community -Feel free to open up issues on Github for any problems you find. +Feel free to open up issues on GitHub for any problems you find. ## Support -For building wrappers and priority support please write to cppsharp@protonmail.com. -Alternatively, you may post bounties at https://www.bountysource.com/. +If you need commercial support feel free to open a discussion or issue for discussion. ## Users @@ -109,4 +108,6 @@ CppSharp is used by the following projects: [GLFW3.NET](https://github.com/realvictorprm/GLFW3.NET) +[DearImguiSharp](https://github.com/Sewer56/DearImguiSharp) + Please feel free to send us a pull request adding your own projects to the list above. From b14038ab07bf85e25c9ed46de541eee7f3a419f4 Mon Sep 17 00:00:00 2001 From: Stefan <29021710+Saalvage@users.noreply.github.com> Date: Mon, 23 Oct 2023 14:23:51 +0200 Subject: [PATCH 17/37] Value types may generate `Dispose` (#1787) --- .../Generators/CSharp/CSharpSources.cs | 110 ++++++++++++------ tests/dotnet/CSharp/CSharp.Tests.cs | 3 + 2 files changed, 77 insertions(+), 36 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index 1abdb262e..8623ad3ce 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -781,7 +781,7 @@ public override void GenerateClassSpecifier(Class @class) } } - if (@class.IsGenerated && isBindingGen && @class.IsRefType && !@class.IsOpaque) + if (@class.IsGenerated && isBindingGen && NeedsDispose(@class) && !@class.IsOpaque) { bases.Add("IDisposable"); } @@ -790,6 +790,12 @@ public override void GenerateClassSpecifier(Class @class) Write(" : {0}", string.Join(", ", bases)); } + private bool NeedsDispose(Class @class) + { + return @class.IsRefType || @class.IsValueType && + (@class.GetConstCharFieldProperties().Any() || @class.HasNonTrivialDestructor); + } + private bool CanUseSequentialLayout(Class @class) { if (@class.IsUnion || @class.HasUnionFields) @@ -2223,25 +2229,24 @@ public void GenerateClassConstructors(Class @class) GenerateMethod(ctor, @class); } - if (@class.IsRefType) - { - // We used to always call GenerateClassFinalizer here. However, the - // finalizer calls Dispose which is conditionally implemented below. - // Instead, generate the finalizer only if Dispose is also implemented. + // We used to always call GenerateClassFinalizer here. However, the + // finalizer calls Dispose which is conditionally implemented below. + // Instead, generate the finalizer only if Dispose is also implemented. - // ensure any virtual dtor in the chain is called - var dtor = @class.Destructors.FirstOrDefault(d => d.Access != AccessSpecifier.Private); - if (ShouldGenerateClassNativeField(@class) || - (dtor != null && (dtor.IsVirtual || @class.HasNonTrivialDestructor)) || - // virtual destructors in abstract classes may lack a pointer in the v-table - // so they have to be called by symbol; thus we need an explicit Dispose override - @class.IsAbstract) - if (!@class.IsOpaque) - { + // ensure any virtual dtor in the chain is called + var dtor = @class.Destructors.FirstOrDefault(d => d.Access != AccessSpecifier.Private); + if (ShouldGenerateClassNativeField(@class) || + (dtor != null && (dtor.IsVirtual || @class.HasNonTrivialDestructor)) || + // virtual destructors in abstract classes may lack a pointer in the v-table + // so they have to be called by symbol; thus we need an explicit Dispose override + @class.IsAbstract) + if (!@class.IsOpaque) + { + if (@class.IsRefType) GenerateClassFinalizer(@class); + if (NeedsDispose(@class)) GenerateDisposeMethods(@class); - } - } + } } private void GenerateClassFinalizer(Class @class) @@ -2250,19 +2255,23 @@ private void GenerateClassFinalizer(Class @class) return; using (PushWriteBlock(BlockKind.Finalizer, $"~{@class.Name}()", NewLineKind.BeforeNextBlock)) - WriteLine($"Dispose(false, callNativeDtor : {Helpers.OwnsNativeInstanceIdentifier} );"); + WriteLine($"Dispose(false, callNativeDtor: {Helpers.OwnsNativeInstanceIdentifier});"); } private void GenerateDisposeMethods(Class @class) { var hasBaseClass = @class.HasBaseClass && @class.BaseClass.IsRefType; + var hasDtorParam = @class.IsRefType; + // Generate the IDispose Dispose() method. if (!hasBaseClass) { using (PushWriteBlock(BlockKind.Method, "public void Dispose()", NewLineKind.BeforeNextBlock)) { - WriteLine($"Dispose(disposing: true, callNativeDtor : {Helpers.OwnsNativeInstanceIdentifier} );"); + WriteLine(hasDtorParam + ? $"Dispose(disposing: true, callNativeDtor: {Helpers.OwnsNativeInstanceIdentifier});" + : "Dispose(disposing: true);"); if (Options.GenerateFinalizerFor(@class)) WriteLine("GC.SuppressFinalize(this);"); } @@ -2276,7 +2285,10 @@ private void GenerateDisposeMethods(Class @class) // Generate Dispose(bool, bool) method var ext = !@class.IsValueType ? (hasBaseClass ? "override " : "virtual ") : string.Empty; - using var _ = PushWriteBlock(BlockKind.Method, $"internal protected {ext}void Dispose(bool disposing, bool callNativeDtor )", NewLineKind.BeforeNextBlock); + var protectionLevel = @class.IsValueType ? "private" : "internal protected"; + using var _ = PushWriteBlock(BlockKind.Method, + $"{protectionLevel} {ext}void Dispose(bool disposing{(hasDtorParam ? ", bool callNativeDtor" : "")})", + NewLineKind.BeforeNextBlock); if (@class.IsRefType) { @@ -2323,7 +2335,7 @@ private void GenerateDisposeMethods(Class @class) // instance from the NativeToManagedMap. Of course, this is somewhat half-hearted // since we can't/don't do this when there's no virtual dtor available to detour. // Anyway, we must be able to call the native dtor in this case even if we don't - /// own the underlying native instance. + // own the underlying native instance. // // 2. When we we pass a disposable object to a function "by value" then the callee // calls the dtor on the argument so our marshalling code must have a way from preventing @@ -2335,21 +2347,29 @@ private void GenerateDisposeMethods(Class @class) // } // // IDisposable.Dispose() and Object.Finalize() set callNativeDtor = Helpers.OwnsNativeInstanceIdentifier - WriteLine("if (callNativeDtor)"); - if (@class.IsDependent || dtor.IsVirtual) - WriteOpenBraceAndIndent(); - else - Indent(); + if (hasDtorParam) + { + WriteLine("if (callNativeDtor)"); + if (@class.IsDependent || dtor.IsVirtual) + WriteOpenBraceAndIndent(); + else + Indent(); + } + if (dtor.IsVirtual) this.GenerateMember(@class, c => GenerateDestructorCall( c is ClassTemplateSpecialization ? c.Methods.First(m => m.InstantiatedFrom == dtor) : dtor)); else this.GenerateMember(@class, c => GenerateMethodBody(c, dtor)); - if (@class.IsDependent || dtor.IsVirtual) - UnindentAndWriteCloseBrace(); - else - Unindent(); + + if (hasDtorParam) + { + if (@class.IsDependent || dtor.IsVirtual) + UnindentAndWriteCloseBrace(); + else + Unindent(); + } } } @@ -2357,19 +2377,37 @@ c is ClassTemplateSpecialization ? // referenced memory. Don't rely on testing if the field's IntPtr is IntPtr.Zero since // unmanaged memory isn't always initialized and/or a reference may be owned by the // native side. - // + + string ptr; + if (@class.IsValueType) + { + ptr = $"{Helpers.InstanceIdentifier}Ptr"; + WriteLine($"fixed ({Helpers.InternalStruct}* {ptr} = &{Helpers.InstanceIdentifier})"); + WriteOpenBraceAndIndent(); + } + else + { + ptr = $"(({Helpers.InternalStruct}*){Helpers.InstanceIdentifier})"; + } + foreach (var prop in @class.GetConstCharFieldProperties()) { string name = prop.Field.OriginalName; - var ptr = $"(({Helpers.InternalStruct}*){Helpers.InstanceIdentifier})->{name}"; WriteLine($"if (__{name}_OwnsNativeMemory)"); - WriteLineIndent($"Marshal.FreeHGlobal({ptr});"); + WriteLineIndent($"Marshal.FreeHGlobal({ptr}->{name});"); } - WriteLine("if ({0})", Helpers.OwnsNativeInstanceIdentifier); - WriteLineIndent("Marshal.FreeHGlobal({0});", Helpers.InstanceIdentifier); + if (@class.IsValueType) + { + UnindentAndWriteCloseBrace(); + } + else + { + WriteLine("if ({0})", Helpers.OwnsNativeInstanceIdentifier); + WriteLineIndent("Marshal.FreeHGlobal({0});", Helpers.InstanceIdentifier); - WriteLine("{0} = IntPtr.Zero;", Helpers.InstanceIdentifier); + WriteLine("{0} = IntPtr.Zero;", Helpers.InstanceIdentifier); + } } private bool GenerateDestructorCall(Method dtor) diff --git a/tests/dotnet/CSharp/CSharp.Tests.cs b/tests/dotnet/CSharp/CSharp.Tests.cs index 2c14bd92c..f61e97ef6 100644 --- a/tests/dotnet/CSharp/CSharp.Tests.cs +++ b/tests/dotnet/CSharp/CSharp.Tests.cs @@ -2034,6 +2034,7 @@ public void TestValueTypeStringMember() test.CharPtrMember = "test2"; Assert.AreEqual("test", test.StringMember); Assert.AreEqual("test2", test.CharPtrMember); + test.Dispose(); } [Test] @@ -2047,6 +2048,7 @@ public void TestValueTypeStringMemberDefaulted() test.CharPtrMember = "test2"; Assert.AreEqual("test", test.StringMember); Assert.AreEqual("test2", test.CharPtrMember); + test.Dispose(); } [Test] @@ -2059,5 +2061,6 @@ public void TestValueTypeStringMemberDefaultedCtor() test.CharPtrMember = "test2"; Assert.AreEqual("test", test.StringMember); Assert.AreEqual("test2", test.CharPtrMember); + test.Dispose(); } } From 40f3a09296ee4f7339483eaaa16e6d2d4b18c2a4 Mon Sep 17 00:00:00 2001 From: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Sat, 11 Nov 2023 16:51:18 +0200 Subject: [PATCH 18/37] Minor improvements (#1793) * CppSharp.Generators.Options: added pre/post TranslationUnitPass callback * CppSharp.Generators.Passes.Pass: added TranslationUnitPassGeneratorDependent --- src/Generator/BindingContext.cs | 8 ++++++++ src/Generator/Options.cs | 7 +++++++ src/Generator/Passes/Pass.cs | 10 ++++++++++ 3 files changed, 25 insertions(+) diff --git a/src/Generator/BindingContext.cs b/src/Generator/BindingContext.cs index e7c094c69..cf0cbd3e4 100644 --- a/src/Generator/BindingContext.cs +++ b/src/Generator/BindingContext.cs @@ -2,6 +2,7 @@ using CppSharp.Passes; using CppSharp.Types; using CppSharp.Parser; +using System.Collections.Generic; namespace CppSharp.Generators { @@ -36,14 +37,21 @@ public BindingContext(DriverOptions options, ParserOptions parserOptions = null) public void RunPasses() { + Dictionary passesByType = new Dictionary(); + int index = 0; TranslationUnitPasses.RunPasses(pass => { + int count = passesByType.GetValueOrDefault(pass.GetType(), 0); Diagnostics.Debug("Pass '{0}'", pass); Diagnostics.PushIndent(); + Options.TranslationUnitPassPreCallBack?.Invoke(pass, index, count); pass.Context = this; pass.VisitASTContext(ASTContext); + Options.TranslationUnitPassPostCallBack?.Invoke(pass, index, count); Diagnostics.PopIndent(); + passesByType[pass.GetType()] = count + 1; + index += 1; }); } } diff --git a/src/Generator/Options.cs b/src/Generator/Options.cs index 567153c05..f42236cd6 100644 --- a/src/Generator/Options.cs +++ b/src/Generator/Options.cs @@ -5,6 +5,7 @@ using System.Text; using CppSharp.AST; using CppSharp.Generators; +using CppSharp.Passes; namespace CppSharp { @@ -254,6 +255,12 @@ public bool GenerateSingleCSharpFile /// public bool GenerateExternalDataFields { get; set; } = false; + public delegate void TranslationUnitPassCallBack(TranslationUnitPass pass, int index, int count); + + public TranslationUnitPassCallBack TranslationUnitPassPreCallBack { get; set; } + + public TranslationUnitPassCallBack TranslationUnitPassPostCallBack { get; set; } + #endregion } diff --git a/src/Generator/Passes/Pass.cs b/src/Generator/Passes/Pass.cs index 877a1116e..3ea925528 100644 --- a/src/Generator/Passes/Pass.cs +++ b/src/Generator/Passes/Pass.cs @@ -51,6 +51,16 @@ bool IsDeclExcluded(Declaration decl) } } + public class TranslationUnitPassGeneratorDependent : TranslationUnitPass + { + public Generator Generator { get; } + + public TranslationUnitPassGeneratorDependent(Generator generator) + { + Generator = generator; + } + } + /// /// Used to modify generated output. /// From 0edd48c6a1d02141bd019feeab5a10f7a2f2e822 Mon Sep 17 00:00:00 2001 From: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Mon, 13 Nov 2023 20:15:24 +0200 Subject: [PATCH 19/37] Major refactoring: refactor GeneratorKind enum into a class (#1794) * Major refactoring: refactor GeneratorKind enum into a class * Minor fix: add readonly * Add Type property for GenerationKind + cleanup * GeneratorKind: add Name property + refactor hardcoded names * GeneratorKind: add CLIOptions property + refactor hardcoded options * CppSharp.CLI: minor fix: use generator.ToLower() * GeneratorKind: fix warning --- src/CLI/CLI.cs | 30 +--- src/CLI/Generator.cs | 17 +- src/CppParser/Bootstrap/Bootstrap.cs | 8 +- src/Generator/Driver.cs | 36 +---- src/Generator/Generator.cs | 18 --- src/Generator/GeneratorKind.cs | 151 ++++++++++++++++++ src/Generator/Generators/ExtensionMethods.cs | 4 +- .../Passes/CheckDuplicatedNamesPass.cs | 16 +- src/Generator/Passes/ValidateOperatorsPass.cs | 7 +- src/Generator/Types/DeclMap.cs | 2 +- src/Generator/Types/DeclMapDatabase.cs | 2 +- src/Generator/Types/Std/Stdlib.CLI.cs | 26 +-- src/Generator/Types/Std/Stdlib.CSharp.cs | 28 ++-- src/Generator/Types/TypeIgnoreChecker.cs | 7 +- src/Generator/Types/TypeMap.cs | 32 ++-- src/Generator/Types/TypeMapDatabase.cs | 4 +- 16 files changed, 231 insertions(+), 157 deletions(-) create mode 100644 src/Generator/GeneratorKind.cs diff --git a/src/CLI/CLI.cs b/src/CLI/CLI.cs index 44889307c..7b8068a4f 100644 --- a/src/CLI/CLI.cs +++ b/src/CLI/CLI.cs @@ -206,33 +206,13 @@ static void GetFilesFromPath(string path, List errorMessages) static void GetGeneratorKind(string generator, List errorMessages) { - switch (generator.ToLower()) + foreach (GeneratorKind generatorKind in GeneratorKind.Registered) { - case "csharp": - options.Kind = GeneratorKind.CSharp; - return; - case "cli": - options.Kind = GeneratorKind.CLI; - return; - case "c": - options.Kind = GeneratorKind.C; - return; - case "cpp": - options.Kind = GeneratorKind.CPlusPlus; - return; - case "napi": - options.Kind = GeneratorKind.NAPI; - return; - case "qjs": - options.Kind = GeneratorKind.QuickJS; - return; - case "ts": - case "typescript": - options.Kind = GeneratorKind.TypeScript; - return; - case "emscripten": - options.Kind = GeneratorKind.Emscripten; + if (generatorKind.IsCLIOptionMatch(generator.ToLower())) + { + options.Kind = generatorKind; return; + } } errorMessages.Add($"Unknown generator kind: {generator}."); diff --git a/src/CLI/Generator.cs b/src/CLI/Generator.cs index 58db9ac72..e7ac5d59f 100644 --- a/src/CLI/Generator.cs +++ b/src/CLI/Generator.cs @@ -198,7 +198,7 @@ public void Postprocess(Driver driver, ASTContext ctx) public void Run() { var messageBuilder = new StringBuilder(); - messageBuilder.Append($"Generating {GetGeneratorKindName(options.Kind)}"); + messageBuilder.Append($"Generating {options.Kind.Name}"); messageBuilder.Append($" bindings for {GetPlatformName(options.Platform)} {options.Architecture}"); if (options.Cpp11ABI) @@ -225,20 +225,5 @@ private static string GetPlatformName(TargetPlatform? platform) return platform.ToString(); } } - - private static string GetGeneratorKindName(GeneratorKind kind) - { - switch (kind) - { - case GeneratorKind.CLI: - return "C++/CLI"; - case GeneratorKind.CSharp: - return "C#"; - case GeneratorKind.NAPI: - return "N-API"; - default: - return kind.ToString(); - } - } } } diff --git a/src/CppParser/Bootstrap/Bootstrap.cs b/src/CppParser/Bootstrap/Bootstrap.cs index 2e8b4d639..a19db6c5f 100644 --- a/src/CppParser/Bootstrap/Bootstrap.cs +++ b/src/CppParser/Bootstrap/Bootstrap.cs @@ -1778,8 +1778,7 @@ private static string CleanClangNamespaceFromName(string qualifiedName) return qualifiedName; } - public static string GetDeclName(Declaration decl, - GeneratorKind kind = GeneratorKind.CPlusPlus) + public static string GetDeclName(Declaration decl, GeneratorKind kind) { string name = decl.Name; @@ -1811,6 +1810,11 @@ public static string GetDeclName(Declaration decl, return name; } + public static string GetDeclName(Declaration decl) + { + return GetDeclName(decl, GeneratorKind.CPlusPlus); + } + public static AST.Type GetDeclType(AST.Type type, TypePrinter typePrinter) { diff --git a/src/Generator/Driver.cs b/src/Generator/Driver.cs index 0751fa1c7..9b2084333 100644 --- a/src/Generator/Driver.cs +++ b/src/Generator/Driver.cs @@ -4,12 +4,6 @@ using System.Linq; using CppSharp.AST; using CppSharp.Generators; -using CppSharp.Generators.C; -using CppSharp.Generators.CLI; -using CppSharp.Generators.Cpp; -using CppSharp.Generators.CSharp; -using CppSharp.Generators.Emscripten; -using CppSharp.Generators.TS; using CppSharp.Parser; using CppSharp.Passes; using CppSharp.Utils; @@ -32,31 +26,6 @@ public Driver(DriverOptions options) ParserOptions = new ParserOptions(); } - Generator CreateGeneratorFromKind(GeneratorKind kind) - { - switch (kind) - { - case GeneratorKind.C: - return new CGenerator(Context); - case GeneratorKind.CPlusPlus: - return new CppGenerator(Context); - case GeneratorKind.CLI: - return new CLIGenerator(Context); - case GeneratorKind.CSharp: - return new CSharpGenerator(Context); - case GeneratorKind.Emscripten: - return new EmscriptenGenerator(Context); - case GeneratorKind.QuickJS: - return new QuickJSGenerator(Context); - case GeneratorKind.NAPI: - return new NAPIGenerator(Context); - case GeneratorKind.TypeScript: - return new TSGenerator(Context); - } - - throw new NotImplementedException(); - } - void ValidateOptions() { if (!Options.Compilation.Platform.HasValue) @@ -87,7 +56,7 @@ public void Setup() ValidateOptions(); ParserOptions.Setup(Platform.Host); Context = new BindingContext(Options, ParserOptions); - Generator = CreateGeneratorFromKind(Options.GeneratorKind); + Generator = Options.GeneratorKind.CreateGenerator(Context); } public void SetupTypeMaps() => @@ -387,8 +356,7 @@ public bool CompileCode(Module module) out int error, out string errorMessage); if (error == 0) { - Diagnostics.Message($@"Compilation succeeded: { - LibraryMappings[module] = Path.Combine( + Diagnostics.Message($@"Compilation succeeded: {LibraryMappings[module] = Path.Combine( Options.OutputDir, $"{module.LibraryName}.dll")}."); return true; } diff --git a/src/Generator/Generator.cs b/src/Generator/Generator.cs index cf414b482..1593a8550 100644 --- a/src/Generator/Generator.cs +++ b/src/Generator/Generator.cs @@ -5,24 +5,6 @@ namespace CppSharp.Generators { - /// - /// Kinds of language generators. - /// - public enum GeneratorKind - { - CLI = 1, - CSharp = 2, - C, - CPlusPlus, - Emscripten, - ObjectiveC, - Java, - Swift, - QuickJS, - NAPI, - TypeScript - } - /// /// Output generated by each backend generator. /// diff --git a/src/Generator/GeneratorKind.cs b/src/Generator/GeneratorKind.cs new file mode 100644 index 000000000..222420404 --- /dev/null +++ b/src/Generator/GeneratorKind.cs @@ -0,0 +1,151 @@ +using CppSharp.AST; +using CppSharp.Generators.C; +using CppSharp.Generators.CLI; +using CppSharp.Generators.Cpp; +using CppSharp.Generators.CSharp; +using CppSharp.Generators.Emscripten; +using CppSharp.Generators.TS; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace CppSharp.Generators +{ + /// + /// Kinds of language generators. + /// + public class GeneratorKind : IEquatable + { + public static readonly HashSet Registered = new(); + + public string ID { get; } + public string Name { get; } + public System.Type Type { get; } + public string[] CLIOptions { get; } + + public GeneratorKind(string id, string name, System.Type type, string[] cLIOptions = null) + { + if (Registered.Any(kind => kind.ID == id)) + { + throw new Exception($"GeneratorKind has an already registered ID: {ID}"); + } + ID = id; + Name = name; + Type = type; + CLIOptions = cLIOptions; + Registered.Add(this); + } + + public Generator CreateGenerator(BindingContext context) + { + return (Generator)Activator.CreateInstance(Type, context); + } + + public bool IsCLIOptionMatch(string cliOption) + { + if (CLIOptions == null) + { + return false; + } + return CLIOptions.Any(cliOption.Contains); + } + + public static bool operator ==(GeneratorKind obj1, GeneratorKind obj2) + { + if (ReferenceEquals(obj1, obj2)) + { + return true; + } + if (obj1 is null) + { + return false; + } + if (obj2 is null) + { + return false; + } + return obj1.Equals(obj2); + } + + public static bool operator !=(GeneratorKind obj1, GeneratorKind obj2) => !(obj1 == obj2); + + public bool Equals(GeneratorKind other) + { + if (other is null) + { + return false; + } + if (ReferenceEquals(this, other)) + { + return true; + } + return ID.Equals(other.ID); + } + + public override bool Equals(object obj) => Equals(obj as GeneratorKind); + + public override int GetHashCode() + { + unchecked + { + return ID.GetHashCode(); + } + } + + public const string CLI_ID = "CLI"; + public static readonly GeneratorKind CLI = new(CLI_ID, "C++/CLI", typeof(CLIGenerator), new[] { "cli" }); + + public const string CSharp_ID = "CSharp"; + public static readonly GeneratorKind CSharp = new(CSharp_ID, "C#", typeof(CSharpGenerator), new[] { "csharp" }); + + public const string C_ID = "C"; + public static readonly GeneratorKind C = new(C_ID, "C", typeof(CGenerator), new[] { "c" }); + + public const string CPlusPlus_ID = "CPlusPlus"; + public static readonly GeneratorKind CPlusPlus = new(CPlusPlus_ID, "CPlusPlus", typeof(CppGenerator), new[] { "cpp" }); + + public const string Emscripten_ID = "Emscripten"; + public static readonly GeneratorKind Emscripten = new(Emscripten_ID, "Emscripten", typeof(EmscriptenGenerator), new[] { "emscripten" }); + + public const string ObjectiveC_ID = "ObjectiveC"; + public static readonly GeneratorKind ObjectiveC = new(ObjectiveC_ID, "ObjectiveC", typeof(NotImplementedGenerator)); + + public const string Java_ID = "Java"; + public static readonly GeneratorKind Java = new(Java_ID, "Java", typeof(NotImplementedGenerator)); + + public const string Swift_ID = "Swift"; + public static readonly GeneratorKind Swift = new(Swift_ID, "Swift", typeof(NotImplementedGenerator)); + + public const string QuickJS_ID = "QuickJS"; + public static readonly GeneratorKind QuickJS = new(QuickJS_ID, "QuickJS", typeof(QuickJSGenerator), new[] { "qjs" }); + + public const string NAPI_ID = "NAPI"; + public static readonly GeneratorKind NAPI = new(NAPI_ID, "N-API", typeof(NAPIGenerator), new[] { "napi" }); + + public const string TypeScript_ID = "TypeScript"; + public static readonly GeneratorKind TypeScript = new(TypeScript_ID, "TypeScript", typeof(TSGenerator), new[] { "ts", "typescript" }); + } + + public class NotImplementedGenerator : Generator + { + public NotImplementedGenerator(BindingContext context) : base(context) + { + throw new NotImplementedException(); + } + + public override List Generate(IEnumerable units) + { + throw new NotImplementedException(); + } + + public override bool SetupPasses() + { + throw new NotImplementedException(); + } + + protected override string TypePrinterDelegate(CppSharp.AST.Type type) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/Generator/Generators/ExtensionMethods.cs b/src/Generator/Generators/ExtensionMethods.cs index eb4d621a8..ee4b1054d 100644 --- a/src/Generator/Generators/ExtensionMethods.cs +++ b/src/Generator/Generators/ExtensionMethods.cs @@ -65,9 +65,9 @@ public static Type GetMappedType(this Type type, TypeMapDatabase typeMaps, switch (generatorKind) { - case GeneratorKind.CLI: + case var _ when ReferenceEquals(generatorKind, GeneratorKind.CLI): return typeMap.CLISignatureType(typePrinterContext).Desugar(); - case GeneratorKind.CSharp: + case var _ when ReferenceEquals(generatorKind, GeneratorKind.CSharp): return typeMap.CSharpSignatureType(typePrinterContext).Desugar(); } } diff --git a/src/Generator/Passes/CheckDuplicatedNamesPass.cs b/src/Generator/Passes/CheckDuplicatedNamesPass.cs index 0a2d7622a..0a520be28 100644 --- a/src/Generator/Passes/CheckDuplicatedNamesPass.cs +++ b/src/Generator/Passes/CheckDuplicatedNamesPass.cs @@ -202,22 +202,22 @@ private TypePrinter GetTypePrinter(GeneratorKind kind, BindingContext context) TypePrinter typePrinter; switch (kind) { - case GeneratorKind.C: + case var _ when ReferenceEquals(kind, GeneratorKind.C): typePrinter = new CppTypePrinter(Context) { PrintFlavorKind = CppTypePrintFlavorKind.C }; break; - case GeneratorKind.Emscripten: + case var _ when ReferenceEquals(kind, GeneratorKind.Emscripten): typePrinter = new EmscriptenTypePrinter(Context); break;; - case GeneratorKind.CPlusPlus: - case GeneratorKind.QuickJS: - case GeneratorKind.NAPI: - case GeneratorKind.TypeScript: + case var _ when ReferenceEquals(kind, GeneratorKind.CPlusPlus): + case var _ when ReferenceEquals(kind, GeneratorKind.QuickJS): + case var _ when ReferenceEquals(kind, GeneratorKind.NAPI): + case var _ when ReferenceEquals(kind, GeneratorKind.TypeScript): typePrinter = new CppTypePrinter(Context); break; - case GeneratorKind.CLI: + case var _ when ReferenceEquals(kind, GeneratorKind.CLI): typePrinter = new CLITypePrinter(Context); break; - case GeneratorKind.CSharp: + case var _ when ReferenceEquals(kind, GeneratorKind.CSharp): typePrinter = new CSharpTypePrinter(Context); break; default: diff --git a/src/Generator/Passes/ValidateOperatorsPass.cs b/src/Generator/Passes/ValidateOperatorsPass.cs index b1f86db1e..49fe8d017 100644 --- a/src/Generator/Passes/ValidateOperatorsPass.cs +++ b/src/Generator/Passes/ValidateOperatorsPass.cs @@ -83,11 +83,12 @@ private bool IsValidOperatorOverload(Method @operator) { Parameter parameter = @operator.Parameters.Last(); Type type = parameter.Type.Desugar(); - switch (Options.GeneratorKind) + var kind = Options.GeneratorKind; + switch (kind) { - case GeneratorKind.CLI: + case var _ when ReferenceEquals(kind, GeneratorKind.CLI): return type.IsPrimitiveType(PrimitiveType.Int); - case GeneratorKind.CSharp: + case var _ when ReferenceEquals(kind, GeneratorKind.CSharp): Types.TypeMap typeMap; if (Context.TypeMaps.FindTypeMap(type, out typeMap)) { diff --git a/src/Generator/Types/DeclMap.cs b/src/Generator/Types/DeclMap.cs index 5028466ca..d1e9b63f9 100644 --- a/src/Generator/Types/DeclMap.cs +++ b/src/Generator/Types/DeclMap.cs @@ -35,7 +35,7 @@ public class DeclMapAttribute : Attribute { public GeneratorKind GeneratorKind { get; set; } - public DeclMapAttribute() : this(0) + public DeclMapAttribute() { } diff --git a/src/Generator/Types/DeclMapDatabase.cs b/src/Generator/Types/DeclMapDatabase.cs index 7cb891c3a..2bdc7b090 100644 --- a/src/Generator/Types/DeclMapDatabase.cs +++ b/src/Generator/Types/DeclMapDatabase.cs @@ -41,7 +41,7 @@ private void SetupDeclMaps(IEnumerable types, var attrs = type.GetCustomAttributes(typeof(DeclMapAttribute), true); foreach (DeclMapAttribute attr in attrs) { - if (attr.GeneratorKind == 0 || + if (attr.GeneratorKind == null || attr.GeneratorKind == bindingContext.Options.GeneratorKind) { var declMap = (DeclMap)Activator.CreateInstance(type); diff --git a/src/Generator/Types/Std/Stdlib.CLI.cs b/src/Generator/Types/Std/Stdlib.CLI.cs index d067c9581..8db2058f9 100644 --- a/src/Generator/Types/Std/Stdlib.CLI.cs +++ b/src/Generator/Types/Std/Stdlib.CLI.cs @@ -9,7 +9,7 @@ namespace CppSharp.Types.Std { - [TypeMap("const char*", GeneratorKind = GeneratorKind.CLI)] + [TypeMap("const char*", GeneratorKindID = GeneratorKind.CLI_ID)] public partial class ConstCharPointer : TypeMap { public override Type CLISignatureType(TypePrinterContext ctx) @@ -62,27 +62,27 @@ public override void CLIMarshalToManaged(MarshalContext ctx) } } - [TypeMap("const char[]", GeneratorKind = GeneratorKind.CLI)] + [TypeMap("const char[]", GeneratorKindID = GeneratorKind.CLI_ID)] public partial class ConstCharArray : ConstCharPointer { } - [TypeMap("const wchar_t*", GeneratorKind = GeneratorKind.CLI)] + [TypeMap("const wchar_t*", GeneratorKindID = GeneratorKind.CLI_ID)] public partial class ConstWCharTPointer : ConstCharPointer { } - [TypeMap("const char16_t*", GeneratorKind = GeneratorKind.CLI)] + [TypeMap("const char16_t*", GeneratorKindID = GeneratorKind.CLI_ID)] public partial class ConstChar16TPointer : ConstCharPointer { } - [TypeMap("const char32_t*", GeneratorKind = GeneratorKind.CLI)] + [TypeMap("const char32_t*", GeneratorKindID = GeneratorKind.CLI_ID)] public partial class ConstChar32TPointer : ConstCharPointer { } - [TypeMap("basic_string, allocator>", GeneratorKind = GeneratorKind.CLI)] + [TypeMap("basic_string, allocator>", GeneratorKindID = GeneratorKind.CLI_ID)] public partial class String : TypeMap { public override Type CLISignatureType(TypePrinterContext ctx) @@ -103,7 +103,7 @@ public override void CLIMarshalToManaged(MarshalContext ctx) } } - [TypeMap("std::wstring", GeneratorKind = GeneratorKind.CLI)] + [TypeMap("std::wstring", GeneratorKindID = GeneratorKind.CLI_ID)] public partial class WString : TypeMap { public override Type CLISignatureType(TypePrinterContext ctx) @@ -124,7 +124,7 @@ public override void CLIMarshalToManaged(MarshalContext ctx) } } - [TypeMap("std::vector", GeneratorKind = GeneratorKind.CLI)] + [TypeMap("std::vector", GeneratorKindID = GeneratorKind.CLI_ID)] public partial class Vector : TypeMap { public override bool IsIgnored @@ -258,7 +258,7 @@ public override void CLIMarshalToManaged(MarshalContext ctx) } } - [TypeMap("std::map", GeneratorKind = GeneratorKind.CLI)] + [TypeMap("std::map", GeneratorKindID = GeneratorKind.CLI_ID)] public partial class Map : TypeMap { public override bool IsIgnored { get { return true; } } @@ -293,19 +293,19 @@ public override Type CSharpSignatureType(TypePrinterContext ctx) } } - [TypeMap("std::list", GeneratorKind = GeneratorKind.CLI)] + [TypeMap("std::list", GeneratorKindID = GeneratorKind.CLI_ID)] public partial class List : TypeMap { public override bool IsIgnored { get { return true; } } } - [TypeMap("std::shared_ptr", GeneratorKind = GeneratorKind.CLI)] + [TypeMap("std::shared_ptr", GeneratorKindID = GeneratorKind.CLI_ID)] public partial class SharedPtr : TypeMap { public override bool IsIgnored { get { return true; } } } - [TypeMap("basic_ostream>", GeneratorKind.CLI)] + [TypeMap("basic_ostream>", GeneratorKind.CLI_ID)] public partial class OStream : TypeMap { public override Type CLISignatureType(TypePrinterContext ctx) @@ -325,7 +325,7 @@ public override void CLIMarshalToNative(MarshalContext ctx) } } - [TypeMap("std::nullptr_t", GeneratorKind = GeneratorKind.CLI)] + [TypeMap("std::nullptr_t", GeneratorKindID = GeneratorKind.CLI_ID)] public partial class NullPtr : TypeMap { public override bool DoesMarshalling { get { return false; } } diff --git a/src/Generator/Types/Std/Stdlib.CSharp.cs b/src/Generator/Types/Std/Stdlib.CSharp.cs index e394c40c4..a3c3d6d5a 100644 --- a/src/Generator/Types/Std/Stdlib.CSharp.cs +++ b/src/Generator/Types/Std/Stdlib.CSharp.cs @@ -11,35 +11,35 @@ namespace CppSharp.Types.Std { - [TypeMap("int", GeneratorKind = GeneratorKind.CSharp)] + [TypeMap("int", GeneratorKindID = GeneratorKind.CSharp_ID)] public partial class Int : TypeMap { public override Type CSharpSignatureType(TypePrinterContext ctx) => CSharpTypePrinter.GetSignedType(Context.TargetInfo.IntWidth); } - [TypeMap("unsigned int", GeneratorKind = GeneratorKind.CSharp)] + [TypeMap("unsigned int", GeneratorKindID = GeneratorKind.CSharp_ID)] public partial class UnsignedInt : TypeMap { public override Type CSharpSignatureType(TypePrinterContext ctx) => CSharpTypePrinter.GetUnsignedType(Context.TargetInfo.IntWidth); } - [TypeMap("long", GeneratorKind = GeneratorKind.CSharp)] + [TypeMap("long", GeneratorKindID = GeneratorKind.CSharp_ID)] public partial class Long : TypeMap { public override Type CSharpSignatureType(TypePrinterContext ctx) => CSharpTypePrinter.GetSignedType(Context.TargetInfo.LongWidth); } - [TypeMap("unsigned long", GeneratorKind = GeneratorKind.CSharp)] + [TypeMap("unsigned long", GeneratorKindID = GeneratorKind.CSharp_ID)] public partial class UnsignedLong : TypeMap { public override Type CSharpSignatureType(TypePrinterContext ctx) => CSharpTypePrinter.GetUnsignedType(Context.TargetInfo.LongWidth); } - [TypeMap("char", GeneratorKind = GeneratorKind.CSharp)] + [TypeMap("char", GeneratorKindID = GeneratorKind.CSharp_ID)] public partial class Char : TypeMap { public override Type CSharpSignatureType(TypePrinterContext ctx) @@ -67,7 +67,7 @@ public override void CSharpMarshalToManaged(CSharpMarshalContext ctx) } } - [TypeMap("char16_t", GeneratorKind = GeneratorKind.CSharp)] + [TypeMap("char16_t", GeneratorKindID = GeneratorKind.CSharp_ID)] public partial class Char16T : TypeMap { public override Type CSharpSignatureType(TypePrinterContext ctx) @@ -76,7 +76,7 @@ public override Type CSharpSignatureType(TypePrinterContext ctx) } } - [TypeMap("wchar_t", GeneratorKind = GeneratorKind.CSharp)] + [TypeMap("wchar_t", GeneratorKindID = GeneratorKind.CSharp_ID)] public partial class WCharT : TypeMap { public override Type CSharpSignatureType(TypePrinterContext ctx) @@ -85,7 +85,7 @@ public override Type CSharpSignatureType(TypePrinterContext ctx) } } - [TypeMap("const char*", GeneratorKind = GeneratorKind.CSharp)] + [TypeMap("const char*", GeneratorKindID = GeneratorKind.CSharp_ID)] public partial class ConstCharPointer : TypeMap { public override Type CSharpSignatureType(TypePrinterContext ctx) @@ -281,27 +281,27 @@ public uint GetCharPtrWidth(PointerType pointer) } } - [TypeMap("const char[]", GeneratorKind = GeneratorKind.CSharp)] + [TypeMap("const char[]", GeneratorKindID = GeneratorKind.CSharp_ID)] public partial class ConstCharArray : ConstCharPointer { } - [TypeMap("const wchar_t*", GeneratorKind = GeneratorKind.CSharp)] + [TypeMap("const wchar_t*", GeneratorKindID = GeneratorKind.CSharp_ID)] public partial class ConstWCharTPointer : ConstCharPointer { } - [TypeMap("const char16_t*", GeneratorKind = GeneratorKind.CSharp)] + [TypeMap("const char16_t*", GeneratorKindID = GeneratorKind.CSharp_ID)] public partial class ConstChar16TPointer : ConstCharPointer { } - [TypeMap("const char32_t*", GeneratorKind = GeneratorKind.CSharp)] + [TypeMap("const char32_t*", GeneratorKindID = GeneratorKind.CSharp_ID)] public partial class ConstChar32TPointer : ConstCharPointer { } - [TypeMap("basic_string, allocator>", GeneratorKind = GeneratorKind.CSharp)] + [TypeMap("basic_string, allocator>", GeneratorKindID = GeneratorKind.CSharp_ID)] public partial class String : TypeMap { public override Type CSharpSignatureType(TypePrinterContext ctx) @@ -420,7 +420,7 @@ private static ClassTemplateSpecialization GetBasicString(Type type) } } - [TypeMap("FILE", GeneratorKind = GeneratorKind.CSharp)] + [TypeMap("FILE", GeneratorKindID = GeneratorKind.CSharp_ID)] public partial class FILE : TypeMap { public override Type CSharpSignatureType(TypePrinterContext ctx) diff --git a/src/Generator/Types/TypeIgnoreChecker.cs b/src/Generator/Types/TypeIgnoreChecker.cs index f06612c7d..707a16774 100644 --- a/src/Generator/Types/TypeIgnoreChecker.cs +++ b/src/Generator/Types/TypeIgnoreChecker.cs @@ -13,14 +13,17 @@ public class TypeIgnoreChecker : AstVisitor ITypeMapDatabase TypeMapDatabase { get; } public bool IsIgnored; - public TypeIgnoreChecker(ITypeMapDatabase database, - GeneratorKind generatorKind = GeneratorKind.CSharp) + public TypeIgnoreChecker(ITypeMapDatabase database, GeneratorKind generatorKind) { TypeMapDatabase = database; VisitOptions.ClearFlags(VisitFlags.ClassBases | VisitFlags.TemplateArguments); this.generatorKind = generatorKind; } + public TypeIgnoreChecker(ITypeMapDatabase database) : this(database, GeneratorKind.CSharp) + { + } + void Ignore() { IsIgnored = true; diff --git a/src/Generator/Types/TypeMap.cs b/src/Generator/Types/TypeMap.cs index 54d5cfa4b..e7060192a 100644 --- a/src/Generator/Types/TypeMap.cs +++ b/src/Generator/Types/TypeMap.cs @@ -15,17 +15,17 @@ namespace CppSharp.Types public class TypeMapAttribute : Attribute { public string Type { get; } - public GeneratorKind GeneratorKind { get; set; } + public string GeneratorKindID { get; set; } - public TypeMapAttribute(string type) : this(type, 0) + public TypeMapAttribute(string type) : this(type, null) { Type = type; } - public TypeMapAttribute(string type, GeneratorKind generatorKind) + public TypeMapAttribute(string type, string generatorKindID) { Type = type; - GeneratorKind = generatorKind; + GeneratorKindID = generatorKindID; } } @@ -55,12 +55,12 @@ public virtual Type SignatureType(GeneratorKind kind, TypePrinterContext ctx) { switch (kind) { - case GeneratorKind.C: - case GeneratorKind.CPlusPlus: + case var _ when ReferenceEquals(kind, GeneratorKind.C): + case var _ when ReferenceEquals(kind, GeneratorKind.CPlusPlus): return CppSignatureType(ctx); - case GeneratorKind.CLI: + case var _ when ReferenceEquals(kind, GeneratorKind.CLI): return CLISignatureType(ctx); - case GeneratorKind.CSharp: + case var _ when ReferenceEquals(kind, GeneratorKind.CSharp): return CSharpSignatureType(ctx); default: throw new System.NotImplementedException(); @@ -71,14 +71,14 @@ public virtual void MarshalToNative(GeneratorKind kind, MarshalContext ctx) { switch (kind) { - case GeneratorKind.C: - case GeneratorKind.CPlusPlus: + case var _ when ReferenceEquals(kind, GeneratorKind.C): + case var _ when ReferenceEquals(kind, GeneratorKind.CPlusPlus): CppMarshalToNative(ctx); return; - case GeneratorKind.CLI: + case var _ when ReferenceEquals(kind, GeneratorKind.CLI): CLIMarshalToNative(ctx); return; - case GeneratorKind.CSharp: + case var _ when ReferenceEquals(kind, GeneratorKind.CSharp): CSharpMarshalToNative(ctx as CSharpMarshalContext); return; default: @@ -90,14 +90,14 @@ public virtual void MarshalToManaged(GeneratorKind kind, MarshalContext ctx) { switch (kind) { - case GeneratorKind.C: - case GeneratorKind.CPlusPlus: + case var _ when ReferenceEquals(kind, GeneratorKind.C): + case var _ when ReferenceEquals(kind, GeneratorKind.CPlusPlus): CppMarshalToManaged(ctx); return; - case GeneratorKind.CLI: + case var _ when ReferenceEquals(kind, GeneratorKind.CLI): CLIMarshalToManaged(ctx); return; - case GeneratorKind.CSharp: + case var _ when ReferenceEquals(kind, GeneratorKind.CSharp): CSharpMarshalToManaged(ctx as CSharpMarshalContext); return; default: diff --git a/src/Generator/Types/TypeMapDatabase.cs b/src/Generator/Types/TypeMapDatabase.cs index fef279abf..96711ae69 100644 --- a/src/Generator/Types/TypeMapDatabase.cs +++ b/src/Generator/Types/TypeMapDatabase.cs @@ -40,8 +40,8 @@ private void SetupTypeMaps(IEnumerable types, var attrs = type.GetCustomAttributes(typeof(TypeMapAttribute), true); foreach (TypeMapAttribute attr in attrs) { - if (attr.GeneratorKind == 0 || - attr.GeneratorKind == bindingContext.Options.GeneratorKind) + if (string.IsNullOrEmpty(attr.GeneratorKindID) || + attr.GeneratorKindID == bindingContext.Options.GeneratorKind.ID) { var typeMap = (TypeMap)Activator.CreateInstance(type); typeMap.Context = bindingContext; From 8c2da6d542d30b7bae588f3c112d0cf9e2079d6d Mon Sep 17 00:00:00 2001 From: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Mon, 13 Nov 2023 22:00:41 +0200 Subject: [PATCH 20/37] Major refactor: TypePrinter: improve modular design + cleanup (#1796) --- src/Generator/Generator.cs | 8 ++- src/Generator/GeneratorKind.cs | 49 +++++++++++-------- src/Generator/Generators/C/CGenerator.cs | 8 --- src/Generator/Generators/C/CppGenerator.cs | 8 --- src/Generator/Generators/C/CppTypePrinter.cs | 7 +-- src/Generator/Generators/CLI/CLIGenerator.cs | 8 --- .../Generators/CSharp/CSharpGenerator.cs | 10 +--- .../Generators/CSharp/CSharpTypePrinter.cs | 7 +-- src/Generator/Generators/Marshal.cs | 10 ++-- .../Generators/NAPI/NAPITypePrinter.cs | 11 +++++ src/Generator/Generators/TS/TSGenerator.cs | 8 --- src/Generator/Generators/TypePrinter.cs | 3 +- .../Passes/CheckDuplicatedNamesPass.cs | 37 +------------- 13 files changed, 58 insertions(+), 116 deletions(-) create mode 100644 src/Generator/Generators/NAPI/NAPITypePrinter.cs diff --git a/src/Generator/Generator.cs b/src/Generator/Generator.cs index 1593a8550..42a8ba69a 100644 --- a/src/Generator/Generator.cs +++ b/src/Generator/Generator.cs @@ -28,9 +28,12 @@ public abstract class Generator : IDisposable { public BindingContext Context { get; } + protected readonly TypePrinter typePrinter; + protected Generator(BindingContext context) { Context = context; + typePrinter = Context.Options.GeneratorKind.CreateTypePrinter(context); CppSharp.AST.Type.TypePrinterDelegate += TypePrinterDelegate; } @@ -155,7 +158,10 @@ public virtual GeneratorOutput GenerateModule(Module module) return output; } - protected abstract string TypePrinterDelegate(CppSharp.AST.Type type); + protected virtual string TypePrinterDelegate(CppSharp.AST.Type type) + { + return type.Visit(typePrinter); + } public static string GeneratedIdentifier(string id) => $"__{(id.StartsWith("@") ? id.Substring(1) : id)}"; diff --git a/src/Generator/GeneratorKind.cs b/src/Generator/GeneratorKind.cs index 222420404..9307452f5 100644 --- a/src/Generator/GeneratorKind.cs +++ b/src/Generator/GeneratorKind.cs @@ -20,10 +20,11 @@ public class GeneratorKind : IEquatable public string ID { get; } public string Name { get; } - public System.Type Type { get; } + public System.Type GeneratorType { get; } + public System.Type TypePrinterType { get; } public string[] CLIOptions { get; } - public GeneratorKind(string id, string name, System.Type type, string[] cLIOptions = null) + public GeneratorKind(string id, string name, System.Type generatorType, System.Type typePrinterType, string[] cLIOptions = null) { if (Registered.Any(kind => kind.ID == id)) { @@ -31,14 +32,20 @@ public GeneratorKind(string id, string name, System.Type type, string[] cLIOptio } ID = id; Name = name; - Type = type; + GeneratorType = generatorType; + TypePrinterType = typePrinterType; CLIOptions = cLIOptions; Registered.Add(this); } public Generator CreateGenerator(BindingContext context) { - return (Generator)Activator.CreateInstance(Type, context); + return (Generator)Activator.CreateInstance(GeneratorType, context); + } + + public TypePrinter CreateTypePrinter(BindingContext context) + { + return (TypePrinter)Activator.CreateInstance(TypePrinterType, context); } public bool IsCLIOptionMatch(string cliOption) @@ -93,37 +100,44 @@ public override int GetHashCode() } public const string CLI_ID = "CLI"; - public static readonly GeneratorKind CLI = new(CLI_ID, "C++/CLI", typeof(CLIGenerator), new[] { "cli" }); + public static readonly GeneratorKind CLI = new(CLI_ID, "C++/CLI", typeof(CLIGenerator), typeof(CLITypePrinter), new[] { "cli" }); public const string CSharp_ID = "CSharp"; - public static readonly GeneratorKind CSharp = new(CSharp_ID, "C#", typeof(CSharpGenerator), new[] { "csharp" }); + public static readonly GeneratorKind CSharp = new(CSharp_ID, "C#", typeof(CSharpGenerator), typeof(CSharpTypePrinter), new[] { "csharp" }); public const string C_ID = "C"; - public static readonly GeneratorKind C = new(C_ID, "C", typeof(CGenerator), new[] { "c" }); + public static readonly GeneratorKind C = new(C_ID, "C", typeof(CGenerator), typeof(CppTypePrinter), new[] { "c" }); public const string CPlusPlus_ID = "CPlusPlus"; - public static readonly GeneratorKind CPlusPlus = new(CPlusPlus_ID, "CPlusPlus", typeof(CppGenerator), new[] { "cpp" }); + public static readonly GeneratorKind CPlusPlus = new(CPlusPlus_ID, "CPlusPlus", typeof(CppGenerator), typeof(CppTypePrinter), new[] { "cpp" }); public const string Emscripten_ID = "Emscripten"; - public static readonly GeneratorKind Emscripten = new(Emscripten_ID, "Emscripten", typeof(EmscriptenGenerator), new[] { "emscripten" }); + public static readonly GeneratorKind Emscripten = new(Emscripten_ID, "Emscripten", typeof(EmscriptenGenerator), typeof(EmscriptenTypePrinter), new[] { "emscripten" }); public const string ObjectiveC_ID = "ObjectiveC"; - public static readonly GeneratorKind ObjectiveC = new(ObjectiveC_ID, "ObjectiveC", typeof(NotImplementedGenerator)); + public static readonly GeneratorKind ObjectiveC = new(ObjectiveC_ID, "ObjectiveC", typeof(NotImplementedGenerator), typeof(NotImplementedTypePrinter)); public const string Java_ID = "Java"; - public static readonly GeneratorKind Java = new(Java_ID, "Java", typeof(NotImplementedGenerator)); + public static readonly GeneratorKind Java = new(Java_ID, "Java", typeof(NotImplementedGenerator), typeof(NotImplementedTypePrinter)); public const string Swift_ID = "Swift"; - public static readonly GeneratorKind Swift = new(Swift_ID, "Swift", typeof(NotImplementedGenerator)); + public static readonly GeneratorKind Swift = new(Swift_ID, "Swift", typeof(NotImplementedGenerator), typeof(NotImplementedTypePrinter)); public const string QuickJS_ID = "QuickJS"; - public static readonly GeneratorKind QuickJS = new(QuickJS_ID, "QuickJS", typeof(QuickJSGenerator), new[] { "qjs" }); + public static readonly GeneratorKind QuickJS = new(QuickJS_ID, "QuickJS", typeof(QuickJSGenerator), typeof(QuickJSTypePrinter), new[] { "qjs" }); public const string NAPI_ID = "NAPI"; - public static readonly GeneratorKind NAPI = new(NAPI_ID, "N-API", typeof(NAPIGenerator), new[] { "napi" }); + public static readonly GeneratorKind NAPI = new(NAPI_ID, "N-API", typeof(NAPIGenerator), typeof(NAPITypePrinter), new[] { "napi" }); public const string TypeScript_ID = "TypeScript"; - public static readonly GeneratorKind TypeScript = new(TypeScript_ID, "TypeScript", typeof(TSGenerator), new[] { "ts", "typescript" }); + public static readonly GeneratorKind TypeScript = new(TypeScript_ID, "TypeScript", typeof(TSGenerator), typeof(TSTypePrinter), new[] { "ts", "typescript" }); + } + + public class NotImplementedTypePrinter : TypePrinter + { + public NotImplementedTypePrinter(BindingContext context) : base(context) + { + } } public class NotImplementedGenerator : Generator @@ -142,10 +156,5 @@ public override bool SetupPasses() { throw new NotImplementedException(); } - - protected override string TypePrinterDelegate(CppSharp.AST.Type type) - { - throw new NotImplementedException(); - } } } diff --git a/src/Generator/Generators/C/CGenerator.cs b/src/Generator/Generators/C/CGenerator.cs index 60c1dc818..07884929c 100644 --- a/src/Generator/Generators/C/CGenerator.cs +++ b/src/Generator/Generators/C/CGenerator.cs @@ -10,11 +10,8 @@ namespace CppSharp.Generators.C /// public class CGenerator : Generator { - private readonly CppTypePrinter typePrinter; - public CGenerator(BindingContext context) : base(context) { - typePrinter = new CppTypePrinter(Context); } public override List Generate(IEnumerable units) @@ -31,10 +28,5 @@ public override List Generate(IEnumerable units) } public override bool SetupPasses() => true; - - protected override string TypePrinterDelegate(Type type) - { - return type.Visit(typePrinter).ToString(); - } } } diff --git a/src/Generator/Generators/C/CppGenerator.cs b/src/Generator/Generators/C/CppGenerator.cs index 73a2aa8dc..f02de85fb 100644 --- a/src/Generator/Generators/C/CppGenerator.cs +++ b/src/Generator/Generators/C/CppGenerator.cs @@ -11,11 +11,8 @@ namespace CppSharp.Generators.Cpp /// public class CppGenerator : CGenerator { - private readonly CppTypePrinter typePrinter; - public CppGenerator(BindingContext context) : base(context) { - typePrinter = new CppTypePrinter(Context); } public override List Generate(IEnumerable units) @@ -44,11 +41,6 @@ public static bool ShouldGenerateClassNativeInstanceField(Class @class) return @class.IsRefType && (!@class.HasBase || !@class.HasRefBase()); } - - protected override string TypePrinterDelegate(Type type) - { - return type.Visit(typePrinter).ToString(); - } } /// diff --git a/src/Generator/Generators/C/CppTypePrinter.cs b/src/Generator/Generators/C/CppTypePrinter.cs index f289705f7..edfcdcd91 100644 --- a/src/Generator/Generators/C/CppTypePrinter.cs +++ b/src/Generator/Generators/C/CppTypePrinter.cs @@ -28,18 +28,13 @@ public class CppTypePrinter : TypePrinter public TypePrintScopeKind MethodScopeKind = TypePrintScopeKind.Qualified; - public CppTypePrinter() : base(TypePrinterContextKind.Native) + public CppTypePrinter(BindingContext context) : base(context, TypePrinterContextKind.Native) { PrintFlavorKind = CppTypePrintFlavorKind.Cpp; PrintTypeQualifiers = true; PrintTypeModifiers = true; } - public CppTypePrinter(BindingContext context) : this() - { - Context = context; - } - public TypeMapDatabase TypeMapDatabase => Context.TypeMaps; public DriverOptions Options => Context.Options; diff --git a/src/Generator/Generators/CLI/CLIGenerator.cs b/src/Generator/Generators/CLI/CLIGenerator.cs index 716095ac7..b3f93eb82 100644 --- a/src/Generator/Generators/CLI/CLIGenerator.cs +++ b/src/Generator/Generators/CLI/CLIGenerator.cs @@ -10,11 +10,8 @@ namespace CppSharp.Generators.CLI /// public class CLIGenerator : Generator { - private readonly CppTypePrinter typePrinter; - public CLIGenerator(BindingContext context) : base(context) { - typePrinter = new CLITypePrinter(context); } public override List Generate(IEnumerable units) @@ -39,10 +36,5 @@ public static bool ShouldGenerateClassNativeField(Class @class) return @class.IsRefType && (!@class.NeedsBase || !@class.HasRefBase()); } - - protected override string TypePrinterDelegate(Type type) - { - return type.Visit(typePrinter).ToString(); - } } } \ No newline at end of file diff --git a/src/Generator/Generators/CSharp/CSharpGenerator.cs b/src/Generator/Generators/CSharp/CSharpGenerator.cs index 5d6da4749..611f3c6bd 100644 --- a/src/Generator/Generators/CSharp/CSharpGenerator.cs +++ b/src/Generator/Generators/CSharp/CSharpGenerator.cs @@ -7,18 +7,15 @@ namespace CppSharp.Generators.CSharp { public class CSharpGenerator : Generator { - private readonly CSharpTypePrinter typePrinter; - public CSharpGenerator(BindingContext context) : base(context) { - typePrinter = new CSharpTypePrinter(context); } public override List Generate(IEnumerable units) { var outputs = new List(); - var gen = new CSharpSources(Context, units) { TypePrinter = typePrinter }; + var gen = new CSharpSources(Context, units) { TypePrinter = (CSharpTypePrinter)typePrinter }; outputs.Add(gen); return outputs; @@ -42,10 +39,5 @@ public override bool SetupPasses() return true; } - - protected override string TypePrinterDelegate(Type type) - { - return type.Visit(typePrinter); - } } } diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index 854b4e543..1453adb1f 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -21,15 +21,10 @@ public class CSharpTypePrinter : TypePrinter public bool PrintModuleOutputNamespace = true; - public CSharpTypePrinter() + public CSharpTypePrinter(BindingContext context) : base(context) { } - public CSharpTypePrinter(BindingContext context) - { - Context = context; - } - public string QualifiedType(string name) { return IsGlobalQualifiedScope ? $"global::{name}" : name; diff --git a/src/Generator/Generators/Marshal.cs b/src/Generator/Generators/Marshal.cs index b1798fdbe..1dcd9dced 100644 --- a/src/Generator/Generators/Marshal.cs +++ b/src/Generator/Generators/Marshal.cs @@ -1,13 +1,13 @@ using CppSharp.AST; using CppSharp.Generators.C; +using System; namespace CppSharp.Generators { public class MarshalContext : TypePrinter { - public MarshalContext(BindingContext context, uint indentation) + public MarshalContext(BindingContext context, uint indentation) : base(context) { - Context = context; Before = new TextGenerator { CurrentIndentation = indentation }; Return = new TextGenerator { CurrentIndentation = indentation }; Cleanup = new TextGenerator { CurrentIndentation = indentation }; @@ -34,16 +34,16 @@ public MarshalContext(BindingContext context, uint indentation) public uint Indentation { get; } } - public abstract class MarshalPrinter : AstVisitor where C : MarshalContext where P : TypePrinter, new() + public abstract class MarshalPrinter : AstVisitor where C : MarshalContext where P : TypePrinter { public C Context { get; } protected MarshalPrinter(C ctx) { Context = ctx; - typePrinter.Context = ctx.Context; + typePrinter = (P)Activator.CreateInstance(typeof(P), ctx.Context); } - protected P typePrinter = new P(); + protected P typePrinter; } } diff --git a/src/Generator/Generators/NAPI/NAPITypePrinter.cs b/src/Generator/Generators/NAPI/NAPITypePrinter.cs new file mode 100644 index 000000000..55109863b --- /dev/null +++ b/src/Generator/Generators/NAPI/NAPITypePrinter.cs @@ -0,0 +1,11 @@ +using CppSharp.Generators.C; + +namespace CppSharp.Generators.C +{ + public class NAPITypePrinter : CppTypePrinter + { + public NAPITypePrinter(BindingContext context) : base(context) + { + } + } +} diff --git a/src/Generator/Generators/TS/TSGenerator.cs b/src/Generator/Generators/TS/TSGenerator.cs index fa4526716..b4e3402c4 100644 --- a/src/Generator/Generators/TS/TSGenerator.cs +++ b/src/Generator/Generators/TS/TSGenerator.cs @@ -11,11 +11,8 @@ namespace CppSharp.Generators.TS /// public class TSGenerator : CGenerator { - private readonly TSTypePrinter typePrinter; - public TSGenerator(BindingContext context) : base(context) { - typePrinter = new TSTypePrinter(Context); } public override List Generate(IEnumerable units) @@ -32,10 +29,5 @@ public override bool SetupPasses() { return true; } - - protected override string TypePrinterDelegate(Type type) - { - return type.Visit(typePrinter).ToString(); - } } } diff --git a/src/Generator/Generators/TypePrinter.cs b/src/Generator/Generators/TypePrinter.cs index 806a71921..136b74d30 100644 --- a/src/Generator/Generators/TypePrinter.cs +++ b/src/Generator/Generators/TypePrinter.cs @@ -64,8 +64,9 @@ public class TypePrinter : ITypePrinter, public TypePrintScopeKind ScopeKind => scopeKinds.Peek(); public bool IsGlobalQualifiedScope => ScopeKind == TypePrintScopeKind.GlobalQualified; - public TypePrinter(TypePrinterContextKind contextKind = TypePrinterContextKind.Managed) + public TypePrinter(BindingContext context, TypePrinterContextKind contextKind = TypePrinterContextKind.Managed) { + Context = context; contexts = new Stack(); marshalKinds = new Stack(); scopeKinds = new Stack(); diff --git a/src/Generator/Passes/CheckDuplicatedNamesPass.cs b/src/Generator/Passes/CheckDuplicatedNamesPass.cs index 0a520be28..13d4bc2f2 100644 --- a/src/Generator/Passes/CheckDuplicatedNamesPass.cs +++ b/src/Generator/Passes/CheckDuplicatedNamesPass.cs @@ -4,10 +4,6 @@ using CppSharp.AST; using CppSharp.AST.Extensions; using CppSharp.Generators; -using CppSharp.Generators.C; -using CppSharp.Generators.CLI; -using CppSharp.Generators.CSharp; -using CppSharp.Generators.Emscripten; using CppSharp.Types; namespace CppSharp.Passes @@ -190,43 +186,12 @@ public class CheckDuplicatedNamesPass : TranslationUnitPass public override bool VisitASTContext(ASTContext context) { - var typePrinter = GetTypePrinter(Options.GeneratorKind, Context); - DeclarationName.ParameterTypeComparer.TypePrinter = typePrinter; + DeclarationName.ParameterTypeComparer.TypePrinter = Options.GeneratorKind.CreateTypePrinter(Context); DeclarationName.ParameterTypeComparer.TypeMaps = Context.TypeMaps; DeclarationName.ParameterTypeComparer.GeneratorKind = Options.GeneratorKind; return base.VisitASTContext(context); } - private TypePrinter GetTypePrinter(GeneratorKind kind, BindingContext context) - { - TypePrinter typePrinter; - switch (kind) - { - case var _ when ReferenceEquals(kind, GeneratorKind.C): - typePrinter = new CppTypePrinter(Context) { PrintFlavorKind = CppTypePrintFlavorKind.C }; - break; - case var _ when ReferenceEquals(kind, GeneratorKind.Emscripten): - typePrinter = new EmscriptenTypePrinter(Context); - break;; - case var _ when ReferenceEquals(kind, GeneratorKind.CPlusPlus): - case var _ when ReferenceEquals(kind, GeneratorKind.QuickJS): - case var _ when ReferenceEquals(kind, GeneratorKind.NAPI): - case var _ when ReferenceEquals(kind, GeneratorKind.TypeScript): - typePrinter = new CppTypePrinter(Context); - break; - case var _ when ReferenceEquals(kind, GeneratorKind.CLI): - typePrinter = new CLITypePrinter(Context); - break; - case var _ when ReferenceEquals(kind, GeneratorKind.CSharp): - typePrinter = new CSharpTypePrinter(Context); - break; - default: - throw new System.NotImplementedException(); - } - - return typePrinter; - } - public override bool VisitProperty(Property decl) { if (!VisitDeclaration(decl)) From e068f2a14ab3bcb89525c3dce66e9d8c4376f3a2 Mon Sep 17 00:00:00 2001 From: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Thu, 7 Dec 2023 16:35:02 +0200 Subject: [PATCH 21/37] Typemap cleanup (#1802) * TypeMap: prepare refactoring into a modular design * TypeMap: refactor C++ backend into common methods * TypeMap: refactor CLI backend into common methods * CLI.Gen.cs: fix omitted typemap from previous commit * Common.Gen.cs: fixed silly modification while testing * GeneratorKind: add FindGeneratorKindByID method * TypeMapDatabase: heavy refactor: group typemaps by GeneratorKind * TypeMap: refactor CSharp backend into common methods + migration * TypeMap: cleanup patches from previous commits * TypeMapDatabase: fix passing GeneratorKind to FindTypeMap calls * Stdlib.CSharp.cs: move std::map typemap from Stdlib.CLI.cs * TypeMapDatabase: improve parameter name --- src/Generator/AST/Utils.cs | 2 +- src/Generator/GeneratorKind.cs | 5 + src/Generator/Generators/C/CppMarshal.cs | 14 +-- src/Generator/Generators/C/CppTypePrinter.cs | 2 +- src/Generator/Generators/CLI/CLIMarshal.cs | 14 +-- .../Generators/CLI/CLITypePrinter.cs | 8 +- .../Generators/CSharp/CSharpMarshal.cs | 4 +- .../Generators/CSharp/CSharpSources.cs | 2 +- .../Generators/CSharp/CSharpTypePrinter.cs | 20 ++-- src/Generator/Generators/ExtensionMethods.cs | 7 +- src/Generator/Generators/NAPI/NAPIMarshal.cs | 12 +- .../Generators/QuickJS/QuickJSMarshal.cs | 14 +-- src/Generator/Passes/ExpressionHelper.cs | 12 +- src/Generator/Passes/ValidateOperatorsPass.cs | 4 +- src/Generator/Types/Std/Stdlib.CLI.cs | 80 ++++++------- src/Generator/Types/Std/Stdlib.CSharp.cs | 98 ++++++++-------- src/Generator/Types/TypeMap.cs | 108 ++---------------- src/Generator/Types/TypeMapDatabase.cs | 75 +++++++----- tests/dotnet/CLI/CLI.Gen.cs | 65 ++++++----- tests/dotnet/CSharp/CSharp.Gen.cs | 36 +++--- tests/dotnet/Common/Common.Gen.cs | 62 +++++----- 21 files changed, 289 insertions(+), 355 deletions(-) diff --git a/src/Generator/AST/Utils.cs b/src/Generator/AST/Utils.cs index 9074614ac..e5a310704 100644 --- a/src/Generator/AST/Utils.cs +++ b/src/Generator/AST/Utils.cs @@ -207,7 +207,7 @@ public static bool IsMappedToPrimitive(ITypeMapDatabase typeMaps, Type type) return false; var typePrinterContext = new TypePrinterContext { Type = type }; - var mappedTo = typeMap.CSharpSignatureType(typePrinterContext); + var mappedTo = typeMap.SignatureType(typePrinterContext); mappedTo = mappedTo.Desugar(); mappedTo = (mappedTo.GetFinalPointee() ?? mappedTo).Desugar(); return (mappedTo.IsPrimitiveType() || diff --git a/src/Generator/GeneratorKind.cs b/src/Generator/GeneratorKind.cs index 9307452f5..200ed11e4 100644 --- a/src/Generator/GeneratorKind.cs +++ b/src/Generator/GeneratorKind.cs @@ -38,6 +38,11 @@ public GeneratorKind(string id, string name, System.Type generatorType, System.T Registered.Add(this); } + public static GeneratorKind FindGeneratorKindByID(string id) + { + return Registered.Where(kind => kind.ID == id).First(); + } + public Generator CreateGenerator(BindingContext context) { return (Generator)Activator.CreateInstance(GeneratorType, context); diff --git a/src/Generator/Generators/C/CppMarshal.cs b/src/Generator/Generators/C/CppMarshal.cs index e0425e9f1..d60a5d656 100644 --- a/src/Generator/Generators/C/CppMarshal.cs +++ b/src/Generator/Generators/C/CppMarshal.cs @@ -25,7 +25,7 @@ public override bool VisitType(Type type, TypeQualifiers quals) TypeMap typeMap; if (Context.Context.TypeMaps.FindTypeMap(type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.CppMarshalToManaged(Context); + typeMap.MarshalToManaged(Context); return false; } @@ -173,7 +173,7 @@ public override bool VisitTypedefType(TypedefType typedef, TypeQualifiers quals) typeMap.DoesMarshalling) { typeMap.Type = typedef; - typeMap.CppMarshalToManaged(Context); + typeMap.MarshalToManaged(Context); return typeMap.IsValueType; } @@ -193,7 +193,7 @@ public override bool VisitTemplateSpecializationType(TemplateSpecializationType if (Context.Context.TypeMaps.FindTypeMap(template, out typeMap) && typeMap.DoesMarshalling) { typeMap.Type = template; - typeMap.CppMarshalToManaged(Context); + typeMap.MarshalToManaged(Context); return true; } @@ -341,7 +341,7 @@ public override bool VisitType(Type type, TypeQualifiers quals) TypeMap typeMap; if (Context.Context.TypeMaps.FindTypeMap(type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.CppMarshalToNative(Context); + typeMap.MarshalToNative(Context); return false; } @@ -478,7 +478,7 @@ public override bool VisitTypedefType(TypedefType typedef, TypeQualifiers quals) if (Context.Context.TypeMaps.FindTypeMap(decl.Type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.CppMarshalToNative(Context); + typeMap.MarshalToNative(Context); return typeMap.IsValueType; } @@ -516,7 +516,7 @@ public override bool VisitTemplateSpecializationType(TemplateSpecializationType if (Context.Context.TypeMaps.FindTypeMap(template, out typeMap) && typeMap.DoesMarshalling) { typeMap.Type = template; - typeMap.CppMarshalToNative(Context); + typeMap.MarshalToNative(Context); return true; } @@ -563,7 +563,7 @@ private void MarshalRefClass(Class @class) if (Context.Context.TypeMaps.FindTypeMap(type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.CppMarshalToNative(Context); + typeMap.MarshalToNative(Context); return; } diff --git a/src/Generator/Generators/C/CppTypePrinter.cs b/src/Generator/Generators/C/CppTypePrinter.cs index edfcdcd91..a8ea5caf5 100644 --- a/src/Generator/Generators/C/CppTypePrinter.cs +++ b/src/Generator/Generators/C/CppTypePrinter.cs @@ -68,7 +68,7 @@ public virtual bool FindTypeMap(CppSharp.AST.Type type, out TypePrinterResult re typePrinter.PushContext(ContextKind); typePrinter.PushScope(ScopeKind); - var typeName = typeMap.CppSignatureType(typePrinterContext).Visit(typePrinter); + var typeName = typeMap.SignatureType(typePrinterContext).Visit(typePrinter); result = new TypePrinterResult(typeName) { TypeMap = typeMap }; return true; diff --git a/src/Generator/Generators/CLI/CLIMarshal.cs b/src/Generator/Generators/CLI/CLIMarshal.cs index c64165175..7e52b9bd2 100644 --- a/src/Generator/Generators/CLI/CLIMarshal.cs +++ b/src/Generator/Generators/CLI/CLIMarshal.cs @@ -22,7 +22,7 @@ public override bool VisitType(Type type, TypeQualifiers quals) TypeMap typeMap; if (Context.Context.TypeMaps.FindTypeMap(type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.CLIMarshalToManaged(Context); + typeMap.MarshalToManaged(Context); return false; } @@ -215,7 +215,7 @@ public override bool VisitTypedefType(TypedefType typedef, TypeQualifiers quals) typeMap.DoesMarshalling) { typeMap.Type = typedef; - typeMap.CLIMarshalToManaged(Context); + typeMap.MarshalToManaged(Context); return typeMap.IsValueType; } @@ -240,7 +240,7 @@ public override bool VisitTemplateSpecializationType(TemplateSpecializationType if (Context.Context.TypeMaps.FindTypeMap(template, out typeMap) && typeMap.DoesMarshalling) { typeMap.Type = template; - typeMap.CLIMarshalToManaged(Context); + typeMap.MarshalToManaged(Context); return true; } @@ -406,7 +406,7 @@ public override bool VisitType(Type type, TypeQualifiers quals) TypeMap typeMap; if (Context.Context.TypeMaps.FindTypeMap(type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.CLIMarshalToNative(Context); + typeMap.MarshalToNative(Context); return false; } @@ -605,7 +605,7 @@ public override bool VisitTypedefType(TypedefType typedef, TypeQualifiers quals) if (Context.Context.TypeMaps.FindTypeMap(decl.Type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.CLIMarshalToNative(Context); + typeMap.MarshalToNative(Context); return typeMap.IsValueType; } @@ -641,7 +641,7 @@ public override bool VisitTemplateSpecializationType(TemplateSpecializationType if (Context.Context.TypeMaps.FindTypeMap(template, out typeMap) && typeMap.DoesMarshalling) { typeMap.Type = template; - typeMap.CLIMarshalToNative(Context); + typeMap.MarshalToNative(Context); return true; } @@ -688,7 +688,7 @@ private void MarshalRefClass(Class @class) if (Context.Context.TypeMaps.FindTypeMap(type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.CLIMarshalToNative(Context); + typeMap.MarshalToNative(Context); return; } diff --git a/src/Generator/Generators/CLI/CLITypePrinter.cs b/src/Generator/Generators/CLI/CLITypePrinter.cs index 783a44342..970130f5d 100644 --- a/src/Generator/Generators/CLI/CLITypePrinter.cs +++ b/src/Generator/Generators/CLI/CLITypePrinter.cs @@ -21,7 +21,7 @@ public override TypePrinterResult VisitTagType(TagType tag, TypeQualifiers quals if (TypeMapDatabase.FindTypeMap(tag, out typeMap)) { var typePrinterContext = new TypePrinterContext { Type = tag }; - return typeMap.CLISignatureType(typePrinterContext).ToString(); + return typeMap.SignatureType(typePrinterContext).ToString(); } Declaration decl = tag.Declaration; @@ -112,7 +112,7 @@ public override TypePrinterResult VisitPointerType(PointerType pointer, Type = pointer }; - return typeMap.CLISignatureType(typePrinterContext).Visit(this); + return typeMap.SignatureType(typePrinterContext).Visit(this); } var pointee = pointer.Pointee.Desugar(); @@ -217,7 +217,7 @@ public override TypePrinterResult VisitTypedefType(TypedefType typedef, { typeMap.Type = typedef; var typePrinterContext = new TypePrinterContext { Type = typedef }; - return typeMap.CLISignatureType(typePrinterContext).ToString(); + return typeMap.SignatureType(typePrinterContext).ToString(); } FunctionType func; @@ -241,7 +241,7 @@ public override TypePrinterResult VisitTemplateSpecializationType( if (TypeMapDatabase.FindTypeMap(template, out typeMap) && !typeMap.IsIgnored) { var typePrinterContext = new TypePrinterContext { Type = template }; - return typeMap.CLISignatureType(typePrinterContext).ToString(); + return typeMap.SignatureType(typePrinterContext).ToString(); } return decl.Name; diff --git a/src/Generator/Generators/CSharp/CSharpMarshal.cs b/src/Generator/Generators/CSharp/CSharpMarshal.cs index 09ced7d11..3dfbd1e83 100644 --- a/src/Generator/Generators/CSharp/CSharpMarshal.cs +++ b/src/Generator/Generators/CSharp/CSharpMarshal.cs @@ -45,7 +45,7 @@ public override bool VisitType(Type type, TypeQualifiers quals) TypeMap typeMap; if (Context.Context.TypeMaps.FindTypeMap(type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.CSharpMarshalToManaged(Context); + typeMap.MarshalToManaged(Context); return false; } @@ -471,7 +471,7 @@ public override bool VisitType(Type type, TypeQualifiers quals) TypeMap typeMap; if (Context.Context.TypeMaps.FindTypeMap(type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.CSharpMarshalToNative(Context); + typeMap.MarshalToNative(Context); return false; } diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index 8623ad3ce..d8152864f 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -3158,7 +3158,7 @@ public void GenerateFunctionCall(string functionName, Function function, Type = indirectRetType.Type.Desugar() }; - WriteLine("{0} {1};", typeMap.CSharpSignatureType(typePrinterContext), + WriteLine("{0} {1};", typeMap.SignatureType(typePrinterContext), Helpers.ReturnIdentifier); } else diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index 1453adb1f..9b1b85535 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -36,7 +36,7 @@ public override TypePrinterResult VisitTagType(TagType tag, TypeQualifiers quals return string.Empty; TypeMap typeMap; - if (TypeMapDatabase.FindTypeMap(tag, out typeMap)) + if (TypeMapDatabase.FindTypeMap(tag, GeneratorKind.CSharp, out typeMap)) { typeMap.Type = tag; @@ -47,7 +47,7 @@ public override TypePrinterResult VisitTagType(TagType tag, TypeQualifiers quals Type = tag }; - return typeMap.CSharpSignatureType(typePrinterContext).ToString(); + return typeMap.SignatureType(typePrinterContext).ToString(); } return base.VisitTagType(tag, quals); @@ -150,7 +150,7 @@ public override TypePrinterResult VisitArrayType(ArrayType array, public override TypePrinterResult VisitBuiltinType(BuiltinType builtin, TypeQualifiers quals) { TypeMap typeMap; - if (TypeMapDatabase.FindTypeMap(builtin, out typeMap)) + if (TypeMapDatabase.FindTypeMap(builtin, GeneratorKind.CSharp, out typeMap)) { var typePrinterContext = new TypePrinterContext() { @@ -159,7 +159,7 @@ public override TypePrinterResult VisitBuiltinType(BuiltinType builtin, TypeQual Type = builtin, Parameter = Parameter }; - return typeMap.CSharpSignatureType(typePrinterContext).Visit(this); + return typeMap.SignatureType(typePrinterContext).Visit(this); } return base.VisitBuiltinType(builtin, quals); } @@ -183,7 +183,7 @@ public override TypePrinterResult VisitPointerType(PointerType pointer, if (allowStrings && pointer.IsConstCharString()) { TypeMap typeMap; - TypeMapDatabase.FindTypeMap(pointer, out typeMap); + TypeMapDatabase.FindTypeMap(pointer, GeneratorKind.CSharp, out typeMap); var typePrinterContext = new TypePrinterContext() { Kind = ContextKind, @@ -191,7 +191,7 @@ public override TypePrinterResult VisitPointerType(PointerType pointer, Type = pointer.Pointee, Parameter = Parameter }; - return typeMap.CSharpSignatureType(typePrinterContext).Visit(this); + return typeMap.SignatureType(typePrinterContext).Visit(this); } var pointee = pointer.Pointee.Desugar(); @@ -258,7 +258,7 @@ public override TypePrinterResult VisitTypedefType(TypedefType typedef, var decl = typedef.Declaration; TypeMap typeMap; - if (TypeMapDatabase.FindTypeMap(typedef, out typeMap)) + if (TypeMapDatabase.FindTypeMap(typedef, GeneratorKind.CSharp, out typeMap)) { typeMap.Type = typedef; @@ -270,7 +270,7 @@ public override TypePrinterResult VisitTypedefType(TypedefType typedef, Parameter = Parameter }; - return typeMap.CSharpSignatureType(typePrinterContext).ToString(); + return typeMap.SignatureType(typePrinterContext).ToString(); } FunctionType func; @@ -299,7 +299,7 @@ public override TypePrinterResult VisitTemplateSpecializationType( template.Template.TemplatedDecl; TypeMap typeMap; - if (!TypeMapDatabase.FindTypeMap(template, out typeMap)) + if (!TypeMapDatabase.FindTypeMap(template, GeneratorKind.CSharp, out typeMap)) { if (ContextKind == TypePrinterContextKind.Managed && decl == template.Template.TemplatedDecl && @@ -330,7 +330,7 @@ public override TypePrinterResult VisitTemplateSpecializationType( MarshalKind = MarshalKind }; - return typeMap.CSharpSignatureType(typePrinterContext).ToString(); + return typeMap.SignatureType(typePrinterContext).ToString(); } public override TypePrinterResult VisitDependentTemplateSpecializationType( diff --git a/src/Generator/Generators/ExtensionMethods.cs b/src/Generator/Generators/ExtensionMethods.cs index ee4b1054d..c24a47038 100644 --- a/src/Generator/Generators/ExtensionMethods.cs +++ b/src/Generator/Generators/ExtensionMethods.cs @@ -63,12 +63,9 @@ public static Type GetMappedType(this Type type, TypeMapDatabase typeMaps, Type = typeMap.Type }; - switch (generatorKind) + if (generatorKind == GeneratorKind.CLI || generatorKind == GeneratorKind.CSharp) { - case var _ when ReferenceEquals(generatorKind, GeneratorKind.CLI): - return typeMap.CLISignatureType(typePrinterContext).Desugar(); - case var _ when ReferenceEquals(generatorKind, GeneratorKind.CSharp): - return typeMap.CSharpSignatureType(typePrinterContext).Desugar(); + return typeMap.SignatureType(typePrinterContext).Desugar(); } } diff --git a/src/Generator/Generators/NAPI/NAPIMarshal.cs b/src/Generator/Generators/NAPI/NAPIMarshal.cs index c0cf70082..3eb23b528 100644 --- a/src/Generator/Generators/NAPI/NAPIMarshal.cs +++ b/src/Generator/Generators/NAPI/NAPIMarshal.cs @@ -26,7 +26,7 @@ public override bool VisitType(Type type, TypeQualifiers quals) TypeMap typeMap; if (Context.Context.TypeMaps.FindTypeMap(type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.CppMarshalToManaged(Context); + typeMap.MarshalToManaged(Context); return false; } @@ -194,7 +194,7 @@ public override bool VisitTypedefType(TypedefType typedef, TypeQualifiers quals) typeMap.DoesMarshalling) { typeMap.Type = typedef; - typeMap.CppMarshalToManaged(Context); + typeMap.MarshalToManaged(Context); return typeMap.IsValueType; } @@ -214,7 +214,7 @@ public override bool VisitTemplateSpecializationType(TemplateSpecializationType if (Context.Context.TypeMaps.FindTypeMap(template, out typeMap) && typeMap.DoesMarshalling) { typeMap.Type = template; - typeMap.CppMarshalToManaged(Context); + typeMap.MarshalToManaged(Context); return true; } @@ -343,7 +343,7 @@ public override bool VisitType(Type type, TypeQualifiers quals) TypeMap typeMap; if (Context.Context.TypeMaps.FindTypeMap(type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.CppMarshalToNative(Context); + typeMap.MarshalToNative(Context); return false; } @@ -591,7 +591,7 @@ public override bool VisitTypedefType(TypedefType typedef, TypeQualifiers quals) if (Context.Context.TypeMaps.FindTypeMap(decl.Type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.CppMarshalToNative(Context); + typeMap.MarshalToNative(Context); return typeMap.IsValueType; } @@ -628,7 +628,7 @@ public override bool VisitTemplateSpecializationType(TemplateSpecializationType if (Context.Context.TypeMaps.FindTypeMap(template, out typeMap) && typeMap.DoesMarshalling) { typeMap.Type = template; - typeMap.CppMarshalToNative(Context); + typeMap.MarshalToNative(Context); return true; } diff --git a/src/Generator/Generators/QuickJS/QuickJSMarshal.cs b/src/Generator/Generators/QuickJS/QuickJSMarshal.cs index 5de2ad048..4937192bf 100644 --- a/src/Generator/Generators/QuickJS/QuickJSMarshal.cs +++ b/src/Generator/Generators/QuickJS/QuickJSMarshal.cs @@ -25,7 +25,7 @@ public override bool VisitType(Type type, TypeQualifiers quals) TypeMap typeMap; if (Context.Context.TypeMaps.FindTypeMap(type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.MarshalToManaged(GeneratorKind.QuickJS, Context); + typeMap.MarshalToManaged(Context); return false; } @@ -210,7 +210,7 @@ public override bool VisitTypedefType(TypedefType typedef, TypeQualifiers quals) typeMap.DoesMarshalling) { typeMap.Type = typedef; - typeMap.MarshalToManaged(GeneratorKind.QuickJS, Context); + typeMap.MarshalToManaged(Context); return typeMap.IsValueType; } @@ -232,7 +232,7 @@ public override bool VisitTemplateSpecializationType(TemplateSpecializationType if (Context.Context.TypeMaps.FindTypeMap(template, out typeMap) && typeMap.DoesMarshalling) { typeMap.Type = template; - typeMap.MarshalToManaged(GeneratorKind.QuickJS, Context); + typeMap.MarshalToManaged(Context); return true; } @@ -385,7 +385,7 @@ public override bool VisitType(Type type, TypeQualifiers quals) TypeMap typeMap; if (Context.Context.TypeMaps.FindTypeMap(type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.MarshalToNative(GeneratorKind.QuickJS, Context); + typeMap.MarshalToNative(Context); return false; } @@ -583,7 +583,7 @@ public override bool VisitTypedefType(TypedefType typedef, TypeQualifiers quals) if (Context.Context.TypeMaps.FindTypeMap(decl.Type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.MarshalToNative(GeneratorKind.QuickJS, Context); + typeMap.MarshalToNative(Context); return typeMap.IsValueType; } @@ -625,7 +625,7 @@ public override bool VisitTemplateSpecializationType(TemplateSpecializationType if (Context.Context.TypeMaps.FindTypeMap(template, out typeMap) && typeMap.DoesMarshalling) { typeMap.Type = template; - typeMap.MarshalToNative(GeneratorKind.QuickJS, Context); + typeMap.MarshalToNative(Context); return true; } @@ -672,7 +672,7 @@ private void MarshalRefClass(Class @class) if (Context.Context.TypeMaps.FindTypeMap(type, out typeMap) && typeMap.DoesMarshalling) { - typeMap.MarshalToNative(GeneratorKind.QuickJS, Context); + typeMap.MarshalToNative(Context); return; } diff --git a/src/Generator/Passes/ExpressionHelper.cs b/src/Generator/Passes/ExpressionHelper.cs index 435dbcf65..be5e924d7 100644 --- a/src/Generator/Passes/ExpressionHelper.cs +++ b/src/Generator/Passes/ExpressionHelper.cs @@ -68,9 +68,9 @@ internal static class ExpressionHelper public static System.Type GetSystemType(BindingContext context, Type type) { - if (context.TypeMaps.FindTypeMap(type, out TypeMap typeMap)) + if (context.TypeMaps.FindTypeMap(type, GeneratorKind.CSharp, out TypeMap typeMap)) { - var cilType = typeMap.CSharpSignatureType(new TypePrinterContext { Type = type, Kind = TypePrinterContextKind.Managed }) as CILType; + var cilType = typeMap.SignatureType(new TypePrinterContext { Type = type, Kind = TypePrinterContextKind.Managed }) as CILType; if (cilType != null) return cilType.Type; } @@ -239,7 +239,7 @@ private static bool CheckForDefaultPointer(BindingContext context, Type desugare var typePrinterResult = type.Visit(typePrinter); TypeMap typeMap; - if (context.TypeMaps.FindTypeMap(type, out typeMap)) + if (context.TypeMaps.FindTypeMap(type, GeneratorKind.CSharp, out typeMap)) { var typePrinterContext = new TypePrinterContext() { @@ -248,7 +248,7 @@ private static bool CheckForDefaultPointer(BindingContext context, Type desugare Type = type }; - var typeInSignature = typeMap.CSharpSignatureType(typePrinterContext) + var typeInSignature = typeMap.SignatureType(typePrinterContext) .SkipPointerRefs().Desugar(); Enumeration @enum; @@ -413,7 +413,7 @@ private static bool CheckForChar(BindingContext context, Type desugared, ref str private static bool CheckForString(BindingContext context, Type desugared, ref string result) { - if (context.TypeMaps.FindTypeMap(desugared, out TypeMap typeMap)) + if (context.TypeMaps.FindTypeMap(desugared, GeneratorKind.CSharp, out TypeMap typeMap)) { var typePrinterContext = new TypePrinterContext() { @@ -422,7 +422,7 @@ private static bool CheckForString(BindingContext context, Type desugared, ref s Type = desugared }; - var typeInSignature = typeMap.CSharpSignatureType(typePrinterContext) + var typeInSignature = typeMap.SignatureType(typePrinterContext) .SkipPointerRefs().Desugar(); if (typeInSignature is CILType managed && managed.Type == typeof(string)) diff --git a/src/Generator/Passes/ValidateOperatorsPass.cs b/src/Generator/Passes/ValidateOperatorsPass.cs index 49fe8d017..690bb092a 100644 --- a/src/Generator/Passes/ValidateOperatorsPass.cs +++ b/src/Generator/Passes/ValidateOperatorsPass.cs @@ -90,9 +90,9 @@ private bool IsValidOperatorOverload(Method @operator) return type.IsPrimitiveType(PrimitiveType.Int); case var _ when ReferenceEquals(kind, GeneratorKind.CSharp): Types.TypeMap typeMap; - if (Context.TypeMaps.FindTypeMap(type, out typeMap)) + if (Context.TypeMaps.FindTypeMap(type, GeneratorKind.CSharp, out typeMap)) { - var mappedTo = typeMap.CSharpSignatureType( + var mappedTo = typeMap.SignatureType( new TypePrinterContext { Parameter = parameter, diff --git a/src/Generator/Types/Std/Stdlib.CLI.cs b/src/Generator/Types/Std/Stdlib.CLI.cs index 8db2058f9..2f12e5b41 100644 --- a/src/Generator/Types/Std/Stdlib.CLI.cs +++ b/src/Generator/Types/Std/Stdlib.CLI.cs @@ -5,19 +5,18 @@ using CppSharp.Generators.AST; using CppSharp.Generators.C; using CppSharp.Generators.CLI; -using CppSharp.Generators.CSharp; -namespace CppSharp.Types.Std +namespace CppSharp.Types.Std.CLI { [TypeMap("const char*", GeneratorKindID = GeneratorKind.CLI_ID)] - public partial class ConstCharPointer : TypeMap + public class ConstCharPointer : TypeMap { - public override Type CLISignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { return new CILType(typeof(string)); } - public override void CLIMarshalToNative(MarshalContext ctx) + public override void MarshalToNative(MarshalContext ctx) { ctx.Before.WriteLine( "auto _{0} = clix::marshalString({1});", @@ -26,7 +25,7 @@ public override void CLIMarshalToNative(MarshalContext ctx) ctx.Return.Write("_{0}.c_str()", ctx.ArgName); } - public override void CLIMarshalToManaged(MarshalContext ctx) + public override void MarshalToManaged(MarshalContext ctx) { if (ctx.Parameter != null && !ctx.Parameter.IsOut && !ctx.Parameter.IsInOut) @@ -57,46 +56,45 @@ public override void CLIMarshalToManaged(MarshalContext ctx) $"{Context.Options.Encoding.EncodingName} is not supported yet."); ctx.Return.Write( - $@"({ctx.ReturnVarName} == 0 ? nullptr : clix::marshalString({ctx.ReturnVarName}))"); + $@"({ctx.ReturnVarName} == 0 ? nullptr : clix::marshalString({ctx.ReturnVarName}))"); } } [TypeMap("const char[]", GeneratorKindID = GeneratorKind.CLI_ID)] - public partial class ConstCharArray : ConstCharPointer + public class ConstCharArray : ConstCharPointer { } [TypeMap("const wchar_t*", GeneratorKindID = GeneratorKind.CLI_ID)] - public partial class ConstWCharTPointer : ConstCharPointer + public class ConstWCharTPointer : ConstCharPointer { } [TypeMap("const char16_t*", GeneratorKindID = GeneratorKind.CLI_ID)] - public partial class ConstChar16TPointer : ConstCharPointer + public class ConstChar16TPointer : ConstCharPointer { } [TypeMap("const char32_t*", GeneratorKindID = GeneratorKind.CLI_ID)] - public partial class ConstChar32TPointer : ConstCharPointer + public class ConstChar32TPointer : ConstCharPointer { } [TypeMap("basic_string, allocator>", GeneratorKindID = GeneratorKind.CLI_ID)] - public partial class String : TypeMap + public class String : TypeMap { - public override Type CLISignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { return new CILType(typeof(string)); } - public override void CLIMarshalToNative(MarshalContext ctx) + public override void MarshalToNative(MarshalContext ctx) { ctx.Return.Write("clix::marshalString({0})", ctx.Parameter.Name); } - public override void CLIMarshalToManaged(MarshalContext ctx) + public override void MarshalToManaged(MarshalContext ctx) { ctx.Return.Write("clix::marshalString({0})", ctx.ReturnVarName); @@ -104,20 +102,20 @@ public override void CLIMarshalToManaged(MarshalContext ctx) } [TypeMap("std::wstring", GeneratorKindID = GeneratorKind.CLI_ID)] - public partial class WString : TypeMap + public class WString : TypeMap { - public override Type CLISignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { return new CILType(typeof(string)); } - public override void CLIMarshalToNative(MarshalContext ctx) + public override void MarshalToNative(MarshalContext ctx) { ctx.Return.Write("clix::marshalString({0})", ctx.Parameter.Name); } - public override void CLIMarshalToManaged(MarshalContext ctx) + public override void MarshalToManaged(MarshalContext ctx) { ctx.Return.Write("clix::marshalString({0})", ctx.ReturnVarName); @@ -125,7 +123,7 @@ public override void CLIMarshalToManaged(MarshalContext ctx) } [TypeMap("std::vector", GeneratorKindID = GeneratorKind.CLI_ID)] - public partial class Vector : TypeMap + public class Vector : TypeMap { public override bool IsIgnored { @@ -145,13 +143,13 @@ public override bool IsIgnored } } - public override Type CLISignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { return new CustomType( $"::System::Collections::Generic::List<{ctx.GetTemplateParameterList()}>^"); } - public override void CLIMarshalToNative(MarshalContext ctx) + public override void MarshalToNative(MarshalContext ctx) { var desugared = Type.Desugar(); var templateType = desugared as TemplateSpecializationType; @@ -209,7 +207,7 @@ public override void CLIMarshalToNative(MarshalContext ctx) ctx.Return.Write(tmpVarName); } - public override void CLIMarshalToManaged(MarshalContext ctx) + public override void MarshalToManaged(MarshalContext ctx) { var desugared = Type.Desugar(); var templateType = desugared as TemplateSpecializationType; @@ -259,61 +257,49 @@ public override void CLIMarshalToManaged(MarshalContext ctx) } [TypeMap("std::map", GeneratorKindID = GeneratorKind.CLI_ID)] - public partial class Map : TypeMap + public class Map : TypeMap { public override bool IsIgnored { get { return true; } } - public override Type CLISignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { var type = Type as TemplateSpecializationType; return new CustomType( - $@"::System::Collections::Generic::Dictionary<{ - type.Arguments[0].Type}, {type.Arguments[1].Type}>^"); + $@"::System::Collections::Generic::Dictionary<{type.Arguments[0].Type}, {type.Arguments[1].Type}>^"); } - public override void CLIMarshalToNative(MarshalContext ctx) + public override void MarshalToNative(MarshalContext ctx) { throw new System.NotImplementedException(); } - public override void CLIMarshalToManaged(MarshalContext ctx) + public override void MarshalToManaged(MarshalContext ctx) { throw new System.NotImplementedException(); } - - public override Type CSharpSignatureType(TypePrinterContext ctx) - { - if (ctx.Kind == TypePrinterContextKind.Native) - return new CustomType("Std.Map"); - - var type = Type as TemplateSpecializationType; - return new CustomType( - $@"System.Collections.Generic.Dictionary<{ - type.Arguments[0].Type}, {type.Arguments[1].Type}>"); - } } [TypeMap("std::list", GeneratorKindID = GeneratorKind.CLI_ID)] - public partial class List : TypeMap + public class List : TypeMap { public override bool IsIgnored { get { return true; } } } [TypeMap("std::shared_ptr", GeneratorKindID = GeneratorKind.CLI_ID)] - public partial class SharedPtr : TypeMap + public class SharedPtr : TypeMap { public override bool IsIgnored { get { return true; } } } [TypeMap("basic_ostream>", GeneratorKind.CLI_ID)] - public partial class OStream : TypeMap + public class OStream : TypeMap { - public override Type CLISignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { return new CILType(typeof(System.IO.TextWriter)); } - public override void CLIMarshalToNative(MarshalContext ctx) + public override void MarshalToNative(MarshalContext ctx) { var marshal = (CLIMarshalManagedToNativePrinter)ctx.MarshalToNative; if (!ctx.Parameter.Type.Desugar().IsPointer()) @@ -326,7 +312,7 @@ public override void CLIMarshalToNative(MarshalContext ctx) } [TypeMap("std::nullptr_t", GeneratorKindID = GeneratorKind.CLI_ID)] - public partial class NullPtr : TypeMap + public class NullPtr : TypeMap { public override bool DoesMarshalling { get { return false; } } diff --git a/src/Generator/Types/Std/Stdlib.CSharp.cs b/src/Generator/Types/Std/Stdlib.CSharp.cs index a3c3d6d5a..a4198bcd1 100644 --- a/src/Generator/Types/Std/Stdlib.CSharp.cs +++ b/src/Generator/Types/Std/Stdlib.CSharp.cs @@ -9,46 +9,46 @@ using CppSharp.Generators.CSharp; using Type = CppSharp.AST.Type; -namespace CppSharp.Types.Std +namespace CppSharp.Types.Std.CSharp { [TypeMap("int", GeneratorKindID = GeneratorKind.CSharp_ID)] - public partial class Int : TypeMap + public class Int : TypeMap { - public override Type CSharpSignatureType(TypePrinterContext ctx) => + public override Type SignatureType(TypePrinterContext ctx) => CSharpTypePrinter.GetSignedType(Context.TargetInfo.IntWidth); } [TypeMap("unsigned int", GeneratorKindID = GeneratorKind.CSharp_ID)] - public partial class UnsignedInt : TypeMap + public class UnsignedInt : TypeMap { - public override Type CSharpSignatureType(TypePrinterContext ctx) => + public override Type SignatureType(TypePrinterContext ctx) => CSharpTypePrinter.GetUnsignedType(Context.TargetInfo.IntWidth); } [TypeMap("long", GeneratorKindID = GeneratorKind.CSharp_ID)] - public partial class Long : TypeMap + public class Long : TypeMap { - public override Type CSharpSignatureType(TypePrinterContext ctx) => + public override Type SignatureType(TypePrinterContext ctx) => CSharpTypePrinter.GetSignedType(Context.TargetInfo.LongWidth); } [TypeMap("unsigned long", GeneratorKindID = GeneratorKind.CSharp_ID)] - public partial class UnsignedLong : TypeMap + public class UnsignedLong : TypeMap { - public override Type CSharpSignatureType(TypePrinterContext ctx) => + public override Type SignatureType(TypePrinterContext ctx) => CSharpTypePrinter.GetUnsignedType(Context.TargetInfo.LongWidth); } [TypeMap("char", GeneratorKindID = GeneratorKind.CSharp_ID)] - public partial class Char : TypeMap + public class Char : TypeMap { - public override Type CSharpSignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { return new CILType(ctx.Kind == TypePrinterContextKind.Native || !Context.Options.MarshalCharAsManagedChar ? typeof(sbyte) : typeof(char)); } - public override void CSharpMarshalToNative(CSharpMarshalContext ctx) + public override void MarshalToNative(MarshalContext ctx) { if (Context.Options.MarshalCharAsManagedChar) ctx.Return.Write("global::System.Convert.ToSByte({0})", @@ -57,7 +57,7 @@ public override void CSharpMarshalToNative(CSharpMarshalContext ctx) ctx.Return.Write(ctx.Parameter.Name); } - public override void CSharpMarshalToManaged(CSharpMarshalContext ctx) + public override void MarshalToManaged(MarshalContext ctx) { if (Context.Options.MarshalCharAsManagedChar) ctx.Return.Write("global::System.Convert.ToChar({0})", @@ -68,27 +68,27 @@ public override void CSharpMarshalToManaged(CSharpMarshalContext ctx) } [TypeMap("char16_t", GeneratorKindID = GeneratorKind.CSharp_ID)] - public partial class Char16T : TypeMap + public class Char16T : TypeMap { - public override Type CSharpSignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { return new CILType(typeof(char)); } } [TypeMap("wchar_t", GeneratorKindID = GeneratorKind.CSharp_ID)] - public partial class WCharT : TypeMap + public class WCharT : TypeMap { - public override Type CSharpSignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { return new CILType(typeof(char)); } } [TypeMap("const char*", GeneratorKindID = GeneratorKind.CSharp_ID)] - public partial class ConstCharPointer : TypeMap + public class ConstCharPointer : TypeMap { - public override Type CSharpSignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { if (ctx.Kind == TypePrinterContextKind.Managed) return new CILType(typeof(string)); @@ -117,7 +117,7 @@ public override Type CSharpSignatureType(TypePrinterContext ctx) $"{Context.Options.Encoding.EncodingName} is not supported yet."); } - public override void CSharpMarshalToNative(CSharpMarshalContext ctx) + public override void MarshalToNative(MarshalContext ctx) { string param = ctx.Parameter.Name; if (ctx.Parameter.Usage == ParameterUsage.Unknown && @@ -194,7 +194,7 @@ public override void CSharpMarshalToNative(CSharpMarshalContext ctx) ctx.Return.Write($"{bytePtr}"); } - public override void CSharpMarshalToManaged(CSharpMarshalContext ctx) + public override void MarshalToManaged(MarshalContext ctx) { if (ctx.Parameter != null && !ctx.Parameter.IsOut && !ctx.Parameter.IsInOut) @@ -282,29 +282,29 @@ public uint GetCharPtrWidth(PointerType pointer) } [TypeMap("const char[]", GeneratorKindID = GeneratorKind.CSharp_ID)] - public partial class ConstCharArray : ConstCharPointer + public class ConstCharArray : ConstCharPointer { } [TypeMap("const wchar_t*", GeneratorKindID = GeneratorKind.CSharp_ID)] - public partial class ConstWCharTPointer : ConstCharPointer + public class ConstWCharTPointer : ConstCharPointer { } [TypeMap("const char16_t*", GeneratorKindID = GeneratorKind.CSharp_ID)] - public partial class ConstChar16TPointer : ConstCharPointer + public class ConstChar16TPointer : ConstCharPointer { } [TypeMap("const char32_t*", GeneratorKindID = GeneratorKind.CSharp_ID)] - public partial class ConstChar32TPointer : ConstCharPointer + public class ConstChar32TPointer : ConstCharPointer { } [TypeMap("basic_string, allocator>", GeneratorKindID = GeneratorKind.CSharp_ID)] - public partial class String : TypeMap + public class String : TypeMap { - public override Type CSharpSignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { if (ctx.Kind == TypePrinterContextKind.Managed) return new CILType(typeof(string)); @@ -316,7 +316,7 @@ public override Type CSharpSignatureType(TypePrinterContext ctx) return new CustomType(basicString.Visit(typePrinter).Type); } - public override void CSharpMarshalToNative(CSharpMarshalContext ctx) + public override void MarshalToNative(MarshalContext ctx) { Type type = ctx.Parameter.Type.Desugar(); ClassTemplateSpecialization basicString = GetBasicString(type); @@ -334,15 +334,13 @@ public override void CSharpMarshalToNative(CSharpMarshalContext ctx) var = Generator.GeneratedIdentifier(ctx.ArgName); ctx.Before.WriteLine($"fixed (void* {var} = &{ctx.ReturnVarName})"); ctx.Before.WriteOpenBraceAndIndent(); - ctx.HasCodeBlock = true; + (ctx as CSharpMarshalContext).HasCodeBlock = true; } else { var = $"&{ctx.ReturnVarName}"; } - ctx.Return.Write($@"{qualifiedBasicString}Extensions.{ - Helpers.InternalStruct}.{assign.Name}(new { - typePrinter.IntPtrType}({var}), "); + ctx.Return.Write($@"{qualifiedBasicString}Extensions.{Helpers.InternalStruct}.{assign.Name}(new {typePrinter.IntPtrType}({var}), "); if (ctx.Parameter.Type.IsTemplateParameterType()) ctx.Return.Write("(string) (object) "); ctx.Return.Write($"{ctx.Parameter.Name})"); @@ -351,22 +349,19 @@ public override void CSharpMarshalToNative(CSharpMarshalContext ctx) else { var varBasicString = $"__basicString{ctx.ParameterIndex}"; - ctx.Before.WriteLine($@"var {varBasicString} = new { - basicString.Visit(typePrinter)}();"); + ctx.Before.WriteLine($@"var {varBasicString} = new {basicString.Visit(typePrinter)}();"); - ctx.Before.Write($@"{qualifiedBasicString}Extensions.{ - assign.Name}({varBasicString}, "); + ctx.Before.Write($@"{qualifiedBasicString}Extensions.{assign.Name}({varBasicString}, "); if (ctx.Parameter.Type.IsTemplateParameterType()) ctx.Before.Write("(string) (object) "); ctx.Before.WriteLine($"{ctx.Parameter.Name});"); ctx.Return.Write($"{varBasicString}.{Helpers.InstanceIdentifier}"); - ctx.Cleanup.WriteLine($@"{varBasicString}.Dispose({ - (!Type.IsAddress() || ctx.Parameter?.IsIndirect == true ? "disposing: true, callNativeDtor:false" : string.Empty)});"); + ctx.Cleanup.WriteLine($@"{varBasicString}.Dispose({(!Type.IsAddress() || ctx.Parameter?.IsIndirect == true ? "disposing: true, callNativeDtor:false" : string.Empty)});"); } } - public override void CSharpMarshalToManaged(CSharpMarshalContext ctx) + public override void MarshalToManaged(MarshalContext ctx) { var type = Type.Desugar(resolveTemplateSubstitution: false); ClassTemplateSpecialization basicString = GetBasicString(type); @@ -376,10 +371,7 @@ public override void CSharpMarshalToManaged(CSharpMarshalContext ctx) string varBasicString = $"__basicStringRet{ctx.ParameterIndex}"; bool usePointer = type.IsAddress() || ctx.MarshalKind == MarshalKind.NativeField || ctx.MarshalKind == MarshalKind.ReturnVariableArray; - ctx.Before.WriteLine($@"var {varBasicString} = { - basicString.Visit(typePrinter)}.{Helpers.CreateInstanceIdentifier}({ - (usePointer ? string.Empty : $"new {typePrinter.IntPtrType}(&")}{ - ctx.ReturnVarName}{(usePointer ? string.Empty : ")")});"); + ctx.Before.WriteLine($@"var {varBasicString} = {basicString.Visit(typePrinter)}.{Helpers.CreateInstanceIdentifier}({(usePointer ? string.Empty : $"new {typePrinter.IntPtrType}(&")}{ctx.ReturnVarName}{(usePointer ? string.Empty : ")")});"); string @string = $"{qualifiedBasicString}Extensions.{data.Name}({varBasicString})"; if (usePointer) { @@ -420,10 +412,26 @@ private static ClassTemplateSpecialization GetBasicString(Type type) } } + [TypeMap("std::map", GeneratorKindID = GeneratorKind.CSharp_ID)] + public class Map : TypeMap + { + public override bool IsIgnored { get { return true; } } + + public override Type SignatureType(TypePrinterContext ctx) + { + if (ctx.Kind == TypePrinterContextKind.Native) + return new CustomType("Std.Map"); + + var type = Type as TemplateSpecializationType; + return new CustomType( + $@"System.Collections.Generic.Dictionary<{type.Arguments[0].Type}, {type.Arguments[1].Type}>"); + } + } + [TypeMap("FILE", GeneratorKindID = GeneratorKind.CSharp_ID)] - public partial class FILE : TypeMap + public class FILE : TypeMap { - public override Type CSharpSignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { return new CILType(typeof(System.IntPtr)); } diff --git a/src/Generator/Types/TypeMap.cs b/src/Generator/Types/TypeMap.cs index e7060192a..5f701c6c4 100644 --- a/src/Generator/Types/TypeMap.cs +++ b/src/Generator/Types/TypeMap.cs @@ -2,10 +2,7 @@ using CppSharp.AST; using CppSharp.Generators; using CppSharp.Generators.AST; -using CppSharp.Generators.C; using CppSharp.Generators.CLI; -using CppSharp.Generators.Cpp; -using CppSharp.Generators.CSharp; using Attribute = System.Attribute; using Type = CppSharp.AST.Type; @@ -51,77 +48,23 @@ public class TypeMap /// public virtual bool DoesMarshalling => true; - public virtual Type SignatureType(GeneratorKind kind, TypePrinterContext ctx) - { - switch (kind) - { - case var _ when ReferenceEquals(kind, GeneratorKind.C): - case var _ when ReferenceEquals(kind, GeneratorKind.CPlusPlus): - return CppSignatureType(ctx); - case var _ when ReferenceEquals(kind, GeneratorKind.CLI): - return CLISignatureType(ctx); - case var _ when ReferenceEquals(kind, GeneratorKind.CSharp): - return CSharpSignatureType(ctx); - default: - throw new System.NotImplementedException(); - } - } - - public virtual void MarshalToNative(GeneratorKind kind, MarshalContext ctx) - { - switch (kind) - { - case var _ when ReferenceEquals(kind, GeneratorKind.C): - case var _ when ReferenceEquals(kind, GeneratorKind.CPlusPlus): - CppMarshalToNative(ctx); - return; - case var _ when ReferenceEquals(kind, GeneratorKind.CLI): - CLIMarshalToNative(ctx); - return; - case var _ when ReferenceEquals(kind, GeneratorKind.CSharp): - CSharpMarshalToNative(ctx as CSharpMarshalContext); - return; - default: - throw new System.NotImplementedException(); - } - } - - public virtual void MarshalToManaged(GeneratorKind kind, MarshalContext ctx) - { - switch (kind) - { - case var _ when ReferenceEquals(kind, GeneratorKind.C): - case var _ when ReferenceEquals(kind, GeneratorKind.CPlusPlus): - CppMarshalToManaged(ctx); - return; - case var _ when ReferenceEquals(kind, GeneratorKind.CLI): - CLIMarshalToManaged(ctx); - return; - case var _ when ReferenceEquals(kind, GeneratorKind.CSharp): - CSharpMarshalToManaged(ctx as CSharpMarshalContext); - return; - default: - throw new System.NotImplementedException(); - } - } - - #region C# backend - - public virtual Type CSharpSignatureType(TypePrinterContext ctx) + public virtual Type SignatureType(TypePrinterContext ctx) { return new CILType(typeof(object)); } - public virtual void CSharpMarshalToNative(CSharpMarshalContext ctx) + public virtual void MarshalToNative(MarshalContext ctx) { ctx.Return.Write(ctx.Parameter.Name); } - public virtual void CSharpMarshalToManaged(CSharpMarshalContext ctx) + public virtual void MarshalToManaged(MarshalContext ctx) { ctx.Return.Write(ctx.ReturnVarName); } + #region C# backend + /// /// Used to construct a new instance of the mapped type. /// @@ -135,55 +78,18 @@ public virtual string CSharpConstruct() #region C++/CLI backend - public virtual Type CLISignatureType(TypePrinterContext ctx) - { - return new CILType(typeof(object)); - } - public virtual void CLITypeReference(CLITypeReferenceCollector collector, ASTRecord loc) { } - public virtual void CLIMarshalToNative(MarshalContext ctx) - { - ctx.Return.Write(ctx.Parameter.Name); - } - - public virtual void CLIMarshalToManaged(MarshalContext ctx) - { - ctx.Return.Write(ctx.ReturnVarName); - } - #endregion - - #region C++ backend - - public virtual Type CppSignatureType(TypePrinterContext ctx) - { - return new CILType(typeof(object)); - } - - public virtual void CppTypeReference(CLITypeReference collector, ASTRecord record) - { - throw new NotImplementedException(); - } - - public virtual void CppMarshalToNative(MarshalContext ctx) - { - ctx.Return.Write(ctx.Parameter.Name); - } - - public virtual void CppMarshalToManaged(MarshalContext ctx) - { - ctx.Return.Write(ctx.ReturnVarName); - } - - #endregion } public interface ITypeMapDatabase { bool FindTypeMap(Type decl, out TypeMap typeMap); + bool FindTypeMap(Type decl, GeneratorKind kind, out TypeMap typeMap); bool FindTypeMap(Declaration declaration, out TypeMap typeMap); + bool FindTypeMap(Declaration declaration, GeneratorKind kind, out TypeMap typeMap); } } diff --git a/src/Generator/Types/TypeMapDatabase.cs b/src/Generator/Types/TypeMapDatabase.cs index 96711ae69..904d58a92 100644 --- a/src/Generator/Types/TypeMapDatabase.cs +++ b/src/Generator/Types/TypeMapDatabase.cs @@ -10,13 +10,16 @@ namespace CppSharp.Types { public class TypeMapDatabase : ITypeMapDatabase { - public IDictionary TypeMaps { get; set; } private readonly BindingContext Context; + private readonly Dictionary> typeMapsCache = new(); + + public Dictionary> GlobalTypeMaps { get; private set; } + public Dictionary TypeMaps => TypeMapsByKind(GlobalTypeMaps, Context.Options.GeneratorKind); public TypeMapDatabase(BindingContext bindingContext) { Context = bindingContext; - TypeMaps = new Dictionary(); + GlobalTypeMaps = new Dictionary>(); foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { try @@ -32,33 +35,22 @@ public TypeMapDatabase(BindingContext bindingContext) } } - private void SetupTypeMaps(IEnumerable types, - BindingContext bindingContext) + public static Dictionary TypeMapsByKind(Dictionary> typeMapsDictionary, GeneratorKind kind) { - foreach (var type in types) + if (!typeMapsDictionary.TryGetValue(kind, out Dictionary typeMap)) { - var attrs = type.GetCustomAttributes(typeof(TypeMapAttribute), true); - foreach (TypeMapAttribute attr in attrs) - { - if (string.IsNullOrEmpty(attr.GeneratorKindID) || - attr.GeneratorKindID == bindingContext.Options.GeneratorKind.ID) - { - var typeMap = (TypeMap)Activator.CreateInstance(type); - typeMap.Context = bindingContext; - typeMap.TypeMapDatabase = this; - - // Custom types won't be overwritten by CppSharp ones. - if (!TypeMaps.ContainsKey(attr.Type)) - { - TypeMaps.Add(attr.Type, typeMap); - } - } - } + typeMap = new Dictionary(); + typeMapsDictionary.Add(kind, typeMap); } + return typeMap; } - public bool FindTypeMap(Type type, out TypeMap typeMap) + public bool FindTypeMap(Type type, out TypeMap typeMap) => + FindTypeMap(type, Context.Options.GeneratorKind, out typeMap); + + public bool FindTypeMap(Type type, GeneratorKind kind, out TypeMap typeMap) { + var typeMaps = TypeMapsByKind(typeMapsCache, kind); // Looks up the type in the cache map. if (typeMaps.ContainsKey(type)) { @@ -72,13 +64,12 @@ public bool FindTypeMap(Type type, out TypeMap typeMap) { var specialization = template.GetClassTemplateSpecialization(); if (specialization != null && - FindTypeMap(specialization, out typeMap)) + FindTypeMap(specialization, kind, out typeMap)) return true; if (template.Template.TemplatedDecl != null) { - if (FindTypeMap(template.Template.TemplatedDecl, - out typeMap)) + if (FindTypeMap(template.Template.TemplatedDecl, kind, out typeMap)) { typeMap.Type = type; return true; @@ -113,7 +104,7 @@ public bool FindTypeMap(Type type, out TypeMap typeMap) typePrinter.PushScope(typePrintScopeKind); var typeName = type.Visit(typePrinter); typePrinter.PopScope(); - if (FindTypeMap(typeName, out typeMap)) + if (FindTypeMap(typeName, kind, out typeMap)) { typeMap.Type = type; typeMaps[type] = typeMap; @@ -127,11 +118,33 @@ public bool FindTypeMap(Type type, out TypeMap typeMap) } public bool FindTypeMap(Declaration declaration, out TypeMap typeMap) => - FindTypeMap(new TagType(declaration), out typeMap); + FindTypeMap(declaration, Context.Options.GeneratorKind, out typeMap); + + public bool FindTypeMap(Declaration declaration, GeneratorKind kind, out TypeMap typeMap) => + FindTypeMap(new TagType(declaration), kind, out typeMap); - public bool FindTypeMap(string name, out TypeMap typeMap) => - TypeMaps.TryGetValue(name, out typeMap) && typeMap.IsEnabled; + public bool FindTypeMap(string name, GeneratorKind kind, out TypeMap typeMap) => + TypeMapsByKind(GlobalTypeMaps, kind).TryGetValue(name, out typeMap) && typeMap.IsEnabled; - private Dictionary typeMaps = new Dictionary(); + private void SetupTypeMaps(IEnumerable types, BindingContext bindingContext) + { + foreach (var type in types) + { + var attrs = type.GetCustomAttributes(typeof(TypeMapAttribute), true); + foreach (TypeMapAttribute attr in attrs) + { + var kind = string.IsNullOrEmpty(attr.GeneratorKindID) ? Context.Options.GeneratorKind : GeneratorKind.FindGeneratorKindByID(attr.GeneratorKindID); + var typeMaps = TypeMapsByKind(GlobalTypeMaps, kind); + // Custom types won't be overwritten by CppSharp ones. + if (!typeMaps.ContainsKey(attr.Type)) + { + var typeMap = (TypeMap)Activator.CreateInstance(type); + typeMap.Context = bindingContext; + typeMap.TypeMapDatabase = this; + typeMaps.Add(attr.Type, typeMap); + } + } + } + } } } diff --git a/tests/dotnet/CLI/CLI.Gen.cs b/tests/dotnet/CLI/CLI.Gen.cs index 3ec8c1dc8..586fd4339 100644 --- a/tests/dotnet/CLI/CLI.Gen.cs +++ b/tests/dotnet/CLI/CLI.Gen.cs @@ -1,59 +1,68 @@ using CppSharp.AST; using CppSharp.Generators; using CppSharp.Generators.C; -using CppSharp.Passes; using CppSharp.Types; using CppSharp.Utils; namespace CppSharp.Tests { - [TypeMap("IgnoredClassTemplateForEmployee")] + [TypeMap("IgnoredClassTemplateForEmployee", GeneratorKindID = GeneratorKind.CLI_ID)] public class IgnoredClassTemplateForEmployeeMap : TypeMap { - public override Type CLISignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { return new CustomType("CLI::Employee^"); } - public override void CLIMarshalToManaged(MarshalContext ctx) + public override void MarshalToManaged(MarshalContext ctx) { ctx.Return.Write($"gcnew CLI::Employee({ctx.ReturnVarName}.m_employee)"); } } - [TypeMap("TestMappedTypeNonConstRefParam")] - public class TestMappedTypeNonConstRefParamTypeMap : TypeMap + namespace CLI { - public override Type CLISignatureType(TypePrinterContext ctx) + [TypeMap("TestMappedTypeNonConstRefParam", GeneratorKindID = GeneratorKind.CLI_ID)] + public class TestMappedTypeNonConstRefParamTypeMap : TypeMap { - return new CILType(typeof(string)); - } + public override Type SignatureType(TypePrinterContext ctx) + { + return new CILType(typeof(string)); + } - public override Type CppSignatureType(TypePrinterContext ctx) - { - var tagType = ctx.Type as TagType; - var typePrinter = new CppTypePrinter(Context); - return new CustomType(tagType.Declaration.Visit(typePrinter)); - } + public override void MarshalToManaged(MarshalContext ctx) + { + ctx.Return.Write("clix::marshalString({0}.m_str)", ctx.ReturnVarName); + } - public override void CLIMarshalToManaged(MarshalContext ctx) - { - ctx.Return.Write("clix::marshalString({0}.m_str)", ctx.ReturnVarName); + public override void MarshalToNative(MarshalContext ctx) + { + if (ctx.Parameter.Usage == ParameterUsage.InOut) + { + ctx.Before.WriteLine($"System::String^ _{ctx.Parameter.Name} = {ctx.Parameter.Name};"); + } + + string paramName = ctx.Parameter.Usage == ParameterUsage.InOut ? $"_{ctx.Parameter.Name}" : ctx.Parameter.Name; + + ctx.Before.WriteLine( + $"::TestMappedTypeNonConstRefParam _{ctx.ArgName} = clix::marshalString({paramName});"); + + ctx.Return.Write("_{0}", ctx.ArgName); + } } + } - public override void CLIMarshalToNative(MarshalContext ctx) + namespace Cpp + { + [TypeMap("TestMappedTypeNonConstRefParam", GeneratorKindID = GeneratorKind.CPlusPlus_ID)] + public class TestMappedTypeNonConstRefParamTypeMap : TypeMap { - if (ctx.Parameter.Usage == ParameterUsage.InOut) + public override Type SignatureType(TypePrinterContext ctx) { - ctx.Before.WriteLine($"System::String^ _{ctx.Parameter.Name} = {ctx.Parameter.Name};"); + var tagType = ctx.Type as TagType; + var typePrinter = new CppTypePrinter(Context); + return new CustomType(tagType.Declaration.Visit(typePrinter)); } - - string paramName = ctx.Parameter.Usage == ParameterUsage.InOut ? $"_{ctx.Parameter.Name}" : ctx.Parameter.Name; - - ctx.Before.WriteLine( - $"::TestMappedTypeNonConstRefParam _{ctx.ArgName} = clix::marshalString({paramName});"); - - ctx.Return.Write("_{0}", ctx.ArgName); } } diff --git a/tests/dotnet/CSharp/CSharp.Gen.cs b/tests/dotnet/CSharp/CSharp.Gen.cs index 38c2e5d67..5c9f45cef 100644 --- a/tests/dotnet/CSharp/CSharp.Gen.cs +++ b/tests/dotnet/CSharp/CSharp.Gen.cs @@ -120,17 +120,17 @@ public override bool VisitFunctionDecl(Function function) [TypeMap("boolean_t")] public class BooleanTypeMap : TypeMap { - public override Type CSharpSignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { return new BuiltinType(PrimitiveType.Bool); } - public override void CSharpMarshalToNative(CSharpMarshalContext ctx) + public override void MarshalToNative(MarshalContext ctx) { ctx.Return.Write(ctx.Parameter.Name); } - public override void CSharpMarshalToManaged(CSharpMarshalContext ctx) + public override void MarshalToManaged(MarshalContext ctx) { ctx.Return.Write(ctx.ReturnVarName); } @@ -144,12 +144,12 @@ public override string CSharpConstruct() return string.Empty; } - public override Type CSharpSignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { return GetEnumType(ctx.Type); } - public override void CSharpMarshalToNative(CSharpMarshalContext ctx) + public override void MarshalToNative(MarshalContext ctx) { if (ctx.Parameter.Type.Desugar().IsAddress()) ctx.Return.Write("new global::System.IntPtr(&{0})", ctx.Parameter.Name); @@ -157,7 +157,7 @@ public override void CSharpMarshalToNative(CSharpMarshalContext ctx) ctx.Return.Write(ctx.Parameter.Name); } - public override void CSharpMarshalToManaged(CSharpMarshalContext ctx) + public override void MarshalToManaged(MarshalContext ctx) { if (ctx.ReturnType.Type.Desugar().IsAddress()) { @@ -196,17 +196,17 @@ public override string CSharpConstruct() return string.Empty; } - public override Type CSharpSignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { return new TagType(flags ?? (flags = Context.ASTContext.FindEnum("Flags").First())); } - public override void CSharpMarshalToNative(CSharpMarshalContext ctx) + public override void MarshalToNative(MarshalContext ctx) { ctx.Return.Write(ctx.Parameter.Name); } - public override void CSharpMarshalToManaged(CSharpMarshalContext ctx) + public override void MarshalToManaged(MarshalContext ctx) { ctx.Return.Write(ctx.ReturnVarName); } @@ -229,7 +229,7 @@ public override bool IsIgnored } } - public override Type CSharpSignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { if (ctx.Kind == TypePrinterContextKind.Native) { @@ -249,7 +249,7 @@ public override Type CSharpSignatureType(TypePrinterContext ctx) ctx.GetTemplateParameterList()}>"); } - public override void CSharpMarshalToNative(CSharpMarshalContext ctx) + public override void MarshalToNative(MarshalContext ctx) { // pointless, put just so that the generated code compiles var type = (TemplateSpecializationType)ctx.Parameter.Type.Desugar(); @@ -259,7 +259,7 @@ public override void CSharpMarshalToNative(CSharpMarshalContext ctx) ctx.Return.Write("new {0}()", specialization.Visit(typePrinter)); } - public override void CSharpMarshalToManaged(CSharpMarshalContext ctx) + public override void MarshalToManaged(MarshalContext ctx) { ctx.Return.Write(ctx.ReturnVarName); } @@ -268,18 +268,18 @@ public override void CSharpMarshalToManaged(CSharpMarshalContext ctx) [TypeMap("TypeMappedWithOperator")] public class TypeMappedWithOperator : TypeMap { - public override Type CSharpSignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { // doesn't matter, we just need it to compile return new BuiltinType(PrimitiveType.Int); } - public override void CSharpMarshalToNative(CSharpMarshalContext ctx) + public override void MarshalToNative(MarshalContext ctx) { ctx.Return.Write(ctx.Parameter.Name); } - public override void CSharpMarshalToManaged(CSharpMarshalContext ctx) + public override void MarshalToManaged(MarshalContext ctx) { ctx.Return.Write(ctx.ReturnVarName); } @@ -288,7 +288,7 @@ public override void CSharpMarshalToManaged(CSharpMarshalContext ctx) [TypeMap("QString")] public class QString : TypeMap { - public override Type CSharpSignatureType(TypePrinterContext ctx) + public override Type SignatureType(TypePrinterContext ctx) { if (ctx.Kind == TypePrinterContextKind.Native) { @@ -299,13 +299,13 @@ public override Type CSharpSignatureType(TypePrinterContext ctx) return new CILType(typeof(string)); } - public override void CSharpMarshalToNative(CSharpMarshalContext ctx) + public override void MarshalToNative(MarshalContext ctx) { ctx.Return.Write(ctx.Parameter.Type.Desugar().IsAddress() ? "global::System.IntPtr.Zero" : "\"test\""); } - public override void CSharpMarshalToManaged(CSharpMarshalContext ctx) + public override void MarshalToManaged(MarshalContext ctx) { ctx.Return.Write("\"test\""); } diff --git a/tests/dotnet/Common/Common.Gen.cs b/tests/dotnet/Common/Common.Gen.cs index 0f1c47d10..08bf971f1 100644 --- a/tests/dotnet/Common/Common.Gen.cs +++ b/tests/dotnet/Common/Common.Gen.cs @@ -7,37 +7,47 @@ namespace CppSharp.Tests { - [TypeMap("TypeMappedIndex")] - public class TypeMappedIndex : TypeMap + namespace CLI { - public override Type CLISignatureType(TypePrinterContext ctx) + [TypeMap("TypeMappedIndex", GeneratorKindID = GeneratorKind.CLI_ID)] + public class TypeMappedIndex : TypeMap { - return new BuiltinType(PrimitiveType.UShort); - } - - public override void CLIMarshalToManaged(MarshalContext ctx) - { - ctx.Return.Write(ctx.ReturnVarName); - } - - public override void CLIMarshalToNative(MarshalContext ctx) - { - ctx.Return.Write("::TypeMappedIndex()"); - } - - public override Type CSharpSignatureType(TypePrinterContext ctx) - { - return new BuiltinType(PrimitiveType.UShort); - } - - public override void CSharpMarshalToManaged(CSharpMarshalContext ctx) - { - ctx.Return.Write(ctx.ReturnVarName); + public override Type SignatureType(TypePrinterContext ctx) + { + return new BuiltinType(PrimitiveType.UShort); + } + + public override void MarshalToManaged(MarshalContext ctx) + { + ctx.Return.Write(ctx.ReturnVarName); + } + + public override void MarshalToNative(MarshalContext ctx) + { + ctx.Return.Write("::TypeMappedIndex()"); + } } + } - public override void CSharpMarshalToNative(CSharpMarshalContext ctx) + namespace CSharp + { + [TypeMap("TypeMappedIndex", GeneratorKindID = GeneratorKind.CSharp_ID)] + public class TypeMappedIndex : TypeMap { - ctx.Return.Write("IntPtr.Zero"); + public override Type SignatureType(TypePrinterContext ctx) + { + return new BuiltinType(PrimitiveType.UShort); + } + + public override void MarshalToManaged(MarshalContext ctx) + { + ctx.Return.Write(ctx.ReturnVarName); + } + + public override void MarshalToNative(MarshalContext ctx) + { + ctx.Return.Write("IntPtr.Zero"); + } } } From 12c267d9c44b90521e419c52a3ee29297da70648 Mon Sep 17 00:00:00 2001 From: zylalx1 Date: Fri, 8 Dec 2023 03:58:10 +0800 Subject: [PATCH 22/37] Fixed a bug causing the header file to be included twice when Options.GenerateName is not null (#1803) --- src/Generator/Generators/C/CppHeaders.cs | 4 +++- src/Generator/Generators/C/CppSources.cs | 3 ++- src/Generator/Generators/CLI/CLIHeaders.cs | 4 +++- src/Generator/Generators/CLI/CLISources.cs | 4 +++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Generator/Generators/C/CppHeaders.cs b/src/Generator/Generators/C/CppHeaders.cs index eb87f4fd8..b39d6877d 100644 --- a/src/Generator/Generators/C/CppHeaders.cs +++ b/src/Generator/Generators/C/CppHeaders.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using CppSharp.AST; using CppSharp.AST.Extensions; @@ -87,7 +88,8 @@ public void GenerateIncludeForwardRefs(TranslationUnit unit) if (typeRef.Include.TranslationUnit == unit) continue; - if (typeRef.Include.File == unit.FileName) + var filename = Context.Options.GenerateName != null ? $"{Context.Options.GenerateName(TranslationUnit)}{Path.GetExtension(TranslationUnit.FileName)}" : TranslationUnit.FileName; + if (typeRef.Include.File == filename) continue; var include = typeRef.Include; diff --git a/src/Generator/Generators/C/CppSources.cs b/src/Generator/Generators/C/CppSources.cs index a8e7a013b..061809b4c 100644 --- a/src/Generator/Generators/C/CppSources.cs +++ b/src/Generator/Generators/C/CppSources.cs @@ -64,7 +64,8 @@ public virtual void GenerateForwardReferenceHeaders(TranslationUnit unit) foreach (var typeRef in typeReferenceCollector.TypeReferences) { - if (typeRef.Include.File == unit.FileName) + var filename = Context.Options.GenerateName != null ? $"{Context.Options.GenerateName(TranslationUnit)}{Path.GetExtension(TranslationUnit.FileName)}" : TranslationUnit.FileName; + if (typeRef.Include.File == filename) continue; var include = typeRef.Include; diff --git a/src/Generator/Generators/CLI/CLIHeaders.cs b/src/Generator/Generators/CLI/CLIHeaders.cs index a143cf4de..900e2a8a5 100644 --- a/src/Generator/Generators/CLI/CLIHeaders.cs +++ b/src/Generator/Generators/CLI/CLIHeaders.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using CppSharp.AST; using CppSharp.AST.Extensions; @@ -61,7 +62,8 @@ public void GenerateIncludeForwardRefs() if (typeRef.Include.TranslationUnit == TranslationUnit) continue; - if (typeRef.Include.File == TranslationUnit.FileName) + var filename = Context.Options.GenerateName != null ? $"{Context.Options.GenerateName(TranslationUnit)}{Path.GetExtension(TranslationUnit.FileName)}" : TranslationUnit.FileName; + if (typeRef.Include.File == filename) continue; var include = typeRef.Include; diff --git a/src/Generator/Generators/CLI/CLISources.cs b/src/Generator/Generators/CLI/CLISources.cs index 0a8882628..3a1b692bc 100644 --- a/src/Generator/Generators/CLI/CLISources.cs +++ b/src/Generator/Generators/CLI/CLISources.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Globalization; +using System.IO; using System.Linq; using CppSharp.AST; using CppSharp.AST.Extensions; @@ -61,7 +62,8 @@ public void GenerateForwardReferenceHeaders() foreach (var typeRef in typeReferenceCollector.TypeReferences) { - if (typeRef.Include.File == TranslationUnit.FileName) + var filename = Context.Options.GenerateName != null ? $"{Context.Options.GenerateName(TranslationUnit)}{Path.GetExtension(TranslationUnit.FileName)}" : TranslationUnit.FileName; + if (typeRef.Include.File == filename) continue; var include = typeRef.Include; From 12112720f3dd7c0eab2f2827a2ac056c9ac250bb Mon Sep 17 00:00:00 2001 From: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:25:12 +0200 Subject: [PATCH 23/37] Build llvm `Debug`/`Release` for `Windows`. (#1800) * Update llvm-win.yml * Update llvm-win.yml * Update llvm-win.yml --- .github/workflows/llvm-win.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/llvm-win.yml b/.github/workflows/llvm-win.yml index 43b9891fb..9b8bcd157 100644 --- a/.github/workflows/llvm-win.yml +++ b/.github/workflows/llvm-win.yml @@ -9,8 +9,12 @@ jobs: fail-fast: false matrix: config: - - { os: windows-2022, platform: x86, vs: "Program Files/Microsoft Visual Studio/2022" } - - { os: windows-2022, platform: x64, vs: "Program Files/Microsoft Visual Studio/2022" } + - { os: windows-2022, platform: x86, configuration : Debug, vs: "Program Files/Microsoft Visual Studio/2022" } + - { os: windows-2022, platform: x64, configuration : Debug, vs: "Program Files/Microsoft Visual Studio/2022" } + - { os: windows-2022, platform: x86, configuration : Release, vs: "Program Files/Microsoft Visual Studio/2022" } + - { os: windows-2022, platform: x64, configuration : Release, vs: "Program Files/Microsoft Visual Studio/2022" } + - { os: windows-2022, platform: x86, configuration : RelWithDebInfo, vs: "Program Files/Microsoft Visual Studio/2022" } + - { os: windows-2022, platform: x64, configuration : RelWithDebInfo, vs: "Program Files/Microsoft Visual Studio/2022" } runs-on: ${{ matrix.config.os }} @@ -19,6 +23,7 @@ jobs: CXX: ${{ matrix.config.cxx }} VS_VERSION: ${{ matrix.config.vs }} PLATFORM: ${{ matrix.config.platform }} + CONFIGURATION: ${{ matrix.config.configuration }} ACTIONS_ALLOW_UNSECURE_COMMANDS: true steps: @@ -51,16 +56,16 @@ jobs: - name: Build LLVM shell: bash - run: build/build.sh build_llvm -platform $PLATFORM + run: build/build.sh build_llvm -platform $PLATFORM -configuration $CONFIGURATION working-directory: C:\CppSharp - name: Package LLVM shell: bash - run: build/build.sh package_llvm -platform $PLATFORM + run: build/build.sh package_llvm -platform $PLATFORM -configuration $CONFIGURATION working-directory: C:\CppSharp - name: 'Upload Artifact' uses: actions/upload-artifact@v3 with: name: llvm - path: C:\CppSharp\build\llvm\llvm-*-*.* \ No newline at end of file + path: C:\CppSharp\build\llvm\llvm-*-*.* From 519e97f2da35bca21dc1de8cdd4598711da406c1 Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Tue, 12 Dec 2023 15:30:14 +0000 Subject: [PATCH 24/37] Remove 32-bit builds and non-debug symbols release builds from LLVM Windows CI. --- .github/workflows/llvm-win.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/llvm-win.yml b/.github/workflows/llvm-win.yml index 9b8bcd157..210579e24 100644 --- a/.github/workflows/llvm-win.yml +++ b/.github/workflows/llvm-win.yml @@ -9,11 +9,7 @@ jobs: fail-fast: false matrix: config: - - { os: windows-2022, platform: x86, configuration : Debug, vs: "Program Files/Microsoft Visual Studio/2022" } - { os: windows-2022, platform: x64, configuration : Debug, vs: "Program Files/Microsoft Visual Studio/2022" } - - { os: windows-2022, platform: x86, configuration : Release, vs: "Program Files/Microsoft Visual Studio/2022" } - - { os: windows-2022, platform: x64, configuration : Release, vs: "Program Files/Microsoft Visual Studio/2022" } - - { os: windows-2022, platform: x86, configuration : RelWithDebInfo, vs: "Program Files/Microsoft Visual Studio/2022" } - { os: windows-2022, platform: x64, configuration : RelWithDebInfo, vs: "Program Files/Microsoft Visual Studio/2022" } runs-on: ${{ matrix.config.os }} From 1327971e25ea298951f64864ad3bcdecf745ca0f Mon Sep 17 00:00:00 2001 From: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Sat, 16 Dec 2023 21:36:04 +0200 Subject: [PATCH 25/37] GeneratorKind: patch bug caused by missing ToString (#1811) --- src/Generator/GeneratorKind.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Generator/GeneratorKind.cs b/src/Generator/GeneratorKind.cs index 200ed11e4..4101a77cb 100644 --- a/src/Generator/GeneratorKind.cs +++ b/src/Generator/GeneratorKind.cs @@ -104,6 +104,11 @@ public override int GetHashCode() } } + public override string ToString() + { + return ID; + } + public const string CLI_ID = "CLI"; public static readonly GeneratorKind CLI = new(CLI_ID, "C++/CLI", typeof(CLIGenerator), typeof(CLITypePrinter), new[] { "cli" }); From 24d1a8491dc9b6eb5785186ad7e7fd90b6faad5f Mon Sep 17 00:00:00 2001 From: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Sun, 17 Dec 2023 11:44:00 +0200 Subject: [PATCH 26/37] Stdlib.CSharp.cs: remove buggy typemap (#1812) --- src/Generator/Types/Std/Stdlib.CSharp.cs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/Generator/Types/Std/Stdlib.CSharp.cs b/src/Generator/Types/Std/Stdlib.CSharp.cs index a4198bcd1..e69de8e7e 100644 --- a/src/Generator/Types/Std/Stdlib.CSharp.cs +++ b/src/Generator/Types/Std/Stdlib.CSharp.cs @@ -412,22 +412,6 @@ private static ClassTemplateSpecialization GetBasicString(Type type) } } - [TypeMap("std::map", GeneratorKindID = GeneratorKind.CSharp_ID)] - public class Map : TypeMap - { - public override bool IsIgnored { get { return true; } } - - public override Type SignatureType(TypePrinterContext ctx) - { - if (ctx.Kind == TypePrinterContextKind.Native) - return new CustomType("Std.Map"); - - var type = Type as TemplateSpecializationType; - return new CustomType( - $@"System.Collections.Generic.Dictionary<{type.Arguments[0].Type}, {type.Arguments[1].Type}>"); - } - } - [TypeMap("FILE", GeneratorKindID = GeneratorKind.CSharp_ID)] public class FILE : TypeMap { From 2ecd9528ff90f0494078868e98385c898c072560 Mon Sep 17 00:00:00 2001 From: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Sun, 17 Dec 2023 13:08:34 +0200 Subject: [PATCH 27/37] regenerated bindings (#1813) * regenerated bindings * regenerated bindings after rebase * Directory.Build.props: support C# 10.0 --- Directory.Build.props | 114 +++---- .../CppSharp.CppParser.cs | 313 +++++++++--------- .../CSharp/i686-apple-darwin12.4.0/Std.cs | 13 +- .../i686-pc-win32-msvc/CppSharp.CppParser.cs | 313 +++++++++--------- .../Bindings/CSharp/i686-pc-win32-msvc/Std.cs | 22 +- .../CppSharp.CppParser.cs | 313 +++++++++--------- .../CSharp/x86_64-apple-darwin12.4.0/Std.cs | 13 +- .../CppSharp.CppParser.cs | 313 +++++++++--------- .../CSharp/x86_64-linux-gnu-cxx11abi/Std.cs | 13 +- .../x86_64-linux-gnu/CppSharp.CppParser.cs | 313 +++++++++--------- .../Bindings/CSharp/x86_64-linux-gnu/Std.cs | 13 +- .../CppSharp.CppParser.cs | 313 +++++++++--------- .../CSharp/x86_64-pc-win32-msvc/Std.cs | 22 +- 13 files changed, 1083 insertions(+), 1005 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 2a32266a0..0dc6c392c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,58 +1,58 @@ - - - - - $(MSBuildThisFileDirectory) - x86;x64 - false - true - MIT - https://github.com/mono/CppSharp - $(GITHUB_SHA) - João Matos, Dimitar Dobrev, Jose Torres - João Matos, Dimitar Dobrev - $(NBGV_Version) - $(NBGV_AssemblyVersion) - $(NBGV_AssemblyFileVersion) - $(NBGV_AssemblyInformationalVersion) - false - $(RootDir)build\ - $(BuildDir)obj\ - $(BuildDir)gen\ - $(RootDir)src\ - $(TargetFramework) - $(ObjDir)$(MSBuildProjectName)\ - $(RootDir)bin\ - $(BaseOutputPath)$(Configuration)_$(PlatformTarget)\ - $(BuildDir)$(PremakeAction)\ - $(ActionDir)projects\ - $(RootDir)artifacts\package\ - $(OutputPath) - 9.0 - 4 - dotnet - dll - "$(MSBuildProgramFiles32)\dotnet\dotnet.exe" - "$(ProgramW6432)\dotnet\dotnet.exe" - win - linux - osx - $(RID)-$(PlatformTarget) - - - - true - full - false - - - - exe - - - - - - - + + + + + $(MSBuildThisFileDirectory) + x86;x64 + false + true + MIT + https://github.com/mono/CppSharp + $(GITHUB_SHA) + João Matos, Dimitar Dobrev, Jose Torres + João Matos, Dimitar Dobrev + $(NBGV_Version) + $(NBGV_AssemblyVersion) + $(NBGV_AssemblyFileVersion) + $(NBGV_AssemblyInformationalVersion) + false + $(RootDir)build\ + $(BuildDir)obj\ + $(BuildDir)gen\ + $(RootDir)src\ + $(TargetFramework) + $(ObjDir)$(MSBuildProjectName)\ + $(RootDir)bin\ + $(BaseOutputPath)$(Configuration)_$(PlatformTarget)\ + $(BuildDir)$(PremakeAction)\ + $(ActionDir)projects\ + $(RootDir)artifacts\package\ + $(OutputPath) + 10.0 + 4 + dotnet + dll + "$(MSBuildProgramFiles32)\dotnet\dotnet.exe" + "$(ProgramW6432)\dotnet\dotnet.exe" + win + linux + osx + $(RID)-$(PlatformTarget) + + + + true + full + false + + + + exe + + + + + + + \ No newline at end of file diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs index fe8c0db53..2a5e810ff 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs @@ -14,6 +14,7 @@ [assembly:InternalsVisibleTo("CppSharp.Parser")] #pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required +#pragma warning disable CS9084 // Struct member returns 'this' or other instance members by reference namespace CppSharp { @@ -187,12 +188,12 @@ public NativeLibrary(global::CppSharp.Parser.AST.NativeLibrary _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -378,12 +379,12 @@ public Comment(global::CppSharp.Parser.AST.Comment _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -602,7 +603,7 @@ public FullComment(global::CppSharp.Parser.AST.FullComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -850,7 +851,7 @@ public ParagraphComment(global::CppSharp.Parser.AST.ParagraphComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1043,12 +1044,12 @@ public Argument(global::CppSharp.Parser.AST.BlockCommandComment.Argument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1151,7 +1152,7 @@ public BlockCommandComment(global::CppSharp.Parser.AST.BlockCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1323,7 +1324,7 @@ public ParamCommandComment(global::CppSharp.Parser.AST.ParamCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1462,7 +1463,7 @@ public TParamCommandComment(global::CppSharp.Parser.AST.TParamCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1589,7 +1590,7 @@ public VerbatimBlockLineComment(global::CppSharp.Parser.AST.VerbatimBlockLineCom partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1716,7 +1717,7 @@ public VerbatimBlockComment(global::CppSharp.Parser.AST.VerbatimBlockComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1847,7 +1848,7 @@ public VerbatimLineComment(global::CppSharp.Parser.AST.VerbatimLineComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2018,12 +2019,12 @@ public Argument(global::CppSharp.Parser.AST.InlineCommandComment.Argument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2117,7 +2118,7 @@ public InlineCommandComment(global::CppSharp.Parser.AST.InlineCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2416,12 +2417,12 @@ public Attribute(global::CppSharp.Parser.AST.HTMLStartTagComment.Attribute _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2529,7 +2530,7 @@ public HTMLStartTagComment(global::CppSharp.Parser.AST.HTMLStartTagComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2673,7 +2674,7 @@ public HTMLEndTagComment(global::CppSharp.Parser.AST.HTMLEndTagComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2786,7 +2787,7 @@ public TextComment(global::CppSharp.Parser.AST.TextComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2918,12 +2919,12 @@ public RawComment(global::CppSharp.Parser.AST.RawComment _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3017,7 +3018,7 @@ public partial struct __Internal } private SourceLocation.__Internal __instance; - internal SourceLocation.__Internal __Instance => __instance; + internal ref SourceLocation.__Internal __Instance => ref __instance; internal static SourceLocation __CreateInstance(__IntPtr native, bool skipVTables = false) { @@ -3040,6 +3041,14 @@ private SourceLocation(void* native, bool skipVTables = false) : this() __instance = *(global::CppSharp.Parser.SourceLocation.__Internal*) native; } + public SourceLocation() + { + fixed (__Internal* __instancePtr = &__instance) + { + __Internal.ctor(new __IntPtr(__instancePtr)); + } + } + public SourceLocation(uint ID) : this() { @@ -3175,12 +3184,12 @@ public SourceRange() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3402,12 +3411,12 @@ public Type(global::CppSharp.Parser.AST.Type _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3543,12 +3552,12 @@ public TypeQualifiers() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3695,12 +3704,12 @@ public QualifiedType(global::CppSharp.Parser.AST.QualifiedType _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4082,7 +4091,7 @@ public FunctionType(global::CppSharp.Parser.AST.FunctionType _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4826,12 +4835,12 @@ public TemplateArgument(global::CppSharp.Parser.AST.TemplateArgument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4997,7 +5006,7 @@ public TemplateSpecializationType(global::CppSharp.Parser.AST.TemplateSpecializa partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5167,7 +5176,7 @@ public DependentTemplateSpecializationType(global::CppSharp.Parser.AST.Dependent partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5313,7 +5322,7 @@ public TemplateParameterType(global::CppSharp.Parser.AST.TemplateParameterType _ partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5688,7 +5697,7 @@ public DependentNameType(global::CppSharp.Parser.AST.DependentNameType _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -6574,12 +6583,12 @@ public Declaration(global::CppSharp.Parser.AST.Declaration _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7147,7 +7156,7 @@ public DeclarationContext(global::CppSharp.Parser.AST.DeclarationContext _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7554,7 +7563,7 @@ public TypedefNameDecl(global::CppSharp.Parser.AST.TypedefNameDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7693,7 +7702,7 @@ public TypedefDecl(global::CppSharp.Parser.AST.TypedefDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7813,7 +7822,7 @@ public TypeAlias(global::CppSharp.Parser.AST.TypeAlias _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7946,7 +7955,7 @@ public Friend(global::CppSharp.Parser.AST.Friend _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8082,12 +8091,12 @@ public StatementObsolete(global::CppSharp.Parser.AST.StatementObsolete _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8232,7 +8241,7 @@ public ExpressionObsolete(global::CppSharp.Parser.AST.ExpressionObsolete _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8344,7 +8353,7 @@ public BinaryOperatorObsolete(global::CppSharp.Parser.AST.BinaryOperatorObsolete partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8503,7 +8512,7 @@ public CallExprObsolete(global::CppSharp.Parser.AST.CallExprObsolete _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8650,7 +8659,7 @@ public CXXConstructExprObsolete(global::CppSharp.Parser.AST.CXXConstructExprObso partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8804,7 +8813,7 @@ public Parameter(global::CppSharp.Parser.AST.Parameter _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9047,7 +9056,7 @@ public Function(global::CppSharp.Parser.AST.Function _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9507,7 +9516,7 @@ public Method(global::CppSharp.Parser.AST.Method _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9878,7 +9887,7 @@ public Item(global::CppSharp.Parser.AST.Enumeration.Item _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9985,7 +9994,7 @@ public Enumeration(global::CppSharp.Parser.AST.Enumeration _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10189,7 +10198,7 @@ public Variable(global::CppSharp.Parser.AST.Variable _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10357,12 +10366,12 @@ public BaseClassSpecifier(global::CppSharp.Parser.AST.BaseClassSpecifier _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10535,7 +10544,7 @@ public Field(global::CppSharp.Parser.AST.Field _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10708,7 +10717,7 @@ public AccessSpecifierDecl(global::CppSharp.Parser.AST.AccessSpecifierDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10819,12 +10828,12 @@ public VTableComponent(global::CppSharp.Parser.AST.VTableComponent _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10989,12 +10998,12 @@ public VTableLayout(global::CppSharp.Parser.AST.VTableLayout _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11141,12 +11150,12 @@ public VFTableInfo(global::CppSharp.Parser.AST.VFTableInfo _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11318,12 +11327,12 @@ public LayoutField(global::CppSharp.Parser.AST.LayoutField other) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11494,12 +11503,12 @@ public LayoutBase(global::CppSharp.Parser.AST.LayoutBase other) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11687,12 +11696,12 @@ public ClassLayout(global::CppSharp.Parser.AST.ClassLayout _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12084,7 +12093,7 @@ public Class(global::CppSharp.Parser.AST.Class _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12505,7 +12514,7 @@ public Template(global::CppSharp.Parser.AST.Template _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12674,7 +12683,7 @@ public TypeAliasTemplate(global::CppSharp.Parser.AST.TypeAliasTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12795,7 +12804,7 @@ public TemplateParameter(global::CppSharp.Parser.AST.TemplateParameter _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12962,7 +12971,7 @@ public TemplateTemplateParameter(global::CppSharp.Parser.AST.TemplateTemplatePar partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13123,7 +13132,7 @@ public TypeTemplateParameter(global::CppSharp.Parser.AST.TypeTemplateParameter _ partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13265,7 +13274,7 @@ public NonTypeTemplateParameter(global::CppSharp.Parser.AST.NonTypeTemplateParam partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13486,7 +13495,7 @@ public ClassTemplate(global::CppSharp.Parser.AST.ClassTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13698,7 +13707,7 @@ public ClassTemplateSpecialization(global::CppSharp.Parser.AST.ClassTemplateSpec partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13902,7 +13911,7 @@ public ClassTemplatePartialSpecialization(global::CppSharp.Parser.AST.ClassTempl partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14038,7 +14047,7 @@ public FunctionTemplate(global::CppSharp.Parser.AST.FunctionTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14209,12 +14218,12 @@ public FunctionTemplateSpecialization(global::CppSharp.Parser.AST.FunctionTempla public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14423,7 +14432,7 @@ public VarTemplate(global::CppSharp.Parser.AST.VarTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14612,7 +14621,7 @@ public VarTemplateSpecialization(global::CppSharp.Parser.AST.VarTemplateSpeciali partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14793,7 +14802,7 @@ public VarTemplatePartialSpecialization(global::CppSharp.Parser.AST.VarTemplateP partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14911,7 +14920,7 @@ public UnresolvedUsingTypename(global::CppSharp.Parser.AST.UnresolvedUsingTypena partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15041,7 +15050,7 @@ public Namespace(global::CppSharp.Parser.AST.Namespace _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15165,12 +15174,12 @@ public PreprocessedEntity(global::CppSharp.Parser.AST.PreprocessedEntity _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15310,7 +15319,7 @@ public MacroDefinition(global::CppSharp.Parser.AST.MacroDefinition _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15466,7 +15475,7 @@ public MacroExpansion(global::CppSharp.Parser.AST.MacroExpansion _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15653,7 +15662,7 @@ public TranslationUnit(global::CppSharp.Parser.AST.TranslationUnit _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15840,12 +15849,12 @@ public ASTContext(global::CppSharp.Parser.AST.ASTContext _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16148,12 +16157,12 @@ public Stmt(global::CppSharp.Parser.AST.Stmt _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16325,7 +16334,7 @@ public DeclStmt(global::CppSharp.Parser.AST.DeclStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16608,7 +16617,7 @@ public CompoundStmt(global::CppSharp.Parser.AST.CompoundStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -18966,7 +18975,7 @@ public AsmStmt(global::CppSharp.Parser.AST.AsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19277,12 +19286,12 @@ public AsmStringPiece(global::CppSharp.Parser.AST.GCCAsmStmt.AsmStringPiece _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19428,7 +19437,7 @@ public GCCAsmStmt(global::CppSharp.Parser.AST.GCCAsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19554,7 +19563,7 @@ public MSAsmStmt(global::CppSharp.Parser.AST.MSAsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -20255,12 +20264,12 @@ public Capture(global::CppSharp.Parser.AST.CapturedStmt.Capture _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -20416,7 +20425,7 @@ public CapturedStmt(global::CppSharp.Parser.AST.CapturedStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -21279,12 +21288,12 @@ public CtorArgs(global::CppSharp.Parser.AST.CoroutineBodyStmt.CtorArgs _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -22107,12 +22116,12 @@ public Classification(global::CppSharp.Parser.AST.Expr.Classification _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -23860,7 +23869,7 @@ public StringLiteral(global::CppSharp.Parser.AST.StringLiteral _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -25233,7 +25242,7 @@ public CallExpr(global::CppSharp.Parser.AST.CallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -26539,7 +26548,7 @@ public BinaryOperator(global::CppSharp.Parser.AST.BinaryOperator _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -26929,7 +26938,7 @@ public CompoundAssignOperator(global::CppSharp.Parser.AST.CompoundAssignOperator partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -28812,12 +28821,12 @@ public Designator(global::CppSharp.Parser.AST.DesignatedInitExpr.Designator _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -29068,12 +29077,12 @@ public FieldDesignator(global::CppSharp.Parser.AST.DesignatedInitExpr.FieldDesig public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -29178,12 +29187,12 @@ public ArrayOrRangeDesignator(global::CppSharp.Parser.AST.DesignatedInitExpr.Arr public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31346,7 +31355,7 @@ public CXXOperatorCallExpr(global::CppSharp.Parser.AST.CXXOperatorCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31523,7 +31532,7 @@ public CXXMemberCallExpr(global::CppSharp.Parser.AST.CXXMemberCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31675,7 +31684,7 @@ public CUDAKernelCallExpr(global::CppSharp.Parser.AST.CUDAKernelCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -32450,7 +32459,7 @@ public UserDefinedLiteral(global::CppSharp.Parser.AST.UserDefinedLiteral _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -33366,7 +33375,7 @@ public CXXUuidofExpr(global::CppSharp.Parser.AST.CXXUuidofExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34172,7 +34181,7 @@ public CXXConstructExpr(global::CppSharp.Parser.AST.CXXConstructExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34714,7 +34723,7 @@ public CXXTemporaryObjectExpr(global::CppSharp.Parser.AST.CXXTemporaryObjectExpr partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34850,7 +34859,7 @@ public LambdaExpr(global::CppSharp.Parser.AST.LambdaExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -35256,7 +35265,7 @@ public CXXNewExpr(global::CppSharp.Parser.AST.CXXNewExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -36398,12 +36407,12 @@ public FindResult(global::CppSharp.Parser.AST.OverloadExpr.FindResult _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -37155,7 +37164,7 @@ public CXXUnresolvedConstructExpr(global::CppSharp.Parser.AST.CXXUnresolvedConst partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -38663,12 +38672,12 @@ public ExtraState(global::CppSharp.Parser.AST.MaterializeTemporaryExpr.ExtraStat public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -39755,12 +39764,12 @@ public ParserTargetInfo(global::CppSharp.Parser.ParserTargetInfo _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -40641,12 +40650,12 @@ public CppParserOptions(global::CppSharp.Parser.CppParserOptions _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41182,12 +41191,12 @@ public CppLinkerOptions(global::CppSharp.Parser.CppLinkerOptions _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41381,12 +41390,12 @@ public ParserDiagnostic(global::CppSharp.Parser.ParserDiagnostic _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41595,12 +41604,12 @@ public ParserResult(global::CppSharp.Parser.ParserResult _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41806,12 +41815,12 @@ public ClangParser(global::CppSharp.Parser.ClangParser _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std.cs index c7e2920ad..f6c861347 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std.cs @@ -16,6 +16,7 @@ [assembly:InternalsVisibleTo("CppSharp.CppParser")] #pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required +#pragma warning disable CS9084 // Struct member returns 'this' or other instance members by reference namespace Std { @@ -147,12 +148,12 @@ public Allocator() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -280,12 +281,12 @@ protected CharTraits(void* native, bool skipVTables = false) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -485,12 +486,12 @@ public BasicString() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs index 076c7153e..110662ddb 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs @@ -14,6 +14,7 @@ [assembly:InternalsVisibleTo("CppSharp.Parser")] #pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required +#pragma warning disable CS9084 // Struct member returns 'this' or other instance members by reference namespace CppSharp { @@ -187,12 +188,12 @@ public NativeLibrary(global::CppSharp.Parser.AST.NativeLibrary _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -378,12 +379,12 @@ public Comment(global::CppSharp.Parser.AST.Comment _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -602,7 +603,7 @@ public FullComment(global::CppSharp.Parser.AST.FullComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -850,7 +851,7 @@ public ParagraphComment(global::CppSharp.Parser.AST.ParagraphComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1043,12 +1044,12 @@ public Argument(global::CppSharp.Parser.AST.BlockCommandComment.Argument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1151,7 +1152,7 @@ public BlockCommandComment(global::CppSharp.Parser.AST.BlockCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1323,7 +1324,7 @@ public ParamCommandComment(global::CppSharp.Parser.AST.ParamCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1462,7 +1463,7 @@ public TParamCommandComment(global::CppSharp.Parser.AST.TParamCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1589,7 +1590,7 @@ public VerbatimBlockLineComment(global::CppSharp.Parser.AST.VerbatimBlockLineCom partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1716,7 +1717,7 @@ public VerbatimBlockComment(global::CppSharp.Parser.AST.VerbatimBlockComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1847,7 +1848,7 @@ public VerbatimLineComment(global::CppSharp.Parser.AST.VerbatimLineComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2018,12 +2019,12 @@ public Argument(global::CppSharp.Parser.AST.InlineCommandComment.Argument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2117,7 +2118,7 @@ public InlineCommandComment(global::CppSharp.Parser.AST.InlineCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2416,12 +2417,12 @@ public Attribute(global::CppSharp.Parser.AST.HTMLStartTagComment.Attribute _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2529,7 +2530,7 @@ public HTMLStartTagComment(global::CppSharp.Parser.AST.HTMLStartTagComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2673,7 +2674,7 @@ public HTMLEndTagComment(global::CppSharp.Parser.AST.HTMLEndTagComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2786,7 +2787,7 @@ public TextComment(global::CppSharp.Parser.AST.TextComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2918,12 +2919,12 @@ public RawComment(global::CppSharp.Parser.AST.RawComment _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3017,7 +3018,7 @@ public partial struct __Internal } private SourceLocation.__Internal __instance; - internal SourceLocation.__Internal __Instance => __instance; + internal ref SourceLocation.__Internal __Instance => ref __instance; internal static SourceLocation __CreateInstance(__IntPtr native, bool skipVTables = false) { @@ -3040,6 +3041,14 @@ private SourceLocation(void* native, bool skipVTables = false) : this() __instance = *(global::CppSharp.Parser.SourceLocation.__Internal*) native; } + public SourceLocation() + { + fixed (__Internal* __instancePtr = &__instance) + { + __Internal.ctor(new __IntPtr(__instancePtr)); + } + } + public SourceLocation(uint ID) : this() { @@ -3175,12 +3184,12 @@ public SourceRange() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3402,12 +3411,12 @@ public Type(global::CppSharp.Parser.AST.Type _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3543,12 +3552,12 @@ public TypeQualifiers() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3695,12 +3704,12 @@ public QualifiedType(global::CppSharp.Parser.AST.QualifiedType _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4082,7 +4091,7 @@ public FunctionType(global::CppSharp.Parser.AST.FunctionType _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4826,12 +4835,12 @@ public TemplateArgument(global::CppSharp.Parser.AST.TemplateArgument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4997,7 +5006,7 @@ public TemplateSpecializationType(global::CppSharp.Parser.AST.TemplateSpecializa partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5167,7 +5176,7 @@ public DependentTemplateSpecializationType(global::CppSharp.Parser.AST.Dependent partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5313,7 +5322,7 @@ public TemplateParameterType(global::CppSharp.Parser.AST.TemplateParameterType _ partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5688,7 +5697,7 @@ public DependentNameType(global::CppSharp.Parser.AST.DependentNameType _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -6574,12 +6583,12 @@ public Declaration(global::CppSharp.Parser.AST.Declaration _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7147,7 +7156,7 @@ public DeclarationContext(global::CppSharp.Parser.AST.DeclarationContext _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7554,7 +7563,7 @@ public TypedefNameDecl(global::CppSharp.Parser.AST.TypedefNameDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7693,7 +7702,7 @@ public TypedefDecl(global::CppSharp.Parser.AST.TypedefDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7813,7 +7822,7 @@ public TypeAlias(global::CppSharp.Parser.AST.TypeAlias _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7946,7 +7955,7 @@ public Friend(global::CppSharp.Parser.AST.Friend _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8082,12 +8091,12 @@ public StatementObsolete(global::CppSharp.Parser.AST.StatementObsolete _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8232,7 +8241,7 @@ public ExpressionObsolete(global::CppSharp.Parser.AST.ExpressionObsolete _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8344,7 +8353,7 @@ public BinaryOperatorObsolete(global::CppSharp.Parser.AST.BinaryOperatorObsolete partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8503,7 +8512,7 @@ public CallExprObsolete(global::CppSharp.Parser.AST.CallExprObsolete _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8650,7 +8659,7 @@ public CXXConstructExprObsolete(global::CppSharp.Parser.AST.CXXConstructExprObso partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8804,7 +8813,7 @@ public Parameter(global::CppSharp.Parser.AST.Parameter _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9047,7 +9056,7 @@ public Function(global::CppSharp.Parser.AST.Function _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9507,7 +9516,7 @@ public Method(global::CppSharp.Parser.AST.Method _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9878,7 +9887,7 @@ public Item(global::CppSharp.Parser.AST.Enumeration.Item _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9985,7 +9994,7 @@ public Enumeration(global::CppSharp.Parser.AST.Enumeration _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10189,7 +10198,7 @@ public Variable(global::CppSharp.Parser.AST.Variable _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10357,12 +10366,12 @@ public BaseClassSpecifier(global::CppSharp.Parser.AST.BaseClassSpecifier _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10535,7 +10544,7 @@ public Field(global::CppSharp.Parser.AST.Field _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10708,7 +10717,7 @@ public AccessSpecifierDecl(global::CppSharp.Parser.AST.AccessSpecifierDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10819,12 +10828,12 @@ public VTableComponent(global::CppSharp.Parser.AST.VTableComponent _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10989,12 +10998,12 @@ public VTableLayout(global::CppSharp.Parser.AST.VTableLayout _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11141,12 +11150,12 @@ public VFTableInfo(global::CppSharp.Parser.AST.VFTableInfo _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11318,12 +11327,12 @@ public LayoutField(global::CppSharp.Parser.AST.LayoutField other) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11494,12 +11503,12 @@ public LayoutBase(global::CppSharp.Parser.AST.LayoutBase other) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11687,12 +11696,12 @@ public ClassLayout(global::CppSharp.Parser.AST.ClassLayout _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12084,7 +12093,7 @@ public Class(global::CppSharp.Parser.AST.Class _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12505,7 +12514,7 @@ public Template(global::CppSharp.Parser.AST.Template _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12674,7 +12683,7 @@ public TypeAliasTemplate(global::CppSharp.Parser.AST.TypeAliasTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12795,7 +12804,7 @@ public TemplateParameter(global::CppSharp.Parser.AST.TemplateParameter _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12962,7 +12971,7 @@ public TemplateTemplateParameter(global::CppSharp.Parser.AST.TemplateTemplatePar partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13123,7 +13132,7 @@ public TypeTemplateParameter(global::CppSharp.Parser.AST.TypeTemplateParameter _ partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13265,7 +13274,7 @@ public NonTypeTemplateParameter(global::CppSharp.Parser.AST.NonTypeTemplateParam partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13486,7 +13495,7 @@ public ClassTemplate(global::CppSharp.Parser.AST.ClassTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13698,7 +13707,7 @@ public ClassTemplateSpecialization(global::CppSharp.Parser.AST.ClassTemplateSpec partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13902,7 +13911,7 @@ public ClassTemplatePartialSpecialization(global::CppSharp.Parser.AST.ClassTempl partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14038,7 +14047,7 @@ public FunctionTemplate(global::CppSharp.Parser.AST.FunctionTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14209,12 +14218,12 @@ public FunctionTemplateSpecialization(global::CppSharp.Parser.AST.FunctionTempla public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14423,7 +14432,7 @@ public VarTemplate(global::CppSharp.Parser.AST.VarTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14612,7 +14621,7 @@ public VarTemplateSpecialization(global::CppSharp.Parser.AST.VarTemplateSpeciali partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14793,7 +14802,7 @@ public VarTemplatePartialSpecialization(global::CppSharp.Parser.AST.VarTemplateP partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14911,7 +14920,7 @@ public UnresolvedUsingTypename(global::CppSharp.Parser.AST.UnresolvedUsingTypena partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15042,7 +15051,7 @@ public Namespace(global::CppSharp.Parser.AST.Namespace _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15166,12 +15175,12 @@ public PreprocessedEntity(global::CppSharp.Parser.AST.PreprocessedEntity _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15311,7 +15320,7 @@ public MacroDefinition(global::CppSharp.Parser.AST.MacroDefinition _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15467,7 +15476,7 @@ public MacroExpansion(global::CppSharp.Parser.AST.MacroExpansion _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15655,7 +15664,7 @@ public TranslationUnit(global::CppSharp.Parser.AST.TranslationUnit _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15842,12 +15851,12 @@ public ASTContext(global::CppSharp.Parser.AST.ASTContext _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16150,12 +16159,12 @@ public Stmt(global::CppSharp.Parser.AST.Stmt _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16327,7 +16336,7 @@ public DeclStmt(global::CppSharp.Parser.AST.DeclStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16610,7 +16619,7 @@ public CompoundStmt(global::CppSharp.Parser.AST.CompoundStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -18968,7 +18977,7 @@ public AsmStmt(global::CppSharp.Parser.AST.AsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19279,12 +19288,12 @@ public AsmStringPiece(global::CppSharp.Parser.AST.GCCAsmStmt.AsmStringPiece _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19430,7 +19439,7 @@ public GCCAsmStmt(global::CppSharp.Parser.AST.GCCAsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19556,7 +19565,7 @@ public MSAsmStmt(global::CppSharp.Parser.AST.MSAsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -20257,12 +20266,12 @@ public Capture(global::CppSharp.Parser.AST.CapturedStmt.Capture _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -20418,7 +20427,7 @@ public CapturedStmt(global::CppSharp.Parser.AST.CapturedStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -21281,12 +21290,12 @@ public CtorArgs(global::CppSharp.Parser.AST.CoroutineBodyStmt.CtorArgs _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -22109,12 +22118,12 @@ public Classification(global::CppSharp.Parser.AST.Expr.Classification _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -23864,7 +23873,7 @@ public StringLiteral(global::CppSharp.Parser.AST.StringLiteral _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -25237,7 +25246,7 @@ public CallExpr(global::CppSharp.Parser.AST.CallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -26543,7 +26552,7 @@ public BinaryOperator(global::CppSharp.Parser.AST.BinaryOperator _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -26933,7 +26942,7 @@ public CompoundAssignOperator(global::CppSharp.Parser.AST.CompoundAssignOperator partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -28817,12 +28826,12 @@ public Designator(global::CppSharp.Parser.AST.DesignatedInitExpr.Designator _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -29073,12 +29082,12 @@ public FieldDesignator(global::CppSharp.Parser.AST.DesignatedInitExpr.FieldDesig public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -29183,12 +29192,12 @@ public ArrayOrRangeDesignator(global::CppSharp.Parser.AST.DesignatedInitExpr.Arr public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31351,7 +31360,7 @@ public CXXOperatorCallExpr(global::CppSharp.Parser.AST.CXXOperatorCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31528,7 +31537,7 @@ public CXXMemberCallExpr(global::CppSharp.Parser.AST.CXXMemberCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31680,7 +31689,7 @@ public CUDAKernelCallExpr(global::CppSharp.Parser.AST.CUDAKernelCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -32455,7 +32464,7 @@ public UserDefinedLiteral(global::CppSharp.Parser.AST.UserDefinedLiteral _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -33373,7 +33382,7 @@ public CXXUuidofExpr(global::CppSharp.Parser.AST.CXXUuidofExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34179,7 +34188,7 @@ public CXXConstructExpr(global::CppSharp.Parser.AST.CXXConstructExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34722,7 +34731,7 @@ public CXXTemporaryObjectExpr(global::CppSharp.Parser.AST.CXXTemporaryObjectExpr partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34858,7 +34867,7 @@ public LambdaExpr(global::CppSharp.Parser.AST.LambdaExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -35264,7 +35273,7 @@ public CXXNewExpr(global::CppSharp.Parser.AST.CXXNewExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -36408,12 +36417,12 @@ public FindResult(global::CppSharp.Parser.AST.OverloadExpr.FindResult _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -37165,7 +37174,7 @@ public CXXUnresolvedConstructExpr(global::CppSharp.Parser.AST.CXXUnresolvedConst partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -38674,12 +38683,12 @@ public ExtraState(global::CppSharp.Parser.AST.MaterializeTemporaryExpr.ExtraStat public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -39766,12 +39775,12 @@ public ParserTargetInfo(global::CppSharp.Parser.ParserTargetInfo _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -40652,12 +40661,12 @@ public CppParserOptions(global::CppSharp.Parser.CppParserOptions _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41193,12 +41202,12 @@ public CppLinkerOptions(global::CppSharp.Parser.CppLinkerOptions _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41392,12 +41401,12 @@ public ParserDiagnostic(global::CppSharp.Parser.ParserDiagnostic _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41606,12 +41615,12 @@ public ParserResult(global::CppSharp.Parser.ParserResult _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41817,12 +41826,12 @@ public ClangParser(global::CppSharp.Parser.ClangParser _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Std.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Std.cs index 7ebca0dad..e44bd1f9e 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Std.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Std.cs @@ -16,6 +16,7 @@ [assembly:InternalsVisibleTo("CppSharp.CppParser")] #pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required +#pragma warning disable CS9084 // Struct member returns 'this' or other instance members by reference namespace Std { @@ -160,17 +161,26 @@ public Allocator() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; NativeToManagedMap.TryRemove(__Instance, out _); DisposePartial(disposing); + if (callNativeDtor) + { + var ___Ty = typeof(_Ty); + if (___Ty.IsAssignableFrom(typeof(sbyte))) + { + return; + } + throw new ArgumentOutOfRangeException("_Ty", string.Join(", ", new[] { typeof(_Ty).FullName }), "global::Std.Allocator<_Ty> maps a C++ template class and therefore it only supports a limited set of types and their subclasses: ."); + } if (__ownsNativeInstance) Marshal.FreeHGlobal(__Instance); __Instance = IntPtr.Zero; @@ -299,12 +309,12 @@ public BasicString() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -431,12 +441,12 @@ protected CharTraits(void* native, bool skipVTables = false) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; diff --git a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs index 0aee6b458..66e101cbb 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs @@ -14,6 +14,7 @@ [assembly:InternalsVisibleTo("CppSharp.Parser")] #pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required +#pragma warning disable CS9084 // Struct member returns 'this' or other instance members by reference namespace CppSharp { @@ -187,12 +188,12 @@ public NativeLibrary(global::CppSharp.Parser.AST.NativeLibrary _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -378,12 +379,12 @@ public Comment(global::CppSharp.Parser.AST.Comment _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -602,7 +603,7 @@ public FullComment(global::CppSharp.Parser.AST.FullComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -850,7 +851,7 @@ public ParagraphComment(global::CppSharp.Parser.AST.ParagraphComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1043,12 +1044,12 @@ public Argument(global::CppSharp.Parser.AST.BlockCommandComment.Argument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1151,7 +1152,7 @@ public BlockCommandComment(global::CppSharp.Parser.AST.BlockCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1323,7 +1324,7 @@ public ParamCommandComment(global::CppSharp.Parser.AST.ParamCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1462,7 +1463,7 @@ public TParamCommandComment(global::CppSharp.Parser.AST.TParamCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1589,7 +1590,7 @@ public VerbatimBlockLineComment(global::CppSharp.Parser.AST.VerbatimBlockLineCom partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1716,7 +1717,7 @@ public VerbatimBlockComment(global::CppSharp.Parser.AST.VerbatimBlockComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1847,7 +1848,7 @@ public VerbatimLineComment(global::CppSharp.Parser.AST.VerbatimLineComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2018,12 +2019,12 @@ public Argument(global::CppSharp.Parser.AST.InlineCommandComment.Argument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2117,7 +2118,7 @@ public InlineCommandComment(global::CppSharp.Parser.AST.InlineCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2416,12 +2417,12 @@ public Attribute(global::CppSharp.Parser.AST.HTMLStartTagComment.Attribute _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2529,7 +2530,7 @@ public HTMLStartTagComment(global::CppSharp.Parser.AST.HTMLStartTagComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2673,7 +2674,7 @@ public HTMLEndTagComment(global::CppSharp.Parser.AST.HTMLEndTagComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2786,7 +2787,7 @@ public TextComment(global::CppSharp.Parser.AST.TextComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2918,12 +2919,12 @@ public RawComment(global::CppSharp.Parser.AST.RawComment _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3017,7 +3018,7 @@ public partial struct __Internal } private SourceLocation.__Internal __instance; - internal SourceLocation.__Internal __Instance => __instance; + internal ref SourceLocation.__Internal __Instance => ref __instance; internal static SourceLocation __CreateInstance(__IntPtr native, bool skipVTables = false) { @@ -3040,6 +3041,14 @@ private SourceLocation(void* native, bool skipVTables = false) : this() __instance = *(global::CppSharp.Parser.SourceLocation.__Internal*) native; } + public SourceLocation() + { + fixed (__Internal* __instancePtr = &__instance) + { + __Internal.ctor(new __IntPtr(__instancePtr)); + } + } + public SourceLocation(uint ID) : this() { @@ -3175,12 +3184,12 @@ public SourceRange() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3402,12 +3411,12 @@ public Type(global::CppSharp.Parser.AST.Type _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3543,12 +3552,12 @@ public TypeQualifiers() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3695,12 +3704,12 @@ public QualifiedType(global::CppSharp.Parser.AST.QualifiedType _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4082,7 +4091,7 @@ public FunctionType(global::CppSharp.Parser.AST.FunctionType _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4826,12 +4835,12 @@ public TemplateArgument(global::CppSharp.Parser.AST.TemplateArgument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4997,7 +5006,7 @@ public TemplateSpecializationType(global::CppSharp.Parser.AST.TemplateSpecializa partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5167,7 +5176,7 @@ public DependentTemplateSpecializationType(global::CppSharp.Parser.AST.Dependent partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5313,7 +5322,7 @@ public TemplateParameterType(global::CppSharp.Parser.AST.TemplateParameterType _ partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5688,7 +5697,7 @@ public DependentNameType(global::CppSharp.Parser.AST.DependentNameType _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -6574,12 +6583,12 @@ public Declaration(global::CppSharp.Parser.AST.Declaration _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7147,7 +7156,7 @@ public DeclarationContext(global::CppSharp.Parser.AST.DeclarationContext _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7554,7 +7563,7 @@ public TypedefNameDecl(global::CppSharp.Parser.AST.TypedefNameDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7693,7 +7702,7 @@ public TypedefDecl(global::CppSharp.Parser.AST.TypedefDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7813,7 +7822,7 @@ public TypeAlias(global::CppSharp.Parser.AST.TypeAlias _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7946,7 +7955,7 @@ public Friend(global::CppSharp.Parser.AST.Friend _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8082,12 +8091,12 @@ public StatementObsolete(global::CppSharp.Parser.AST.StatementObsolete _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8232,7 +8241,7 @@ public ExpressionObsolete(global::CppSharp.Parser.AST.ExpressionObsolete _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8344,7 +8353,7 @@ public BinaryOperatorObsolete(global::CppSharp.Parser.AST.BinaryOperatorObsolete partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8503,7 +8512,7 @@ public CallExprObsolete(global::CppSharp.Parser.AST.CallExprObsolete _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8650,7 +8659,7 @@ public CXXConstructExprObsolete(global::CppSharp.Parser.AST.CXXConstructExprObso partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8804,7 +8813,7 @@ public Parameter(global::CppSharp.Parser.AST.Parameter _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9047,7 +9056,7 @@ public Function(global::CppSharp.Parser.AST.Function _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9507,7 +9516,7 @@ public Method(global::CppSharp.Parser.AST.Method _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9878,7 +9887,7 @@ public Item(global::CppSharp.Parser.AST.Enumeration.Item _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9985,7 +9994,7 @@ public Enumeration(global::CppSharp.Parser.AST.Enumeration _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10189,7 +10198,7 @@ public Variable(global::CppSharp.Parser.AST.Variable _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10357,12 +10366,12 @@ public BaseClassSpecifier(global::CppSharp.Parser.AST.BaseClassSpecifier _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10535,7 +10544,7 @@ public Field(global::CppSharp.Parser.AST.Field _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10708,7 +10717,7 @@ public AccessSpecifierDecl(global::CppSharp.Parser.AST.AccessSpecifierDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10819,12 +10828,12 @@ public VTableComponent(global::CppSharp.Parser.AST.VTableComponent _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10989,12 +10998,12 @@ public VTableLayout(global::CppSharp.Parser.AST.VTableLayout _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11140,12 +11149,12 @@ public VFTableInfo(global::CppSharp.Parser.AST.VFTableInfo _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11317,12 +11326,12 @@ public LayoutField(global::CppSharp.Parser.AST.LayoutField other) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11493,12 +11502,12 @@ public LayoutBase(global::CppSharp.Parser.AST.LayoutBase other) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11686,12 +11695,12 @@ public ClassLayout(global::CppSharp.Parser.AST.ClassLayout _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12083,7 +12092,7 @@ public Class(global::CppSharp.Parser.AST.Class _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12504,7 +12513,7 @@ public Template(global::CppSharp.Parser.AST.Template _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12673,7 +12682,7 @@ public TypeAliasTemplate(global::CppSharp.Parser.AST.TypeAliasTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12794,7 +12803,7 @@ public TemplateParameter(global::CppSharp.Parser.AST.TemplateParameter _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12961,7 +12970,7 @@ public TemplateTemplateParameter(global::CppSharp.Parser.AST.TemplateTemplatePar partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13122,7 +13131,7 @@ public TypeTemplateParameter(global::CppSharp.Parser.AST.TypeTemplateParameter _ partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13264,7 +13273,7 @@ public NonTypeTemplateParameter(global::CppSharp.Parser.AST.NonTypeTemplateParam partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13485,7 +13494,7 @@ public ClassTemplate(global::CppSharp.Parser.AST.ClassTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13697,7 +13706,7 @@ public ClassTemplateSpecialization(global::CppSharp.Parser.AST.ClassTemplateSpec partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13901,7 +13910,7 @@ public ClassTemplatePartialSpecialization(global::CppSharp.Parser.AST.ClassTempl partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14037,7 +14046,7 @@ public FunctionTemplate(global::CppSharp.Parser.AST.FunctionTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14208,12 +14217,12 @@ public FunctionTemplateSpecialization(global::CppSharp.Parser.AST.FunctionTempla public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14422,7 +14431,7 @@ public VarTemplate(global::CppSharp.Parser.AST.VarTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14611,7 +14620,7 @@ public VarTemplateSpecialization(global::CppSharp.Parser.AST.VarTemplateSpeciali partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14792,7 +14801,7 @@ public VarTemplatePartialSpecialization(global::CppSharp.Parser.AST.VarTemplateP partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14910,7 +14919,7 @@ public UnresolvedUsingTypename(global::CppSharp.Parser.AST.UnresolvedUsingTypena partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15040,7 +15049,7 @@ public Namespace(global::CppSharp.Parser.AST.Namespace _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15164,12 +15173,12 @@ public PreprocessedEntity(global::CppSharp.Parser.AST.PreprocessedEntity _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15309,7 +15318,7 @@ public MacroDefinition(global::CppSharp.Parser.AST.MacroDefinition _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15465,7 +15474,7 @@ public MacroExpansion(global::CppSharp.Parser.AST.MacroExpansion _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15652,7 +15661,7 @@ public TranslationUnit(global::CppSharp.Parser.AST.TranslationUnit _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15839,12 +15848,12 @@ public ASTContext(global::CppSharp.Parser.AST.ASTContext _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16147,12 +16156,12 @@ public Stmt(global::CppSharp.Parser.AST.Stmt _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16324,7 +16333,7 @@ public DeclStmt(global::CppSharp.Parser.AST.DeclStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16607,7 +16616,7 @@ public CompoundStmt(global::CppSharp.Parser.AST.CompoundStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -18965,7 +18974,7 @@ public AsmStmt(global::CppSharp.Parser.AST.AsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19276,12 +19285,12 @@ public AsmStringPiece(global::CppSharp.Parser.AST.GCCAsmStmt.AsmStringPiece _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19427,7 +19436,7 @@ public GCCAsmStmt(global::CppSharp.Parser.AST.GCCAsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19553,7 +19562,7 @@ public MSAsmStmt(global::CppSharp.Parser.AST.MSAsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -20254,12 +20263,12 @@ public Capture(global::CppSharp.Parser.AST.CapturedStmt.Capture _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -20415,7 +20424,7 @@ public CapturedStmt(global::CppSharp.Parser.AST.CapturedStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -21278,12 +21287,12 @@ public CtorArgs(global::CppSharp.Parser.AST.CoroutineBodyStmt.CtorArgs _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -22106,12 +22115,12 @@ public Classification(global::CppSharp.Parser.AST.Expr.Classification _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -23859,7 +23868,7 @@ public StringLiteral(global::CppSharp.Parser.AST.StringLiteral _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -25232,7 +25241,7 @@ public CallExpr(global::CppSharp.Parser.AST.CallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -26538,7 +26547,7 @@ public BinaryOperator(global::CppSharp.Parser.AST.BinaryOperator _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -26928,7 +26937,7 @@ public CompoundAssignOperator(global::CppSharp.Parser.AST.CompoundAssignOperator partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -28811,12 +28820,12 @@ public Designator(global::CppSharp.Parser.AST.DesignatedInitExpr.Designator _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -29067,12 +29076,12 @@ public FieldDesignator(global::CppSharp.Parser.AST.DesignatedInitExpr.FieldDesig public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -29177,12 +29186,12 @@ public ArrayOrRangeDesignator(global::CppSharp.Parser.AST.DesignatedInitExpr.Arr public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31345,7 +31354,7 @@ public CXXOperatorCallExpr(global::CppSharp.Parser.AST.CXXOperatorCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31522,7 +31531,7 @@ public CXXMemberCallExpr(global::CppSharp.Parser.AST.CXXMemberCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31674,7 +31683,7 @@ public CUDAKernelCallExpr(global::CppSharp.Parser.AST.CUDAKernelCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -32449,7 +32458,7 @@ public UserDefinedLiteral(global::CppSharp.Parser.AST.UserDefinedLiteral _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -33365,7 +33374,7 @@ public CXXUuidofExpr(global::CppSharp.Parser.AST.CXXUuidofExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34171,7 +34180,7 @@ public CXXConstructExpr(global::CppSharp.Parser.AST.CXXConstructExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34713,7 +34722,7 @@ public CXXTemporaryObjectExpr(global::CppSharp.Parser.AST.CXXTemporaryObjectExpr partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34849,7 +34858,7 @@ public LambdaExpr(global::CppSharp.Parser.AST.LambdaExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -35255,7 +35264,7 @@ public CXXNewExpr(global::CppSharp.Parser.AST.CXXNewExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -36397,12 +36406,12 @@ public FindResult(global::CppSharp.Parser.AST.OverloadExpr.FindResult _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -37154,7 +37163,7 @@ public CXXUnresolvedConstructExpr(global::CppSharp.Parser.AST.CXXUnresolvedConst partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -38662,12 +38671,12 @@ public ExtraState(global::CppSharp.Parser.AST.MaterializeTemporaryExpr.ExtraStat public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -39754,12 +39763,12 @@ public ParserTargetInfo(global::CppSharp.Parser.ParserTargetInfo _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -40640,12 +40649,12 @@ public CppParserOptions(global::CppSharp.Parser.CppParserOptions _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41181,12 +41190,12 @@ public CppLinkerOptions(global::CppSharp.Parser.CppLinkerOptions _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41380,12 +41389,12 @@ public ParserDiagnostic(global::CppSharp.Parser.ParserDiagnostic _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41594,12 +41603,12 @@ public ParserResult(global::CppSharp.Parser.ParserResult _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41805,12 +41814,12 @@ public ClangParser(global::CppSharp.Parser.ClangParser _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; diff --git a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std.cs b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std.cs index 086462296..3f7910977 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std.cs @@ -16,6 +16,7 @@ [assembly:InternalsVisibleTo("CppSharp.CppParser")] #pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required +#pragma warning disable CS9084 // Struct member returns 'this' or other instance members by reference namespace Std { @@ -147,12 +148,12 @@ public Allocator() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -280,12 +281,12 @@ protected CharTraits(void* native, bool skipVTables = false) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -485,12 +486,12 @@ public BasicString() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs index 5c0c7a9d4..95c942de4 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs @@ -14,6 +14,7 @@ [assembly:InternalsVisibleTo("CppSharp.Parser")] #pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required +#pragma warning disable CS9084 // Struct member returns 'this' or other instance members by reference namespace CppSharp { @@ -187,12 +188,12 @@ public NativeLibrary(global::CppSharp.Parser.AST.NativeLibrary _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -378,12 +379,12 @@ public Comment(global::CppSharp.Parser.AST.Comment _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -602,7 +603,7 @@ public FullComment(global::CppSharp.Parser.AST.FullComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -850,7 +851,7 @@ public ParagraphComment(global::CppSharp.Parser.AST.ParagraphComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1043,12 +1044,12 @@ public Argument(global::CppSharp.Parser.AST.BlockCommandComment.Argument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1151,7 +1152,7 @@ public BlockCommandComment(global::CppSharp.Parser.AST.BlockCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1323,7 +1324,7 @@ public ParamCommandComment(global::CppSharp.Parser.AST.ParamCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1462,7 +1463,7 @@ public TParamCommandComment(global::CppSharp.Parser.AST.TParamCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1589,7 +1590,7 @@ public VerbatimBlockLineComment(global::CppSharp.Parser.AST.VerbatimBlockLineCom partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1716,7 +1717,7 @@ public VerbatimBlockComment(global::CppSharp.Parser.AST.VerbatimBlockComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1847,7 +1848,7 @@ public VerbatimLineComment(global::CppSharp.Parser.AST.VerbatimLineComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2018,12 +2019,12 @@ public Argument(global::CppSharp.Parser.AST.InlineCommandComment.Argument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2117,7 +2118,7 @@ public InlineCommandComment(global::CppSharp.Parser.AST.InlineCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2416,12 +2417,12 @@ public Attribute(global::CppSharp.Parser.AST.HTMLStartTagComment.Attribute _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2529,7 +2530,7 @@ public HTMLStartTagComment(global::CppSharp.Parser.AST.HTMLStartTagComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2673,7 +2674,7 @@ public HTMLEndTagComment(global::CppSharp.Parser.AST.HTMLEndTagComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2786,7 +2787,7 @@ public TextComment(global::CppSharp.Parser.AST.TextComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2918,12 +2919,12 @@ public RawComment(global::CppSharp.Parser.AST.RawComment _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3017,7 +3018,7 @@ public partial struct __Internal } private SourceLocation.__Internal __instance; - internal SourceLocation.__Internal __Instance => __instance; + internal ref SourceLocation.__Internal __Instance => ref __instance; internal static SourceLocation __CreateInstance(__IntPtr native, bool skipVTables = false) { @@ -3040,6 +3041,14 @@ private SourceLocation(void* native, bool skipVTables = false) : this() __instance = *(global::CppSharp.Parser.SourceLocation.__Internal*) native; } + public SourceLocation() + { + fixed (__Internal* __instancePtr = &__instance) + { + __Internal.ctor(new __IntPtr(__instancePtr)); + } + } + public SourceLocation(uint ID) : this() { @@ -3175,12 +3184,12 @@ public SourceRange() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3402,12 +3411,12 @@ public Type(global::CppSharp.Parser.AST.Type _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3543,12 +3552,12 @@ public TypeQualifiers() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3695,12 +3704,12 @@ public QualifiedType(global::CppSharp.Parser.AST.QualifiedType _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4082,7 +4091,7 @@ public FunctionType(global::CppSharp.Parser.AST.FunctionType _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4826,12 +4835,12 @@ public TemplateArgument(global::CppSharp.Parser.AST.TemplateArgument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4997,7 +5006,7 @@ public TemplateSpecializationType(global::CppSharp.Parser.AST.TemplateSpecializa partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5167,7 +5176,7 @@ public DependentTemplateSpecializationType(global::CppSharp.Parser.AST.Dependent partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5313,7 +5322,7 @@ public TemplateParameterType(global::CppSharp.Parser.AST.TemplateParameterType _ partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5688,7 +5697,7 @@ public DependentNameType(global::CppSharp.Parser.AST.DependentNameType _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -6574,12 +6583,12 @@ public Declaration(global::CppSharp.Parser.AST.Declaration _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7147,7 +7156,7 @@ public DeclarationContext(global::CppSharp.Parser.AST.DeclarationContext _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7554,7 +7563,7 @@ public TypedefNameDecl(global::CppSharp.Parser.AST.TypedefNameDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7693,7 +7702,7 @@ public TypedefDecl(global::CppSharp.Parser.AST.TypedefDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7813,7 +7822,7 @@ public TypeAlias(global::CppSharp.Parser.AST.TypeAlias _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7946,7 +7955,7 @@ public Friend(global::CppSharp.Parser.AST.Friend _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8082,12 +8091,12 @@ public StatementObsolete(global::CppSharp.Parser.AST.StatementObsolete _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8232,7 +8241,7 @@ public ExpressionObsolete(global::CppSharp.Parser.AST.ExpressionObsolete _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8344,7 +8353,7 @@ public BinaryOperatorObsolete(global::CppSharp.Parser.AST.BinaryOperatorObsolete partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8503,7 +8512,7 @@ public CallExprObsolete(global::CppSharp.Parser.AST.CallExprObsolete _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8650,7 +8659,7 @@ public CXXConstructExprObsolete(global::CppSharp.Parser.AST.CXXConstructExprObso partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8804,7 +8813,7 @@ public Parameter(global::CppSharp.Parser.AST.Parameter _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9047,7 +9056,7 @@ public Function(global::CppSharp.Parser.AST.Function _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9507,7 +9516,7 @@ public Method(global::CppSharp.Parser.AST.Method _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9878,7 +9887,7 @@ public Item(global::CppSharp.Parser.AST.Enumeration.Item _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9985,7 +9994,7 @@ public Enumeration(global::CppSharp.Parser.AST.Enumeration _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10189,7 +10198,7 @@ public Variable(global::CppSharp.Parser.AST.Variable _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10357,12 +10366,12 @@ public BaseClassSpecifier(global::CppSharp.Parser.AST.BaseClassSpecifier _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10535,7 +10544,7 @@ public Field(global::CppSharp.Parser.AST.Field _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10708,7 +10717,7 @@ public AccessSpecifierDecl(global::CppSharp.Parser.AST.AccessSpecifierDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10819,12 +10828,12 @@ public VTableComponent(global::CppSharp.Parser.AST.VTableComponent _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10989,12 +10998,12 @@ public VTableLayout(global::CppSharp.Parser.AST.VTableLayout _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11140,12 +11149,12 @@ public VFTableInfo(global::CppSharp.Parser.AST.VFTableInfo _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11317,12 +11326,12 @@ public LayoutField(global::CppSharp.Parser.AST.LayoutField other) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11493,12 +11502,12 @@ public LayoutBase(global::CppSharp.Parser.AST.LayoutBase other) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11686,12 +11695,12 @@ public ClassLayout(global::CppSharp.Parser.AST.ClassLayout _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12083,7 +12092,7 @@ public Class(global::CppSharp.Parser.AST.Class _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12504,7 +12513,7 @@ public Template(global::CppSharp.Parser.AST.Template _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12673,7 +12682,7 @@ public TypeAliasTemplate(global::CppSharp.Parser.AST.TypeAliasTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12794,7 +12803,7 @@ public TemplateParameter(global::CppSharp.Parser.AST.TemplateParameter _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12961,7 +12970,7 @@ public TemplateTemplateParameter(global::CppSharp.Parser.AST.TemplateTemplatePar partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13122,7 +13131,7 @@ public TypeTemplateParameter(global::CppSharp.Parser.AST.TypeTemplateParameter _ partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13264,7 +13273,7 @@ public NonTypeTemplateParameter(global::CppSharp.Parser.AST.NonTypeTemplateParam partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13485,7 +13494,7 @@ public ClassTemplate(global::CppSharp.Parser.AST.ClassTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13697,7 +13706,7 @@ public ClassTemplateSpecialization(global::CppSharp.Parser.AST.ClassTemplateSpec partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13901,7 +13910,7 @@ public ClassTemplatePartialSpecialization(global::CppSharp.Parser.AST.ClassTempl partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14037,7 +14046,7 @@ public FunctionTemplate(global::CppSharp.Parser.AST.FunctionTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14208,12 +14217,12 @@ public FunctionTemplateSpecialization(global::CppSharp.Parser.AST.FunctionTempla public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14422,7 +14431,7 @@ public VarTemplate(global::CppSharp.Parser.AST.VarTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14611,7 +14620,7 @@ public VarTemplateSpecialization(global::CppSharp.Parser.AST.VarTemplateSpeciali partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14792,7 +14801,7 @@ public VarTemplatePartialSpecialization(global::CppSharp.Parser.AST.VarTemplateP partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14910,7 +14919,7 @@ public UnresolvedUsingTypename(global::CppSharp.Parser.AST.UnresolvedUsingTypena partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15040,7 +15049,7 @@ public Namespace(global::CppSharp.Parser.AST.Namespace _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15164,12 +15173,12 @@ public PreprocessedEntity(global::CppSharp.Parser.AST.PreprocessedEntity _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15309,7 +15318,7 @@ public MacroDefinition(global::CppSharp.Parser.AST.MacroDefinition _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15465,7 +15474,7 @@ public MacroExpansion(global::CppSharp.Parser.AST.MacroExpansion _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15652,7 +15661,7 @@ public TranslationUnit(global::CppSharp.Parser.AST.TranslationUnit _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15839,12 +15848,12 @@ public ASTContext(global::CppSharp.Parser.AST.ASTContext _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16147,12 +16156,12 @@ public Stmt(global::CppSharp.Parser.AST.Stmt _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16324,7 +16333,7 @@ public DeclStmt(global::CppSharp.Parser.AST.DeclStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16607,7 +16616,7 @@ public CompoundStmt(global::CppSharp.Parser.AST.CompoundStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -18965,7 +18974,7 @@ public AsmStmt(global::CppSharp.Parser.AST.AsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19276,12 +19285,12 @@ public AsmStringPiece(global::CppSharp.Parser.AST.GCCAsmStmt.AsmStringPiece _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19427,7 +19436,7 @@ public GCCAsmStmt(global::CppSharp.Parser.AST.GCCAsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19553,7 +19562,7 @@ public MSAsmStmt(global::CppSharp.Parser.AST.MSAsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -20254,12 +20263,12 @@ public Capture(global::CppSharp.Parser.AST.CapturedStmt.Capture _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -20415,7 +20424,7 @@ public CapturedStmt(global::CppSharp.Parser.AST.CapturedStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -21278,12 +21287,12 @@ public CtorArgs(global::CppSharp.Parser.AST.CoroutineBodyStmt.CtorArgs _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -22106,12 +22115,12 @@ public Classification(global::CppSharp.Parser.AST.Expr.Classification _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -23859,7 +23868,7 @@ public StringLiteral(global::CppSharp.Parser.AST.StringLiteral _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -25232,7 +25241,7 @@ public CallExpr(global::CppSharp.Parser.AST.CallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -26538,7 +26547,7 @@ public BinaryOperator(global::CppSharp.Parser.AST.BinaryOperator _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -26928,7 +26937,7 @@ public CompoundAssignOperator(global::CppSharp.Parser.AST.CompoundAssignOperator partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -28811,12 +28820,12 @@ public Designator(global::CppSharp.Parser.AST.DesignatedInitExpr.Designator _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -29067,12 +29076,12 @@ public FieldDesignator(global::CppSharp.Parser.AST.DesignatedInitExpr.FieldDesig public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -29177,12 +29186,12 @@ public ArrayOrRangeDesignator(global::CppSharp.Parser.AST.DesignatedInitExpr.Arr public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31345,7 +31354,7 @@ public CXXOperatorCallExpr(global::CppSharp.Parser.AST.CXXOperatorCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31522,7 +31531,7 @@ public CXXMemberCallExpr(global::CppSharp.Parser.AST.CXXMemberCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31674,7 +31683,7 @@ public CUDAKernelCallExpr(global::CppSharp.Parser.AST.CUDAKernelCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -32449,7 +32458,7 @@ public UserDefinedLiteral(global::CppSharp.Parser.AST.UserDefinedLiteral _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -33365,7 +33374,7 @@ public CXXUuidofExpr(global::CppSharp.Parser.AST.CXXUuidofExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34171,7 +34180,7 @@ public CXXConstructExpr(global::CppSharp.Parser.AST.CXXConstructExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34713,7 +34722,7 @@ public CXXTemporaryObjectExpr(global::CppSharp.Parser.AST.CXXTemporaryObjectExpr partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34849,7 +34858,7 @@ public LambdaExpr(global::CppSharp.Parser.AST.LambdaExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -35255,7 +35264,7 @@ public CXXNewExpr(global::CppSharp.Parser.AST.CXXNewExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -36397,12 +36406,12 @@ public FindResult(global::CppSharp.Parser.AST.OverloadExpr.FindResult _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -37154,7 +37163,7 @@ public CXXUnresolvedConstructExpr(global::CppSharp.Parser.AST.CXXUnresolvedConst partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -38662,12 +38671,12 @@ public ExtraState(global::CppSharp.Parser.AST.MaterializeTemporaryExpr.ExtraStat public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -39754,12 +39763,12 @@ public ParserTargetInfo(global::CppSharp.Parser.ParserTargetInfo _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -40640,12 +40649,12 @@ public CppParserOptions(global::CppSharp.Parser.CppParserOptions _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41181,12 +41190,12 @@ public CppLinkerOptions(global::CppSharp.Parser.CppLinkerOptions _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41380,12 +41389,12 @@ public ParserDiagnostic(global::CppSharp.Parser.ParserDiagnostic _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41594,12 +41603,12 @@ public ParserResult(global::CppSharp.Parser.ParserResult _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41805,12 +41814,12 @@ public ClangParser(global::CppSharp.Parser.ClangParser _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std.cs index cdf0bbf78..640bb868c 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std.cs @@ -16,6 +16,7 @@ [assembly:InternalsVisibleTo("CppSharp.CppParser")] #pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required +#pragma warning disable CS9084 // Struct member returns 'this' or other instance members by reference namespace Std { @@ -113,12 +114,12 @@ public Allocator() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -305,12 +306,12 @@ protected CharTraits(void* native, bool skipVTables = false) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -457,12 +458,12 @@ public BasicString() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs index 58d27ea06..3799d088f 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs @@ -14,6 +14,7 @@ [assembly:InternalsVisibleTo("CppSharp.Parser")] #pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required +#pragma warning disable CS9084 // Struct member returns 'this' or other instance members by reference namespace CppSharp { @@ -187,12 +188,12 @@ public NativeLibrary(global::CppSharp.Parser.AST.NativeLibrary _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -378,12 +379,12 @@ public Comment(global::CppSharp.Parser.AST.Comment _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -602,7 +603,7 @@ public FullComment(global::CppSharp.Parser.AST.FullComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -850,7 +851,7 @@ public ParagraphComment(global::CppSharp.Parser.AST.ParagraphComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1043,12 +1044,12 @@ public Argument(global::CppSharp.Parser.AST.BlockCommandComment.Argument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1151,7 +1152,7 @@ public BlockCommandComment(global::CppSharp.Parser.AST.BlockCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1323,7 +1324,7 @@ public ParamCommandComment(global::CppSharp.Parser.AST.ParamCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1462,7 +1463,7 @@ public TParamCommandComment(global::CppSharp.Parser.AST.TParamCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1589,7 +1590,7 @@ public VerbatimBlockLineComment(global::CppSharp.Parser.AST.VerbatimBlockLineCom partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1716,7 +1717,7 @@ public VerbatimBlockComment(global::CppSharp.Parser.AST.VerbatimBlockComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1847,7 +1848,7 @@ public VerbatimLineComment(global::CppSharp.Parser.AST.VerbatimLineComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2018,12 +2019,12 @@ public Argument(global::CppSharp.Parser.AST.InlineCommandComment.Argument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2117,7 +2118,7 @@ public InlineCommandComment(global::CppSharp.Parser.AST.InlineCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2416,12 +2417,12 @@ public Attribute(global::CppSharp.Parser.AST.HTMLStartTagComment.Attribute _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2529,7 +2530,7 @@ public HTMLStartTagComment(global::CppSharp.Parser.AST.HTMLStartTagComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2673,7 +2674,7 @@ public HTMLEndTagComment(global::CppSharp.Parser.AST.HTMLEndTagComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2786,7 +2787,7 @@ public TextComment(global::CppSharp.Parser.AST.TextComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2918,12 +2919,12 @@ public RawComment(global::CppSharp.Parser.AST.RawComment _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3017,7 +3018,7 @@ public partial struct __Internal } private SourceLocation.__Internal __instance; - internal SourceLocation.__Internal __Instance => __instance; + internal ref SourceLocation.__Internal __Instance => ref __instance; internal static SourceLocation __CreateInstance(__IntPtr native, bool skipVTables = false) { @@ -3040,6 +3041,14 @@ private SourceLocation(void* native, bool skipVTables = false) : this() __instance = *(global::CppSharp.Parser.SourceLocation.__Internal*) native; } + public SourceLocation() + { + fixed (__Internal* __instancePtr = &__instance) + { + __Internal.ctor(new __IntPtr(__instancePtr)); + } + } + public SourceLocation(uint ID) : this() { @@ -3175,12 +3184,12 @@ public SourceRange() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3402,12 +3411,12 @@ public Type(global::CppSharp.Parser.AST.Type _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3543,12 +3552,12 @@ public TypeQualifiers() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3695,12 +3704,12 @@ public QualifiedType(global::CppSharp.Parser.AST.QualifiedType _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4082,7 +4091,7 @@ public FunctionType(global::CppSharp.Parser.AST.FunctionType _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4826,12 +4835,12 @@ public TemplateArgument(global::CppSharp.Parser.AST.TemplateArgument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4997,7 +5006,7 @@ public TemplateSpecializationType(global::CppSharp.Parser.AST.TemplateSpecializa partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5167,7 +5176,7 @@ public DependentTemplateSpecializationType(global::CppSharp.Parser.AST.Dependent partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5313,7 +5322,7 @@ public TemplateParameterType(global::CppSharp.Parser.AST.TemplateParameterType _ partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5688,7 +5697,7 @@ public DependentNameType(global::CppSharp.Parser.AST.DependentNameType _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -6574,12 +6583,12 @@ public Declaration(global::CppSharp.Parser.AST.Declaration _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7147,7 +7156,7 @@ public DeclarationContext(global::CppSharp.Parser.AST.DeclarationContext _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7554,7 +7563,7 @@ public TypedefNameDecl(global::CppSharp.Parser.AST.TypedefNameDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7693,7 +7702,7 @@ public TypedefDecl(global::CppSharp.Parser.AST.TypedefDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7813,7 +7822,7 @@ public TypeAlias(global::CppSharp.Parser.AST.TypeAlias _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7946,7 +7955,7 @@ public Friend(global::CppSharp.Parser.AST.Friend _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8082,12 +8091,12 @@ public StatementObsolete(global::CppSharp.Parser.AST.StatementObsolete _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8232,7 +8241,7 @@ public ExpressionObsolete(global::CppSharp.Parser.AST.ExpressionObsolete _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8344,7 +8353,7 @@ public BinaryOperatorObsolete(global::CppSharp.Parser.AST.BinaryOperatorObsolete partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8503,7 +8512,7 @@ public CallExprObsolete(global::CppSharp.Parser.AST.CallExprObsolete _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8650,7 +8659,7 @@ public CXXConstructExprObsolete(global::CppSharp.Parser.AST.CXXConstructExprObso partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8804,7 +8813,7 @@ public Parameter(global::CppSharp.Parser.AST.Parameter _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9047,7 +9056,7 @@ public Function(global::CppSharp.Parser.AST.Function _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9507,7 +9516,7 @@ public Method(global::CppSharp.Parser.AST.Method _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9878,7 +9887,7 @@ public Item(global::CppSharp.Parser.AST.Enumeration.Item _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9985,7 +9994,7 @@ public Enumeration(global::CppSharp.Parser.AST.Enumeration _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10189,7 +10198,7 @@ public Variable(global::CppSharp.Parser.AST.Variable _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10357,12 +10366,12 @@ public BaseClassSpecifier(global::CppSharp.Parser.AST.BaseClassSpecifier _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10535,7 +10544,7 @@ public Field(global::CppSharp.Parser.AST.Field _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10708,7 +10717,7 @@ public AccessSpecifierDecl(global::CppSharp.Parser.AST.AccessSpecifierDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10819,12 +10828,12 @@ public VTableComponent(global::CppSharp.Parser.AST.VTableComponent _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10989,12 +10998,12 @@ public VTableLayout(global::CppSharp.Parser.AST.VTableLayout _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11140,12 +11149,12 @@ public VFTableInfo(global::CppSharp.Parser.AST.VFTableInfo _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11317,12 +11326,12 @@ public LayoutField(global::CppSharp.Parser.AST.LayoutField other) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11493,12 +11502,12 @@ public LayoutBase(global::CppSharp.Parser.AST.LayoutBase other) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11686,12 +11695,12 @@ public ClassLayout(global::CppSharp.Parser.AST.ClassLayout _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12083,7 +12092,7 @@ public Class(global::CppSharp.Parser.AST.Class _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12504,7 +12513,7 @@ public Template(global::CppSharp.Parser.AST.Template _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12673,7 +12682,7 @@ public TypeAliasTemplate(global::CppSharp.Parser.AST.TypeAliasTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12794,7 +12803,7 @@ public TemplateParameter(global::CppSharp.Parser.AST.TemplateParameter _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12961,7 +12970,7 @@ public TemplateTemplateParameter(global::CppSharp.Parser.AST.TemplateTemplatePar partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13122,7 +13131,7 @@ public TypeTemplateParameter(global::CppSharp.Parser.AST.TypeTemplateParameter _ partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13264,7 +13273,7 @@ public NonTypeTemplateParameter(global::CppSharp.Parser.AST.NonTypeTemplateParam partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13485,7 +13494,7 @@ public ClassTemplate(global::CppSharp.Parser.AST.ClassTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13697,7 +13706,7 @@ public ClassTemplateSpecialization(global::CppSharp.Parser.AST.ClassTemplateSpec partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13901,7 +13910,7 @@ public ClassTemplatePartialSpecialization(global::CppSharp.Parser.AST.ClassTempl partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14037,7 +14046,7 @@ public FunctionTemplate(global::CppSharp.Parser.AST.FunctionTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14208,12 +14217,12 @@ public FunctionTemplateSpecialization(global::CppSharp.Parser.AST.FunctionTempla public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14422,7 +14431,7 @@ public VarTemplate(global::CppSharp.Parser.AST.VarTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14611,7 +14620,7 @@ public VarTemplateSpecialization(global::CppSharp.Parser.AST.VarTemplateSpeciali partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14792,7 +14801,7 @@ public VarTemplatePartialSpecialization(global::CppSharp.Parser.AST.VarTemplateP partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14910,7 +14919,7 @@ public UnresolvedUsingTypename(global::CppSharp.Parser.AST.UnresolvedUsingTypena partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15040,7 +15049,7 @@ public Namespace(global::CppSharp.Parser.AST.Namespace _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15164,12 +15173,12 @@ public PreprocessedEntity(global::CppSharp.Parser.AST.PreprocessedEntity _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15309,7 +15318,7 @@ public MacroDefinition(global::CppSharp.Parser.AST.MacroDefinition _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15465,7 +15474,7 @@ public MacroExpansion(global::CppSharp.Parser.AST.MacroExpansion _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15652,7 +15661,7 @@ public TranslationUnit(global::CppSharp.Parser.AST.TranslationUnit _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15839,12 +15848,12 @@ public ASTContext(global::CppSharp.Parser.AST.ASTContext _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16147,12 +16156,12 @@ public Stmt(global::CppSharp.Parser.AST.Stmt _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16324,7 +16333,7 @@ public DeclStmt(global::CppSharp.Parser.AST.DeclStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16607,7 +16616,7 @@ public CompoundStmt(global::CppSharp.Parser.AST.CompoundStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -18965,7 +18974,7 @@ public AsmStmt(global::CppSharp.Parser.AST.AsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19276,12 +19285,12 @@ public AsmStringPiece(global::CppSharp.Parser.AST.GCCAsmStmt.AsmStringPiece _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19427,7 +19436,7 @@ public GCCAsmStmt(global::CppSharp.Parser.AST.GCCAsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19553,7 +19562,7 @@ public MSAsmStmt(global::CppSharp.Parser.AST.MSAsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -20254,12 +20263,12 @@ public Capture(global::CppSharp.Parser.AST.CapturedStmt.Capture _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -20415,7 +20424,7 @@ public CapturedStmt(global::CppSharp.Parser.AST.CapturedStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -21278,12 +21287,12 @@ public CtorArgs(global::CppSharp.Parser.AST.CoroutineBodyStmt.CtorArgs _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -22106,12 +22115,12 @@ public Classification(global::CppSharp.Parser.AST.Expr.Classification _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -23859,7 +23868,7 @@ public StringLiteral(global::CppSharp.Parser.AST.StringLiteral _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -25232,7 +25241,7 @@ public CallExpr(global::CppSharp.Parser.AST.CallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -26538,7 +26547,7 @@ public BinaryOperator(global::CppSharp.Parser.AST.BinaryOperator _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -26928,7 +26937,7 @@ public CompoundAssignOperator(global::CppSharp.Parser.AST.CompoundAssignOperator partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -28811,12 +28820,12 @@ public Designator(global::CppSharp.Parser.AST.DesignatedInitExpr.Designator _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -29067,12 +29076,12 @@ public FieldDesignator(global::CppSharp.Parser.AST.DesignatedInitExpr.FieldDesig public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -29177,12 +29186,12 @@ public ArrayOrRangeDesignator(global::CppSharp.Parser.AST.DesignatedInitExpr.Arr public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31345,7 +31354,7 @@ public CXXOperatorCallExpr(global::CppSharp.Parser.AST.CXXOperatorCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31522,7 +31531,7 @@ public CXXMemberCallExpr(global::CppSharp.Parser.AST.CXXMemberCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31674,7 +31683,7 @@ public CUDAKernelCallExpr(global::CppSharp.Parser.AST.CUDAKernelCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -32449,7 +32458,7 @@ public UserDefinedLiteral(global::CppSharp.Parser.AST.UserDefinedLiteral _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -33365,7 +33374,7 @@ public CXXUuidofExpr(global::CppSharp.Parser.AST.CXXUuidofExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34171,7 +34180,7 @@ public CXXConstructExpr(global::CppSharp.Parser.AST.CXXConstructExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34713,7 +34722,7 @@ public CXXTemporaryObjectExpr(global::CppSharp.Parser.AST.CXXTemporaryObjectExpr partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34849,7 +34858,7 @@ public LambdaExpr(global::CppSharp.Parser.AST.LambdaExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -35255,7 +35264,7 @@ public CXXNewExpr(global::CppSharp.Parser.AST.CXXNewExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -36397,12 +36406,12 @@ public FindResult(global::CppSharp.Parser.AST.OverloadExpr.FindResult _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -37154,7 +37163,7 @@ public CXXUnresolvedConstructExpr(global::CppSharp.Parser.AST.CXXUnresolvedConst partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -38662,12 +38671,12 @@ public ExtraState(global::CppSharp.Parser.AST.MaterializeTemporaryExpr.ExtraStat public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -39754,12 +39763,12 @@ public ParserTargetInfo(global::CppSharp.Parser.ParserTargetInfo _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -40640,12 +40649,12 @@ public CppParserOptions(global::CppSharp.Parser.CppParserOptions _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41181,12 +41190,12 @@ public CppLinkerOptions(global::CppSharp.Parser.CppLinkerOptions _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41380,12 +41389,12 @@ public ParserDiagnostic(global::CppSharp.Parser.ParserDiagnostic _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41594,12 +41603,12 @@ public ParserResult(global::CppSharp.Parser.ParserResult _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41805,12 +41814,12 @@ public ClangParser(global::CppSharp.Parser.ClangParser _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std.cs index 91785e9fd..55496aa49 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std.cs @@ -16,6 +16,7 @@ [assembly:InternalsVisibleTo("CppSharp.CppParser")] #pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required +#pragma warning disable CS9084 // Struct member returns 'this' or other instance members by reference namespace Std { @@ -113,12 +114,12 @@ public Allocator() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -305,12 +306,12 @@ protected CharTraits(void* native, bool skipVTables = false) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -433,12 +434,12 @@ public BasicString() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; diff --git a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs index e8e7233f1..7664bbf6d 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs @@ -14,6 +14,7 @@ [assembly:InternalsVisibleTo("CppSharp.Parser")] #pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required +#pragma warning disable CS9084 // Struct member returns 'this' or other instance members by reference namespace CppSharp { @@ -187,12 +188,12 @@ public NativeLibrary(global::CppSharp.Parser.AST.NativeLibrary _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -378,12 +379,12 @@ public Comment(global::CppSharp.Parser.AST.Comment _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -602,7 +603,7 @@ public FullComment(global::CppSharp.Parser.AST.FullComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -850,7 +851,7 @@ public ParagraphComment(global::CppSharp.Parser.AST.ParagraphComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1043,12 +1044,12 @@ public Argument(global::CppSharp.Parser.AST.BlockCommandComment.Argument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1151,7 +1152,7 @@ public BlockCommandComment(global::CppSharp.Parser.AST.BlockCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1323,7 +1324,7 @@ public ParamCommandComment(global::CppSharp.Parser.AST.ParamCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1462,7 +1463,7 @@ public TParamCommandComment(global::CppSharp.Parser.AST.TParamCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1589,7 +1590,7 @@ public VerbatimBlockLineComment(global::CppSharp.Parser.AST.VerbatimBlockLineCom partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1716,7 +1717,7 @@ public VerbatimBlockComment(global::CppSharp.Parser.AST.VerbatimBlockComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -1847,7 +1848,7 @@ public VerbatimLineComment(global::CppSharp.Parser.AST.VerbatimLineComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2018,12 +2019,12 @@ public Argument(global::CppSharp.Parser.AST.InlineCommandComment.Argument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2117,7 +2118,7 @@ public InlineCommandComment(global::CppSharp.Parser.AST.InlineCommandComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2416,12 +2417,12 @@ public Attribute(global::CppSharp.Parser.AST.HTMLStartTagComment.Attribute _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2529,7 +2530,7 @@ public HTMLStartTagComment(global::CppSharp.Parser.AST.HTMLStartTagComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2673,7 +2674,7 @@ public HTMLEndTagComment(global::CppSharp.Parser.AST.HTMLEndTagComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2786,7 +2787,7 @@ public TextComment(global::CppSharp.Parser.AST.TextComment _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -2918,12 +2919,12 @@ public RawComment(global::CppSharp.Parser.AST.RawComment _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3017,7 +3018,7 @@ public partial struct __Internal } private SourceLocation.__Internal __instance; - internal SourceLocation.__Internal __Instance => __instance; + internal ref SourceLocation.__Internal __Instance => ref __instance; internal static SourceLocation __CreateInstance(__IntPtr native, bool skipVTables = false) { @@ -3040,6 +3041,14 @@ private SourceLocation(void* native, bool skipVTables = false) : this() __instance = *(global::CppSharp.Parser.SourceLocation.__Internal*) native; } + public SourceLocation() + { + fixed (__Internal* __instancePtr = &__instance) + { + __Internal.ctor(new __IntPtr(__instancePtr)); + } + } + public SourceLocation(uint ID) : this() { @@ -3175,12 +3184,12 @@ public SourceRange() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3402,12 +3411,12 @@ public Type(global::CppSharp.Parser.AST.Type _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3543,12 +3552,12 @@ public TypeQualifiers() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -3695,12 +3704,12 @@ public QualifiedType(global::CppSharp.Parser.AST.QualifiedType _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4082,7 +4091,7 @@ public FunctionType(global::CppSharp.Parser.AST.FunctionType _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4826,12 +4835,12 @@ public TemplateArgument(global::CppSharp.Parser.AST.TemplateArgument _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -4997,7 +5006,7 @@ public TemplateSpecializationType(global::CppSharp.Parser.AST.TemplateSpecializa partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5167,7 +5176,7 @@ public DependentTemplateSpecializationType(global::CppSharp.Parser.AST.Dependent partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5313,7 +5322,7 @@ public TemplateParameterType(global::CppSharp.Parser.AST.TemplateParameterType _ partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -5688,7 +5697,7 @@ public DependentNameType(global::CppSharp.Parser.AST.DependentNameType _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -6574,12 +6583,12 @@ public Declaration(global::CppSharp.Parser.AST.Declaration _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7147,7 +7156,7 @@ public DeclarationContext(global::CppSharp.Parser.AST.DeclarationContext _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7554,7 +7563,7 @@ public TypedefNameDecl(global::CppSharp.Parser.AST.TypedefNameDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7693,7 +7702,7 @@ public TypedefDecl(global::CppSharp.Parser.AST.TypedefDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7813,7 +7822,7 @@ public TypeAlias(global::CppSharp.Parser.AST.TypeAlias _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -7946,7 +7955,7 @@ public Friend(global::CppSharp.Parser.AST.Friend _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8082,12 +8091,12 @@ public StatementObsolete(global::CppSharp.Parser.AST.StatementObsolete _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8232,7 +8241,7 @@ public ExpressionObsolete(global::CppSharp.Parser.AST.ExpressionObsolete _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8344,7 +8353,7 @@ public BinaryOperatorObsolete(global::CppSharp.Parser.AST.BinaryOperatorObsolete partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8503,7 +8512,7 @@ public CallExprObsolete(global::CppSharp.Parser.AST.CallExprObsolete _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8650,7 +8659,7 @@ public CXXConstructExprObsolete(global::CppSharp.Parser.AST.CXXConstructExprObso partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -8804,7 +8813,7 @@ public Parameter(global::CppSharp.Parser.AST.Parameter _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9047,7 +9056,7 @@ public Function(global::CppSharp.Parser.AST.Function _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9507,7 +9516,7 @@ public Method(global::CppSharp.Parser.AST.Method _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9879,7 +9888,7 @@ public Item(global::CppSharp.Parser.AST.Enumeration.Item _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -9986,7 +9995,7 @@ public Enumeration(global::CppSharp.Parser.AST.Enumeration _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10190,7 +10199,7 @@ public Variable(global::CppSharp.Parser.AST.Variable _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10358,12 +10367,12 @@ public BaseClassSpecifier(global::CppSharp.Parser.AST.BaseClassSpecifier _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10536,7 +10545,7 @@ public Field(global::CppSharp.Parser.AST.Field _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10709,7 +10718,7 @@ public AccessSpecifierDecl(global::CppSharp.Parser.AST.AccessSpecifierDecl _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10820,12 +10829,12 @@ public VTableComponent(global::CppSharp.Parser.AST.VTableComponent _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -10990,12 +10999,12 @@ public VTableLayout(global::CppSharp.Parser.AST.VTableLayout _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11142,12 +11151,12 @@ public VFTableInfo(global::CppSharp.Parser.AST.VFTableInfo _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11319,12 +11328,12 @@ public LayoutField(global::CppSharp.Parser.AST.LayoutField other) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11495,12 +11504,12 @@ public LayoutBase(global::CppSharp.Parser.AST.LayoutBase other) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -11688,12 +11697,12 @@ public ClassLayout(global::CppSharp.Parser.AST.ClassLayout _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12085,7 +12094,7 @@ public Class(global::CppSharp.Parser.AST.Class _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12506,7 +12515,7 @@ public Template(global::CppSharp.Parser.AST.Template _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12675,7 +12684,7 @@ public TypeAliasTemplate(global::CppSharp.Parser.AST.TypeAliasTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12796,7 +12805,7 @@ public TemplateParameter(global::CppSharp.Parser.AST.TemplateParameter _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -12963,7 +12972,7 @@ public TemplateTemplateParameter(global::CppSharp.Parser.AST.TemplateTemplatePar partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13124,7 +13133,7 @@ public TypeTemplateParameter(global::CppSharp.Parser.AST.TypeTemplateParameter _ partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13266,7 +13275,7 @@ public NonTypeTemplateParameter(global::CppSharp.Parser.AST.NonTypeTemplateParam partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13487,7 +13496,7 @@ public ClassTemplate(global::CppSharp.Parser.AST.ClassTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13699,7 +13708,7 @@ public ClassTemplateSpecialization(global::CppSharp.Parser.AST.ClassTemplateSpec partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -13903,7 +13912,7 @@ public ClassTemplatePartialSpecialization(global::CppSharp.Parser.AST.ClassTempl partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14039,7 +14048,7 @@ public FunctionTemplate(global::CppSharp.Parser.AST.FunctionTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14210,12 +14219,12 @@ public FunctionTemplateSpecialization(global::CppSharp.Parser.AST.FunctionTempla public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14424,7 +14433,7 @@ public VarTemplate(global::CppSharp.Parser.AST.VarTemplate _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14613,7 +14622,7 @@ public VarTemplateSpecialization(global::CppSharp.Parser.AST.VarTemplateSpeciali partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14794,7 +14803,7 @@ public VarTemplatePartialSpecialization(global::CppSharp.Parser.AST.VarTemplateP partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -14912,7 +14921,7 @@ public UnresolvedUsingTypename(global::CppSharp.Parser.AST.UnresolvedUsingTypena partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15043,7 +15052,7 @@ public Namespace(global::CppSharp.Parser.AST.Namespace _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15167,12 +15176,12 @@ public PreprocessedEntity(global::CppSharp.Parser.AST.PreprocessedEntity _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15312,7 +15321,7 @@ public MacroDefinition(global::CppSharp.Parser.AST.MacroDefinition _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15468,7 +15477,7 @@ public MacroExpansion(global::CppSharp.Parser.AST.MacroExpansion _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15656,7 +15665,7 @@ public TranslationUnit(global::CppSharp.Parser.AST.TranslationUnit _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -15843,12 +15852,12 @@ public ASTContext(global::CppSharp.Parser.AST.ASTContext _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16151,12 +16160,12 @@ public Stmt(global::CppSharp.Parser.AST.Stmt _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16328,7 +16337,7 @@ public DeclStmt(global::CppSharp.Parser.AST.DeclStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -16611,7 +16620,7 @@ public CompoundStmt(global::CppSharp.Parser.AST.CompoundStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -18969,7 +18978,7 @@ public AsmStmt(global::CppSharp.Parser.AST.AsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19280,12 +19289,12 @@ public AsmStringPiece(global::CppSharp.Parser.AST.GCCAsmStmt.AsmStringPiece _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19431,7 +19440,7 @@ public GCCAsmStmt(global::CppSharp.Parser.AST.GCCAsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -19557,7 +19566,7 @@ public MSAsmStmt(global::CppSharp.Parser.AST.MSAsmStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -20258,12 +20267,12 @@ public Capture(global::CppSharp.Parser.AST.CapturedStmt.Capture _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -20419,7 +20428,7 @@ public CapturedStmt(global::CppSharp.Parser.AST.CapturedStmt _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -21282,12 +21291,12 @@ public CtorArgs(global::CppSharp.Parser.AST.CoroutineBodyStmt.CtorArgs _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -22110,12 +22119,12 @@ public Classification(global::CppSharp.Parser.AST.Expr.Classification _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -23869,7 +23878,7 @@ public StringLiteral(global::CppSharp.Parser.AST.StringLiteral _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -25246,7 +25255,7 @@ public CallExpr(global::CppSharp.Parser.AST.CallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -26557,7 +26566,7 @@ public BinaryOperator(global::CppSharp.Parser.AST.BinaryOperator _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -26948,7 +26957,7 @@ public CompoundAssignOperator(global::CppSharp.Parser.AST.CompoundAssignOperator partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -28836,12 +28845,12 @@ public Designator(global::CppSharp.Parser.AST.DesignatedInitExpr.Designator _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -29092,12 +29101,12 @@ public FieldDesignator(global::CppSharp.Parser.AST.DesignatedInitExpr.FieldDesig public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -29202,12 +29211,12 @@ public ArrayOrRangeDesignator(global::CppSharp.Parser.AST.DesignatedInitExpr.Arr public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31373,7 +31382,7 @@ public CXXOperatorCallExpr(global::CppSharp.Parser.AST.CXXOperatorCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31550,7 +31559,7 @@ public CXXMemberCallExpr(global::CppSharp.Parser.AST.CXXMemberCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -31702,7 +31711,7 @@ public CUDAKernelCallExpr(global::CppSharp.Parser.AST.CUDAKernelCallExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -32482,7 +32491,7 @@ public UserDefinedLiteral(global::CppSharp.Parser.AST.UserDefinedLiteral _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -33402,7 +33411,7 @@ public CXXUuidofExpr(global::CppSharp.Parser.AST.CXXUuidofExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34209,7 +34218,7 @@ public CXXConstructExpr(global::CppSharp.Parser.AST.CXXConstructExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34753,7 +34762,7 @@ public CXXTemporaryObjectExpr(global::CppSharp.Parser.AST.CXXTemporaryObjectExpr partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -34889,7 +34898,7 @@ public LambdaExpr(global::CppSharp.Parser.AST.LambdaExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -35296,7 +35305,7 @@ public CXXNewExpr(global::CppSharp.Parser.AST.CXXNewExpr _0) partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -36441,12 +36450,12 @@ public FindResult(global::CppSharp.Parser.AST.OverloadExpr.FindResult _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -37201,7 +37210,7 @@ public CXXUnresolvedConstructExpr(global::CppSharp.Parser.AST.CXXUnresolvedConst partial void DisposePartial(bool disposing); - internal protected override void Dispose(bool disposing, bool callNativeDtor ) + internal protected override void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -38716,12 +38725,12 @@ public ExtraState(global::CppSharp.Parser.AST.MaterializeTemporaryExpr.ExtraStat public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -39811,12 +39820,12 @@ public ParserTargetInfo(global::CppSharp.Parser.ParserTargetInfo _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -40697,12 +40706,12 @@ public CppParserOptions(global::CppSharp.Parser.CppParserOptions _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41238,12 +41247,12 @@ public CppLinkerOptions(global::CppSharp.Parser.CppLinkerOptions _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41437,12 +41446,12 @@ public ParserDiagnostic(global::CppSharp.Parser.ParserDiagnostic _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41651,12 +41660,12 @@ public ParserResult(global::CppSharp.Parser.ParserResult _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -41862,12 +41871,12 @@ public ClangParser(global::CppSharp.Parser.ClangParser _0) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; diff --git a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/Std.cs b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/Std.cs index 8a426d693..a34a2d26e 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/Std.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/Std.cs @@ -16,6 +16,7 @@ [assembly:InternalsVisibleTo("CppSharp.CppParser")] #pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required +#pragma warning disable CS9084 // Struct member returns 'this' or other instance members by reference namespace Std { @@ -160,17 +161,26 @@ public Allocator() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; NativeToManagedMap.TryRemove(__Instance, out _); DisposePartial(disposing); + if (callNativeDtor) + { + var ___Ty = typeof(_Ty); + if (___Ty.IsAssignableFrom(typeof(sbyte))) + { + return; + } + throw new ArgumentOutOfRangeException("_Ty", string.Join(", ", new[] { typeof(_Ty).FullName }), "global::Std.Allocator<_Ty> maps a C++ template class and therefore it only supports a limited set of types and their subclasses: ."); + } if (__ownsNativeInstance) Marshal.FreeHGlobal(__Instance); __Instance = IntPtr.Zero; @@ -299,12 +309,12 @@ public BasicString() public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; @@ -431,12 +441,12 @@ protected CharTraits(void* native, bool skipVTables = false) public void Dispose() { - Dispose(disposing: true, callNativeDtor : __ownsNativeInstance ); + Dispose(disposing: true, callNativeDtor: __ownsNativeInstance); } partial void DisposePartial(bool disposing); - internal protected virtual void Dispose(bool disposing, bool callNativeDtor ) + internal protected virtual void Dispose(bool disposing, bool callNativeDtor) { if (__Instance == IntPtr.Zero) return; From 9071cd2a591d5dcb5c584d2774f60905db12ce56 Mon Sep 17 00:00:00 2001 From: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Sun, 17 Dec 2023 17:03:24 +0200 Subject: [PATCH 28/37] Implement ClassTemplatePartialSpecialization::Parameters (#1809) * Implement ClassTemplatePartialSpecialization::Parameters * Template.cs: Implement ClassTemplatePartialSpecialization.Parameters * GeneratorKind: fix bug introduced while migrating from enum to class * Implement native ClassTemplatePartialSpecialization.Parameters + ASTConverter * regenerated bindings (#1813) * regenerated bindings * regenerated bindings after rebase * Directory.Build.props: support C# 10.0 * Implement native ClassTemplatePartialSpecialization.Parameters + ASTConverter * Regenerated bindings * TestAST.cs: add TestASTClassTemplatePartialSpecialization --- src/AST/Template.cs | 6 +++ src/CppParser/AST.cpp | 2 + src/CppParser/Bindings/CLI/Decl.cpp | 49 +++++++++++++++++++ src/CppParser/Bindings/CLI/Decl.h | 17 +++++++ .../CppSharp.CppParser.cs | 45 ++++++++++++++++- .../i686-pc-win32-msvc/CppSharp.CppParser.cs | 45 ++++++++++++++++- .../CppSharp.CppParser.cs | 45 ++++++++++++++++- .../CppSharp.CppParser.cs | 45 ++++++++++++++++- .../x86_64-linux-gnu/CppSharp.CppParser.cs | 45 ++++++++++++++++- .../CppSharp.CppParser.cs | 45 ++++++++++++++++- src/CppParser/Decl.h | 1 + src/CppParser/Parser.cpp | 2 + src/Generator.Tests/AST/TestAST.cs | 22 +++++++++ src/Parser/ASTConverter.cs | 6 +++ tests/dotnet/Native/AST.h | 11 ++++- 15 files changed, 379 insertions(+), 7 deletions(-) diff --git a/src/AST/Template.cs b/src/AST/Template.cs index e71ee5b81..57cd5c7dc 100644 --- a/src/AST/Template.cs +++ b/src/AST/Template.cs @@ -304,6 +304,12 @@ public override string ToString() /// public class ClassTemplatePartialSpecialization : ClassTemplateSpecialization { + public readonly List Parameters; + + public ClassTemplatePartialSpecialization() + { + Parameters = new List(); + } } /// diff --git a/src/CppParser/AST.cpp b/src/CppParser/AST.cpp index b01cb8deb..1b33cdb8c 100644 --- a/src/CppParser/AST.cpp +++ b/src/CppParser/AST.cpp @@ -793,6 +793,8 @@ ClassTemplatePartialSpecialization::ClassTemplatePartialSpecialization() ClassTemplatePartialSpecialization::~ClassTemplatePartialSpecialization() {} +DEF_VECTOR(ClassTemplatePartialSpecialization, Declaration*, Parameters) + FunctionTemplate::FunctionTemplate() : Template(DeclarationKind::FunctionTemplate) {} FunctionTemplate::~FunctionTemplate() {} diff --git a/src/CppParser/Bindings/CLI/Decl.cpp b/src/CppParser/Bindings/CLI/Decl.cpp index 6afab65ea..58553e540 100644 --- a/src/CppParser/Bindings/CLI/Decl.cpp +++ b/src/CppParser/Bindings/CLI/Decl.cpp @@ -4514,6 +4514,26 @@ CppSharp::Parser::AST::ClassTemplatePartialSpecialization::ClassTemplatePartialS NativePtr = new class ::CppSharp::CppParser::AST::ClassTemplatePartialSpecialization(); } +CppSharp::Parser::AST::Declaration^ CppSharp::Parser::AST::ClassTemplatePartialSpecialization::GetParameters(unsigned int i) +{ + auto ___ret = ((class ::CppSharp::CppParser::AST::ClassTemplatePartialSpecialization*)NativePtr)->getParameters(i); + if (___ret == nullptr) return nullptr; + return (___ret == nullptr) ? nullptr : gcnew ::CppSharp::Parser::AST::Declaration((class ::CppSharp::CppParser::AST::Declaration*)___ret); +} + +void CppSharp::Parser::AST::ClassTemplatePartialSpecialization::AddParameters(CppSharp::Parser::AST::Declaration^ s) +{ + if (ReferenceEquals(s, nullptr)) + throw gcnew ::System::ArgumentNullException("s", "Cannot be null because it is a C++ reference (&)."); + auto __arg0 = (class ::CppSharp::CppParser::AST::Declaration*)s->NativePtr; + ((class ::CppSharp::CppParser::AST::ClassTemplatePartialSpecialization*)NativePtr)->addParameters(__arg0); +} + +void CppSharp::Parser::AST::ClassTemplatePartialSpecialization::ClearParameters() +{ + ((class ::CppSharp::CppParser::AST::ClassTemplatePartialSpecialization*)NativePtr)->clearParameters(); +} + CppSharp::Parser::AST::ClassTemplatePartialSpecialization::ClassTemplatePartialSpecialization(CppSharp::Parser::AST::ClassTemplatePartialSpecialization^ _0) : CppSharp::Parser::AST::ClassTemplateSpecialization((::CppSharp::CppParser::AST::ClassTemplateSpecialization*)nullptr) { @@ -4524,6 +4544,35 @@ CppSharp::Parser::AST::ClassTemplatePartialSpecialization::ClassTemplatePartialS NativePtr = new class ::CppSharp::CppParser::AST::ClassTemplatePartialSpecialization(__arg0); } +::System::Collections::Generic::List^ CppSharp::Parser::AST::ClassTemplatePartialSpecialization::Parameters::get() +{ + auto _tmp__Parameters = gcnew ::System::Collections::Generic::List(); + auto __list0 = ((class ::CppSharp::CppParser::AST::ClassTemplatePartialSpecialization*)NativePtr)->Parameters; + for(auto _element : __list0) + { + auto _marshalElement = (_element == nullptr) ? nullptr : gcnew ::CppSharp::Parser::AST::Declaration((class ::CppSharp::CppParser::AST::Declaration*)_element); + _tmp__Parameters->Add(_marshalElement); + } + return _tmp__Parameters; +} + +void CppSharp::Parser::AST::ClassTemplatePartialSpecialization::Parameters::set(::System::Collections::Generic::List^ value) +{ + auto _tmpvalue = std::vector<::CppSharp::CppParser::AST::Declaration*>(); + for each(CppSharp::Parser::AST::Declaration^ _element in value) + { + auto _marshalElement = (class ::CppSharp::CppParser::AST::Declaration*)_element->NativePtr; + _tmpvalue.push_back(_marshalElement); + } + ((class ::CppSharp::CppParser::AST::ClassTemplatePartialSpecialization*)NativePtr)->Parameters = _tmpvalue; +} + +unsigned int CppSharp::Parser::AST::ClassTemplatePartialSpecialization::ParametersCount::get() +{ + auto ___ret = ((class ::CppSharp::CppParser::AST::ClassTemplatePartialSpecialization*)NativePtr)->getParametersCount(); + return ___ret; +} + CppSharp::Parser::AST::FunctionTemplate::FunctionTemplate(class ::CppSharp::CppParser::AST::FunctionTemplate* native) : CppSharp::Parser::AST::Template((::CppSharp::CppParser::AST::Template*)native) { diff --git a/src/CppParser/Bindings/CLI/Decl.h b/src/CppParser/Bindings/CLI/Decl.h index cfc54e856..107a2aefc 100644 --- a/src/CppParser/Bindings/CLI/Decl.h +++ b/src/CppParser/Bindings/CLI/Decl.h @@ -2205,6 +2205,23 @@ namespace CppSharp ClassTemplatePartialSpecialization(CppSharp::Parser::AST::ClassTemplatePartialSpecialization^ _0); ~ClassTemplatePartialSpecialization(); + + property ::System::Collections::Generic::List^ Parameters + { + ::System::Collections::Generic::List^ get(); + void set(::System::Collections::Generic::List^); + } + + property unsigned int ParametersCount + { + unsigned int get(); + } + + CppSharp::Parser::AST::Declaration^ GetParameters(unsigned int i); + + void AddParameters(CppSharp::Parser::AST::Declaration^ s); + + void ClearParameters(); }; public ref class FunctionTemplate : CppSharp::Parser::AST::Template diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs index 2a5e810ff..2f075705a 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs @@ -13779,7 +13779,7 @@ public uint ArgumentsCount public unsafe partial class ClassTemplatePartialSpecialization : global::CppSharp.Parser.AST.ClassTemplateSpecialization, IDisposable { - [StructLayout(LayoutKind.Sequential, Size = 328)] + [StructLayout(LayoutKind.Sequential, Size = 340)] public new partial struct __Internal { internal global::CppSharp.Parser.AST.DeclarationKind kind; @@ -13834,6 +13834,7 @@ public unsafe partial class ClassTemplatePartialSpecialization : global::CppShar internal __IntPtr templatedDecl; internal global::Std.Vector.__Internalc__N_std_N___1_S_vector____N_CppSharp_N_CppParser_N_AST_S_TemplateArgument___N_std_N___1_S_allocator__S0_ Arguments; internal global::CppSharp.Parser.AST.TemplateSpecializationKind specializationKind; + internal global::Std.Vector.__Internalc__N_std_N___1_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Declaration___N_std_N___1_S_allocator__S0_ Parameters; [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecializationC2Ev", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ctor(__IntPtr __instance); @@ -13843,6 +13844,18 @@ public unsafe partial class ClassTemplatePartialSpecialization : global::CppShar [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecializationD2Ev", CallingConvention = __CallingConvention.Cdecl)] internal static extern void dtor(__IntPtr __instance); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecialization13getParametersEj", CallingConvention = __CallingConvention.Cdecl)] + internal static extern __IntPtr GetParameters(__IntPtr __instance, uint i); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecialization13addParametersERPNS1_11DeclarationE", CallingConvention = __CallingConvention.Cdecl)] + internal static extern void AddParameters(__IntPtr __instance, __IntPtr s); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecialization15clearParametersEv", CallingConvention = __CallingConvention.Cdecl)] + internal static extern void ClearParameters(__IntPtr __instance); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecialization18getParametersCountEv", CallingConvention = __CallingConvention.Cdecl)] + internal static extern uint GetParametersCount(__IntPtr __instance); } internal static new ClassTemplatePartialSpecialization __CreateInstance(__IntPtr native, bool skipVTables = false) @@ -13923,6 +13936,36 @@ internal protected override void Dispose(bool disposing, bool callNativeDtor) Marshal.FreeHGlobal(__Instance); __Instance = IntPtr.Zero; } + + public global::CppSharp.Parser.AST.Declaration GetParameters(uint i) + { + var ___ret = __Internal.GetParameters(__Instance, i); + var __result0 = global::CppSharp.Parser.AST.Declaration.__GetOrCreateInstance(___ret, false); + return __result0; + } + + public void AddParameters(global::CppSharp.Parser.AST.Declaration s) + { + if (ReferenceEquals(s, null)) + throw new global::System.ArgumentNullException("s", "Cannot be null because it is a C++ reference (&)."); + var ____arg0 = s.__Instance; + var __arg0 = new __IntPtr(&____arg0); + __Internal.AddParameters(__Instance, __arg0); + } + + public void ClearParameters() + { + __Internal.ClearParameters(__Instance); + } + + public uint ParametersCount + { + get + { + var ___ret = __Internal.GetParametersCount(__Instance); + return ___ret; + } + } } public unsafe partial class FunctionTemplate : global::CppSharp.Parser.AST.Template, IDisposable diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs index 110662ddb..80f6d22dd 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs @@ -13779,7 +13779,7 @@ public uint ArgumentsCount public unsafe partial class ClassTemplatePartialSpecialization : global::CppSharp.Parser.AST.ClassTemplateSpecialization, IDisposable { - [StructLayout(LayoutKind.Sequential, Size = 360)] + [StructLayout(LayoutKind.Sequential, Size = 372)] public new partial struct __Internal { internal global::CppSharp.Parser.AST.DeclarationKind kind; @@ -13834,6 +13834,7 @@ public unsafe partial class ClassTemplatePartialSpecialization : global::CppShar internal __IntPtr templatedDecl; internal global::Std.Vector.__Internalc__N_std_S_vector____N_CppSharp_N_CppParser_N_AST_S_TemplateArgument___N_std_S_allocator__S0_ Arguments; internal global::CppSharp.Parser.AST.TemplateSpecializationKind specializationKind; + internal global::Std.Vector.__Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Declaration___N_std_S_allocator__S0_ Parameters; [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "??0ClassTemplatePartialSpecialization@AST@CppParser@CppSharp@@QAE@XZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern __IntPtr ctor(__IntPtr __instance); @@ -13843,6 +13844,18 @@ public unsafe partial class ClassTemplatePartialSpecialization : global::CppShar [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "??1ClassTemplatePartialSpecialization@AST@CppParser@CppSharp@@QAE@XZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern void dtor(__IntPtr __instance); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?getParameters@ClassTemplatePartialSpecialization@AST@CppParser@CppSharp@@QAEPAVDeclaration@234@I@Z", CallingConvention = __CallingConvention.ThisCall)] + internal static extern __IntPtr GetParameters(__IntPtr __instance, uint i); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addParameters@ClassTemplatePartialSpecialization@AST@CppParser@CppSharp@@QAEXAAPAVDeclaration@234@@Z", CallingConvention = __CallingConvention.ThisCall)] + internal static extern void AddParameters(__IntPtr __instance, __IntPtr s); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearParameters@ClassTemplatePartialSpecialization@AST@CppParser@CppSharp@@QAEXXZ", CallingConvention = __CallingConvention.ThisCall)] + internal static extern void ClearParameters(__IntPtr __instance); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?getParametersCount@ClassTemplatePartialSpecialization@AST@CppParser@CppSharp@@QAEIXZ", CallingConvention = __CallingConvention.ThisCall)] + internal static extern uint GetParametersCount(__IntPtr __instance); } internal static new ClassTemplatePartialSpecialization __CreateInstance(__IntPtr native, bool skipVTables = false) @@ -13923,6 +13936,36 @@ internal protected override void Dispose(bool disposing, bool callNativeDtor) Marshal.FreeHGlobal(__Instance); __Instance = IntPtr.Zero; } + + public global::CppSharp.Parser.AST.Declaration GetParameters(uint i) + { + var ___ret = __Internal.GetParameters(__Instance, i); + var __result0 = global::CppSharp.Parser.AST.Declaration.__GetOrCreateInstance(___ret, false); + return __result0; + } + + public void AddParameters(global::CppSharp.Parser.AST.Declaration s) + { + if (ReferenceEquals(s, null)) + throw new global::System.ArgumentNullException("s", "Cannot be null because it is a C++ reference (&)."); + var ____arg0 = s.__Instance; + var __arg0 = new __IntPtr(&____arg0); + __Internal.AddParameters(__Instance, __arg0); + } + + public void ClearParameters() + { + __Internal.ClearParameters(__Instance); + } + + public uint ParametersCount + { + get + { + var ___ret = __Internal.GetParametersCount(__Instance); + return ___ret; + } + } } public unsafe partial class FunctionTemplate : global::CppSharp.Parser.AST.Template, IDisposable diff --git a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs index 66e101cbb..5f7e6c23c 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs @@ -13778,7 +13778,7 @@ public uint ArgumentsCount public unsafe partial class ClassTemplatePartialSpecialization : global::CppSharp.Parser.AST.ClassTemplateSpecialization, IDisposable { - [StructLayout(LayoutKind.Sequential, Size = 608)] + [StructLayout(LayoutKind.Sequential, Size = 632)] public new partial struct __Internal { internal global::CppSharp.Parser.AST.DeclarationKind kind; @@ -13833,6 +13833,7 @@ public unsafe partial class ClassTemplatePartialSpecialization : global::CppShar internal __IntPtr templatedDecl; internal global::Std.Vector.__Internalc__N_std_N___1_S_vector____N_CppSharp_N_CppParser_N_AST_S_TemplateArgument___N_std_N___1_S_allocator__S0_ Arguments; internal global::CppSharp.Parser.AST.TemplateSpecializationKind specializationKind; + internal global::Std.Vector.__Internalc__N_std_N___1_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Declaration___N_std_N___1_S_allocator__S0_ Parameters; [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecializationC2Ev", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ctor(__IntPtr __instance); @@ -13842,6 +13843,18 @@ public unsafe partial class ClassTemplatePartialSpecialization : global::CppShar [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecializationD2Ev", CallingConvention = __CallingConvention.Cdecl)] internal static extern void dtor(__IntPtr __instance); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecialization13getParametersEj", CallingConvention = __CallingConvention.Cdecl)] + internal static extern __IntPtr GetParameters(__IntPtr __instance, uint i); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecialization13addParametersERPNS1_11DeclarationE", CallingConvention = __CallingConvention.Cdecl)] + internal static extern void AddParameters(__IntPtr __instance, __IntPtr s); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecialization15clearParametersEv", CallingConvention = __CallingConvention.Cdecl)] + internal static extern void ClearParameters(__IntPtr __instance); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecialization18getParametersCountEv", CallingConvention = __CallingConvention.Cdecl)] + internal static extern uint GetParametersCount(__IntPtr __instance); } internal static new ClassTemplatePartialSpecialization __CreateInstance(__IntPtr native, bool skipVTables = false) @@ -13922,6 +13935,36 @@ internal protected override void Dispose(bool disposing, bool callNativeDtor) Marshal.FreeHGlobal(__Instance); __Instance = IntPtr.Zero; } + + public global::CppSharp.Parser.AST.Declaration GetParameters(uint i) + { + var ___ret = __Internal.GetParameters(__Instance, i); + var __result0 = global::CppSharp.Parser.AST.Declaration.__GetOrCreateInstance(___ret, false); + return __result0; + } + + public void AddParameters(global::CppSharp.Parser.AST.Declaration s) + { + if (ReferenceEquals(s, null)) + throw new global::System.ArgumentNullException("s", "Cannot be null because it is a C++ reference (&)."); + var ____arg0 = s.__Instance; + var __arg0 = new __IntPtr(&____arg0); + __Internal.AddParameters(__Instance, __arg0); + } + + public void ClearParameters() + { + __Internal.ClearParameters(__Instance); + } + + public uint ParametersCount + { + get + { + var ___ret = __Internal.GetParametersCount(__Instance); + return ___ret; + } + } } public unsafe partial class FunctionTemplate : global::CppSharp.Parser.AST.Template, IDisposable diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs index 95c942de4..c4efef79d 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs @@ -13778,7 +13778,7 @@ public uint ArgumentsCount public unsafe partial class ClassTemplatePartialSpecialization : global::CppSharp.Parser.AST.ClassTemplateSpecialization, IDisposable { - [StructLayout(LayoutKind.Sequential, Size = 656)] + [StructLayout(LayoutKind.Sequential, Size = 680)] public new partial struct __Internal { internal global::CppSharp.Parser.AST.DeclarationKind kind; @@ -13833,6 +13833,7 @@ public unsafe partial class ClassTemplatePartialSpecialization : global::CppShar internal __IntPtr templatedDecl; internal global::Std.Vector.__Internal Arguments; internal global::CppSharp.Parser.AST.TemplateSpecializationKind specializationKind; + internal global::Std.Vector.__Internal Parameters; [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecializationC2Ev", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ctor(__IntPtr __instance); @@ -13842,6 +13843,18 @@ public unsafe partial class ClassTemplatePartialSpecialization : global::CppShar [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecializationD2Ev", CallingConvention = __CallingConvention.Cdecl)] internal static extern void dtor(__IntPtr __instance); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecialization13getParametersEj", CallingConvention = __CallingConvention.Cdecl)] + internal static extern __IntPtr GetParameters(__IntPtr __instance, uint i); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecialization13addParametersERPNS1_11DeclarationE", CallingConvention = __CallingConvention.Cdecl)] + internal static extern void AddParameters(__IntPtr __instance, __IntPtr s); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecialization15clearParametersEv", CallingConvention = __CallingConvention.Cdecl)] + internal static extern void ClearParameters(__IntPtr __instance); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecialization18getParametersCountEv", CallingConvention = __CallingConvention.Cdecl)] + internal static extern uint GetParametersCount(__IntPtr __instance); } internal static new ClassTemplatePartialSpecialization __CreateInstance(__IntPtr native, bool skipVTables = false) @@ -13922,6 +13935,36 @@ internal protected override void Dispose(bool disposing, bool callNativeDtor) Marshal.FreeHGlobal(__Instance); __Instance = IntPtr.Zero; } + + public global::CppSharp.Parser.AST.Declaration GetParameters(uint i) + { + var ___ret = __Internal.GetParameters(__Instance, i); + var __result0 = global::CppSharp.Parser.AST.Declaration.__GetOrCreateInstance(___ret, false); + return __result0; + } + + public void AddParameters(global::CppSharp.Parser.AST.Declaration s) + { + if (ReferenceEquals(s, null)) + throw new global::System.ArgumentNullException("s", "Cannot be null because it is a C++ reference (&)."); + var ____arg0 = s.__Instance; + var __arg0 = new __IntPtr(&____arg0); + __Internal.AddParameters(__Instance, __arg0); + } + + public void ClearParameters() + { + __Internal.ClearParameters(__Instance); + } + + public uint ParametersCount + { + get + { + var ___ret = __Internal.GetParametersCount(__Instance); + return ___ret; + } + } } public unsafe partial class FunctionTemplate : global::CppSharp.Parser.AST.Template, IDisposable diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs index 3799d088f..1aec7530f 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs @@ -13778,7 +13778,7 @@ public uint ArgumentsCount public unsafe partial class ClassTemplatePartialSpecialization : global::CppSharp.Parser.AST.ClassTemplateSpecialization, IDisposable { - [StructLayout(LayoutKind.Sequential, Size = 584)] + [StructLayout(LayoutKind.Sequential, Size = 608)] public new partial struct __Internal { internal global::CppSharp.Parser.AST.DeclarationKind kind; @@ -13833,6 +13833,7 @@ public unsafe partial class ClassTemplatePartialSpecialization : global::CppShar internal __IntPtr templatedDecl; internal global::Std.Vector.__Internal Arguments; internal global::CppSharp.Parser.AST.TemplateSpecializationKind specializationKind; + internal global::Std.Vector.__Internal Parameters; [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecializationC2Ev", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ctor(__IntPtr __instance); @@ -13842,6 +13843,18 @@ public unsafe partial class ClassTemplatePartialSpecialization : global::CppShar [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecializationD2Ev", CallingConvention = __CallingConvention.Cdecl)] internal static extern void dtor(__IntPtr __instance); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecialization13getParametersEj", CallingConvention = __CallingConvention.Cdecl)] + internal static extern __IntPtr GetParameters(__IntPtr __instance, uint i); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecialization13addParametersERPNS1_11DeclarationE", CallingConvention = __CallingConvention.Cdecl)] + internal static extern void AddParameters(__IntPtr __instance, __IntPtr s); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecialization15clearParametersEv", CallingConvention = __CallingConvention.Cdecl)] + internal static extern void ClearParameters(__IntPtr __instance); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST34ClassTemplatePartialSpecialization18getParametersCountEv", CallingConvention = __CallingConvention.Cdecl)] + internal static extern uint GetParametersCount(__IntPtr __instance); } internal static new ClassTemplatePartialSpecialization __CreateInstance(__IntPtr native, bool skipVTables = false) @@ -13922,6 +13935,36 @@ internal protected override void Dispose(bool disposing, bool callNativeDtor) Marshal.FreeHGlobal(__Instance); __Instance = IntPtr.Zero; } + + public global::CppSharp.Parser.AST.Declaration GetParameters(uint i) + { + var ___ret = __Internal.GetParameters(__Instance, i); + var __result0 = global::CppSharp.Parser.AST.Declaration.__GetOrCreateInstance(___ret, false); + return __result0; + } + + public void AddParameters(global::CppSharp.Parser.AST.Declaration s) + { + if (ReferenceEquals(s, null)) + throw new global::System.ArgumentNullException("s", "Cannot be null because it is a C++ reference (&)."); + var ____arg0 = s.__Instance; + var __arg0 = new __IntPtr(&____arg0); + __Internal.AddParameters(__Instance, __arg0); + } + + public void ClearParameters() + { + __Internal.ClearParameters(__Instance); + } + + public uint ParametersCount + { + get + { + var ___ret = __Internal.GetParametersCount(__Instance); + return ___ret; + } + } } public unsafe partial class FunctionTemplate : global::CppSharp.Parser.AST.Template, IDisposable diff --git a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs index 7664bbf6d..c626a8ec5 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs @@ -13780,7 +13780,7 @@ public uint ArgumentsCount public unsafe partial class ClassTemplatePartialSpecialization : global::CppSharp.Parser.AST.ClassTemplateSpecialization, IDisposable { - [StructLayout(LayoutKind.Sequential, Size = 624)] + [StructLayout(LayoutKind.Sequential, Size = 648)] public new partial struct __Internal { internal global::CppSharp.Parser.AST.DeclarationKind kind; @@ -13835,6 +13835,7 @@ public unsafe partial class ClassTemplatePartialSpecialization : global::CppShar internal __IntPtr templatedDecl; internal global::Std.Vector.__Internalc__N_std_S_vector____N_CppSharp_N_CppParser_N_AST_S_TemplateArgument___N_std_S_allocator__S0_ Arguments; internal global::CppSharp.Parser.AST.TemplateSpecializationKind specializationKind; + internal global::Std.Vector.__Internalc__N_std_S_vector_____N_CppSharp_N_CppParser_N_AST_S_Declaration___N_std_S_allocator__S0_ Parameters; [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "??0ClassTemplatePartialSpecialization@AST@CppParser@CppSharp@@QEAA@XZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern __IntPtr ctor(__IntPtr __instance); @@ -13844,6 +13845,18 @@ public unsafe partial class ClassTemplatePartialSpecialization : global::CppShar [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "??1ClassTemplatePartialSpecialization@AST@CppParser@CppSharp@@QEAA@XZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern void dtor(__IntPtr __instance); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?getParameters@ClassTemplatePartialSpecialization@AST@CppParser@CppSharp@@QEAAPEAVDeclaration@234@I@Z", CallingConvention = __CallingConvention.Cdecl)] + internal static extern __IntPtr GetParameters(__IntPtr __instance, uint i); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addParameters@ClassTemplatePartialSpecialization@AST@CppParser@CppSharp@@QEAAXAEAPEAVDeclaration@234@@Z", CallingConvention = __CallingConvention.Cdecl)] + internal static extern void AddParameters(__IntPtr __instance, __IntPtr s); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearParameters@ClassTemplatePartialSpecialization@AST@CppParser@CppSharp@@QEAAXXZ", CallingConvention = __CallingConvention.Cdecl)] + internal static extern void ClearParameters(__IntPtr __instance); + + [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?getParametersCount@ClassTemplatePartialSpecialization@AST@CppParser@CppSharp@@QEAAIXZ", CallingConvention = __CallingConvention.Cdecl)] + internal static extern uint GetParametersCount(__IntPtr __instance); } internal static new ClassTemplatePartialSpecialization __CreateInstance(__IntPtr native, bool skipVTables = false) @@ -13924,6 +13937,36 @@ internal protected override void Dispose(bool disposing, bool callNativeDtor) Marshal.FreeHGlobal(__Instance); __Instance = IntPtr.Zero; } + + public global::CppSharp.Parser.AST.Declaration GetParameters(uint i) + { + var ___ret = __Internal.GetParameters(__Instance, i); + var __result0 = global::CppSharp.Parser.AST.Declaration.__GetOrCreateInstance(___ret, false); + return __result0; + } + + public void AddParameters(global::CppSharp.Parser.AST.Declaration s) + { + if (ReferenceEquals(s, null)) + throw new global::System.ArgumentNullException("s", "Cannot be null because it is a C++ reference (&)."); + var ____arg0 = s.__Instance; + var __arg0 = new __IntPtr(&____arg0); + __Internal.AddParameters(__Instance, __arg0); + } + + public void ClearParameters() + { + __Internal.ClearParameters(__Instance); + } + + public uint ParametersCount + { + get + { + var ___ret = __Internal.GetParametersCount(__Instance); + return ___ret; + } + } } public unsafe partial class FunctionTemplate : global::CppSharp.Parser.AST.Template, IDisposable diff --git a/src/CppParser/Decl.h b/src/CppParser/Decl.h index 40a2128bb..e8665ca7d 100644 --- a/src/CppParser/Decl.h +++ b/src/CppParser/Decl.h @@ -715,6 +715,7 @@ namespace CppSharp public: ClassTemplatePartialSpecialization(); ~ClassTemplatePartialSpecialization(); + VECTOR(Declaration *, Parameters) }; class CS_API FunctionTemplate : public Template diff --git a/src/CppParser/Parser.cpp b/src/CppParser/Parser.cpp index 8821ae03e..06b39aa12 100644 --- a/src/CppParser/Parser.cpp +++ b/src/CppParser/Parser.cpp @@ -1339,6 +1339,8 @@ Parser::WalkClassTemplatePartialSpecialization(const clang::ClassTemplatePartial } } + TS->Parameters = WalkTemplateParameterList(CTS->getTemplateParameters()); + return TS; } diff --git a/src/Generator.Tests/AST/TestAST.cs b/src/Generator.Tests/AST/TestAST.cs index b04a6f0c9..62a0f6d9f 100644 --- a/src/Generator.Tests/AST/TestAST.cs +++ b/src/Generator.Tests/AST/TestAST.cs @@ -289,6 +289,28 @@ public void TestASTClassTemplates() Assert.AreSame(classTemplateSpecialization.TemplatedDecl.TemplatedClass, template.TemplatedClass); } + [Test] + public void TestASTClassTemplatePartialSpecialization() + { + var classTemplate = AstContext.TranslationUnits + .SelectMany(u => u.Templates.OfType()) + .FirstOrDefault(t => t.Name == "TestClassTemplatePartialSpecialization"); + + var classTemplatePartialSpecializations = classTemplate.Specializations.Where(specialization => specialization is ClassTemplatePartialSpecialization).Cast(); + Assert.IsTrue(classTemplatePartialSpecializations.Count() == 1); + var classTemplatePartialSpecialization = classTemplatePartialSpecializations.First(); + Assert.AreEqual(TemplateSpecializationKind.ExplicitSpecialization, classTemplatePartialSpecialization.SpecializationKind); + + var classTemplatePartialSpecializationParameters = classTemplatePartialSpecialization.Parameters; + Assert.AreEqual(1, classTemplatePartialSpecializationParameters.Count); + Assert.AreEqual((classTemplatePartialSpecializationParameters[0] as TypeTemplateParameter).Name, "K"); + + var classTemplatePartialSpecializationArguments = classTemplatePartialSpecialization.Arguments; + Assert.AreEqual(2, classTemplatePartialSpecializationArguments.Count); + Assert.AreEqual((classTemplatePartialSpecializationArguments[0].Type.Type as BuiltinType).Type, PrimitiveType.Int); + Assert.AreEqual((classTemplatePartialSpecializationArguments[1].Type.Type as TemplateParameterType).Parameter, classTemplatePartialSpecializationParameters[0]); + } + [Test] public void TestDeprecatedAttrs() { diff --git a/src/Parser/ASTConverter.cs b/src/Parser/ASTConverter.cs index 1c03e9390..ea827d097 100644 --- a/src/Parser/ASTConverter.cs +++ b/src/Parser/ASTConverter.cs @@ -1918,6 +1918,12 @@ public override AST.Declaration VisitClassTemplatePartialSpecialization( { var _decl = new AST.ClassTemplatePartialSpecialization(); VisitClassTemplateSpecialization(decl, _decl); + for (uint i = 0; i < decl.ParametersCount; ++i) + { + var param = decl.GetParameters(i); + var _param = Visit(param); + _decl.Parameters.Add(_param); + } return _decl; } diff --git a/tests/dotnet/Native/AST.h b/tests/dotnet/Native/AST.h index 29ff07628..1ec43910a 100644 --- a/tests/dotnet/Native/AST.h +++ b/tests/dotnet/Native/AST.h @@ -190,4 +190,13 @@ class HasMethods { public: void isVolatileMethod() volatile {} -}; \ No newline at end of file +}; + +template +class TestClassTemplatePartialSpecialization +{ +}; +template +class TestClassTemplatePartialSpecialization +{ +}; From d1307a532f4f88f46b343755cc864dc70dc50dea Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Thu, 1 Feb 2024 11:21:52 +0000 Subject: [PATCH 29/37] Add support for AArch64 C++ ABI. --- src/AST/ASTContext.cs | 1 + .../CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs | 7 ++++--- .../CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs | 7 ++++--- .../CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs | 7 ++++--- .../CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs | 7 ++++--- .../Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs | 7 ++++--- .../CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs | 7 ++++--- src/CppParser/Decl.h | 1 + src/CppParser/Parser.cpp | 4 ++++ src/Generator/AST/VTables.cs | 1 + src/Parser/ASTConverter.cs | 2 ++ 11 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/AST/ASTContext.cs b/src/AST/ASTContext.cs index 827ce261f..a9cb6831d 100644 --- a/src/AST/ASTContext.cs +++ b/src/AST/ASTContext.cs @@ -10,6 +10,7 @@ public enum CppAbi Itanium, Microsoft, ARM, + AArch64, iOS, iOS64, WebAssembly diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs index 2f075705a..f11b94cdc 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs @@ -6401,9 +6401,10 @@ public enum CppAbi Itanium = 0, Microsoft = 1, ARM = 2, - iOS = 3, - iOS64 = 4, - WebAssembly = 5 + AArch64 = 3, + iOS = 4, + iOS64 = 5, + WebAssembly = 6 } public enum RecordArgABI diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs index 80f6d22dd..951d7a1f5 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs @@ -6401,9 +6401,10 @@ public enum CppAbi Itanium = 0, Microsoft = 1, ARM = 2, - iOS = 3, - iOS64 = 4, - WebAssembly = 5 + AArch64 = 3, + iOS = 4, + iOS64 = 5, + WebAssembly = 6 } public enum RecordArgABI diff --git a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs index 5f7e6c23c..6c8c1e3e4 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs @@ -6401,9 +6401,10 @@ public enum CppAbi Itanium = 0, Microsoft = 1, ARM = 2, - iOS = 3, - iOS64 = 4, - WebAssembly = 5 + AArch64 = 3, + iOS = 4, + iOS64 = 5, + WebAssembly = 6 } public enum RecordArgABI diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs index c4efef79d..a962c0034 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs @@ -6401,9 +6401,10 @@ public enum CppAbi Itanium = 0, Microsoft = 1, ARM = 2, - iOS = 3, - iOS64 = 4, - WebAssembly = 5 + AArch64 = 3, + iOS = 4, + iOS64 = 5, + WebAssembly = 6 } public enum RecordArgABI diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs index 1aec7530f..832b9e9ef 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs @@ -6401,9 +6401,10 @@ public enum CppAbi Itanium = 0, Microsoft = 1, ARM = 2, - iOS = 3, - iOS64 = 4, - WebAssembly = 5 + AArch64 = 3, + iOS = 4, + iOS64 = 5, + WebAssembly = 6 } public enum RecordArgABI diff --git a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs index c626a8ec5..436fe3946 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs @@ -6401,9 +6401,10 @@ public enum CppAbi Itanium = 0, Microsoft = 1, ARM = 2, - iOS = 3, - iOS64 = 4, - WebAssembly = 5 + AArch64 = 3, + iOS = 4, + iOS64 = 5, + WebAssembly = 6 } public enum RecordArgABI diff --git a/src/CppParser/Decl.h b/src/CppParser/Decl.h index e8665ca7d..2a26940a7 100644 --- a/src/CppParser/Decl.h +++ b/src/CppParser/Decl.h @@ -471,6 +471,7 @@ namespace CppSharp Itanium, Microsoft, ARM, + AArch64, iOS, iOS64, WebAssembly diff --git a/src/CppParser/Parser.cpp b/src/CppParser/Parser.cpp index 06b39aa12..02b83ebb8 100644 --- a/src/CppParser/Parser.cpp +++ b/src/CppParser/Parser.cpp @@ -100,6 +100,8 @@ static CppAbi GetClassLayoutAbi(clang::TargetCXXABI::Kind abi) return CppAbi::Itanium; case clang::TargetCXXABI::GenericARM: return CppAbi::ARM; + case clang::TargetCXXABI::GenericAArch64: + return CppAbi::AArch64; case clang::TargetCXXABI::iOS: return CppAbi::iOS; case clang::TargetCXXABI::AppleARM64: @@ -231,6 +233,8 @@ ConvertToClangTargetCXXABI(CppSharp::CppParser::AST::CppAbi abi) return TargetCXXABI::Microsoft; case CppSharp::CppParser::AST::CppAbi::ARM: return TargetCXXABI::GenericARM; + case CppSharp::CppParser::AST::CppAbi::AArch64: + return TargetCXXABI::GenericARM; case CppSharp::CppParser::AST::CppAbi::iOS: return TargetCXXABI::iOS; case CppSharp::CppParser::AST::CppAbi::iOS64: diff --git a/src/Generator/AST/VTables.cs b/src/Generator/AST/VTables.cs index 93e59ed9d..59bc2909c 100644 --- a/src/Generator/AST/VTables.cs +++ b/src/Generator/AST/VTables.cs @@ -15,6 +15,7 @@ public static List GatherVTableMethodEntries(Class @class) case CppAbi.Microsoft: return GatherVTableMethodsMS(@class); case CppAbi.Itanium: + default: return GatherVTableMethodsItanium(@class); } diff --git a/src/Parser/ASTConverter.cs b/src/Parser/ASTConverter.cs index ea827d097..f74799ef1 100644 --- a/src/Parser/ASTConverter.cs +++ b/src/Parser/ASTConverter.cs @@ -1719,6 +1719,8 @@ AST.CppAbi VisitCppAbi(CppAbi abi) return AST.CppAbi.Microsoft; case CppAbi.ARM: return AST.CppAbi.ARM; + case CppAbi.AArch64: + return AST.CppAbi.AArch64; case CppAbi.iOS: return AST.CppAbi.iOS; case CppAbi.iOS64: From b5ab95e11d253815b8b115bb749411ec4d74eeea Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Thu, 1 Feb 2024 11:39:24 +0000 Subject: [PATCH 30/37] Update iOS64 ABI name to the more accurate AppleARM64. --- src/AST/ASTContext.cs | 2 +- src/CppParser/Bindings/CLI/Decl.h | 2 +- .../CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs | 2 +- .../Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs | 2 +- .../CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs | 2 +- .../CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs | 2 +- .../Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs | 2 +- .../CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs | 2 +- src/CppParser/Decl.h | 2 +- src/CppParser/Parser.cpp | 4 ++-- src/Parser/ASTConverter.cs | 4 ++-- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/AST/ASTContext.cs b/src/AST/ASTContext.cs index a9cb6831d..e52107e0d 100644 --- a/src/AST/ASTContext.cs +++ b/src/AST/ASTContext.cs @@ -12,7 +12,7 @@ public enum CppAbi ARM, AArch64, iOS, - iOS64, + AppleARM64, WebAssembly } diff --git a/src/CppParser/Bindings/CLI/Decl.h b/src/CppParser/Bindings/CLI/Decl.h index 107a2aefc..58233c2c1 100644 --- a/src/CppParser/Bindings/CLI/Decl.h +++ b/src/CppParser/Bindings/CLI/Decl.h @@ -256,7 +256,7 @@ namespace CppSharp Microsoft = 1, ARM = 2, iOS = 3, - iOS64 = 4, + AppleARM64 = 4, WebAssembly = 5 }; diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs index f11b94cdc..c12579c6c 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs @@ -6403,7 +6403,7 @@ public enum CppAbi ARM = 2, AArch64 = 3, iOS = 4, - iOS64 = 5, + AppleARM64 = 5, WebAssembly = 6 } diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs index 951d7a1f5..929151367 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs @@ -6403,7 +6403,7 @@ public enum CppAbi ARM = 2, AArch64 = 3, iOS = 4, - iOS64 = 5, + AppleARM64 = 5, WebAssembly = 6 } diff --git a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs index 6c8c1e3e4..2c6915daa 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs @@ -6403,7 +6403,7 @@ public enum CppAbi ARM = 2, AArch64 = 3, iOS = 4, - iOS64 = 5, + AppleARM64 = 5, WebAssembly = 6 } diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs index a962c0034..93855910f 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs @@ -6403,7 +6403,7 @@ public enum CppAbi ARM = 2, AArch64 = 3, iOS = 4, - iOS64 = 5, + AppleARM64 = 5, WebAssembly = 6 } diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs index 832b9e9ef..f9e378173 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs @@ -6403,7 +6403,7 @@ public enum CppAbi ARM = 2, AArch64 = 3, iOS = 4, - iOS64 = 5, + AppleARM64 = 5, WebAssembly = 6 } diff --git a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs index 436fe3946..fde849036 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs @@ -6403,7 +6403,7 @@ public enum CppAbi ARM = 2, AArch64 = 3, iOS = 4, - iOS64 = 5, + AppleARM64 = 5, WebAssembly = 6 } diff --git a/src/CppParser/Decl.h b/src/CppParser/Decl.h index 2a26940a7..99c972eb0 100644 --- a/src/CppParser/Decl.h +++ b/src/CppParser/Decl.h @@ -473,7 +473,7 @@ namespace CppSharp ARM, AArch64, iOS, - iOS64, + AppleARM64, WebAssembly }; diff --git a/src/CppParser/Parser.cpp b/src/CppParser/Parser.cpp index 02b83ebb8..1edc0850c 100644 --- a/src/CppParser/Parser.cpp +++ b/src/CppParser/Parser.cpp @@ -105,7 +105,7 @@ static CppAbi GetClassLayoutAbi(clang::TargetCXXABI::Kind abi) case clang::TargetCXXABI::iOS: return CppAbi::iOS; case clang::TargetCXXABI::AppleARM64: - return CppAbi::iOS64; + return CppAbi::AppleARM64; case clang::TargetCXXABI::WebAssembly: return CppAbi::WebAssembly; default: @@ -237,7 +237,7 @@ ConvertToClangTargetCXXABI(CppSharp::CppParser::AST::CppAbi abi) return TargetCXXABI::GenericARM; case CppSharp::CppParser::AST::CppAbi::iOS: return TargetCXXABI::iOS; - case CppSharp::CppParser::AST::CppAbi::iOS64: + case CppSharp::CppParser::AST::CppAbi::AppleARM64: return TargetCXXABI::AppleARM64; } diff --git a/src/Parser/ASTConverter.cs b/src/Parser/ASTConverter.cs index f74799ef1..81332f027 100644 --- a/src/Parser/ASTConverter.cs +++ b/src/Parser/ASTConverter.cs @@ -1723,8 +1723,8 @@ AST.CppAbi VisitCppAbi(CppAbi abi) return AST.CppAbi.AArch64; case CppAbi.iOS: return AST.CppAbi.iOS; - case CppAbi.iOS64: - return AST.CppAbi.iOS64; + case CppAbi.AppleARM64: + return AST.CppAbi.AppleARM64; case CppAbi.WebAssembly: return AST.CppAbi.WebAssembly; default: From bbb0693ef53a36db667ee4f4e53e35b4fca87217 Mon Sep 17 00:00:00 2001 From: Conrad Kreyling Date: Fri, 2 Feb 2024 13:35:11 -0500 Subject: [PATCH 31/37] Enable ARM64 support on LLVM builds --- .github/workflows/llvm.yml | 2 ++ build/Helpers.lua | 5 +++++ build/LLVM.lua | 6 ++++++ build/llvm/LLVM.lua | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/llvm.yml b/.github/workflows/llvm.yml index 57dc21d4b..87b31a680 100644 --- a/.github/workflows/llvm.yml +++ b/.github/workflows/llvm.yml @@ -10,8 +10,10 @@ jobs: matrix: config: - { os: ubuntu-22.04, platform: x64, cxx: g++-11, cc: gcc-11 } + - { os: ubuntu-22.04, platform: arm64, cxx: g++-11, cc: gcc-11 } - { os: macos-11, platform: x64, cxx: clang++, cc: clang } - { os: macos-12, platform: x64, cxx: clang++, cc: clang } + - { os: macos-12, platform: arm64, cxx: clang++, cc: clang } runs-on: ${{ matrix.config.os }} diff --git a/build/Helpers.lua b/build/Helpers.lua index 0a2e030d1..96a323547 100644 --- a/build/Helpers.lua +++ b/build/Helpers.lua @@ -10,6 +10,7 @@ newoption { allowed = { { "x86", "x86 32-bits" }, { "x64", "x64 64-bits" }, + { "arm64","ARM64 64-bits" }, } } @@ -251,11 +252,15 @@ function AddPlatformSpecificFiles(folder, filename) filter { "toolset:msc*", "architecture:x86" } files { path.join(folder, "i686-pc-win32-msvc", filename) } elseif os.istarget("macosx") then + filter { "architecture:arm64" } + files { path.join(folder, "arm64-apple-darwin12.4.0", filename) } filter { "architecture:x86_64" } files { path.join(folder, "x86_64-apple-darwin12.4.0", filename) } filter {"architecture:x86" } files { path.join(folder, "i686-apple-darwin12.4.0", filename) } elseif os.istarget("linux") then + filter { "architecture:arm64" } + files { path.join(folder, "arm64-linux-gnu" .. (UseCxx11ABI() and "-cxx11abi" or ""), filename) } filter { "architecture:x86_64" } files { path.join(folder, "x86_64-linux-gnu" .. (UseCxx11ABI() and "-cxx11abi" or ""), filename) } else diff --git a/build/LLVM.lua b/build/LLVM.lua index 86fa1be6b..9ac89c54c 100644 --- a/build/LLVM.lua +++ b/build/LLVM.lua @@ -172,6 +172,12 @@ function SetupLLVMLibs() "LLVMX86CodeGen", "LLVMX86Desc", "LLVMX86Info", + "LLVMAArch64AsmParser", + "LLVMAArch64CodeGen", + "LLVMAArch64Desc", + "LLVMAArch64Disassembler", + "LLVMAArch64Info", + "LLVMAArch64Utils", "LLVMipo", "LLVMInstrumentation", "LLVMVectorize", diff --git a/build/llvm/LLVM.lua b/build/llvm/LLVM.lua index f375b39e9..015743965 100644 --- a/build/llvm/LLVM.lua +++ b/build/llvm/LLVM.lua @@ -254,7 +254,7 @@ function cmake(gen, conf, builddir, options) .. ' -DLLVM_ENABLE_ZSTD=false' .. ' -DLLVM_INCLUDE_DOCS=false' .. ' -DLLVM_INCLUDE_EXAMPLES=false' - .. ' -DLLVM_TARGETS_TO_BUILD="X86"' + .. ' -DLLVM_TARGETS_TO_BUILD="X86;AArch64"' .. ' -DLLVM_TOOL_BUGPOINT_BUILD=false' .. ' -DLLVM_TOOL_BUGPOINT_PASSES_BUILD=false' .. ' -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=false' From 491248b7d5976026b133fd8fdda4070d3e1f20d7 Mon Sep 17 00:00:00 2001 From: Conrad Kreyling Date: Fri, 2 Feb 2024 15:09:44 -0500 Subject: [PATCH 32/37] Fix missing AArch64 entry in CLI CppAbi --- src/CppParser/Bindings/CLI/Decl.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/CppParser/Bindings/CLI/Decl.h b/src/CppParser/Bindings/CLI/Decl.h index 58233c2c1..940ad9694 100644 --- a/src/CppParser/Bindings/CLI/Decl.h +++ b/src/CppParser/Bindings/CLI/Decl.h @@ -255,9 +255,10 @@ namespace CppSharp Itanium = 0, Microsoft = 1, ARM = 2, - iOS = 3, - AppleARM64 = 4, - WebAssembly = 5 + AArch64 = 3, + iOS = 4, + AppleARM64 = 5, + WebAssembly = 6 }; public enum class RecordArgABI From 1d1b21f25e15ac2dc3ff05cdea35daddf4117d18 Mon Sep 17 00:00:00 2001 From: Conrad Kreyling Date: Fri, 2 Feb 2024 15:12:42 -0500 Subject: [PATCH 33/37] Instruct generator to build ARM64 bindings --- src/CppParser/ParserGen/ParserGen.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/CppParser/ParserGen/ParserGen.cs b/src/CppParser/ParserGen/ParserGen.cs index f068a71ed..48b0ab4af 100644 --- a/src/CppParser/ParserGen/ParserGen.cs +++ b/src/CppParser/ParserGen/ParserGen.cs @@ -170,13 +170,17 @@ public static void Main(string[] args) var osxHeadersPath = Path.Combine(GetSourceDirectory("build"), @"headers\osx"); if (Directory.Exists(osxHeadersPath) || Platform.IsMacOS) { - Console.WriteLine("Generating the C# parser bindings for OSX..."); + Console.WriteLine("Generating the C# parser bindings for OSX x86..."); ConsoleDriver.Run(new ParserGen(GeneratorKind.CSharp, "i686-apple-darwin12.4.0")); Console.WriteLine(); - Console.WriteLine("Generating the C# parser bindings for OSX..."); + Console.WriteLine("Generating the C# parser bindings for OSX x64..."); ConsoleDriver.Run(new ParserGen(GeneratorKind.CSharp, "x86_64-apple-darwin12.4.0")); Console.WriteLine(); + + Console.WriteLine("Generating the C# parser bindings for OSX ARM64..."); + ConsoleDriver.Run(new ParserGen(GeneratorKind.CSharp, "arm64-apple-darwin12.4.0")); + Console.WriteLine(); } var linuxHeadersPath = Path.Combine(GetSourceDirectory("build"), @"headers\x86_64-linux-gnu"); @@ -186,10 +190,19 @@ public static void Main(string[] args) ConsoleDriver.Run(new ParserGen(GeneratorKind.CSharp, "x86_64-linux-gnu")); Console.WriteLine(); + Console.WriteLine("Generating the C# parser bindings for Linux ARM64..."); + ConsoleDriver.Run(new ParserGen(GeneratorKind.CSharp, "arm64-linux-gnu")); + Console.WriteLine(); + Console.WriteLine("Generating the C# parser bindings for Linux (GCC C++11 ABI)..."); ConsoleDriver.Run(new ParserGen(GeneratorKind.CSharp, "x86_64-linux-gnu", isGnuCpp11Abi: true)); Console.WriteLine(); + + Console.WriteLine("Generating the C# parser bindings for Linux ARM64 (GCC C++11 ABI)..."); + ConsoleDriver.Run(new ParserGen(GeneratorKind.CSharp, "arm64-linux-gnu", + isGnuCpp11Abi: true)); + Console.WriteLine(); } } } From a81abd56143bcd9139f3aadc1b732e359a3143c1 Mon Sep 17 00:00:00 2001 From: Conrad Kreyling Date: Tue, 6 Feb 2024 11:29:07 -0500 Subject: [PATCH 34/37] LLVM crosscompile x64 for ARM64 (#1826) * LLVM crosscompile x64 for ARM64 * Fix MacOS host platform test * Ensure options is persistent in cross compile paths --- build/llvm/LLVM.lua | 34 ++++++++++++++++++++++++++++++++++ build/scripts/Utils.lua | 7 ++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/build/llvm/LLVM.lua b/build/llvm/LLVM.lua index 015743965..0a08c0619 100644 --- a/build/llvm/LLVM.lua +++ b/build/llvm/LLVM.lua @@ -438,10 +438,44 @@ function build_llvm(llvm_build) local options = os.ishost("macosx") and "-DLLVM_ENABLE_LIBCXX=true" or "" local is32bits = target_architecture() == "x86" + local targetIsArm64 = target_architecture() == "arm64" + if is32bits then options = options .. (is32bits and " -DLLVM_BUILD_32_BITS=true" or "") end + if targetIsArm64 then + if os.host() == "linux" then + local host_arch = unix_host_architecture() + if host_arch ~= "aarch64" then + options = options .. "" + .. ' -DCMAKE_SYSTEM_NAME=Linux' + .. ' -DCMAKE_SYSTEM_PROCESSOR=aarch64' + .. ' -DCMAKE_C_COMPILER=/usr/bin/aarch64-linux-gnu-gcc' + .. ' -DCMAKE_CXX_COMPILER=/usr/bin/aarch64-linux-gnu-g++' + .. ' -DCMAKE_ASM_COMPILER=/usr/bin/aarch64-linux-gnu-as' + .. ' -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER' + .. ' -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY' + .. ' -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY' + .. ' -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY' + .. ' ' .. options + end + end + if os.host() == "macosx" then + local host_arch = unix_host_architecture() + if host_arch ~= "arm64" then + options = options .. "" + .. ' -DCMAKE_SYSTEM_NAME=Darwin' + .. ' -DCMAKE_SYSTEM_PROCESSOR=arm64' + .. ' -DCMAKE_C_COMPILER_TARGET=arm64-apple-darwin21.6.0' + .. ' -DCMAKE_CXX_COMPILER_TARGET=arm64-apple-darwin21.6.0' + .. ' -DCMAKE_ASM_COMPILER_TARGET=arm64-apple-darwin21.6.0' + .. ' ' .. options + end + end + end + + cmake("Ninja", conf, llvm_build, options) ninja('"' .. llvm_build .. '"') ninja('"' .. llvm_build .. '"', "clang-headers") diff --git a/build/scripts/Utils.lua b/build/scripts/Utils.lua index afccb4e73..0ec325caf 100644 --- a/build/scripts/Utils.lua +++ b/build/scripts/Utils.lua @@ -112,6 +112,11 @@ function download(url, file, try) return res, code end +function unix_host_architecture() + result, errorCode = os.outputof("uname -m") + return result +end + -- -- Allows copying directories. -- It uses the premake patterns (**=recursive match, *=file match) @@ -202,4 +207,4 @@ function os.rmfiles(src_dir, filter) print( "Error: " .. counter .. "/" .. #matches .. " files removed.") return nil end -end \ No newline at end of file +end From 8bd3f456a1a194d0074307af1e00c4f73d7ed5b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Matos?= Date: Tue, 6 Feb 2024 18:30:12 +0000 Subject: [PATCH 35/37] Update llvm.yml to install AArch64 cross compilers --- .github/workflows/llvm.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/llvm.yml b/.github/workflows/llvm.yml index 87b31a680..966cc1692 100644 --- a/.github/workflows/llvm.yml +++ b/.github/workflows/llvm.yml @@ -27,6 +27,10 @@ jobs: - uses: actions/checkout@v4 - uses: lukka/get-cmake@latest + - name: Install cross compilers + if: startsWith(matrix.config.os, 'ubuntu') && startsWith(matrix.config.platform, 'arm64') + run: sudo apt install -y g++-aarch64-linux-gnu gcc-aarch64-linux-gnu + - name: Clone LLVM shell: bash run: build/build.sh clone_llvm @@ -43,4 +47,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: llvm - path: build/llvm/llvm-*-*.* \ No newline at end of file + path: build/llvm/llvm-*-*.* From 099fadb9a1c1b8889222e4d364c25ba5215add00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Matos?= Date: Thu, 8 Feb 2024 17:02:09 +0000 Subject: [PATCH 36/37] ABI handling fixes in Parser.cpp (#1829) * ABI handling fixes in Parser.cpp * Update Parser.cpp --- src/CppParser/Parser.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/CppParser/Parser.cpp b/src/CppParser/Parser.cpp index 1edc0850c..ac6fbf5de 100644 --- a/src/CppParser/Parser.cpp +++ b/src/CppParser/Parser.cpp @@ -234,7 +234,7 @@ ConvertToClangTargetCXXABI(CppSharp::CppParser::AST::CppAbi abi) case CppSharp::CppParser::AST::CppAbi::ARM: return TargetCXXABI::GenericARM; case CppSharp::CppParser::AST::CppAbi::AArch64: - return TargetCXXABI::GenericARM; + return TargetCXXABI::GenericAArch64; case CppSharp::CppParser::AST::CppAbi::iOS: return TargetCXXABI::iOS; case CppSharp::CppParser::AST::CppAbi::AppleARM64: @@ -731,7 +731,7 @@ void Parser::WalkVTable(const clang::CXXRecordDecl* RD, Class* C) } break; } - case TargetCXXABI::GenericItanium: + default: { ItaniumVTableContext VTContext(AST); @@ -739,8 +739,6 @@ void Parser::WalkVTable(const clang::CXXRecordDecl* RD, Class* C) C->layout->layout = WalkVTableLayout(VTLayout); break; } - default: - llvm_unreachable("Unsupported C++ ABI kind"); } } @@ -4959,4 +4957,4 @@ Declaration* Parser::GetDeclarationFromFriend(clang::NamedDecl* FriendDecl) Decl->lineNumberEnd = MinLineNumberEnd; } return Decl; -} \ No newline at end of file +} From f2f48dc1a348c16e624b1b736e3688fa2b426d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Matos?= Date: Mon, 12 Feb 2024 14:49:57 +0000 Subject: [PATCH 37/37] Update LLVM.md Fix documentation. --- docs/LLVM.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/LLVM.md b/docs/LLVM.md index 4a3d625af..bbeaec6c6 100644 --- a/docs/LLVM.md +++ b/docs/LLVM.md @@ -54,9 +54,7 @@ Make sure to use the revisions specified below, or you will most likely get comp Required LLVM/Clang commits: -[LLVM: see /build/llvm/LLVM-commit.](https://github.com/mono/CppSharp/tree/master/build/LLVM-commit) - -[Clang: see /build/Clang-commit.](https://github.com/mono/CppSharp/tree/master/build/Clang-commit) +[LLVM: see /build/llvm/LLVM-commit.](https://github.com/mono/CppSharp/tree/master/build/llvm/LLVM-commit) To change to the revisions specified above you can run the following commands: