Browse Source

Fix the check to ignore dependent name types

The bug used to break the parser bindings for macOS since std::string uses a dependent name type for its necessary methods.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1272/head
Dimitar Dobrev 6 years ago
parent
commit
16bfc67a9a
  1. 19
      src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std.cs
  2. 5
      src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Std.cs
  3. 19
      src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std.cs
  4. 5
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std.cs
  5. 5
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std.cs
  6. 5
      src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/Std.cs
  7. 9
      src/Generator/Generators/CSharp/CSharpSources.cs
  8. 3
      src/Generator/Types/TypeIgnoreChecker.cs

19
src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std.cs

@ -704,16 +704,6 @@ namespace Std @@ -704,16 +704,6 @@ namespace Std
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev")]
internal static extern void dtorc__N_std_N___1_S_basic_string__C___N_std_N___1_S_char_traits__C___N_std_N___1_S_allocator__C(global::System.IntPtr __instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKc")]
internal static extern global::System.IntPtr Assignc__N_std_N___1_S_basic_string__C___N_std_N___1_S_char_traits__C___N_std_N___1_S_allocator__C(global::System.IntPtr __instance, [MarshalAs(UnmanagedType.LPUTF8Str)] string __s);
[SuppressUnmanagedCodeSecurity]
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4dataEv")]
internal static extern global::System.IntPtr Datac__N_std_N___1_S_basic_string__C___N_std_N___1_S_char_traits__C___N_std_N___1_S_allocator__C(global::System.IntPtr __instance);
}
namespace Rep
@ -961,7 +951,7 @@ namespace Std @@ -961,7 +951,7 @@ namespace Std
[SuppressUnmanagedCodeSecurity]
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKc")]
internal static extern global::System.IntPtr Assign(global::System.IntPtr __instance, [MarshalAs(UnmanagedType.LPStr)] string __s);
internal static extern global::System.IntPtr Assign(global::System.IntPtr __instance, [MarshalAs(UnmanagedType.LPUTF8Str)] string __s);
[SuppressUnmanagedCodeSecurity]
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
@ -985,7 +975,12 @@ namespace Std @@ -985,7 +975,12 @@ namespace Std
{
var __arg0 = ReferenceEquals(@this, null) ? global::System.IntPtr.Zero : @this.__Instance;
var __ret = __Internal.Data(__arg0);
return Marshal.PtrToStringAnsi(__ret);
if (__ret == global::System.IntPtr.Zero)
return default(string);
var __retPtr = (byte*) __ret;
int __length = 0;
while (*(__retPtr++) != 0) __length += sizeof(byte);
return global::System.Text.Encoding.UTF8.GetString((byte*) __ret, __length);
}
}
}

5
src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Std.cs

@ -492,11 +492,6 @@ namespace Std @@ -492,11 +492,6 @@ namespace Std
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ")]
internal static extern void dtorc__N_std_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C(global::System.IntPtr __instance, int delete);
[SuppressUnmanagedCodeSecurity]
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?data@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ")]
internal static extern global::System.IntPtr Datac__N_std_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C(global::System.IntPtr __instance);
}
}

19
src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std.cs

