Browse Source

Optimised the parser by skipping the system translation units.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/988/head
Dimitar Dobrev 9 years ago
parent
commit
e96580357e
  1. 218
      src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std.cs
  2. 124
      src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Std.cs
  3. 218
      src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std.cs
  4. 75
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std.cs
  5. 101
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std.cs
  6. 124
      src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/Std.cs
  7. 69
      src/CppParser/Parser.cpp
  8. 2
      src/CppParser/Parser.h

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

@ -35,30 +35,20 @@ namespace Std
namespace Std namespace Std
{ {
} namespace CompressedPair
{
namespace Std [StructLayout(LayoutKind.Explicit, Size = 12)]
{ public unsafe partial struct __Internal
} {
[FieldOffset(0)]
namespace Std internal global::Std.BasicString.Rep.__Internal __first_;
{ }
} }
namespace Std
{
}
namespace Std
{
}
namespace Std public unsafe partial class CompressedPair<_T1, _T2>
{ {
} }
namespace Std
{
namespace Allocator namespace Allocator
{ {
[StructLayout(LayoutKind.Explicit, Size = 0)] [StructLayout(LayoutKind.Explicit, Size = 0)]
@ -142,36 +132,6 @@ namespace Std
__Instance = IntPtr.Zero; __Instance = IntPtr.Zero;
} }
} }
namespace CompressedPair
{
[StructLayout(LayoutKind.Explicit, Size = 12)]
public unsafe partial struct __Internal
{
[FieldOffset(0)]
internal global::Std.BasicString.Rep.__Internal __first_;
}
}
public unsafe partial class CompressedPair<_T1, _T2>
{
}
}
namespace Std
{
}
namespace Std
{
}
namespace Std
{
}
namespace Std
{
} }
namespace Std namespace Std
@ -234,10 +194,6 @@ namespace Std
} }
} }
namespace Std
{
}
namespace Std namespace Std
{ {
namespace Map namespace Map
@ -257,76 +213,6 @@ namespace Std
namespace Std namespace Std
{ {
}
namespace Std
{
namespace CharTraits
{
[StructLayout(LayoutKind.Explicit, Size = 0)]
public unsafe partial struct __Internal
{
}
}
public unsafe partial class CharTraits<_CharT> : IDisposable
{
public global::System.IntPtr __Instance { get; protected set; }
protected int __PointerAdjustment;
internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Std.CharTraits<_CharT>> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Std.CharTraits<_CharT>>();
protected void*[] __OriginalVTables;
protected bool __ownsNativeInstance;
internal static global::Std.CharTraits<_CharT> __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
{
return new global::Std.CharTraits<_CharT>(native.ToPointer(), skipVTables);
}
internal static global::Std.CharTraits<_CharT> __CreateInstance(global::Std.CharTraits.__Internal native, bool skipVTables = false)
{
return new global::Std.CharTraits<_CharT>(native, skipVTables);
}
private static void* __CopyValue(global::Std.CharTraits.__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(global::Std.CharTraits.__Internal));
*(global::Std.CharTraits.__Internal*) ret = native;
return ret.ToPointer();
}
private CharTraits(global::Std.CharTraits.__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected CharTraits(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new global::System.IntPtr(native);
}
public void Dispose()
{
Dispose(disposing: true);
}
public virtual void Dispose(bool disposing)
{
if (__Instance == IntPtr.Zero)
return;
global::Std.CharTraits<_CharT> __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
__Instance = IntPtr.Zero;
}
}
public unsafe static partial class BasicStringExtensions public unsafe static partial class BasicStringExtensions
{ {
[StructLayout(LayoutKind.Explicit, Size = 0)] [StructLayout(LayoutKind.Explicit, Size = 0)]
@ -467,20 +353,6 @@ namespace Std
[FieldOffset(0)] [FieldOffset(0)]
internal fixed uint __words[3]; internal fixed uint __words[3];
} }
}
public unsafe partial struct Ulx
{
[StructLayout(LayoutKind.Explicit, Size = 12)]
public partial struct __Internal
{
[FieldOffset(0)]
internal global::Std.BasicString.Long.__Internal __lx;
[FieldOffset(0)]
internal global::Std.BasicString.Short.__Internal __lxx;
}
} }
} }
@ -553,4 +425,70 @@ namespace Std
__Instance = IntPtr.Zero; __Instance = IntPtr.Zero;
} }
} }
namespace CharTraits
{
[StructLayout(LayoutKind.Explicit, Size = 0)]
public unsafe partial struct __Internal
{
}
}
public unsafe partial class CharTraits<_CharT> : IDisposable
{
public global::System.IntPtr __Instance { get; protected set; }
protected int __PointerAdjustment;
internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Std.CharTraits<_CharT>> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Std.CharTraits<_CharT>>();
protected void*[] __OriginalVTables;
protected bool __ownsNativeInstance;
internal static global::Std.CharTraits<_CharT> __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
{
return new global::Std.CharTraits<_CharT>(native.ToPointer(), skipVTables);
}
internal static global::Std.CharTraits<_CharT> __CreateInstance(global::Std.CharTraits.__Internal native, bool skipVTables = false)
{
return new global::Std.CharTraits<_CharT>(native, skipVTables);
}
private static void* __CopyValue(global::Std.CharTraits.__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(global::Std.CharTraits.__Internal));
*(global::Std.CharTraits.__Internal*) ret = native;
return ret.ToPointer();
}
private CharTraits(global::Std.CharTraits.__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected CharTraits(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new global::System.IntPtr(native);
}
public void Dispose()
{
Dispose(disposing: true);
}
public virtual void Dispose(bool disposing)
{
if (__Instance == IntPtr.Zero)
return;
global::Std.CharTraits<_CharT> __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
__Instance = IntPtr.Zero;
}
}
} }

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

