From 450a26a443b46410633dbd0e9b19cc72483d6ea9 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Wed, 15 Nov 2017 17:47:03 +0200 Subject: [PATCH] Revert "Removed an unused field and redundant parameters from the parser." This reverts commit 51a109d2dba2b793521906faff8d2f32a59f9dfc. # Conflicts: # src/CppParser/CppParser.cpp # src/CppParser/CppParser.h # src/CppParser/Parser.cpp # src/CppParser/Parser.h Signed-off-by: Dimitar Dobrev --- src/CppParser/Bindings/CLI/CppParser.h | 1 + .../CppSharp.CppParser.cs | 70 ++++++++++++++++++- .../i686-pc-win32-msvc/CppSharp.CppParser.cs | 70 ++++++++++++++++++- .../CppSharp.CppParser.cs | 70 ++++++++++++++++++- .../CppSharp.CppParser.cs | 70 ++++++++++++++++++- .../x86_64-linux-gnu/CppSharp.CppParser.cs | 70 ++++++++++++++++++- .../CppSharp.CppParser.cs | 70 ++++++++++++++++++- src/CppParser/CppParser.cpp | 4 ++ src/CppParser/CppParser.h | 3 + src/CppParser/Parser.cpp | 5 +- 10 files changed, 425 insertions(+), 8 deletions(-) diff --git a/src/CppParser/Bindings/CLI/CppParser.h b/src/CppParser/Bindings/CLI/CppParser.h index 78aee77c..36f5c4ac 100644 --- a/src/CppParser/Bindings/CLI/CppParser.h +++ b/src/CppParser/Bindings/CLI/CppParser.h @@ -18,6 +18,7 @@ namespace CppSharp enum struct SourceLocationKind; ref class ClangParser; ref class CppParserOptions; + ref class Parser; ref class ParserDiagnostic; ref class ParserResult; ref class ParserTargetInfo; diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs index 1bf57148..e1ab4e1a 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs @@ -17899,6 +17899,53 @@ namespace CppSharp User = 4 } + public unsafe partial class Parser + { + [StructLayout(LayoutKind.Explicit, Size = 0)] + public partial struct __Internal + { + } + + public global::System.IntPtr __Instance { get; protected set; } + + protected int __PointerAdjustment; + internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; + + protected bool __ownsNativeInstance; + + internal static global::CppSharp.Parser.Parser __CreateInstance(global::System.IntPtr native, bool skipVTables = false) + { + return new global::CppSharp.Parser.Parser(native.ToPointer(), skipVTables); + } + + internal static global::CppSharp.Parser.Parser __CreateInstance(global::CppSharp.Parser.Parser.__Internal native, bool skipVTables = false) + { + return new global::CppSharp.Parser.Parser(native, skipVTables); + } + + private static void* __CopyValue(global::CppSharp.Parser.Parser.__Internal native) + { + var ret = Marshal.AllocHGlobal(sizeof(global::CppSharp.Parser.Parser.__Internal)); + *(global::CppSharp.Parser.Parser.__Internal*) ret = native; + return ret.ToPointer(); + } + + private Parser(global::CppSharp.Parser.Parser.__Internal native, bool skipVTables = false) + : this(__CopyValue(native), skipVTables) + { + __ownsNativeInstance = true; + NativeToManagedMap[__Instance] = this; + } + + protected Parser(void* native, bool skipVTables = false) + { + if (native == null) + return; + __Instance = new global::System.IntPtr(native); + } + } + public unsafe partial class CppParserOptions : IDisposable { [StructLayout(LayoutKind.Explicit, Size = 148)] @@ -18751,7 +18798,7 @@ namespace CppSharp public unsafe partial class ParserResult : IDisposable { - [StructLayout(LayoutKind.Explicit, Size = 24)] + [StructLayout(LayoutKind.Explicit, Size = 28)] public partial struct __Internal { [FieldOffset(0)] @@ -18766,6 +18813,9 @@ namespace CppSharp [FieldOffset(20)] internal global::System.IntPtr targetInfo; + [FieldOffset(24)] + internal global::System.IntPtr codeParser; + [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, EntryPoint="_ZN8CppSharp9CppParser12ParserResultC2Ev")] @@ -18947,6 +18997,24 @@ namespace CppSharp } } + public global::CppSharp.Parser.Parser CodeParser + { + get + { + global::CppSharp.Parser.Parser __result0; + if (((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser == IntPtr.Zero) __result0 = null; + else if (global::CppSharp.Parser.Parser.NativeToManagedMap.ContainsKey(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser)) + __result0 = (global::CppSharp.Parser.Parser) global::CppSharp.Parser.Parser.NativeToManagedMap[((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser]; + else __result0 = global::CppSharp.Parser.Parser.__CreateInstance(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser); + return __result0; + } + + set + { + ((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance; + } + } + public uint DiagnosticsCount { get diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs index 5debd308..aa429d29 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs @@ -17899,6 +17899,53 @@ namespace CppSharp User = 4 } + public unsafe partial class Parser + { + [StructLayout(LayoutKind.Explicit, Size = 0)] + public partial struct __Internal + { + } + + public global::System.IntPtr __Instance { get; protected set; } + + protected int __PointerAdjustment; + internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; + + protected bool __ownsNativeInstance; + + internal static global::CppSharp.Parser.Parser __CreateInstance(global::System.IntPtr native, bool skipVTables = false) + { + return new global::CppSharp.Parser.Parser(native.ToPointer(), skipVTables); + } + + internal static global::CppSharp.Parser.Parser __CreateInstance(global::CppSharp.Parser.Parser.__Internal native, bool skipVTables = false) + { + return new global::CppSharp.Parser.Parser(native, skipVTables); + } + + private static void* __CopyValue(global::CppSharp.Parser.Parser.__Internal native) + { + var ret = Marshal.AllocHGlobal(sizeof(global::CppSharp.Parser.Parser.__Internal)); + *(global::CppSharp.Parser.Parser.__Internal*) ret = native; + return ret.ToPointer(); + } + + private Parser(global::CppSharp.Parser.Parser.__Internal native, bool skipVTables = false) + : this(__CopyValue(native), skipVTables) + { + __ownsNativeInstance = true; + NativeToManagedMap[__Instance] = this; + } + + protected Parser(void* native, bool skipVTables = false) + { + if (native == null) + return; + __Instance = new global::System.IntPtr(native); + } + } + public unsafe partial class CppParserOptions : IDisposable { [StructLayout(LayoutKind.Explicit, Size = 184)] @@ -18751,7 +18798,7 @@ namespace CppSharp public unsafe partial class ParserResult : IDisposable { - [StructLayout(LayoutKind.Explicit, Size = 24)] + [StructLayout(LayoutKind.Explicit, Size = 28)] public partial struct __Internal { [FieldOffset(0)] @@ -18766,6 +18813,9 @@ namespace CppSharp [FieldOffset(20)] internal global::System.IntPtr targetInfo; + [FieldOffset(24)] + internal global::System.IntPtr codeParser; + [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall, EntryPoint="??0ParserResult@CppParser@CppSharp@@QAE@XZ")] @@ -18947,6 +18997,24 @@ namespace CppSharp } } + public global::CppSharp.Parser.Parser CodeParser + { + get + { + global::CppSharp.Parser.Parser __result0; + if (((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser == IntPtr.Zero) __result0 = null; + else if (global::CppSharp.Parser.Parser.NativeToManagedMap.ContainsKey(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser)) + __result0 = (global::CppSharp.Parser.Parser) global::CppSharp.Parser.Parser.NativeToManagedMap[((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser]; + else __result0 = global::CppSharp.Parser.Parser.__CreateInstance(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser); + return __result0; + } + + set + { + ((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance; + } + } + public uint DiagnosticsCount { get diff --git a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs index 4e399189..6f144831 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs @@ -17898,6 +17898,53 @@ namespace CppSharp User = 4 } + public unsafe partial class Parser + { + [StructLayout(LayoutKind.Explicit, Size = 0)] + public partial struct __Internal + { + } + + public global::System.IntPtr __Instance { get; protected set; } + + protected int __PointerAdjustment; + internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; + + protected bool __ownsNativeInstance; + + internal static global::CppSharp.Parser.Parser __CreateInstance(global::System.IntPtr native, bool skipVTables = false) + { + return new global::CppSharp.Parser.Parser(native.ToPointer(), skipVTables); + } + + internal static global::CppSharp.Parser.Parser __CreateInstance(global::CppSharp.Parser.Parser.__Internal native, bool skipVTables = false) + { + return new global::CppSharp.Parser.Parser(native, skipVTables); + } + + private static void* __CopyValue(global::CppSharp.Parser.Parser.__Internal native) + { + var ret = Marshal.AllocHGlobal(sizeof(global::CppSharp.Parser.Parser.__Internal)); + *(global::CppSharp.Parser.Parser.__Internal*) ret = native; + return ret.ToPointer(); + } + + private Parser(global::CppSharp.Parser.Parser.__Internal native, bool skipVTables = false) + : this(__CopyValue(native), skipVTables) + { + __ownsNativeInstance = true; + NativeToManagedMap[__Instance] = this; + } + + protected Parser(void* native, bool skipVTables = false) + { + if (native == null) + return; + __Instance = new global::System.IntPtr(native); + } + } + public unsafe partial class CppParserOptions : IDisposable { [StructLayout(LayoutKind.Explicit, Size = 288)] @@ -18750,7 +18797,7 @@ namespace CppSharp public unsafe partial class ParserResult : IDisposable { - [StructLayout(LayoutKind.Explicit, Size = 48)] + [StructLayout(LayoutKind.Explicit, Size = 56)] public partial struct __Internal { [FieldOffset(0)] @@ -18765,6 +18812,9 @@ namespace CppSharp [FieldOffset(40)] internal global::System.IntPtr targetInfo; + [FieldOffset(48)] + internal global::System.IntPtr codeParser; + [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, EntryPoint="_ZN8CppSharp9CppParser12ParserResultC2Ev")] @@ -18946,6 +18996,24 @@ namespace CppSharp } } + public global::CppSharp.Parser.Parser CodeParser + { + get + { + global::CppSharp.Parser.Parser __result0; + if (((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser == IntPtr.Zero) __result0 = null; + else if (global::CppSharp.Parser.Parser.NativeToManagedMap.ContainsKey(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser)) + __result0 = (global::CppSharp.Parser.Parser) global::CppSharp.Parser.Parser.NativeToManagedMap[((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser]; + else __result0 = global::CppSharp.Parser.Parser.__CreateInstance(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser); + return __result0; + } + + set + { + ((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance; + } + } + public uint DiagnosticsCount { get diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs index 0c0d2b35..7c91b3ec 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs @@ -17898,6 +17898,53 @@ namespace CppSharp User = 4 } + public unsafe partial class Parser + { + [StructLayout(LayoutKind.Explicit, Size = 0)] + public partial struct __Internal + { + } + + public global::System.IntPtr __Instance { get; protected set; } + + protected int __PointerAdjustment; + internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; + + protected bool __ownsNativeInstance; + + internal static global::CppSharp.Parser.Parser __CreateInstance(global::System.IntPtr native, bool skipVTables = false) + { + return new global::CppSharp.Parser.Parser(native.ToPointer(), skipVTables); + } + + internal static global::CppSharp.Parser.Parser __CreateInstance(global::CppSharp.Parser.Parser.__Internal native, bool skipVTables = false) + { + return new global::CppSharp.Parser.Parser(native, skipVTables); + } + + private static void* __CopyValue(global::CppSharp.Parser.Parser.__Internal native) + { + var ret = Marshal.AllocHGlobal(sizeof(global::CppSharp.Parser.Parser.__Internal)); + *(global::CppSharp.Parser.Parser.__Internal*) ret = native; + return ret.ToPointer(); + } + + private Parser(global::CppSharp.Parser.Parser.__Internal native, bool skipVTables = false) + : this(__CopyValue(native), skipVTables) + { + __ownsNativeInstance = true; + NativeToManagedMap[__Instance] = this; + } + + protected Parser(void* native, bool skipVTables = false) + { + if (native == null) + return; + __Instance = new global::System.IntPtr(native); + } + } + public unsafe partial class CppParserOptions : IDisposable { [StructLayout(LayoutKind.Explicit, Size = 312)] @@ -18750,7 +18797,7 @@ namespace CppSharp public unsafe partial class ParserResult : IDisposable { - [StructLayout(LayoutKind.Explicit, Size = 48)] + [StructLayout(LayoutKind.Explicit, Size = 56)] public partial struct __Internal { [FieldOffset(0)] @@ -18765,6 +18812,9 @@ namespace CppSharp [FieldOffset(40)] internal global::System.IntPtr targetInfo; + [FieldOffset(48)] + internal global::System.IntPtr codeParser; + [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, EntryPoint="_ZN8CppSharp9CppParser12ParserResultC2Ev")] @@ -18946,6 +18996,24 @@ namespace CppSharp } } + public global::CppSharp.Parser.Parser CodeParser + { + get + { + global::CppSharp.Parser.Parser __result0; + if (((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser == IntPtr.Zero) __result0 = null; + else if (global::CppSharp.Parser.Parser.NativeToManagedMap.ContainsKey(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser)) + __result0 = (global::CppSharp.Parser.Parser) global::CppSharp.Parser.Parser.NativeToManagedMap[((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser]; + else __result0 = global::CppSharp.Parser.Parser.__CreateInstance(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser); + return __result0; + } + + set + { + ((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance; + } + } + public uint DiagnosticsCount { get diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs index 21503613..1e93cc2f 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs @@ -17898,6 +17898,53 @@ namespace CppSharp User = 4 } + public unsafe partial class Parser + { + [StructLayout(LayoutKind.Explicit, Size = 0)] + public partial struct __Internal + { + } + + public global::System.IntPtr __Instance { get; protected set; } + + protected int __PointerAdjustment; + internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; + + protected bool __ownsNativeInstance; + + internal static global::CppSharp.Parser.Parser __CreateInstance(global::System.IntPtr native, bool skipVTables = false) + { + return new global::CppSharp.Parser.Parser(native.ToPointer(), skipVTables); + } + + internal static global::CppSharp.Parser.Parser __CreateInstance(global::CppSharp.Parser.Parser.__Internal native, bool skipVTables = false) + { + return new global::CppSharp.Parser.Parser(native, skipVTables); + } + + private static void* __CopyValue(global::CppSharp.Parser.Parser.__Internal native) + { + var ret = Marshal.AllocHGlobal(sizeof(global::CppSharp.Parser.Parser.__Internal)); + *(global::CppSharp.Parser.Parser.__Internal*) ret = native; + return ret.ToPointer(); + } + + private Parser(global::CppSharp.Parser.Parser.__Internal native, bool skipVTables = false) + : this(__CopyValue(native), skipVTables) + { + __ownsNativeInstance = true; + NativeToManagedMap[__Instance] = this; + } + + protected Parser(void* native, bool skipVTables = false) + { + if (native == null) + return; + __Instance = new global::System.IntPtr(native); + } + } + public unsafe partial class CppParserOptions : IDisposable { [StructLayout(LayoutKind.Explicit, Size = 240)] @@ -18750,7 +18797,7 @@ namespace CppSharp public unsafe partial class ParserResult : IDisposable { - [StructLayout(LayoutKind.Explicit, Size = 48)] + [StructLayout(LayoutKind.Explicit, Size = 56)] public partial struct __Internal { [FieldOffset(0)] @@ -18765,6 +18812,9 @@ namespace CppSharp [FieldOffset(40)] internal global::System.IntPtr targetInfo; + [FieldOffset(48)] + internal global::System.IntPtr codeParser; + [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, EntryPoint="_ZN8CppSharp9CppParser12ParserResultC2Ev")] @@ -18946,6 +18996,24 @@ namespace CppSharp } } + public global::CppSharp.Parser.Parser CodeParser + { + get + { + global::CppSharp.Parser.Parser __result0; + if (((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser == IntPtr.Zero) __result0 = null; + else if (global::CppSharp.Parser.Parser.NativeToManagedMap.ContainsKey(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser)) + __result0 = (global::CppSharp.Parser.Parser) global::CppSharp.Parser.Parser.NativeToManagedMap[((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser]; + else __result0 = global::CppSharp.Parser.Parser.__CreateInstance(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser); + return __result0; + } + + set + { + ((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance; + } + } + public uint DiagnosticsCount { get diff --git a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs index b34fd668..3944ffb8 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs @@ -17899,6 +17899,53 @@ namespace CppSharp User = 4 } + public unsafe partial class Parser + { + [StructLayout(LayoutKind.Explicit, Size = 0)] + public partial struct __Internal + { + } + + public global::System.IntPtr __Instance { get; protected set; } + + protected int __PointerAdjustment; + internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary(); + protected void*[] __OriginalVTables; + + protected bool __ownsNativeInstance; + + internal static global::CppSharp.Parser.Parser __CreateInstance(global::System.IntPtr native, bool skipVTables = false) + { + return new global::CppSharp.Parser.Parser(native.ToPointer(), skipVTables); + } + + internal static global::CppSharp.Parser.Parser __CreateInstance(global::CppSharp.Parser.Parser.__Internal native, bool skipVTables = false) + { + return new global::CppSharp.Parser.Parser(native, skipVTables); + } + + private static void* __CopyValue(global::CppSharp.Parser.Parser.__Internal native) + { + var ret = Marshal.AllocHGlobal(sizeof(global::CppSharp.Parser.Parser.__Internal)); + *(global::CppSharp.Parser.Parser.__Internal*) ret = native; + return ret.ToPointer(); + } + + private Parser(global::CppSharp.Parser.Parser.__Internal native, bool skipVTables = false) + : this(__CopyValue(native), skipVTables) + { + __ownsNativeInstance = true; + NativeToManagedMap[__Instance] = this; + } + + protected Parser(void* native, bool skipVTables = false) + { + if (native == null) + return; + __Instance = new global::System.IntPtr(native); + } + } + public unsafe partial class CppParserOptions : IDisposable { [StructLayout(LayoutKind.Explicit, Size = 312)] @@ -18751,7 +18798,7 @@ namespace CppSharp public unsafe partial class ParserResult : IDisposable { - [StructLayout(LayoutKind.Explicit, Size = 48)] + [StructLayout(LayoutKind.Explicit, Size = 56)] public partial struct __Internal { [FieldOffset(0)] @@ -18766,6 +18813,9 @@ namespace CppSharp [FieldOffset(40)] internal global::System.IntPtr targetInfo; + [FieldOffset(48)] + internal global::System.IntPtr codeParser; + [SuppressUnmanagedCodeSecurity] [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, EntryPoint="??0ParserResult@CppParser@CppSharp@@QEAA@XZ")] @@ -18947,6 +18997,24 @@ namespace CppSharp } } + public global::CppSharp.Parser.Parser CodeParser + { + get + { + global::CppSharp.Parser.Parser __result0; + if (((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser == IntPtr.Zero) __result0 = null; + else if (global::CppSharp.Parser.Parser.NativeToManagedMap.ContainsKey(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser)) + __result0 = (global::CppSharp.Parser.Parser) global::CppSharp.Parser.Parser.NativeToManagedMap[((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser]; + else __result0 = global::CppSharp.Parser.Parser.__CreateInstance(((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser); + return __result0; + } + + set + { + ((global::CppSharp.Parser.ParserResult.__Internal*) __Instance)->codeParser = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance; + } + } + public uint DiagnosticsCount { get diff --git a/src/CppParser/CppParser.cpp b/src/CppParser/CppParser.cpp index e705e1b4..aa326b28 100644 --- a/src/CppParser/CppParser.cpp +++ b/src/CppParser/CppParser.cpp @@ -35,6 +35,7 @@ DEF_VECTOR_STRING(CppParserOptions, SupportedStdTypes) ParserResult::ParserResult() : library(0) , targetInfo(0) + , codeParser(0) { } @@ -43,10 +44,13 @@ ParserResult::ParserResult(const ParserResult& rhs) , Diagnostics(rhs.Diagnostics) , library(rhs.library) , targetInfo(rhs.targetInfo) + , codeParser(rhs.codeParser) {} ParserResult::~ParserResult() { + if (codeParser) + delete codeParser; if (library) delete library; } diff --git a/src/CppParser/CppParser.h b/src/CppParser/CppParser.h index 98436b92..208577d9 100644 --- a/src/CppParser/CppParser.h +++ b/src/CppParser/CppParser.h @@ -73,6 +73,8 @@ enum class ParserResultKind FileNotFound }; +class Parser; + struct CS_API ParserResult { ParserResult(); @@ -84,6 +86,7 @@ struct CS_API ParserResult NativeLibrary* library; ParserTargetInfo* targetInfo; + Parser* codeParser; }; enum class SourceLocationKind diff --git a/src/CppParser/Parser.cpp b/src/CppParser/Parser.cpp index a46f113e..1029b4e8 100644 --- a/src/CppParser/Parser.cpp +++ b/src/CppParser/Parser.cpp @@ -4274,8 +4274,9 @@ ParserResult* ClangParser::ParseHeader(CppParserOptions* Opts) if (!Opts) return nullptr; - Parser Parser(Opts); - return Parser.ParseHeader(Opts->SourceFiles); + auto res = new ParserResult(); + res->codeParser = new Parser(Opts); + return res->codeParser->ParseHeader(Opts->SourceFiles); } ParserResult* ClangParser::ParseLibrary(CppParserOptions* Opts)