From 0e8a6e368c52bc170acf398ae77f5a34d7877ee2 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Thu, 4 Sep 2014 17:42:57 +0300 Subject: [PATCH] Moved the code for creating a ref object by value from the marshalling printer to a valid ctor by value. Signed-off-by: Dimitar Dobrev --- .../CSharp/i686-apple-darwin12.4.0/AST.cs | 607 ++++++++++++++---- .../i686-apple-darwin12.4.0/CppParser.cs | 40 +- .../CSharp/i686-apple-darwin12.4.0/Target.cs | 9 +- .../Bindings/CSharp/i686-pc-win32-msvc/AST.cs | 607 ++++++++++++++---- .../CSharp/i686-pc-win32-msvc/CppParser.cs | 40 +- .../CSharp/i686-pc-win32-msvc/Target.cs | 9 +- .../Bindings/CSharp/x86_64-linux-gnu/AST.cs | 607 ++++++++++++++---- .../CSharp/x86_64-linux-gnu/CppParser.cs | 40 +- .../CSharp/x86_64-linux-gnu/Target.cs | 9 +- .../Generators/CSharp/CSharpMarshal.cs | 51 -- .../Generators/CSharp/CSharpTextTemplate.cs | 67 +- 11 files changed, 1586 insertions(+), 500 deletions(-) diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/AST.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/AST.cs index 321b67c4..7e767611 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/AST.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/AST.cs @@ -245,8 +245,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Type.Internal native) + { + var ret = Marshal.AllocHGlobal(8); + CppSharp.Parser.AST.Type.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Type(Type.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -331,8 +338,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TypeQualifiers.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(3); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(3)); + return ret; + } + internal TypeQualifiers(TypeQualifiers.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -432,8 +446,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(QualifiedType.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(8); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(8)); + return ret; + } + internal QualifiedType(QualifiedType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -479,9 +500,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(3); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Qualifiers), new UIntPtr(3)); - return new CppSharp.Parser.AST.TypeQualifiers(__instance); + return new CppSharp.Parser.AST.TypeQualifiers(__ptr->Qualifiers); } set @@ -522,8 +541,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TagType.Internal native) + { + var ret = Marshal.AllocHGlobal(12); + CppSharp.Parser.AST.TagType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TagType(TagType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -604,8 +630,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ArrayType.Internal native) + { + var ret = Marshal.AllocHGlobal(24); + CppSharp.Parser.AST.ArrayType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ArrayType(ArrayType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -631,9 +664,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedType), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedType); } set @@ -732,8 +763,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(FunctionType.Internal native) + { + var ret = Marshal.AllocHGlobal(32); + CppSharp.Parser.AST.FunctionType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal FunctionType(FunctionType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -786,9 +824,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->ReturnType), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->ReturnType); } set @@ -855,8 +891,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(PointerType.Internal native) + { + var ret = Marshal.AllocHGlobal(20); + CppSharp.Parser.AST.PointerType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal PointerType(PointerType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -882,9 +925,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedPointee), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedPointee); } set @@ -940,8 +981,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(MemberPointerType.Internal native) + { + var ret = Marshal.AllocHGlobal(16); + CppSharp.Parser.AST.MemberPointerType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal MemberPointerType(MemberPointerType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -967,9 +1015,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Pointee), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Pointee); } set @@ -1010,8 +1056,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TypedefType.Internal native) + { + var ret = Marshal.AllocHGlobal(12); + CppSharp.Parser.AST.TypedefType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TypedefType(TypedefType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1081,8 +1134,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(AttributedType.Internal native) + { + var ret = Marshal.AllocHGlobal(24); + CppSharp.Parser.AST.AttributedType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal AttributedType(AttributedType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1108,9 +1168,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Modified), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Modified); } set @@ -1125,9 +1183,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Equivalent), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Equivalent); } set @@ -1174,8 +1230,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(DecayedType.Internal native) + { + var ret = Marshal.AllocHGlobal(32); + CppSharp.Parser.AST.DecayedType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal DecayedType(DecayedType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1201,9 +1264,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Decayed), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Decayed); } set @@ -1218,9 +1279,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Original), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Original); } set @@ -1235,9 +1294,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Pointee), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Pointee); } set @@ -1295,8 +1352,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TemplateArgument.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(20); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(20)); + return ret; + } + internal TemplateArgument(TemplateArgument.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1342,9 +1406,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Type), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Type); } set @@ -1443,8 +1505,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TemplateSpecializationType.Internal native) + { + var ret = Marshal.AllocHGlobal(28); + CppSharp.Parser.AST.TemplateSpecializationType.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TemplateSpecializationType(TemplateSpecializationType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1469,9 +1538,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.TemplateArgument.Internal(); Internal.getArguments_0(new IntPtr(&__ret), __Instance, i); - var __instance = Marshal.AllocHGlobal(20); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ret), new UIntPtr(20)); - return new CppSharp.Parser.AST.TemplateArgument(__instance); + return new CppSharp.Parser.AST.TemplateArgument(__ret); } public void addArguments(CppSharp.Parser.AST.TemplateArgument s) @@ -1572,8 +1639,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TemplateParameter.Internal native) + { + var ret = Marshal.AllocHGlobal(16); + CppSharp.Parser.AST.TemplateParameter.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TemplateParameter(TemplateParameter.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1690,8 +1764,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TemplateParameterType.Internal native) + { + var ret = Marshal.AllocHGlobal(36); + CppSharp.Parser.AST.TemplateParameterType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TemplateParameterType(TemplateParameterType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1717,9 +1798,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Parser.AST.TemplateParameter.Internal.cctor_1(__instance, new global::System.IntPtr(&__ptr->Parameter)); - return new CppSharp.Parser.AST.TemplateParameter(__instance); + return new CppSharp.Parser.AST.TemplateParameter(__ptr->Parameter); } set @@ -1805,8 +1884,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TemplateParameterSubstitutionType.Internal native) + { + var ret = Marshal.AllocHGlobal(16); + CppSharp.Parser.AST.TemplateParameterSubstitutionType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TemplateParameterSubstitutionType(TemplateParameterSubstitutionType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1832,9 +1918,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Replacement), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Replacement); } set @@ -1878,8 +1962,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(InjectedClassNameType.Internal native) + { + var ret = Marshal.AllocHGlobal(16); + CppSharp.Parser.AST.InjectedClassNameType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal InjectedClassNameType(InjectedClassNameType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1958,8 +2049,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(DependentNameType.Internal native) + { + var ret = Marshal.AllocHGlobal(8); + CppSharp.Parser.AST.DependentNameType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal DependentNameType(DependentNameType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2008,8 +2106,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(PackExpansionType.Internal native) + { + var ret = Marshal.AllocHGlobal(8); + CppSharp.Parser.AST.PackExpansionType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal PackExpansionType(PackExpansionType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2061,8 +2166,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(BuiltinType.Internal native) + { + var ret = Marshal.AllocHGlobal(12); + CppSharp.Parser.AST.BuiltinType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal BuiltinType(BuiltinType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2131,8 +2243,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(VTableComponent.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(12); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(12)); + return ret; + } + internal VTableComponent(VTableComponent.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2252,8 +2371,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(VTableLayout.Internal native) + { + var ret = Marshal.AllocHGlobal(12); + CppSharp.Parser.AST.VTableLayout.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal VTableLayout(VTableLayout.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2284,9 +2410,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.VTableComponent.Internal(); Internal.getComponents_0(new IntPtr(&__ret), __Instance, i); - var __instance = Marshal.AllocHGlobal(12); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ret), new UIntPtr(12)); - return new CppSharp.Parser.AST.VTableComponent(__instance); + return new CppSharp.Parser.AST.VTableComponent(__ret); } public void addComponents(CppSharp.Parser.AST.VTableComponent s) @@ -2350,8 +2474,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(VFTableInfo.Internal native) + { + var ret = Marshal.AllocHGlobal(28); + CppSharp.Parser.AST.VFTableInfo.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal VFTableInfo(VFTableInfo.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2428,9 +2559,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(12); - CppSharp.Parser.AST.VTableLayout.Internal.cctor_1(__instance, new global::System.IntPtr(&__ptr->Layout)); - return new CppSharp.Parser.AST.VTableLayout(__instance); + return new CppSharp.Parser.AST.VTableLayout(__ptr->Layout); } set @@ -2510,8 +2639,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ClassLayout.Internal native) + { + var ret = Marshal.AllocHGlobal(48); + CppSharp.Parser.AST.ClassLayout.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ClassLayout(ClassLayout.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2542,9 +2678,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.VFTableInfo.Internal(); Internal.getVFTables_0(new IntPtr(&__ret), __Instance, i); - var __instance = Marshal.AllocHGlobal(28); - CppSharp.Parser.AST.VFTableInfo.Internal.cctor_1(__instance, new global::System.IntPtr(&__ret)); - return new CppSharp.Parser.AST.VFTableInfo(__instance); + return new CppSharp.Parser.AST.VFTableInfo(__ret); } public void addVFTables(CppSharp.Parser.AST.VFTableInfo s) @@ -2587,9 +2721,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(12); - CppSharp.Parser.AST.VTableLayout.Internal.cctor_1(__instance, new global::System.IntPtr(&__ptr->Layout)); - return new CppSharp.Parser.AST.VTableLayout(__instance); + return new CppSharp.Parser.AST.VTableLayout(__ptr->Layout); } set @@ -2773,8 +2905,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Declaration.Internal native) + { + var ret = Marshal.AllocHGlobal(84); + CppSharp.Parser.AST.Declaration.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Declaration(Declaration.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3216,8 +3355,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(DeclarationContext.Internal native) + { + var ret = Marshal.AllocHGlobal(184); + CppSharp.Parser.AST.DeclarationContext.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal DeclarationContext(DeclarationContext.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3503,8 +3649,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TypedefDecl.Internal native) + { + var ret = Marshal.AllocHGlobal(92); + CppSharp.Parser.AST.TypedefDecl.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TypedefDecl(TypedefDecl.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3530,9 +3683,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedType), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedType); } set @@ -3582,8 +3733,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Statement.Internal native) + { + var ret = Marshal.AllocHGlobal(20); + CppSharp.Parser.AST.Statement.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Statement(Statement.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3679,8 +3837,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Expression.Internal native) + { + var ret = Marshal.AllocHGlobal(20); + CppSharp.Parser.AST.Expression.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Expression(Expression.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3766,8 +3931,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Parameter.Internal native) + { + var ret = Marshal.AllocHGlobal(104); + CppSharp.Parser.AST.Parameter.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Parameter(Parameter.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3793,9 +3965,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedType), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedType); } set @@ -3989,8 +4159,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Function.Internal native) + { + var ret = Marshal.AllocHGlobal(148); + CppSharp.Parser.AST.Function.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Function(Function.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -4077,9 +4254,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->ReturnType), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->ReturnType); } set @@ -4329,8 +4504,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Method.Internal native) + { + var ret = Marshal.AllocHGlobal(176); + CppSharp.Parser.AST.Method.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Method(Method.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -4521,9 +4703,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->ConversionType), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->ConversionType); } set @@ -4697,8 +4877,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Item.Internal native) + { + var ret = Marshal.AllocHGlobal(104); + CppSharp.Parser.AST.Enumeration.Item.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Item(Item.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -4757,8 +4944,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Enumeration.Internal native) + { + var ret = Marshal.AllocHGlobal(208); + CppSharp.Parser.AST.Enumeration.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Enumeration(Enumeration.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -4783,9 +4977,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.Enumeration.Item.Internal(); Internal.getItems_0(new IntPtr(&__ret), __Instance, i); - var __instance = Marshal.AllocHGlobal(104); - CppSharp.Parser.AST.Enumeration.Item.Internal.cctor_1(__instance, new global::System.IntPtr(&__ret)); - return new CppSharp.Parser.AST.Enumeration.Item(__instance); + return new CppSharp.Parser.AST.Enumeration.Item(__ret); } public void addItems(CppSharp.Parser.AST.Enumeration.Item s) @@ -4923,8 +5115,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Variable.Internal native) + { + var ret = Marshal.AllocHGlobal(104); + CppSharp.Parser.AST.Variable.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Variable(Variable.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -4967,9 +5166,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedType), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedType); } set @@ -5012,8 +5209,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(BaseClassSpecifier.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(12); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(12)); + return ret; + } + internal BaseClassSpecifier(BaseClassSpecifier.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -5150,8 +5354,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Field.Internal native) + { + var ret = Marshal.AllocHGlobal(100); + CppSharp.Parser.AST.Field.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Field(Field.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -5177,9 +5388,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedType), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedType); } set @@ -5276,8 +5485,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(AccessSpecifierDecl.Internal native) + { + var ret = Marshal.AllocHGlobal(84); + CppSharp.Parser.AST.AccessSpecifierDecl.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal AccessSpecifierDecl(AccessSpecifierDecl.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -5471,8 +5687,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Class.Internal native) + { + var ret = Marshal.AllocHGlobal(248); + CppSharp.Parser.AST.Class.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Class(Class.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -5836,8 +6059,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Template.Internal native) + { + var ret = Marshal.AllocHGlobal(100); + CppSharp.Parser.AST.Template.Internal.cctor_3(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Template(Template.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -5870,9 +6100,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.TemplateParameter.Internal(); Internal.getParameters_0(new IntPtr(&__ret), __Instance, i); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Parser.AST.TemplateParameter.Internal.cctor_1(__instance, new global::System.IntPtr(&__ret)); - return new CppSharp.Parser.AST.TemplateParameter(__instance); + return new CppSharp.Parser.AST.TemplateParameter(__ret); } public void addParameters(CppSharp.Parser.AST.TemplateParameter s) @@ -5990,8 +6218,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ClassTemplate.Internal native) + { + var ret = Marshal.AllocHGlobal(112); + CppSharp.Parser.AST.ClassTemplate.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ClassTemplate(ClassTemplate.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6158,8 +6393,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ClassTemplateSpecialization.Internal native) + { + var ret = Marshal.AllocHGlobal(268); + CppSharp.Parser.AST.ClassTemplateSpecialization.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ClassTemplateSpecialization(ClassTemplateSpecialization.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6184,9 +6426,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.TemplateArgument.Internal(); Internal.getArguments_0(new IntPtr(&__ret), __Instance, i); - var __instance = Marshal.AllocHGlobal(20); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ret), new UIntPtr(20)); - return new CppSharp.Parser.AST.TemplateArgument(__instance); + return new CppSharp.Parser.AST.TemplateArgument(__ret); } public void addArguments(CppSharp.Parser.AST.TemplateArgument s) @@ -6338,8 +6578,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ClassTemplatePartialSpecialization.Internal native) + { + var ret = Marshal.AllocHGlobal(268); + CppSharp.Parser.AST.ClassTemplatePartialSpecialization.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ClassTemplatePartialSpecialization(ClassTemplatePartialSpecialization.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6440,8 +6687,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(FunctionTemplate.Internal native) + { + var ret = Marshal.AllocHGlobal(112); + CppSharp.Parser.AST.FunctionTemplate.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal FunctionTemplate(FunctionTemplate.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6547,8 +6801,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(FunctionTemplateSpecialization.Internal native) + { + var ret = Marshal.AllocHGlobal(24); + CppSharp.Parser.AST.FunctionTemplateSpecialization.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal FunctionTemplateSpecialization(FunctionTemplateSpecialization.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6579,9 +6840,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.TemplateArgument.Internal(); Internal.getArguments_0(new IntPtr(&__ret), __Instance, i); - var __instance = Marshal.AllocHGlobal(20); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ret), new UIntPtr(20)); - return new CppSharp.Parser.AST.TemplateArgument(__instance); + return new CppSharp.Parser.AST.TemplateArgument(__ret); } public void addArguments(CppSharp.Parser.AST.TemplateArgument s) @@ -6715,8 +6974,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Namespace.Internal native) + { + var ret = Marshal.AllocHGlobal(184); + CppSharp.Parser.AST.Namespace.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Namespace(Namespace.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6812,8 +7078,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(PreprocessedEntity.Internal native) + { + var ret = Marshal.AllocHGlobal(88); + CppSharp.Parser.AST.PreprocessedEntity.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal PreprocessedEntity(PreprocessedEntity.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6919,8 +7192,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(MacroDefinition.Internal native) + { + var ret = Marshal.AllocHGlobal(100); + CppSharp.Parser.AST.MacroDefinition.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal MacroDefinition(MacroDefinition.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7031,8 +7311,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(MacroExpansion.Internal native) + { + var ret = Marshal.AllocHGlobal(104); + CppSharp.Parser.AST.MacroExpansion.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal MacroExpansion(MacroExpansion.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7184,8 +7471,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TranslationUnit.Internal native) + { + var ret = Marshal.AllocHGlobal(212); + CppSharp.Parser.AST.TranslationUnit.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TranslationUnit(TranslationUnit.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7344,8 +7638,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(NativeLibrary.Internal native) + { + var ret = Marshal.AllocHGlobal(36); + CppSharp.Parser.AST.NativeLibrary.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal NativeLibrary(NativeLibrary.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7494,8 +7795,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ASTContext.Internal native) + { + var ret = Marshal.AllocHGlobal(12); + CppSharp.Parser.AST.ASTContext.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ASTContext(ASTContext.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7576,8 +7884,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Comment.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(4); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(4)); + return ret; + } + internal Comment(Comment.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7644,8 +7959,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(FullComment.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(4); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(4)); + return ret; + } + internal FullComment(FullComment.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7721,8 +8043,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(RawComment.Internal native) + { + var ret = Marshal.AllocHGlobal(32); + CppSharp.Parser.AST.RawComment.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal RawComment(RawComment.Internal native) - : this(&native) + : this(__CopyValue(native)) { } diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppParser.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppParser.cs index d0e49f00..547205db 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppParser.cs @@ -217,8 +217,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ParserOptions.Internal native) + { + var ret = Marshal.AllocHGlobal(104); + CppSharp.Parser.ParserOptions.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ParserOptions(ParserOptions.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -597,8 +604,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ParserDiagnostic.Internal native) + { + var ret = Marshal.AllocHGlobal(36); + CppSharp.Parser.ParserDiagnostic.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ParserDiagnostic(ParserDiagnostic.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -765,8 +779,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ParserResult.Internal native) + { + var ret = Marshal.AllocHGlobal(28); + CppSharp.Parser.ParserResult.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ParserResult(ParserResult.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -797,9 +818,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.ParserDiagnostic.Internal(); Internal.getDiagnostics_0(new IntPtr(&__ret), __Instance, i); - var __instance = Marshal.AllocHGlobal(36); - CppSharp.Parser.ParserDiagnostic.Internal.cctor_1(__instance, new global::System.IntPtr(&__ret)); - return new CppSharp.Parser.ParserDiagnostic(__instance); + return new CppSharp.Parser.ParserDiagnostic(__ret); } public void addDiagnostics(CppSharp.Parser.ParserDiagnostic s) @@ -901,8 +920,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ClangParser.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(1); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(1)); + return ret; + } + internal ClangParser(ClangParser.Internal native) - : this(&native) + : this(__CopyValue(native)) { } diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Target.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Target.cs index 9d42134e..af0f0cf7 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Target.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Target.cs @@ -177,8 +177,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ParserTargetInfo.Internal native) + { + var ret = Marshal.AllocHGlobal(164); + CppSharp.Parser.ParserTargetInfo.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ParserTargetInfo(ParserTargetInfo.Internal native) - : this(&native) + : this(__CopyValue(native)) { } diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/AST.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/AST.cs index 559495c1..cf84be67 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/AST.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/AST.cs @@ -245,8 +245,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Type.Internal native) + { + var ret = Marshal.AllocHGlobal(8); + CppSharp.Parser.AST.Type.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Type(Type.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -331,8 +338,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TypeQualifiers.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(3); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(3)); + return ret; + } + internal TypeQualifiers(TypeQualifiers.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -432,8 +446,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(QualifiedType.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(8); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(8)); + return ret; + } + internal QualifiedType(QualifiedType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -479,9 +500,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(3); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Qualifiers), new UIntPtr(3)); - return new CppSharp.Parser.AST.TypeQualifiers(__instance); + return new CppSharp.Parser.AST.TypeQualifiers(__ptr->Qualifiers); } set @@ -522,8 +541,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TagType.Internal native) + { + var ret = Marshal.AllocHGlobal(12); + CppSharp.Parser.AST.TagType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TagType(TagType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -604,8 +630,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ArrayType.Internal native) + { + var ret = Marshal.AllocHGlobal(24); + CppSharp.Parser.AST.ArrayType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ArrayType(ArrayType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -631,9 +664,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedType), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedType); } set @@ -732,8 +763,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(FunctionType.Internal native) + { + var ret = Marshal.AllocHGlobal(32); + CppSharp.Parser.AST.FunctionType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal FunctionType(FunctionType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -786,9 +824,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->ReturnType), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->ReturnType); } set @@ -855,8 +891,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(PointerType.Internal native) + { + var ret = Marshal.AllocHGlobal(20); + CppSharp.Parser.AST.PointerType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal PointerType(PointerType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -882,9 +925,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedPointee), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedPointee); } set @@ -940,8 +981,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(MemberPointerType.Internal native) + { + var ret = Marshal.AllocHGlobal(16); + CppSharp.Parser.AST.MemberPointerType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal MemberPointerType(MemberPointerType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -967,9 +1015,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Pointee), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Pointee); } set @@ -1010,8 +1056,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TypedefType.Internal native) + { + var ret = Marshal.AllocHGlobal(12); + CppSharp.Parser.AST.TypedefType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TypedefType(TypedefType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1081,8 +1134,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(AttributedType.Internal native) + { + var ret = Marshal.AllocHGlobal(24); + CppSharp.Parser.AST.AttributedType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal AttributedType(AttributedType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1108,9 +1168,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Modified), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Modified); } set @@ -1125,9 +1183,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Equivalent), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Equivalent); } set @@ -1174,8 +1230,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(DecayedType.Internal native) + { + var ret = Marshal.AllocHGlobal(32); + CppSharp.Parser.AST.DecayedType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal DecayedType(DecayedType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1201,9 +1264,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Decayed), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Decayed); } set @@ -1218,9 +1279,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Original), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Original); } set @@ -1235,9 +1294,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Pointee), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Pointee); } set @@ -1295,8 +1352,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TemplateArgument.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(20); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(20)); + return ret; + } + internal TemplateArgument(TemplateArgument.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1342,9 +1406,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Type), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Type); } set @@ -1443,8 +1505,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TemplateSpecializationType.Internal native) + { + var ret = Marshal.AllocHGlobal(28); + CppSharp.Parser.AST.TemplateSpecializationType.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TemplateSpecializationType(TemplateSpecializationType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1469,9 +1538,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.TemplateArgument.Internal(); Internal.getArguments_0(__Instance, new IntPtr(&__ret), i); - var __instance = Marshal.AllocHGlobal(20); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ret), new UIntPtr(20)); - return new CppSharp.Parser.AST.TemplateArgument(__instance); + return new CppSharp.Parser.AST.TemplateArgument(__ret); } public void addArguments(CppSharp.Parser.AST.TemplateArgument s) @@ -1572,8 +1639,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TemplateParameter.Internal native) + { + var ret = Marshal.AllocHGlobal(28); + CppSharp.Parser.AST.TemplateParameter.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TemplateParameter(TemplateParameter.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1690,8 +1764,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TemplateParameterType.Internal native) + { + var ret = Marshal.AllocHGlobal(48); + CppSharp.Parser.AST.TemplateParameterType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TemplateParameterType(TemplateParameterType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1717,9 +1798,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(28); - CppSharp.Parser.AST.TemplateParameter.Internal.cctor_1(__instance, new global::System.IntPtr(&__ptr->Parameter)); - return new CppSharp.Parser.AST.TemplateParameter(__instance); + return new CppSharp.Parser.AST.TemplateParameter(__ptr->Parameter); } set @@ -1805,8 +1884,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TemplateParameterSubstitutionType.Internal native) + { + var ret = Marshal.AllocHGlobal(16); + CppSharp.Parser.AST.TemplateParameterSubstitutionType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TemplateParameterSubstitutionType(TemplateParameterSubstitutionType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1832,9 +1918,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Replacement), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Replacement); } set @@ -1878,8 +1962,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(InjectedClassNameType.Internal native) + { + var ret = Marshal.AllocHGlobal(16); + CppSharp.Parser.AST.InjectedClassNameType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal InjectedClassNameType(InjectedClassNameType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1958,8 +2049,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(DependentNameType.Internal native) + { + var ret = Marshal.AllocHGlobal(8); + CppSharp.Parser.AST.DependentNameType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal DependentNameType(DependentNameType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2008,8 +2106,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(PackExpansionType.Internal native) + { + var ret = Marshal.AllocHGlobal(8); + CppSharp.Parser.AST.PackExpansionType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal PackExpansionType(PackExpansionType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2061,8 +2166,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(BuiltinType.Internal native) + { + var ret = Marshal.AllocHGlobal(12); + CppSharp.Parser.AST.BuiltinType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal BuiltinType(BuiltinType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2131,8 +2243,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(VTableComponent.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(12); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(12)); + return ret; + } + internal VTableComponent(VTableComponent.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2252,8 +2371,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(VTableLayout.Internal native) + { + var ret = Marshal.AllocHGlobal(12); + CppSharp.Parser.AST.VTableLayout.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal VTableLayout(VTableLayout.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2284,9 +2410,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.VTableComponent.Internal(); Internal.getComponents_0(__Instance, new IntPtr(&__ret), i); - var __instance = Marshal.AllocHGlobal(12); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ret), new UIntPtr(12)); - return new CppSharp.Parser.AST.VTableComponent(__instance); + return new CppSharp.Parser.AST.VTableComponent(__ret); } public void addComponents(CppSharp.Parser.AST.VTableComponent s) @@ -2350,8 +2474,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(VFTableInfo.Internal native) + { + var ret = Marshal.AllocHGlobal(32); + CppSharp.Parser.AST.VFTableInfo.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal VFTableInfo(VFTableInfo.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2428,9 +2559,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(12); - CppSharp.Parser.AST.VTableLayout.Internal.cctor_1(__instance, new global::System.IntPtr(&__ptr->Layout)); - return new CppSharp.Parser.AST.VTableLayout(__instance); + return new CppSharp.Parser.AST.VTableLayout(__ptr->Layout); } set @@ -2510,8 +2639,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ClassLayout.Internal native) + { + var ret = Marshal.AllocHGlobal(48); + CppSharp.Parser.AST.ClassLayout.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ClassLayout(ClassLayout.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2542,9 +2678,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.VFTableInfo.Internal(); Internal.getVFTables_0(__Instance, new IntPtr(&__ret), i); - var __instance = Marshal.AllocHGlobal(32); - CppSharp.Parser.AST.VFTableInfo.Internal.cctor_1(__instance, new global::System.IntPtr(&__ret)); - return new CppSharp.Parser.AST.VFTableInfo(__instance); + return new CppSharp.Parser.AST.VFTableInfo(__ret); } public void addVFTables(CppSharp.Parser.AST.VFTableInfo s) @@ -2587,9 +2721,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(12); - CppSharp.Parser.AST.VTableLayout.Internal.cctor_1(__instance, new global::System.IntPtr(&__ptr->Layout)); - return new CppSharp.Parser.AST.VTableLayout(__instance); + return new CppSharp.Parser.AST.VTableLayout(__ptr->Layout); } set @@ -2773,8 +2905,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Declaration.Internal native) + { + var ret = Marshal.AllocHGlobal(120); + CppSharp.Parser.AST.Declaration.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Declaration(Declaration.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3216,8 +3355,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(DeclarationContext.Internal native) + { + var ret = Marshal.AllocHGlobal(216); + CppSharp.Parser.AST.DeclarationContext.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal DeclarationContext(DeclarationContext.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3503,8 +3649,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TypedefDecl.Internal native) + { + var ret = Marshal.AllocHGlobal(128); + CppSharp.Parser.AST.TypedefDecl.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TypedefDecl(TypedefDecl.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3530,9 +3683,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedType), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedType); } set @@ -3582,8 +3733,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Statement.Internal native) + { + var ret = Marshal.AllocHGlobal(32); + CppSharp.Parser.AST.Statement.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Statement(Statement.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3679,8 +3837,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Expression.Internal native) + { + var ret = Marshal.AllocHGlobal(32); + CppSharp.Parser.AST.Expression.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Expression(Expression.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3766,8 +3931,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Parameter.Internal native) + { + var ret = Marshal.AllocHGlobal(140); + CppSharp.Parser.AST.Parameter.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Parameter(Parameter.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3793,9 +3965,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedType), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedType); } set @@ -3989,8 +4159,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Function.Internal native) + { + var ret = Marshal.AllocHGlobal(208); + CppSharp.Parser.AST.Function.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Function(Function.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -4077,9 +4254,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->ReturnType), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->ReturnType); } set @@ -4329,8 +4504,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Method.Internal native) + { + var ret = Marshal.AllocHGlobal(236); + CppSharp.Parser.AST.Method.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Method(Method.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -4521,9 +4703,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->ConversionType), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->ConversionType); } set @@ -4697,8 +4877,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Item.Internal native) + { + var ret = Marshal.AllocHGlobal(152); + CppSharp.Parser.AST.Enumeration.Item.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Item(Item.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -4757,8 +4944,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Enumeration.Internal native) + { + var ret = Marshal.AllocHGlobal(240); + CppSharp.Parser.AST.Enumeration.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Enumeration(Enumeration.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -4783,9 +4977,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.Enumeration.Item.Internal(); Internal.getItems_0(__Instance, new IntPtr(&__ret), i); - var __instance = Marshal.AllocHGlobal(152); - CppSharp.Parser.AST.Enumeration.Item.Internal.cctor_1(__instance, new global::System.IntPtr(&__ret)); - return new CppSharp.Parser.AST.Enumeration.Item(__instance); + return new CppSharp.Parser.AST.Enumeration.Item(__ret); } public void addItems(CppSharp.Parser.AST.Enumeration.Item s) @@ -4923,8 +5115,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Variable.Internal native) + { + var ret = Marshal.AllocHGlobal(152); + CppSharp.Parser.AST.Variable.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Variable(Variable.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -4967,9 +5166,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedType), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedType); } set @@ -5012,8 +5209,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(BaseClassSpecifier.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(12); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(12)); + return ret; + } + internal BaseClassSpecifier(BaseClassSpecifier.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -5150,8 +5354,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Field.Internal native) + { + var ret = Marshal.AllocHGlobal(136); + CppSharp.Parser.AST.Field.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Field(Field.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -5177,9 +5388,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(8); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedType), new UIntPtr(8)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedType); } set @@ -5276,8 +5485,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(AccessSpecifierDecl.Internal native) + { + var ret = Marshal.AllocHGlobal(120); + CppSharp.Parser.AST.AccessSpecifierDecl.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal AccessSpecifierDecl(AccessSpecifierDecl.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -5471,8 +5687,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Class.Internal native) + { + var ret = Marshal.AllocHGlobal(280); + CppSharp.Parser.AST.Class.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Class(Class.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -5836,8 +6059,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Template.Internal native) + { + var ret = Marshal.AllocHGlobal(136); + CppSharp.Parser.AST.Template.Internal.cctor_3(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Template(Template.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -5870,9 +6100,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.TemplateParameter.Internal(); Internal.getParameters_0(__Instance, new IntPtr(&__ret), i); - var __instance = Marshal.AllocHGlobal(28); - CppSharp.Parser.AST.TemplateParameter.Internal.cctor_1(__instance, new global::System.IntPtr(&__ret)); - return new CppSharp.Parser.AST.TemplateParameter(__instance); + return new CppSharp.Parser.AST.TemplateParameter(__ret); } public void addParameters(CppSharp.Parser.AST.TemplateParameter s) @@ -5990,8 +6218,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ClassTemplate.Internal native) + { + var ret = Marshal.AllocHGlobal(148); + CppSharp.Parser.AST.ClassTemplate.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ClassTemplate(ClassTemplate.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6158,8 +6393,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ClassTemplateSpecialization.Internal native) + { + var ret = Marshal.AllocHGlobal(300); + CppSharp.Parser.AST.ClassTemplateSpecialization.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ClassTemplateSpecialization(ClassTemplateSpecialization.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6184,9 +6426,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.TemplateArgument.Internal(); Internal.getArguments_0(__Instance, new IntPtr(&__ret), i); - var __instance = Marshal.AllocHGlobal(20); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ret), new UIntPtr(20)); - return new CppSharp.Parser.AST.TemplateArgument(__instance); + return new CppSharp.Parser.AST.TemplateArgument(__ret); } public void addArguments(CppSharp.Parser.AST.TemplateArgument s) @@ -6338,8 +6578,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ClassTemplatePartialSpecialization.Internal native) + { + var ret = Marshal.AllocHGlobal(300); + CppSharp.Parser.AST.ClassTemplatePartialSpecialization.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ClassTemplatePartialSpecialization(ClassTemplatePartialSpecialization.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6440,8 +6687,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(FunctionTemplate.Internal native) + { + var ret = Marshal.AllocHGlobal(148); + CppSharp.Parser.AST.FunctionTemplate.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal FunctionTemplate(FunctionTemplate.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6547,8 +6801,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(FunctionTemplateSpecialization.Internal native) + { + var ret = Marshal.AllocHGlobal(24); + CppSharp.Parser.AST.FunctionTemplateSpecialization.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal FunctionTemplateSpecialization(FunctionTemplateSpecialization.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6579,9 +6840,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.TemplateArgument.Internal(); Internal.getArguments_0(__Instance, new IntPtr(&__ret), i); - var __instance = Marshal.AllocHGlobal(20); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ret), new UIntPtr(20)); - return new CppSharp.Parser.AST.TemplateArgument(__instance); + return new CppSharp.Parser.AST.TemplateArgument(__ret); } public void addArguments(CppSharp.Parser.AST.TemplateArgument s) @@ -6715,8 +6974,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Namespace.Internal native) + { + var ret = Marshal.AllocHGlobal(220); + CppSharp.Parser.AST.Namespace.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Namespace(Namespace.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6812,8 +7078,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(PreprocessedEntity.Internal native) + { + var ret = Marshal.AllocHGlobal(124); + CppSharp.Parser.AST.PreprocessedEntity.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal PreprocessedEntity(PreprocessedEntity.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6919,8 +7192,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(MacroDefinition.Internal native) + { + var ret = Marshal.AllocHGlobal(148); + CppSharp.Parser.AST.MacroDefinition.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal MacroDefinition(MacroDefinition.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7031,8 +7311,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(MacroExpansion.Internal native) + { + var ret = Marshal.AllocHGlobal(152); + CppSharp.Parser.AST.MacroExpansion.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal MacroExpansion(MacroExpansion.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7184,8 +7471,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TranslationUnit.Internal native) + { + var ret = Marshal.AllocHGlobal(260); + CppSharp.Parser.AST.TranslationUnit.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TranslationUnit(TranslationUnit.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7344,8 +7638,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(NativeLibrary.Internal native) + { + var ret = Marshal.AllocHGlobal(48); + CppSharp.Parser.AST.NativeLibrary.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal NativeLibrary(NativeLibrary.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7494,8 +7795,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ASTContext.Internal native) + { + var ret = Marshal.AllocHGlobal(12); + CppSharp.Parser.AST.ASTContext.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ASTContext(ASTContext.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7576,8 +7884,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Comment.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(4); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(4)); + return ret; + } + internal Comment(Comment.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7644,8 +7959,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(FullComment.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(4); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(4)); + return ret; + } + internal FullComment(FullComment.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7721,8 +8043,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(RawComment.Internal native) + { + var ret = Marshal.AllocHGlobal(56); + CppSharp.Parser.AST.RawComment.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal RawComment(RawComment.Internal native) - : this(&native) + : this(__CopyValue(native)) { } diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppParser.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppParser.cs index f65eb0b2..22fa210c 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppParser.cs @@ -217,8 +217,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ParserOptions.Internal native) + { + var ret = Marshal.AllocHGlobal(128); + CppSharp.Parser.ParserOptions.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ParserOptions(ParserOptions.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -597,8 +604,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ParserDiagnostic.Internal native) + { + var ret = Marshal.AllocHGlobal(60); + CppSharp.Parser.ParserDiagnostic.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ParserDiagnostic(ParserDiagnostic.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -765,8 +779,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ParserResult.Internal native) + { + var ret = Marshal.AllocHGlobal(28); + CppSharp.Parser.ParserResult.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ParserResult(ParserResult.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -797,9 +818,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.ParserDiagnostic.Internal(); Internal.getDiagnostics_0(__Instance, new IntPtr(&__ret), i); - var __instance = Marshal.AllocHGlobal(60); - CppSharp.Parser.ParserDiagnostic.Internal.cctor_1(__instance, new global::System.IntPtr(&__ret)); - return new CppSharp.Parser.ParserDiagnostic(__instance); + return new CppSharp.Parser.ParserDiagnostic(__ret); } public void addDiagnostics(CppSharp.Parser.ParserDiagnostic s) @@ -901,8 +920,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ClangParser.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(1); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(1)); + return ret; + } + internal ClangParser(ClangParser.Internal native) - : this(&native) + : this(__CopyValue(native)) { } diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Target.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Target.cs index c4aa2ba9..91be5521 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Target.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Target.cs @@ -177,8 +177,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ParserTargetInfo.Internal native) + { + var ret = Marshal.AllocHGlobal(176); + CppSharp.Parser.ParserTargetInfo.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ParserTargetInfo(ParserTargetInfo.Internal native) - : this(&native) + : this(__CopyValue(native)) { } diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/AST.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/AST.cs index 5afc3b93..899e4eb7 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/AST.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/AST.cs @@ -245,8 +245,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Type.Internal native) + { + var ret = Marshal.AllocHGlobal(8); + CppSharp.Parser.AST.Type.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Type(Type.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -331,8 +338,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TypeQualifiers.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(3); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(3)); + return ret; + } + internal TypeQualifiers(TypeQualifiers.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -432,8 +446,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(QualifiedType.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(16); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(16)); + return ret; + } + internal QualifiedType(QualifiedType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -479,9 +500,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(3); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Qualifiers), new UIntPtr(3)); - return new CppSharp.Parser.AST.TypeQualifiers(__instance); + return new CppSharp.Parser.AST.TypeQualifiers(__ptr->Qualifiers); } set @@ -522,8 +541,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TagType.Internal native) + { + var ret = Marshal.AllocHGlobal(16); + CppSharp.Parser.AST.TagType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TagType(TagType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -604,8 +630,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ArrayType.Internal native) + { + var ret = Marshal.AllocHGlobal(40); + CppSharp.Parser.AST.ArrayType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ArrayType(ArrayType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -631,9 +664,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedType), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedType); } set @@ -732,8 +763,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(FunctionType.Internal native) + { + var ret = Marshal.AllocHGlobal(56); + CppSharp.Parser.AST.FunctionType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal FunctionType(FunctionType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -786,9 +824,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->ReturnType), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->ReturnType); } set @@ -855,8 +891,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(PointerType.Internal native) + { + var ret = Marshal.AllocHGlobal(32); + CppSharp.Parser.AST.PointerType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal PointerType(PointerType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -882,9 +925,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedPointee), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedPointee); } set @@ -940,8 +981,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(MemberPointerType.Internal native) + { + var ret = Marshal.AllocHGlobal(24); + CppSharp.Parser.AST.MemberPointerType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal MemberPointerType(MemberPointerType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -967,9 +1015,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Pointee), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Pointee); } set @@ -1010,8 +1056,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TypedefType.Internal native) + { + var ret = Marshal.AllocHGlobal(16); + CppSharp.Parser.AST.TypedefType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TypedefType(TypedefType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1081,8 +1134,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(AttributedType.Internal native) + { + var ret = Marshal.AllocHGlobal(40); + CppSharp.Parser.AST.AttributedType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal AttributedType(AttributedType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1108,9 +1168,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Modified), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Modified); } set @@ -1125,9 +1183,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Equivalent), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Equivalent); } set @@ -1174,8 +1230,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(DecayedType.Internal native) + { + var ret = Marshal.AllocHGlobal(56); + CppSharp.Parser.AST.DecayedType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal DecayedType(DecayedType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1201,9 +1264,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Decayed), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Decayed); } set @@ -1218,9 +1279,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Original), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Original); } set @@ -1235,9 +1294,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Pointee), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Pointee); } set @@ -1295,8 +1352,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TemplateArgument.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(40); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(40)); + return ret; + } + internal TemplateArgument(TemplateArgument.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1342,9 +1406,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Type), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Type); } set @@ -1443,8 +1505,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TemplateSpecializationType.Internal native) + { + var ret = Marshal.AllocHGlobal(48); + CppSharp.Parser.AST.TemplateSpecializationType.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TemplateSpecializationType(TemplateSpecializationType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1469,9 +1538,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.TemplateArgument.Internal(); Internal.getArguments_0(new IntPtr(&__ret), __Instance, i); - var __instance = Marshal.AllocHGlobal(40); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ret), new UIntPtr(40)); - return new CppSharp.Parser.AST.TemplateArgument(__instance); + return new CppSharp.Parser.AST.TemplateArgument(__ret); } public void addArguments(CppSharp.Parser.AST.TemplateArgument s) @@ -1572,8 +1639,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TemplateParameter.Internal native) + { + var ret = Marshal.AllocHGlobal(16); + CppSharp.Parser.AST.TemplateParameter.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TemplateParameter(TemplateParameter.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1690,8 +1764,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TemplateParameterType.Internal native) + { + var ret = Marshal.AllocHGlobal(40); + CppSharp.Parser.AST.TemplateParameterType.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TemplateParameterType(TemplateParameterType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1717,9 +1798,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Parser.AST.TemplateParameter.Internal.cctor_1(__instance, new global::System.IntPtr(&__ptr->Parameter)); - return new CppSharp.Parser.AST.TemplateParameter(__instance); + return new CppSharp.Parser.AST.TemplateParameter(__ptr->Parameter); } set @@ -1805,8 +1884,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TemplateParameterSubstitutionType.Internal native) + { + var ret = Marshal.AllocHGlobal(24); + CppSharp.Parser.AST.TemplateParameterSubstitutionType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TemplateParameterSubstitutionType(TemplateParameterSubstitutionType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1832,9 +1918,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->Replacement), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->Replacement); } set @@ -1878,8 +1962,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(InjectedClassNameType.Internal native) + { + var ret = Marshal.AllocHGlobal(24); + CppSharp.Parser.AST.InjectedClassNameType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal InjectedClassNameType(InjectedClassNameType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -1958,8 +2049,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(DependentNameType.Internal native) + { + var ret = Marshal.AllocHGlobal(8); + CppSharp.Parser.AST.DependentNameType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal DependentNameType(DependentNameType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2008,8 +2106,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(PackExpansionType.Internal native) + { + var ret = Marshal.AllocHGlobal(8); + CppSharp.Parser.AST.PackExpansionType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal PackExpansionType(PackExpansionType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2061,8 +2166,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(BuiltinType.Internal native) + { + var ret = Marshal.AllocHGlobal(12); + CppSharp.Parser.AST.BuiltinType.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal BuiltinType(BuiltinType.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2131,8 +2243,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(VTableComponent.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(16); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(16)); + return ret; + } + internal VTableComponent(VTableComponent.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2252,8 +2371,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(VTableLayout.Internal native) + { + var ret = Marshal.AllocHGlobal(24); + CppSharp.Parser.AST.VTableLayout.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal VTableLayout(VTableLayout.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2283,9 +2409,7 @@ namespace CppSharp public CppSharp.Parser.AST.VTableComponent getComponents(uint i) { var __ret = Internal.getComponents_0(__Instance, i); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ret), new UIntPtr(16)); - return new CppSharp.Parser.AST.VTableComponent(__instance); + return new CppSharp.Parser.AST.VTableComponent(__ret); } public void addComponents(CppSharp.Parser.AST.VTableComponent s) @@ -2349,8 +2473,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(VFTableInfo.Internal native) + { + var ret = Marshal.AllocHGlobal(40); + CppSharp.Parser.AST.VFTableInfo.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal VFTableInfo(VFTableInfo.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2427,9 +2558,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(24); - CppSharp.Parser.AST.VTableLayout.Internal.cctor_1(__instance, new global::System.IntPtr(&__ptr->Layout)); - return new CppSharp.Parser.AST.VTableLayout(__instance); + return new CppSharp.Parser.AST.VTableLayout(__ptr->Layout); } set @@ -2509,8 +2638,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ClassLayout.Internal native) + { + var ret = Marshal.AllocHGlobal(88); + CppSharp.Parser.AST.ClassLayout.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ClassLayout(ClassLayout.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -2541,9 +2677,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.VFTableInfo.Internal(); Internal.getVFTables_0(new IntPtr(&__ret), __Instance, i); - var __instance = Marshal.AllocHGlobal(40); - CppSharp.Parser.AST.VFTableInfo.Internal.cctor_1(__instance, new global::System.IntPtr(&__ret)); - return new CppSharp.Parser.AST.VFTableInfo(__instance); + return new CppSharp.Parser.AST.VFTableInfo(__ret); } public void addVFTables(CppSharp.Parser.AST.VFTableInfo s) @@ -2586,9 +2720,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(24); - CppSharp.Parser.AST.VTableLayout.Internal.cctor_1(__instance, new global::System.IntPtr(&__ptr->Layout)); - return new CppSharp.Parser.AST.VTableLayout(__instance); + return new CppSharp.Parser.AST.VTableLayout(__ptr->Layout); } set @@ -2772,8 +2904,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Declaration.Internal native) + { + var ret = Marshal.AllocHGlobal(112); + CppSharp.Parser.AST.Declaration.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Declaration(Declaration.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3215,8 +3354,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(DeclarationContext.Internal native) + { + var ret = Marshal.AllocHGlobal(336); + CppSharp.Parser.AST.DeclarationContext.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal DeclarationContext(DeclarationContext.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3502,8 +3648,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TypedefDecl.Internal native) + { + var ret = Marshal.AllocHGlobal(128); + CppSharp.Parser.AST.TypedefDecl.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TypedefDecl(TypedefDecl.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3529,9 +3682,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedType), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedType); } set @@ -3581,8 +3732,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Statement.Internal native) + { + var ret = Marshal.AllocHGlobal(24); + CppSharp.Parser.AST.Statement.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Statement(Statement.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3678,8 +3836,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Expression.Internal native) + { + var ret = Marshal.AllocHGlobal(24); + CppSharp.Parser.AST.Expression.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Expression(Expression.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3765,8 +3930,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Parameter.Internal native) + { + var ret = Marshal.AllocHGlobal(144); + CppSharp.Parser.AST.Parameter.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Parameter(Parameter.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -3792,9 +3964,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedType), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedType); } set @@ -3988,8 +4158,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Function.Internal native) + { + var ret = Marshal.AllocHGlobal(200); + CppSharp.Parser.AST.Function.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Function(Function.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -4076,9 +4253,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->ReturnType), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->ReturnType); } set @@ -4328,8 +4503,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Method.Internal native) + { + var ret = Marshal.AllocHGlobal(240); + CppSharp.Parser.AST.Method.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Method(Method.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -4520,9 +4702,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->ConversionType), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->ConversionType); } set @@ -4696,8 +4876,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Item.Internal native) + { + var ret = Marshal.AllocHGlobal(128); + CppSharp.Parser.AST.Enumeration.Item.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Item(Item.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -4756,8 +4943,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Enumeration.Internal native) + { + var ret = Marshal.AllocHGlobal(376); + CppSharp.Parser.AST.Enumeration.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Enumeration(Enumeration.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -4782,9 +4976,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.Enumeration.Item.Internal(); Internal.getItems_0(new IntPtr(&__ret), __Instance, i); - var __instance = Marshal.AllocHGlobal(128); - CppSharp.Parser.AST.Enumeration.Item.Internal.cctor_1(__instance, new global::System.IntPtr(&__ret)); - return new CppSharp.Parser.AST.Enumeration.Item(__instance); + return new CppSharp.Parser.AST.Enumeration.Item(__ret); } public void addItems(CppSharp.Parser.AST.Enumeration.Item s) @@ -4922,8 +5114,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Variable.Internal native) + { + var ret = Marshal.AllocHGlobal(136); + CppSharp.Parser.AST.Variable.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Variable(Variable.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -4966,9 +5165,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedType), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedType); } set @@ -5011,8 +5208,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(BaseClassSpecifier.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(16); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(16)); + return ret; + } + internal BaseClassSpecifier(BaseClassSpecifier.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -5149,8 +5353,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Field.Internal native) + { + var ret = Marshal.AllocHGlobal(144); + CppSharp.Parser.AST.Field.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Field(Field.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -5176,9 +5387,7 @@ namespace CppSharp get { var __ptr = (Internal*)__Instance.ToPointer(); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ptr->QualifiedType), new UIntPtr(16)); - return new CppSharp.Parser.AST.QualifiedType(__instance); + return new CppSharp.Parser.AST.QualifiedType(__ptr->QualifiedType); } set @@ -5275,8 +5484,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(AccessSpecifierDecl.Internal native) + { + var ret = Marshal.AllocHGlobal(112); + CppSharp.Parser.AST.AccessSpecifierDecl.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal AccessSpecifierDecl(AccessSpecifierDecl.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -5470,8 +5686,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Class.Internal native) + { + var ret = Marshal.AllocHGlobal(456); + CppSharp.Parser.AST.Class.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Class(Class.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -5835,8 +6058,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Template.Internal native) + { + var ret = Marshal.AllocHGlobal(144); + CppSharp.Parser.AST.Template.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Template(Template.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -5869,9 +6099,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.TemplateParameter.Internal(); Internal.getParameters_0(new IntPtr(&__ret), __Instance, i); - var __instance = Marshal.AllocHGlobal(16); - CppSharp.Parser.AST.TemplateParameter.Internal.cctor_1(__instance, new global::System.IntPtr(&__ret)); - return new CppSharp.Parser.AST.TemplateParameter(__instance); + return new CppSharp.Parser.AST.TemplateParameter(__ret); } public void addParameters(CppSharp.Parser.AST.TemplateParameter s) @@ -5989,8 +6217,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ClassTemplate.Internal native) + { + var ret = Marshal.AllocHGlobal(168); + CppSharp.Parser.AST.ClassTemplate.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ClassTemplate(ClassTemplate.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6157,8 +6392,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ClassTemplateSpecialization.Internal native) + { + var ret = Marshal.AllocHGlobal(496); + CppSharp.Parser.AST.ClassTemplateSpecialization.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ClassTemplateSpecialization(ClassTemplateSpecialization.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6183,9 +6425,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.TemplateArgument.Internal(); Internal.getArguments_0(new IntPtr(&__ret), __Instance, i); - var __instance = Marshal.AllocHGlobal(40); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ret), new UIntPtr(40)); - return new CppSharp.Parser.AST.TemplateArgument(__instance); + return new CppSharp.Parser.AST.TemplateArgument(__ret); } public void addArguments(CppSharp.Parser.AST.TemplateArgument s) @@ -6337,8 +6577,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ClassTemplatePartialSpecialization.Internal native) + { + var ret = Marshal.AllocHGlobal(496); + CppSharp.Parser.AST.ClassTemplatePartialSpecialization.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ClassTemplatePartialSpecialization(ClassTemplatePartialSpecialization.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6439,8 +6686,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(FunctionTemplate.Internal native) + { + var ret = Marshal.AllocHGlobal(168); + CppSharp.Parser.AST.FunctionTemplate.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal FunctionTemplate(FunctionTemplate.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6546,8 +6800,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(FunctionTemplateSpecialization.Internal native) + { + var ret = Marshal.AllocHGlobal(48); + CppSharp.Parser.AST.FunctionTemplateSpecialization.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal FunctionTemplateSpecialization(FunctionTemplateSpecialization.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6578,9 +6839,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.AST.TemplateArgument.Internal(); Internal.getArguments_0(new IntPtr(&__ret), __Instance, i); - var __instance = Marshal.AllocHGlobal(40); - CppSharp.Runtime.Helpers.memcpy(__instance, new IntPtr(&__ret), new UIntPtr(40)); - return new CppSharp.Parser.AST.TemplateArgument(__instance); + return new CppSharp.Parser.AST.TemplateArgument(__ret); } public void addArguments(CppSharp.Parser.AST.TemplateArgument s) @@ -6714,8 +6973,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Namespace.Internal native) + { + var ret = Marshal.AllocHGlobal(336); + CppSharp.Parser.AST.Namespace.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal Namespace(Namespace.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6811,8 +7077,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(PreprocessedEntity.Internal native) + { + var ret = Marshal.AllocHGlobal(120); + CppSharp.Parser.AST.PreprocessedEntity.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal PreprocessedEntity(PreprocessedEntity.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -6918,8 +7191,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(MacroDefinition.Internal native) + { + var ret = Marshal.AllocHGlobal(128); + CppSharp.Parser.AST.MacroDefinition.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal MacroDefinition(MacroDefinition.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7030,8 +7310,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(MacroExpansion.Internal native) + { + var ret = Marshal.AllocHGlobal(136); + CppSharp.Parser.AST.MacroExpansion.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal MacroExpansion(MacroExpansion.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7183,8 +7470,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(TranslationUnit.Internal native) + { + var ret = Marshal.AllocHGlobal(376); + CppSharp.Parser.AST.TranslationUnit.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal TranslationUnit(TranslationUnit.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7343,8 +7637,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(NativeLibrary.Internal native) + { + var ret = Marshal.AllocHGlobal(56); + CppSharp.Parser.AST.NativeLibrary.Internal.cctor_0(ret, new global::System.IntPtr(&native)); + return ret; + } + internal NativeLibrary(NativeLibrary.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7493,8 +7794,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ASTContext.Internal native) + { + var ret = Marshal.AllocHGlobal(24); + CppSharp.Parser.AST.ASTContext.Internal.cctor_2(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ASTContext(ASTContext.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7575,8 +7883,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(Comment.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(4); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(4)); + return ret; + } + internal Comment(Comment.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7643,8 +7958,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(FullComment.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(4); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(4)); + return ret; + } + internal FullComment(FullComment.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -7720,8 +8042,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(RawComment.Internal native) + { + var ret = Marshal.AllocHGlobal(32); + CppSharp.Parser.AST.RawComment.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal RawComment(RawComment.Internal native) - : this(&native) + : this(__CopyValue(native)) { } diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppParser.cs index 934ec1db..fe76500e 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppParser.cs @@ -217,8 +217,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ParserOptions.Internal native) + { + var ret = Marshal.AllocHGlobal(168); + CppSharp.Parser.ParserOptions.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ParserOptions(ParserOptions.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -597,8 +604,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ParserDiagnostic.Internal native) + { + var ret = Marshal.AllocHGlobal(32); + CppSharp.Parser.ParserDiagnostic.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ParserDiagnostic(ParserDiagnostic.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -765,8 +779,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ParserResult.Internal native) + { + var ret = Marshal.AllocHGlobal(56); + CppSharp.Parser.ParserResult.Internal.cctor_1(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ParserResult(ParserResult.Internal native) - : this(&native) + : this(__CopyValue(native)) { } @@ -797,9 +818,7 @@ namespace CppSharp { var __ret = new CppSharp.Parser.ParserDiagnostic.Internal(); Internal.getDiagnostics_0(new IntPtr(&__ret), __Instance, i); - var __instance = Marshal.AllocHGlobal(32); - CppSharp.Parser.ParserDiagnostic.Internal.cctor_1(__instance, new global::System.IntPtr(&__ret)); - return new CppSharp.Parser.ParserDiagnostic(__instance); + return new CppSharp.Parser.ParserDiagnostic(__ret); } public void addDiagnostics(CppSharp.Parser.ParserDiagnostic s) @@ -901,8 +920,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ClangParser.Internal native) + { + global::System.IntPtr ret = Marshal.AllocHGlobal(1); + CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr(1)); + return ret; + } + internal ClangParser(ClangParser.Internal native) - : this(&native) + : this(__CopyValue(native)) { } diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Target.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Target.cs index 4e17444f..1464bdc6 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Target.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Target.cs @@ -177,8 +177,15 @@ namespace CppSharp { } + private static global::System.IntPtr __CopyValue(ParserTargetInfo.Internal native) + { + var ret = Marshal.AllocHGlobal(160); + CppSharp.Parser.ParserTargetInfo.Internal.cctor_0(ret, new global::System.IntPtr(&native)); + return ret; + } + internal ParserTargetInfo(ParserTargetInfo.Internal native) - : this(&native) + : this(__CopyValue(native)) { } diff --git a/src/Generator/Generators/CSharp/CSharpMarshal.cs b/src/Generator/Generators/CSharp/CSharpMarshal.cs index 48049cc6..e5a714ec 100644 --- a/src/Generator/Generators/CSharp/CSharpMarshal.cs +++ b/src/Generator/Generators/CSharp/CSharpMarshal.cs @@ -61,8 +61,6 @@ namespace CppSharp.Generators.CSharp Context.MarshalToManaged = this; } - public int VarSuffix { get; set; } - public static string QualifiedIdentifier(Declaration decl) { var names = new List { decl.Name }; @@ -248,60 +246,11 @@ namespace CppSharp.Generators.CSharp public override bool VisitClassDecl(Class @class) { - var ctx = Context as CSharpMarshalContext; - var instance = Context.ReturnVarName; @class = @class.OriginalClass ?? @class; Type returnType = Context.ReturnType.Type.Desugar(); - if (@class.IsRefType && - (Context.ReturnType.Qualifiers.IsConst || !returnType.IsAddress()) && - (!Context.Driver.Options.GenerateAbstractImpls || !@class.IsAbstract)) - { - var instanceName = Generator.GeneratedIdentifier("instance"); - if (VarSuffix > 0) - instanceName += VarSuffix; - if (@class.HasNonTrivialCopyConstructor) - { - // Find a valid copy constructor overload. - var copyCtorMethod = @class.Methods.FirstOrDefault(method => - method.IsCopyConstructor); - - if (copyCtorMethod == null) - throw new NotSupportedException("Expected a valid copy constructor"); - - // Call the copy constructor. - TypeMap typeMap; - if (!copyCtorMethod.IsGenerated && FindTypeMap(ctx.Driver.TypeDatabase, @class, out typeMap)) - { - typeMap.CSharpMarshalCopyCtorToManaged(Context); - } - else - { - // Allocate memory for a new native object and call the ctor. - Context.SupportBefore.WriteLine("var {0} = Marshal.AllocHGlobal({1});", - instanceName, @class.Layout.Size); - Context.SupportBefore.WriteLine("{0}.Internal.{1}({2}, new global::System.IntPtr(&{3}));", - QualifiedIdentifier(@class), - CSharpTextTemplate.GetFunctionNativeIdentifier(copyCtorMethod), - instanceName, instance); - } - } - else - { - // Allocate memory for a new native object and call the ctor. - Context.SupportBefore.WriteLine("var {0} = Marshal.AllocHGlobal({1});", - instanceName, @class.Layout.Size); - instance = instance.Trim('*'); - Context.SupportBefore.WriteLine( - "CppSharp.Runtime.Helpers.memcpy({0}, new IntPtr(&{1}), new UIntPtr({2}));", - instanceName, instance, @class.Layout.Size); - } - - instance = instanceName; - } - var type = QualifiedIdentifier(@class) + (Context.Driver.Options.GenerateAbstractImpls && @class.IsAbstract ? "Internal" : ""); diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index d2d85cee..cd38d486 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -613,7 +613,7 @@ namespace CppSharp.Generators.CSharp ReturnType = property.QualifiedType }; - var marshal = new CSharpMarshalNativeToManagedPrinter(ctx) { VarSuffix = i }; + var marshal = new CSharpMarshalNativeToManagedPrinter(ctx); property.Visit(marshal); if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore)) @@ -1513,7 +1513,7 @@ namespace CppSharp.Generators.CSharp ReturnVarName = param.Name }; - var marshal = new CSharpMarshalNativeToManagedPrinter(ctx) { VarSuffix = i }; + var marshal = new CSharpMarshalNativeToManagedPrinter(ctx); param.Visit(marshal); if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore)) @@ -1889,12 +1889,7 @@ namespace CppSharp.Generators.CSharp WriteCloseBraceIndent(); PopBlock(NewLineKind.BeforeNextBlock); - PushBlock(CSharpBlockKind.Method); - WriteLine("internal {0}({1}.Internal native)", safeIdentifier, className); - WriteLineIndent(": this(&native)"); - WriteStartBraceIndent(); - WriteCloseBraceIndent(); - PopBlock(NewLineKind.BeforeNextBlock); + GenerateNativeConstructorByValue(@class, className, safeIdentifier); PushBlock(CSharpBlockKind.Method); WriteLine("public {0}(global::System.IntPtr native, bool isInternalImpl = false){1}", @@ -1945,6 +1940,62 @@ namespace CppSharp.Generators.CSharp } } + private void GenerateNativeConstructorByValue(Class @class, string className, string safeIdentifier) + { + if (@class.IsRefType) + { + PushBlock(CSharpBlockKind.Method); + WriteLine("private static global::System.IntPtr __CopyValue({0}.Internal native)", className); + WriteStartBraceIndent(); + if (@class.HasNonTrivialCopyConstructor) + { + // Find a valid copy constructor overload. + var copyCtorMethod = @class.Methods.FirstOrDefault(method => + method.IsCopyConstructor); + + if (copyCtorMethod == null) + throw new NotSupportedException("Expected a valid copy constructor"); + + // Call the copy constructor. + TypeMap typeMap; + if (!copyCtorMethod.IsGenerated && Driver.TypeDatabase.FindTypeMap(@class, out typeMap)) + { + var context = new CSharpMarshalContext(Driver) + { + ArgName = "native", + ReturnVarName = "ret", + ReturnType = new QualifiedType(new TagType(@class)) + }; + typeMap.CSharpMarshalCopyCtorToManaged(context); + WriteLine(context.SupportBefore); + } + else + { + // Allocate memory for a new native object and call the ctor. + WriteLine("var ret = Marshal.AllocHGlobal({0});", @class.Layout.Size); + WriteLine("{0}.Internal.{1}(ret, new global::System.IntPtr(&native));", + QualifiedIdentifier(@class), GetFunctionNativeIdentifier(copyCtorMethod)); + WriteLine("return ret;"); + } + } + else + { + WriteLine("global::System.IntPtr ret = Marshal.AllocHGlobal({0});", @class.Layout.Size); + WriteLine("CppSharp.Runtime.Helpers.memcpy(ret, new IntPtr(&native), new UIntPtr({0}));", + @class.Layout.Size); + WriteLine("return ret;"); + } + WriteCloseBraceIndent(); + PopBlock(NewLineKind.BeforeNextBlock); + } + PushBlock(CSharpBlockKind.Method); + WriteLine("internal {0}({1}.Internal native)", safeIdentifier, className); + WriteLineIndent(@class.IsRefType ? ": this(__CopyValue(native))" : ": this(&native)", className); + WriteStartBraceIndent(); + WriteCloseBraceIndent(); + PopBlock(NewLineKind.BeforeNextBlock); + } + private bool GenerateClassConstructorBase(Class @class, Method method) { var hasBase = @class.HasBaseClass;