@ -13,18 +13,6 @@ using System.Runtime.CompilerServices;
[assembly:InternalsVisibleTo("CppSharp.CppParser")] [assembly:InternalsVisibleTo("CppSharp.CppParser")]
namespace Std
{
}
namespace Std
{
}
namespace Std
{
}
namespace Std namespace Std
{ {
namespace CharTraits namespace CharTraits
@ -94,10 +82,6 @@ namespace Std
} }
} }
namespace Std
{
}
namespace Std namespace Std
{ {
namespace CompressedPair namespace CompressedPair
@ -383,7 +367,7 @@ namespace Std
} }
} }
public unsafe partial class CompressedPair<_Ty1, _Ty2, _73> public unsafe partial class CompressedPair<_Ty1, _Ty2, _0>
{ {
} }
} }
@ -477,43 +461,6 @@ namespace Std
namespace Std namespace Std
{ {
namespace StringVal
{
[StructLayout(LayoutKind.Explicit, Size = 24)]
public unsafe partial struct __Internal
{
[FieldOffset(0)]
internal global::Std.StringVal.Bxty.__Internal _Bx;
[FieldOffset(16)]
internal uint _Mysize;
[FieldOffset(20)]
internal uint _Myres;
}
public unsafe partial struct Bxty
{
[StructLayout(LayoutKind.Explicit, Size = 16)]
public partial struct __Internal
{
[FieldOffset(0)]
internal fixed sbyte _Buf[16];
[FieldOffset(0)]
internal global::System.IntPtr _Ptr;
[FieldOffset(0)]
internal fixed sbyte _Alias[16];
}
}
}
public unsafe partial class StringVal<_Val_types>
{
}
public unsafe static partial class BasicStringExtensions public unsafe static partial class BasicStringExtensions
{ {
[StructLayout(LayoutKind.Explicit, Size = 0)] [StructLayout(LayoutKind.Explicit, Size = 0)]
@ -642,30 +589,47 @@ namespace Std
__Instance = IntPtr.Zero; __Instance = IntPtr.Zero;
} }
} }
}
namespace Std namespace StringVal
{
namespace VectorVal
{ {
[StructLayout(LayoutKind.Explicit, Size = 12)] [StructLayout(LayoutKind.Explicit, Size = 24)]
public unsafe partial struct __Internal public unsafe partial struct __Internal
{ {
[FieldOffset(0)] [FieldOffset(0)]
internal global::System.IntPtr _Myfirst; internal global::Std.StringVal.Bxty.__Internal _Bx;
[FieldOffset(4)] [FieldOffset(16)]
internal global::System.IntPtr _Mylast; internal uint _Mysize;
[FieldOffset(8)] [FieldOffset(20)]
internal global::System.IntPtr _Myend; internal uint _Myres;
}
public unsafe partial struct Bxty
{
[StructLayout(LayoutKind.Explicit, Size = 16)]
public partial struct __Internal
{
[FieldOffset(0)]
internal fixed sbyte _Buf[16];
[FieldOffset(0)]
internal global::System.IntPtr _Ptr;
[FieldOffset(0)]
internal fixed sbyte _Alias[16];
}
} }
} }
public unsafe partial class VectorVal<_Val_types> public unsafe partial class StringVal<_Val_types>
{ {
} }
}
namespace Std
{
namespace Vector namespace Vector
{ {
[StructLayout(LayoutKind.Explicit, Size = 12)] [StructLayout(LayoutKind.Explicit, Size = 12)]
@ -679,10 +643,26 @@ namespace Std
public unsafe partial class Vector<_Ty, _Alloc> public unsafe partial class Vector<_Ty, _Alloc>
{ {
} }
}
namespace Std namespace VectorVal
{ {
[StructLayout(LayoutKind.Explicit, Size = 12)]
public unsafe partial struct __Internal
{
[FieldOffset(0)]
internal global::System.IntPtr _Myfirst;
[FieldOffset(4)]
internal global::System.IntPtr _Mylast;
[FieldOffset(8)]
internal global::System.IntPtr _Myend;
}
}
public unsafe partial class VectorVal<_Val_types>
{
}
} }
namespace Std namespace Std
@ -721,11 +701,3 @@ namespace Std
{ {
} }
} }
namespace Std
{
}
namespace Std
{
}

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

