Browse Source

Freed up the native parser options when done with.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/337/merge
Dimitar Dobrev 8 years ago
parent
commit
ee171eb9fa
  1. 6
      src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs
  2. 6
      src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs
  3. 6
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs
  4. 2
      src/CppParser/CppParser.cpp
  5. 1
      src/CppParser/CppParser.h
  6. 6
      src/Generator.Tests/AST/TestAST.cs
  7. 4
      src/Generator/Driver.cs

6
src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs

@ -17218,7 +17218,7 @@ namespace CppSharp
[SuppressUnmanagedCodeSecurity] [SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, [DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser16CppParserOptionsC2ERKS1_")] EntryPoint="_ZN8CppSharp9CppParser16CppParserOptionsC2ERKS1_")]
internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); internal static extern void cctor_1(global::System.IntPtr instance, global::System.IntPtr _0);
[SuppressUnmanagedCodeSecurity] [SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, [DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
@ -17407,7 +17407,7 @@ namespace CppSharp
private static void* __CopyValue(CppParserOptions.__Internal native) private static void* __CopyValue(CppParserOptions.__Internal native)
{ {
var ret = Marshal.AllocHGlobal(132); var ret = Marshal.AllocHGlobal(132);
global::CppSharp.Parser.CppParserOptions.__Internal.cctor_2(ret, new global::System.IntPtr(&native)); global::CppSharp.Parser.CppParserOptions.__Internal.cctor_1(ret, new global::System.IntPtr(&native));
return ret.ToPointer(); return ret.ToPointer();
} }
@ -17441,7 +17441,7 @@ namespace CppSharp
if (ReferenceEquals(_0, null)) if (ReferenceEquals(_0, null))
throw new global::System.ArgumentNullException("_0", "Cannot be null because it is a C++ reference (&)."); throw new global::System.ArgumentNullException("_0", "Cannot be null because it is a C++ reference (&).");
var __arg0 = _0.__Instance; var __arg0 = _0.__Instance;
__Internal.cctor_2((__Instance + __PointerAdjustment), __arg0); __Internal.cctor_1((__Instance + __PointerAdjustment), __arg0);
} }
public void Dispose() public void Dispose()

6
src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs

@ -17217,7 +17217,7 @@ namespace CppSharp
[SuppressUnmanagedCodeSecurity] [SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, [DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser16CppParserOptionsC2ERKS1_")] EntryPoint="_ZN8CppSharp9CppParser16CppParserOptionsC2ERKS1_")]
internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); internal static extern void cctor_1(global::System.IntPtr instance, global::System.IntPtr _0);
[SuppressUnmanagedCodeSecurity] [SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, [DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
@ -17406,7 +17406,7 @@ namespace CppSharp
private static void* __CopyValue(CppParserOptions.__Internal native) private static void* __CopyValue(CppParserOptions.__Internal native)
{ {
var ret = Marshal.AllocHGlobal(256); var ret = Marshal.AllocHGlobal(256);
global::CppSharp.Parser.CppParserOptions.__Internal.cctor_2(ret, new global::System.IntPtr(&native)); global::CppSharp.Parser.CppParserOptions.__Internal.cctor_1(ret, new global::System.IntPtr(&native));
return ret.ToPointer(); return ret.ToPointer();
} }
@ -17440,7 +17440,7 @@ namespace CppSharp
if (ReferenceEquals(_0, null)) if (ReferenceEquals(_0, null))
throw new global::System.ArgumentNullException("_0", "Cannot be null because it is a C++ reference (&)."); throw new global::System.ArgumentNullException("_0", "Cannot be null because it is a C++ reference (&).");
var __arg0 = _0.__Instance; var __arg0 = _0.__Instance;
__Internal.cctor_2((__Instance + __PointerAdjustment), __arg0); __Internal.cctor_1((__Instance + __PointerAdjustment), __arg0);
} }
public void Dispose() public void Dispose()

6
src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs

@ -17217,7 +17217,7 @@ namespace CppSharp
[SuppressUnmanagedCodeSecurity] [SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, [DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser16CppParserOptionsC2ERKS1_")] EntryPoint="_ZN8CppSharp9CppParser16CppParserOptionsC2ERKS1_")]
internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); internal static extern void cctor_1(global::System.IntPtr instance, global::System.IntPtr _0);
[SuppressUnmanagedCodeSecurity] [SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, [DllImport("CppSharp.CppParser", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
@ -17406,7 +17406,7 @@ namespace CppSharp
private static void* __CopyValue(CppParserOptions.__Internal native) private static void* __CopyValue(CppParserOptions.__Internal native)
{ {
var ret = Marshal.AllocHGlobal(272); var ret = Marshal.AllocHGlobal(272);
global::CppSharp.Parser.CppParserOptions.__Internal.cctor_2(ret, new global::System.IntPtr(&native)); global::CppSharp.Parser.CppParserOptions.__Internal.cctor_1(ret, new global::System.IntPtr(&native));
return ret.ToPointer(); return ret.ToPointer();
} }
@ -17440,7 +17440,7 @@ namespace CppSharp
if (ReferenceEquals(_0, null)) if (ReferenceEquals(_0, null))
throw new global::System.ArgumentNullException("_0", "Cannot be null because it is a C++ reference (&)."); throw new global::System.ArgumentNullException("_0", "Cannot be null because it is a C++ reference (&).");
var __arg0 = _0.__Instance; var __arg0 = _0.__Instance;
__Internal.cctor_2((__Instance + __PointerAdjustment), __arg0); __Internal.cctor_1((__Instance + __PointerAdjustment), __arg0);
} }
public void Dispose() public void Dispose()

2
src/CppParser/CppParser.cpp

@ -23,6 +23,8 @@ CppParserOptions::CppParserOptions()
{ {
} }
CppParserOptions::~CppParserOptions() {}
DEF_VECTOR_STRING(CppParserOptions, Arguments) DEF_VECTOR_STRING(CppParserOptions, Arguments)
DEF_STRING(CppParserOptions, LibraryFile) DEF_STRING(CppParserOptions, LibraryFile)
DEF_VECTOR_STRING(CppParserOptions, SourceFiles) DEF_VECTOR_STRING(CppParserOptions, SourceFiles)

1
src/CppParser/CppParser.h

@ -46,6 +46,7 @@ enum class LanguageVersion
struct CS_API CppParserOptions struct CS_API CppParserOptions
{ {
CppParserOptions(); CppParserOptions();
~CppParserOptions();
VECTOR_STRING(Arguments) VECTOR_STRING(Arguments)

6
src/Generator.Tests/AST/TestAST.cs

@ -22,6 +22,12 @@ namespace CppSharp.Generator.Tests.AST
ParseLibrary("AST.h", "ASTExtensions.h"); ParseLibrary("AST.h", "ASTExtensions.h");
} }
[TestFixtureTearDown]
public void CleanUp()
{
ParserOptions.Dispose();
}
[Test] [Test]
public void TestASTParameter() public void TestASTParameter()
{ {

4
src/Generator/Driver.cs

@ -198,6 +198,9 @@ namespace CppSharp
parser.SourcesParsed += OnSourceFileParsed; parser.SourcesParsed += OnSourceFileParsed;
parser.ParseProject(Project, Options.UnityBuild); parser.ParseProject(Project, Options.UnityBuild);
foreach (var source in Project.Sources.Where(s => s.Options != null))
source.Options.Dispose();
Context.TargetInfo = parser.GetTargetInfo(ParserOptions); Context.TargetInfo = parser.GetTargetInfo(ParserOptions);
Context.ASTContext = ClangParser.ConvertASTContext(parser.ASTContext); Context.ASTContext = ClangParser.ConvertASTContext(parser.ASTContext);
@ -534,6 +537,7 @@ namespace CppSharp
driver.Generator.Dispose(); driver.Generator.Dispose();
driver.Context.TargetInfo.Dispose(); driver.Context.TargetInfo.Dispose();
driver.ParserOptions.Dispose();
} }
} }
} }
Loading…
Cancel
Save