@ -704,16 +704,6 @@ namespace Std @@ -704,16 +704,6 @@ namespace Std
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev")]
internal static extern void dtorc__N_std_N___1_S_basic_string__C___N_std_N___1_S_char_traits__C___N_std_N___1_S_allocator__C(global::System.IntPtr __instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKc")]
internal static extern global::System.IntPtr Assignc__N_std_N___1_S_basic_string__C___N_std_N___1_S_char_traits__C___N_std_N___1_S_allocator__C(global::System.IntPtr __instance, [MarshalAs(UnmanagedType.LPUTF8Str)] string __s);
[SuppressUnmanagedCodeSecurity]
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4dataEv")]
internal static extern global::System.IntPtr Datac__N_std_N___1_S_basic_string__C___N_std_N___1_S_char_traits__C___N_std_N___1_S_allocator__C(global::System.IntPtr __instance);
}
namespace Rep
@ -961,7 +951,7 @@ namespace Std @@ -961,7 +951,7 @@ namespace Std
[SuppressUnmanagedCodeSecurity]
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKc")]
internal static extern global::System.IntPtr Assign(global::System.IntPtr __instance, [MarshalAs(UnmanagedType.LPStr)] string __s);
internal static extern global::System.IntPtr Assign(global::System.IntPtr __instance, [MarshalAs(UnmanagedType.LPUTF8Str)] string __s);
[SuppressUnmanagedCodeSecurity]
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
@ -985,7 +975,12 @@ namespace Std @@ -985,7 +975,12 @@ namespace Std
{
var __arg0 = ReferenceEquals(@this, null) ? global::System.IntPtr.Zero : @this.__Instance;
var __ret = __Internal.Data(__arg0);
return Marshal.PtrToStringAnsi(__ret);
if (__ret == global::System.IntPtr.Zero)
return default(string);
var __retPtr = (byte*) __ret;
int __length = 0;
while (*(__retPtr++) != 0) __length += sizeof(byte);
return global::System.Text.Encoding.UTF8.GetString((byte*) __ret, __length);
}
}
}

5
src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std.cs

@ -868,11 +868,6 @@ namespace Std @@ -868,11 +868,6 @@ namespace Std
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev")]
internal static extern void dtorc__N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C(global::System.IntPtr __instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv")]
internal static extern global::System.IntPtr Datac__N_std_N___cxx11_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C(global::System.IntPtr __instance);
}
namespace AllocHider

5
src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std.cs

@ -859,11 +859,6 @@ namespace Std @@ -859,11 +859,6 @@ namespace Std
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZNSsD2Ev")]
internal static extern void dtorc__N_std_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C(global::System.IntPtr __instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZNKSs4dataEv")]
internal static extern global::System.IntPtr Datac__N_std_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C(global::System.IntPtr __instance);
}
namespace AllocHider

5
src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/Std.cs

@ -492,11 +492,6 @@ namespace Std @@ -492,11 +492,6 @@ namespace Std
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@XZ")]
internal static extern void dtorc__N_std_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C(global::System.IntPtr __instance, int delete);
[SuppressUnmanagedCodeSecurity]
[DllImport("Std-symbols", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?data@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAPEBDXZ")]
internal static extern global::System.IntPtr Datac__N_std_S_basic_string__C___N_std_S_char_traits__C___N_std_S_allocator__C(global::System.IntPtr __instance);
}
}

9
src/Generator/Generators/CSharp/CSharpSources.cs

@ -641,12 +641,13 @@ namespace CppSharp.Generators.CSharp @@ -641,12 +641,13 @@ namespace CppSharp.Generators.CSharp
foreach (var prop in @class.Properties.Where(p => p.Field == null))
{
if ((!prop.IsOverride || prop.GetMethod.Namespace == @class) &&
!functions.Contains(prop.GetMethod))
!functions.Contains(prop.GetMethod) && !prop.GetMethod.Ignore)
tryAddOverload(prop.GetMethod);
if (prop.SetMethod != null
&& (!prop.IsOverride || prop.SetMethod.Namespace == @class)
&& !functions.Contains(prop.SetMethod))
if (prop.SetMethod != null &&
(!prop.IsOverride || prop.SetMethod.Namespace == @class) &&
!functions.Contains(prop.SetMethod) &&
!prop.GetMethod.Ignore)
tryAddOverload(prop.SetMethod);
}
}

3
src/Generator/Types/TypeIgnoreChecker.cs

@ -57,8 +57,7 @@ namespace CppSharp @@ -57,8 +57,7 @@ namespace CppSharp
public override bool VisitDependentNameType(DependentNameType dependent, TypeQualifiers quals)
{
Ignore();
return false;
return dependent.Qualifier.Type.Visit(this);
}
public override bool VisitClassDecl(Class @class)

Loading…
Cancel
Save