@ -35,30 +35,20 @@ namespace Std
namespace Std namespace Std
{ {
} namespace CompressedPair
{
namespace Std [StructLayout(LayoutKind.Explicit, Size = 24)]
{ public unsafe partial struct __Internal
} {
[FieldOffset(0)]
namespace Std internal global::Std.BasicString.Rep.__Internal __first_;
{ }
} }
namespace Std
{
}
namespace Std
{
}
namespace Std public unsafe partial class CompressedPair<_T1, _T2>
{ {
} }
namespace Std
{
namespace Allocator namespace Allocator
{ {
[StructLayout(LayoutKind.Explicit, Size = 0)] [StructLayout(LayoutKind.Explicit, Size = 0)]
@ -142,36 +132,6 @@ namespace Std
__Instance = IntPtr.Zero; __Instance = IntPtr.Zero;
} }
} }
namespace CompressedPair
{
[StructLayout(LayoutKind.Explicit, Size = 24)]
public unsafe partial struct __Internal
{
[FieldOffset(0)]
internal global::Std.BasicString.Rep.__Internal __first_;
}
}
public unsafe partial class CompressedPair<_T1, _T2>
{
}
}
namespace Std
{
}
namespace Std
{
}
namespace Std
{
}
namespace Std
{
} }
namespace Std namespace Std
@ -234,10 +194,6 @@ namespace Std
} }
} }
namespace Std
{
}
namespace Std namespace Std
{ {
namespace Map namespace Map
@ -257,76 +213,6 @@ namespace Std
namespace Std namespace Std
{ {
}
namespace Std
{
namespace CharTraits
{
[StructLayout(LayoutKind.Explicit, Size = 0)]
public unsafe partial struct __Internal
{
}
}
public unsafe partial class CharTraits<_CharT> : IDisposable
{
public global::System.IntPtr __Instance { get; protected set; }
protected int __PointerAdjustment;
internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Std.CharTraits<_CharT>> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Std.CharTraits<_CharT>>();
protected void*[] __OriginalVTables;
protected bool __ownsNativeInstance;
internal static global::Std.CharTraits<_CharT> __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
{
return new global::Std.CharTraits<_CharT>(native.ToPointer(), skipVTables);
}
internal static global::Std.CharTraits<_CharT> __CreateInstance(global::Std.CharTraits.__Internal native, bool skipVTables = false)
{
return new global::Std.CharTraits<_CharT>(native, skipVTables);
}
private static void* __CopyValue(global::Std.CharTraits.__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(global::Std.CharTraits.__Internal));
*(global::Std.CharTraits.__Internal*) ret = native;
return ret.ToPointer();
}
private CharTraits(global::Std.CharTraits.__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected CharTraits(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new global::System.IntPtr(native);
}
public void Dispose()
{
Dispose(disposing: true);
}
public virtual void Dispose(bool disposing)
{
if (__Instance == IntPtr.Zero)
return;
global::Std.CharTraits<_CharT> __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
__Instance = IntPtr.Zero;
}
}
public unsafe static partial class BasicStringExtensions public unsafe static partial class BasicStringExtensions
{ {
[StructLayout(LayoutKind.Explicit, Size = 0)] [StructLayout(LayoutKind.Explicit, Size = 0)]
@ -467,20 +353,6 @@ namespace Std
[FieldOffset(0)] [FieldOffset(0)]
internal fixed ulong __words[3]; internal fixed ulong __words[3];
} }
}
public unsafe partial struct Ulx
{
[StructLayout(LayoutKind.Explicit, Size = 24)]
public partial struct __Internal
{
[FieldOffset(0)]
internal global::Std.BasicString.Long.__Internal __lx;
[FieldOffset(0)]
internal global::Std.BasicString.Short.__Internal __lxx;
}
} }
} }
@ -553,4 +425,70 @@ namespace Std
__Instance = IntPtr.Zero; __Instance = IntPtr.Zero;
} }
} }
namespace CharTraits
{
[StructLayout(LayoutKind.Explicit, Size = 0)]
public unsafe partial struct __Internal
{
}
}
public unsafe partial class CharTraits<_CharT> : IDisposable
{
public global::System.IntPtr __Instance { get; protected set; }
protected int __PointerAdjustment;
internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Std.CharTraits<_CharT>> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Std.CharTraits<_CharT>>();
protected void*[] __OriginalVTables;
protected bool __ownsNativeInstance;
internal static global::Std.CharTraits<_CharT> __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
{
return new global::Std.CharTraits<_CharT>(native.ToPointer(), skipVTables);
}
internal static global::Std.CharTraits<_CharT> __CreateInstance(global::Std.CharTraits.__Internal native, bool skipVTables = false)
{
return new global::Std.CharTraits<_CharT>(native, skipVTables);
}
private static void* __CopyValue(global::Std.CharTraits.__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(global::Std.CharTraits.__Internal));
*(global::Std.CharTraits.__Internal*) ret = native;
return ret.ToPointer();
}
private CharTraits(global::Std.CharTraits.__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected CharTraits(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new global::System.IntPtr(native);
}
public void Dispose()
{
Dispose(disposing: true);
}
public virtual void Dispose(bool disposing)
{
if (__Instance == IntPtr.Zero)
return;
global::Std.CharTraits<_CharT> __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
__Instance = IntPtr.Zero;
}
}
} }

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

@ -13,17 +13,6 @@ using System.Runtime.CompilerServices;
[assembly:InternalsVisibleTo("CppSharp.CppParser")] [assembly:InternalsVisibleTo("CppSharp.CppParser")]
namespace GnuCxx
{
}
namespace Std
{
namespace ExceptionPtr
{
}
}
namespace Std namespace Std
{ {
namespace Allocator namespace Allocator
@ -128,6 +117,20 @@ namespace Std
namespace Std namespace Std
{ {
namespace Vector
{
[StructLayout(LayoutKind.Explicit, Size = 24)]
public unsafe partial struct __Internal
{
[FieldOffset(0)]
internal global::Std.VectorBase.VectorImpl.__Internal _M_impl;
}
}
public unsafe partial class Vector<_Tp, _Alloc>
{
}
namespace VectorBase namespace VectorBase
{ {
[StructLayout(LayoutKind.Explicit, Size = 24)] [StructLayout(LayoutKind.Explicit, Size = 24)]
@ -158,24 +161,6 @@ namespace Std
public unsafe partial class VectorBase<_Tp, _Alloc> public unsafe partial class VectorBase<_Tp, _Alloc>
{ {
} }
namespace Vector
{
[StructLayout(LayoutKind.Explicit, Size = 24)]
public unsafe partial struct __Internal
{
[FieldOffset(0)]
internal global::Std.VectorBase.VectorImpl.__Internal _M_impl;
}
}
public unsafe partial class Vector<_Tp, _Alloc>
{
}
}
namespace Std
{
} }
namespace Std namespace Std
@ -295,10 +280,6 @@ namespace Std
{ {
} }
namespace Std
{
}
namespace Std namespace Std
{ {
namespace CharTraits namespace CharTraits
@ -368,14 +349,6 @@ namespace Std
} }
} }
namespace Std
{
}
namespace Std
{
}
namespace Std namespace Std
{ {
public unsafe static partial class BasicStringExtensions public unsafe static partial class BasicStringExtensions
@ -542,23 +515,3 @@ namespace Std
namespace Std namespace Std
{ {
} }
namespace Std
{
}
namespace Std
{
}
namespace Std
{
}
namespace Std
{
}
namespace Std
{
}

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

@ -13,17 +13,6 @@ using System.Runtime.CompilerServices;
[assembly:InternalsVisibleTo("CppSharp.CppParser")] [assembly:InternalsVisibleTo("CppSharp.CppParser")]
namespace GnuCxx
{
}
namespace Std
{
namespace ExceptionPtr
{
}
}
namespace Std namespace Std
{ {
namespace Allocator namespace Allocator
@ -128,6 +117,20 @@ namespace Std
namespace Std namespace Std
{ {
namespace Vector
{
[StructLayout(LayoutKind.Explicit, Size = 24)]
public unsafe partial struct __Internal
{
[FieldOffset(0)]
internal global::Std.VectorBase.VectorImpl.__Internal _M_impl;
}
}
public unsafe partial class Vector<_Tp, _Alloc>
{
}
namespace VectorBase namespace VectorBase
{ {
[StructLayout(LayoutKind.Explicit, Size = 24)] [StructLayout(LayoutKind.Explicit, Size = 24)]
@ -158,24 +161,6 @@ namespace Std
public unsafe partial class VectorBase<_Tp, _Alloc> public unsafe partial class VectorBase<_Tp, _Alloc>
{ {
} }
namespace Vector
{
[StructLayout(LayoutKind.Explicit, Size = 24)]
public unsafe partial struct __Internal
{
[FieldOffset(0)]
internal global::Std.VectorBase.VectorImpl.__Internal _M_impl;
}
}
public unsafe partial class Vector<_Tp, _Alloc>
{
}
}
namespace Std
{
} }
namespace Std namespace Std
@ -295,10 +280,6 @@ namespace Std
{ {
} }
namespace Std
{
}
namespace Std namespace Std
{ {
namespace CharTraits namespace CharTraits
@ -437,40 +418,6 @@ namespace Std
[FieldOffset(0)] [FieldOffset(0)]
internal global::System.IntPtr _M_p; internal global::System.IntPtr _M_p;
} }
}
public unsafe partial class RepBase
{
[StructLayout(LayoutKind.Explicit, Size = 24)]
public partial struct __Internal
{
[FieldOffset(0)]
internal ulong _M_length;
[FieldOffset(8)]
internal ulong _M_capacity;
[FieldOffset(16)]
internal int _M_refcount;
}
}
public unsafe partial class Rep
{
[StructLayout(LayoutKind.Explicit, Size = 24)]
public partial struct __Internal
{
[FieldOffset(0)]
internal ulong _M_length;
[FieldOffset(8)]
internal ulong _M_capacity;
[FieldOffset(16)]
internal int _M_refcount;
}
} }
} }
@ -548,23 +495,3 @@ namespace Std
namespace Std namespace Std
{ {
} }
namespace Std
{
}
namespace Std
{
}
namespace Std
{
}
namespace Std
{
}
namespace Std
{
}

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

@ -13,18 +13,6 @@ using System.Runtime.CompilerServices;
[assembly:InternalsVisibleTo("CppSharp.CppParser")] [assembly:InternalsVisibleTo("CppSharp.CppParser")]
namespace Std
{
}
namespace Std
{
}
namespace Std
{
}
namespace Std namespace Std
{ {
namespace CharTraits namespace CharTraits
@ -94,10 +82,6 @@ namespace Std
} }
} }
namespace Std
{
}
namespace Std namespace Std
{ {
namespace CompressedPair namespace CompressedPair
@ -383,7 +367,7 @@ namespace Std
} }
} }
public unsafe partial class CompressedPair<_Ty1, _Ty2, _73> public unsafe partial class CompressedPair<_Ty1, _Ty2, _0>
{ {
} }
} }
@ -477,43 +461,6 @@ namespace Std
namespace Std namespace Std
{ {
namespace StringVal
{
[StructLayout(LayoutKind.Explicit, Size = 32)]
public unsafe partial struct __Internal
{
[FieldOffset(0)]
internal global::Std.StringVal.Bxty.__Internal _Bx;
[FieldOffset(16)]
internal ulong _Mysize;
[FieldOffset(24)]
internal ulong _Myres;
}
public unsafe partial struct Bxty
{
[StructLayout(LayoutKind.Explicit, Size = 16)]
public partial struct __Internal
{
[FieldOffset(0)]
internal fixed sbyte _Buf[16];
[FieldOffset(0)]
internal global::System.IntPtr _Ptr;
[FieldOffset(0)]
internal fixed sbyte _Alias[16];
}
}
}
public unsafe partial class StringVal<_Val_types>
{
}
public unsafe static partial class BasicStringExtensions public unsafe static partial class BasicStringExtensions
{ {
[StructLayout(LayoutKind.Explicit, Size = 0)] [StructLayout(LayoutKind.Explicit, Size = 0)]
@ -642,30 +589,47 @@ namespace Std
__Instance = IntPtr.Zero; __Instance = IntPtr.Zero;
} }
} }
}
namespace Std namespace StringVal
{
namespace VectorVal
{ {
[StructLayout(LayoutKind.Explicit, Size = 24)] [StructLayout(LayoutKind.Explicit, Size = 32)]
public unsafe partial struct __Internal public unsafe partial struct __Internal
{ {
[FieldOffset(0)] [FieldOffset(0)]
internal global::System.IntPtr _Myfirst; internal global::Std.StringVal.Bxty.__Internal _Bx;
[FieldOffset(8)]
internal global::System.IntPtr _Mylast;
[FieldOffset(16)] [FieldOffset(16)]
internal global::System.IntPtr _Myend; internal ulong _Mysize;
[FieldOffset(24)]
internal ulong _Myres;
}
public unsafe partial struct Bxty
{
[StructLayout(LayoutKind.Explicit, Size = 16)]
public partial struct __Internal
{
[FieldOffset(0)]
internal fixed sbyte _Buf[16];
[FieldOffset(0)]
internal global::System.IntPtr _Ptr;
[FieldOffset(0)]
internal fixed sbyte _Alias[16];
}
} }
} }
public unsafe partial class VectorVal<_Val_types> public unsafe partial class StringVal<_Val_types>
{ {
} }
}
namespace Std
{
namespace Vector namespace Vector
{ {
[StructLayout(LayoutKind.Explicit, Size = 24)] [StructLayout(LayoutKind.Explicit, Size = 24)]
@ -679,10 +643,26 @@ namespace Std
public unsafe partial class Vector<_Ty, _Alloc> public unsafe partial class Vector<_Ty, _Alloc>
{ {
} }
}
namespace Std namespace VectorVal
{ {
[StructLayout(LayoutKind.Explicit, Size = 24)]
public unsafe partial struct __Internal
{
[FieldOffset(0)]
internal global::System.IntPtr _Myfirst;
[FieldOffset(8)]
internal global::System.IntPtr _Mylast;
[FieldOffset(16)]
internal global::System.IntPtr _Myend;
}
}
public unsafe partial class VectorVal<_Val_types>
{
}
} }
namespace Std namespace Std
@ -721,11 +701,3 @@ namespace Std
{ {
} }
} }
namespace Std
{
}
namespace Std
{
}

69
src/CppParser/Parser.cpp

@ -885,10 +885,11 @@ static bool HasLayout(const clang::RecordDecl* Record)
return true; return true;
} }
bool Parser::IsSupported(const clang::RecordDecl* RD) bool Parser::IsSupported(const clang::NamedDecl* ND)
{ {
return !c->getSourceManager().isInSystemHeader(RD->getLocStart()) || return !c->getSourceManager().isInSystemHeader(ND->getLocStart()) ||
supportedStdTypes.find(RD->getName()) != supportedStdTypes.end(); (llvm::isa<clang::RecordDecl>(ND) &&
supportedStdTypes.find(ND->getName()) != supportedStdTypes.end());
} }
bool Parser::IsSupported(const clang::CXXMethodDecl* MD) bool Parser::IsSupported(const clang::CXXMethodDecl* MD)
@ -944,8 +945,29 @@ void Parser::WalkRecord(const clang::RecordDecl* Record, Class* RC)
for (auto FD : Record->fields()) for (auto FD : Record->fields())
WalkFieldCXX(FD, RC); WalkFieldCXX(FD, RC);
if (!IsSupported(Record)) if (c->getSourceManager().isInSystemHeader(Record->getLocStart()))
{
if (supportedStdTypes.find(Record->getName()) != supportedStdTypes.end())
{
for (auto D : Record->decls())
{
switch (D->getKind())
{
case Decl::CXXConstructor:
case Decl::CXXDestructor:
case Decl::CXXConversion:
case Decl::CXXMethod:
{
auto MD = cast<CXXMethodDecl>(D);
if (IsSupported(MD))
WalkMethodCXX(MD);
break;
}
}
}
}
return; return;
}
for (auto D : Record->decls()) for (auto D : Record->decls())
{ {
@ -957,8 +979,7 @@ void Parser::WalkRecord(const clang::RecordDecl* Record, Class* RC)
case Decl::CXXMethod: case Decl::CXXMethod:
{ {
auto MD = cast<CXXMethodDecl>(D); auto MD = cast<CXXMethodDecl>(D);
if (IsSupported(MD)) WalkMethodCXX(MD);
WalkMethodCXX(MD);
break; break;
} }
case Decl::AccessSpec: case Decl::AccessSpec:
@ -1677,11 +1698,12 @@ Method* Parser::WalkMethodCXX(const clang::CXXMethodDecl* MD)
// Check for an already existing method that came from the same declaration. // Check for an already existing method that came from the same declaration.
auto USR = GetDeclUSR(MD); auto USR = GetDeclUSR(MD);
for (unsigned I = 0, E = Class->Methods.size(); I != E; ++I) for (auto& M : Class->Methods)
{ {
Method* Method = Class->Methods[I]; if (M->USR == USR)
if (Method->USR == USR) {
return Method; return M;
}
} }
for (unsigned I = 0, E = Class->Templates.size(); I != E; ++I) for (unsigned I = 0, E = Class->Templates.size(); I != E; ++I)
{ {
@ -1716,16 +1738,9 @@ Method* Parser::WalkMethodCXX(const clang::CXXMethodDecl* MD)
break; break;
} }
WalkFunction(MD, Method); Class->Methods.push_back(Method);
for (auto& M : Class->Methods) WalkFunction(MD, Method);
{
if (M->USR == USR)
{
delete Method;
return M;
}
}
if (const CXXConstructorDecl* CD = dyn_cast<CXXConstructorDecl>(MD)) if (const CXXConstructorDecl* CD = dyn_cast<CXXConstructorDecl>(MD))
{ {
@ -1743,8 +1758,6 @@ Method* Parser::WalkMethodCXX(const clang::CXXMethodDecl* MD)
auto RTL = TL.getReturnLoc(); auto RTL = TL.getReturnLoc();
Method->conversionType = GetQualifiedType(CD->getConversionType(), &RTL); Method->conversionType = GetQualifiedType(CD->getConversionType(), &RTL);
} }
Class->Methods.push_back(Method);
return Method; return Method;
} }
@ -3147,10 +3160,11 @@ bool Parser::IsValidDeclaration(const clang::SourceLocation& Loc)
void Parser::WalkAST() void Parser::WalkAST()
{ {
auto TU = AST->getTranslationUnitDecl(); auto TU = AST->getTranslationUnitDecl();
for(auto it = TU->decls_begin(); it != TU->decls_end(); ++it) for (auto D : TU->decls())
{ {
clang::Decl* D = (*it); if (D->getLocStart().isValid() &&
WalkDeclarationDef(D); !c->getSourceManager().isInSystemHeader(D->getLocStart()))
WalkDeclarationDef(D);
} }
} }
@ -3763,10 +3777,11 @@ Declaration* Parser::WalkDeclaration(const clang::Decl* D)
{ {
auto ND = cast<NamespaceDecl>(D); auto ND = cast<NamespaceDecl>(D);
for (auto it = ND->decls_begin(); it != ND->decls_end(); ++it) for (auto D : ND->decls())
{ {
clang::Decl* D = (*it); auto ND = dyn_cast<NamedDecl>(D);
Decl = WalkDeclarationDef(D); if (IsSupported(ND))
Decl = WalkDeclarationDef(D);
} }
break; break;

2
src/CppParser/Parser.h

@ -60,7 +60,7 @@ public:
ParserTargetInfo* GetTargetInfo(); ParserTargetInfo* GetTargetInfo();
private: private:
bool IsSupported(const clang::RecordDecl* RD); bool IsSupported(const clang::NamedDecl* ND);
bool IsSupported(const clang::CXXMethodDecl* MD); bool IsSupported(const clang::CXXMethodDecl* MD);
// AST traversers // AST traversers
void WalkAST(); void WalkAST();

Loading…
Cancel
Save