Browse Source

Fixed a bug when a default arg is a binary operator expression.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/479/head
Dimitar Dobrev 10 years ago
parent
commit
c512a558c7
  1. 21
      src/AST/Expression.cs
  2. 5
      src/Core/Parser/ASTConverter.cs
  3. 5
      src/CppParser/AST.cpp
  4. 9
      src/CppParser/AST.h
  5. 44
      src/CppParser/Bindings/CLI/AST.cpp
  6. 26
      src/CppParser/Bindings/CLI/AST.h
  7. 1540
      src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/AST.cs
  8. 130
      src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppParser.cs
  9. 20
      src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Target.cs
  10. 1540
      src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/AST.cs
  11. 131
      src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppParser.cs
  12. 20
      src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Target.cs
  13. 1540
      src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/AST.cs
  14. 130
      src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppParser.cs
  15. 20
      src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Target.cs
  16. 1540
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu/AST.cs
  17. 130
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppParser.cs
  18. 20
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Target.cs
  19. 7
      src/CppParser/Parser.cpp
  20. 17
      src/Generator/Passes/HandleDefaultParamValuesPass.cs
  21. 4
      tests/CSharpTemp/CSharpTemp.cpp
  22. 1
      tests/CSharpTemp/CSharpTemp.h

21
src/AST/Expression.cs

@ -49,6 +49,7 @@ namespace CppSharp.AST @@ -49,6 +49,7 @@ namespace CppSharp.AST
return visitor.VisitExpression(this);
}
}
public class CtorExpr : Expression
{
public Expression SubExpression;
@ -59,6 +60,26 @@ namespace CppSharp.AST @@ -59,6 +60,26 @@ namespace CppSharp.AST
}
}
public class BinaryOperator : Expression
{
public BinaryOperator(Expression lhs, Expression rhs, string opcodeStr)
{
Class = StatementClass.BinaryOperator;
this.LHS = lhs;
this.RHS = rhs;
this.OpcodeStr = opcodeStr;
}
public Expression LHS { get; set; }
public Expression RHS { get; set; }
public string OpcodeStr { get; set; }
public override T Visit<T>(IExpressionVisitor<T> visitor)
{
return visitor.VisitExpression(this);
}
}
public interface IExpressionVisitor<out T>
{
T VisitExpression(Expression exp);

5
src/Core/Parser/ASTConverter.cs

@ -867,8 +867,9 @@ namespace CppSharp @@ -867,8 +867,9 @@ namespace CppSharp
switch (statement.Class)
{
case StatementClass.BinaryOperator:
expression = new AST.BuiltinTypeExpression();
expression.Class = AST.StatementClass.BinaryOperator;
var binaryOperator = BinaryOperator.__CreateInstance(statement.__Instance);
expression = new AST.BinaryOperator(VisitStatement(binaryOperator.LHS),
VisitStatement(binaryOperator.RHS), binaryOperator.OpcodeStr);
break;
case StatementClass.DeclRefExprClass:
expression = new AST.BuiltinTypeExpression();

5
src/CppParser/AST.cpp

@ -478,6 +478,11 @@ Statement::Statement(const std::string& str, StatementClass stmtClass, Declarati @@ -478,6 +478,11 @@ Statement::Statement(const std::string& str, StatementClass stmtClass, Declarati
Expression::Expression(const std::string& str, StatementClass stmtClass, Declaration* decl, Expression* subexpr)
:Statement(str, stmtClass, decl), Subexpression(subexpr) {}
BinaryOperator::BinaryOperator(const std::string& str, Expression* lhs, Expression* rhs, const std::string& opcodeStr)
: Expression(str, StatementClass::BinaryOperator), LHS(lhs), RHS(rhs), OpcodeStr(opcodeStr) {}
DEF_STRING(BinaryOperator, OpcodeStr)
Parameter::Parameter() : Declaration(DeclarationKind::Parameter),
IsIndirect(false), HasDefaultValue(false), DefaultArgument(0) {}

9
src/CppParser/AST.h

@ -501,6 +501,15 @@ public: @@ -501,6 +501,15 @@ public:
Expression* Subexpression;
};
class CS_API BinaryOperator : public Expression
{
public:
BinaryOperator(const std::string& str, Expression* lhs, Expression* rhs, const std::string& opcodeStr);
Expression* LHS;
Expression* RHS;
STRING(OpcodeStr)
};
class CS_API Parameter : public Declaration
{
public:

44
src/CppParser/Bindings/CLI/AST.cpp

@ -1647,6 +1647,50 @@ void CppSharp::Parser::AST::Expression::Subexpression::set(CppSharp::Parser::AST @@ -1647,6 +1647,50 @@ void CppSharp::Parser::AST::Expression::Subexpression::set(CppSharp::Parser::AST
((::CppSharp::CppParser::AST::Expression*)NativePtr)->Subexpression = (::CppSharp::CppParser::AST::Expression*)value->NativePtr;
}
CppSharp::Parser::AST::BinaryOperator::BinaryOperator(::CppSharp::CppParser::AST::BinaryOperator* native)
: CppSharp::Parser::AST::Expression((::CppSharp::CppParser::AST::Expression*)native)
{
}
CppSharp::Parser::AST::BinaryOperator^ CppSharp::Parser::AST::BinaryOperator::__CreateInstance(::System::IntPtr native)
{
return gcnew CppSharp::Parser::AST::BinaryOperator((::CppSharp::CppParser::AST::BinaryOperator*) native.ToPointer());
}
System::String^ CppSharp::Parser::AST::BinaryOperator::OpcodeStr::get()
{
auto __ret = ((::CppSharp::CppParser::AST::BinaryOperator*)NativePtr)->getOpcodeStr();
if (__ret == nullptr) return nullptr;
return clix::marshalString<clix::E_UTF8>(__ret);
}
void CppSharp::Parser::AST::BinaryOperator::OpcodeStr::set(System::String^ s)
{
auto _arg0 = clix::marshalString<clix::E_UTF8>(s);
auto arg0 = _arg0.c_str();
((::CppSharp::CppParser::AST::BinaryOperator*)NativePtr)->setOpcodeStr(arg0);
}
CppSharp::Parser::AST::Expression^ CppSharp::Parser::AST::BinaryOperator::LHS::get()
{
return (((::CppSharp::CppParser::AST::BinaryOperator*)NativePtr)->LHS == nullptr) ? nullptr : gcnew CppSharp::Parser::AST::Expression((::CppSharp::CppParser::AST::Expression*)((::CppSharp::CppParser::AST::BinaryOperator*)NativePtr)->LHS);
}
void CppSharp::Parser::AST::BinaryOperator::LHS::set(CppSharp::Parser::AST::Expression^ value)
{
((::CppSharp::CppParser::AST::BinaryOperator*)NativePtr)->LHS = (::CppSharp::CppParser::AST::Expression*)value->NativePtr;
}
CppSharp::Parser::AST::Expression^ CppSharp::Parser::AST::BinaryOperator::RHS::get()
{
return (((::CppSharp::CppParser::AST::BinaryOperator*)NativePtr)->RHS == nullptr) ? nullptr : gcnew CppSharp::Parser::AST::Expression((::CppSharp::CppParser::AST::Expression*)((::CppSharp::CppParser::AST::BinaryOperator*)NativePtr)->RHS);
}
void CppSharp::Parser::AST::BinaryOperator::RHS::set(CppSharp::Parser::AST::Expression^ value)
{
((::CppSharp::CppParser::AST::BinaryOperator*)NativePtr)->RHS = (::CppSharp::CppParser::AST::Expression*)value->NativePtr;
}
CppSharp::Parser::AST::Parameter::Parameter(::CppSharp::CppParser::AST::Parameter* native)
: CppSharp::Parser::AST::Declaration((::CppSharp::CppParser::AST::Declaration*)native)
{

26
src/CppParser/Bindings/CLI/AST.h

@ -30,6 +30,7 @@ namespace CppSharp @@ -30,6 +30,7 @@ namespace CppSharp
ref class ArrayType;
ref class AttributedType;
ref class BaseClassSpecifier;
ref class BinaryOperator;
ref class BuiltinType;
ref class Class;
ref class ClassLayout;
@ -1262,6 +1263,31 @@ namespace CppSharp @@ -1262,6 +1263,31 @@ namespace CppSharp
}
};
public ref class BinaryOperator : CppSharp::Parser::AST::Expression
{
public:
BinaryOperator(::CppSharp::CppParser::AST::BinaryOperator* native);
static BinaryOperator^ __CreateInstance(::System::IntPtr native);
property System::String^ OpcodeStr
{
System::String^ get();
void set(System::String^);
}
property CppSharp::Parser::AST::Expression^ LHS
{
CppSharp::Parser::AST::Expression^ get();
void set(CppSharp::Parser::AST::Expression^);
}
property CppSharp::Parser::AST::Expression^ RHS
{
CppSharp::Parser::AST::Expression^ get();
void set(CppSharp::Parser::AST::Expression^);
}
};
public ref class Parameter : CppSharp::Parser::AST::Declaration
{
public:

1540
src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/AST.cs

File diff suppressed because it is too large Load Diff

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

@ -231,6 +231,7 @@ namespace CppSharp @@ -231,6 +231,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserOptions> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserOptions>();
private readonly bool __ownsNativeInstance;
@ -255,6 +256,7 @@ namespace CppSharp @@ -255,6 +256,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ParserOptions(ParserOptions.Internal* native, bool isInternalImpl = false)
@ -266,28 +268,38 @@ namespace CppSharp @@ -266,28 +268,38 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(116);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0(__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ParserOptions __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance || force)
Internal.dtor_0(__Instance);
if (__ownsNativeInstance)
{
Marshal.FreeHGlobal(__Instance);
}
}
public string getArguments(uint i)
{
var __ret = Internal.getArguments_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -306,7 +318,6 @@ namespace CppSharp @@ -306,7 +318,6 @@ namespace CppSharp
public string getIncludeDirs(uint i)
{
var __ret = Internal.getIncludeDirs_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -325,7 +336,6 @@ namespace CppSharp @@ -325,7 +336,6 @@ namespace CppSharp
public string getSystemIncludeDirs(uint i)
{
var __ret = Internal.getSystemIncludeDirs_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -344,7 +354,6 @@ namespace CppSharp @@ -344,7 +354,6 @@ namespace CppSharp
public string getDefines(uint i)
{
var __ret = Internal.getDefines_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -363,7 +372,6 @@ namespace CppSharp @@ -363,7 +372,6 @@ namespace CppSharp
public string getUndefines(uint i)
{
var __ret = Internal.getUndefines_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -382,7 +390,6 @@ namespace CppSharp @@ -382,7 +390,6 @@ namespace CppSharp
public string getLibraryDirs(uint i)
{
var __ret = Internal.getLibraryDirs_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -412,7 +419,6 @@ namespace CppSharp @@ -412,7 +419,6 @@ namespace CppSharp
get
{
var __ret = Internal.getFileName_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -474,7 +480,6 @@ namespace CppSharp @@ -474,7 +480,6 @@ namespace CppSharp
get
{
var __ret = Internal.getTargetTriple_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -490,7 +495,12 @@ namespace CppSharp @@ -490,7 +495,12 @@ namespace CppSharp
{
get
{
return (((Internal*) __Instance)->ASTContext == IntPtr.Zero) ? null : CppSharp.Parser.AST.ASTContext.__CreateInstance(((Internal*) __Instance)->ASTContext);
ASTContext __result0;
if (((Internal*) __Instance)->ASTContext == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AST.ASTContext.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->ASTContext))
__result0 = (ASTContext) CppSharp.Parser.AST.ASTContext.NativeToManagedMap[((Internal*) __Instance)->ASTContext];
else __result0 = CppSharp.Parser.AST.ASTContext.__CreateInstance(((Internal*) __Instance)->ASTContext);
return __result0;
}
set
@ -642,6 +652,7 @@ namespace CppSharp @@ -642,6 +652,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserDiagnostic> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserDiagnostic>();
private readonly bool __ownsNativeInstance;
@ -666,6 +677,7 @@ namespace CppSharp @@ -666,6 +677,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ParserDiagnostic(ParserDiagnostic.Internal* native, bool isInternalImpl = false)
@ -677,30 +689,40 @@ namespace CppSharp @@ -677,30 +689,40 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(36);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0(__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ParserDiagnostic __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance || force)
Internal.dtor_0(__Instance);
if (__ownsNativeInstance)
{
Marshal.FreeHGlobal(__Instance);
}
}
public string FileName
{
get
{
var __ret = Internal.getFileName_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -717,7 +739,6 @@ namespace CppSharp @@ -717,7 +739,6 @@ namespace CppSharp
get
{
var __ret = Internal.getMessage_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -823,6 +844,7 @@ namespace CppSharp @@ -823,6 +844,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserResult> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserResult>();
private readonly bool __ownsNativeInstance;
@ -847,6 +869,7 @@ namespace CppSharp @@ -847,6 +869,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ParserResult(ParserResult.Internal* native, bool isInternalImpl = false)
@ -858,23 +881,34 @@ namespace CppSharp @@ -858,23 +881,34 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(28);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0(__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ParserResult __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance || force)
Internal.dtor_0(__Instance);
if (__ownsNativeInstance)
{
Marshal.FreeHGlobal(__Instance);
}
}
public CppSharp.Parser.ParserDiagnostic getDiagnostics(uint i)
{
@ -920,7 +954,12 @@ namespace CppSharp @@ -920,7 +954,12 @@ namespace CppSharp
{
get
{
return (((Internal*) __Instance)->ASTContext == IntPtr.Zero) ? null : CppSharp.Parser.AST.ASTContext.__CreateInstance(((Internal*) __Instance)->ASTContext);
ASTContext __result0;
if (((Internal*) __Instance)->ASTContext == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AST.ASTContext.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->ASTContext))
__result0 = (ASTContext) CppSharp.Parser.AST.ASTContext.NativeToManagedMap[((Internal*) __Instance)->ASTContext];
else __result0 = CppSharp.Parser.AST.ASTContext.__CreateInstance(((Internal*) __Instance)->ASTContext);
return __result0;
}
set
@ -933,7 +972,12 @@ namespace CppSharp @@ -933,7 +972,12 @@ namespace CppSharp
{
get
{
return (((Internal*) __Instance)->Library == IntPtr.Zero) ? null : CppSharp.Parser.AST.NativeLibrary.__CreateInstance(((Internal*) __Instance)->Library);
NativeLibrary __result0;
if (((Internal*) __Instance)->Library == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AST.NativeLibrary.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->Library))
__result0 = (NativeLibrary) CppSharp.Parser.AST.NativeLibrary.NativeToManagedMap[((Internal*) __Instance)->Library];
else __result0 = CppSharp.Parser.AST.NativeLibrary.__CreateInstance(((Internal*) __Instance)->Library);
return __result0;
}
set
@ -970,6 +1014,7 @@ namespace CppSharp @@ -970,6 +1014,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ClangParser> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ClangParser>();
private readonly bool __ownsNativeInstance;
@ -994,6 +1039,7 @@ namespace CppSharp @@ -994,6 +1039,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ClangParser(ClangParser.Internal* native, bool isInternalImpl = false)
@ -1005,44 +1051,66 @@ namespace CppSharp @@ -1005,44 +1051,66 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(1);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (__ownsNativeInstance)
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
Marshal.FreeHGlobal(__Instance);
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ClangParser __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
}
public static CppSharp.Parser.ParserResult ParseHeader(CppSharp.Parser.ParserOptions Opts)
{
var arg0 = ReferenceEquals(Opts, null) ? global::System.IntPtr.Zero : Opts.__Instance;
var __ret = Internal.ParseHeader_0(arg0);
if (__ret == global::System.IntPtr.Zero) return null;
return (__ret == IntPtr.Zero) ? null : CppSharp.Parser.ParserResult.__CreateInstance(__ret);
ParserResult __result0;
if (__ret == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.ParserResult.NativeToManagedMap.ContainsKey(__ret))
__result0 = (ParserResult) CppSharp.Parser.ParserResult.NativeToManagedMap[__ret];
else __result0 = CppSharp.Parser.ParserResult.__CreateInstance(__ret);
return __result0;
}
public static CppSharp.Parser.ParserResult ParseLibrary(CppSharp.Parser.ParserOptions Opts)
{
var arg0 = ReferenceEquals(Opts, null) ? global::System.IntPtr.Zero : Opts.__Instance;
var __ret = Internal.ParseLibrary_0(arg0);
if (__ret == global::System.IntPtr.Zero) return null;
return (__ret == IntPtr.Zero) ? null : CppSharp.Parser.ParserResult.__CreateInstance(__ret);
ParserResult __result0;
if (__ret == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.ParserResult.NativeToManagedMap.ContainsKey(__ret))
__result0 = (ParserResult) CppSharp.Parser.ParserResult.NativeToManagedMap[__ret];
else __result0 = CppSharp.Parser.ParserResult.__CreateInstance(__ret);
return __result0;
}
public static CppSharp.Parser.ParserTargetInfo GetTargetInfo(CppSharp.Parser.ParserOptions Opts)
{
var arg0 = ReferenceEquals(Opts, null) ? global::System.IntPtr.Zero : Opts.__Instance;
var __ret = Internal.GetTargetInfo_0(arg0);
if (__ret == global::System.IntPtr.Zero) return null;
return (__ret == IntPtr.Zero) ? null : CppSharp.Parser.ParserTargetInfo.__CreateInstance(__ret);
ParserTargetInfo __result0;
if (__ret == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.ParserTargetInfo.NativeToManagedMap.ContainsKey(__ret))
__result0 = (ParserTargetInfo) CppSharp.Parser.ParserTargetInfo.NativeToManagedMap[__ret];
else __result0 = CppSharp.Parser.ParserTargetInfo.__CreateInstance(__ret);
return __result0;
}
}
}

20
src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Target.cs

@ -171,6 +171,7 @@ namespace CppSharp @@ -171,6 +171,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserTargetInfo> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserTargetInfo>();
private readonly bool __ownsNativeInstance;
@ -195,6 +196,7 @@ namespace CppSharp @@ -195,6 +196,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ParserTargetInfo(ParserTargetInfo.Internal* native, bool isInternalImpl = false)
@ -206,30 +208,40 @@ namespace CppSharp @@ -206,30 +208,40 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(164);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_1(__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ParserTargetInfo __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance || force)
Internal.dtor_0(__Instance);
if (__ownsNativeInstance)
{
Marshal.FreeHGlobal(__Instance);
}
}
public string ABI
{
get
{
var __ret = Internal.getABI_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}

1540
src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/AST.cs

File diff suppressed because it is too large Load Diff

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

@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using CppSharp.Parser.AST;
namespace CppSharp
{
@ -231,6 +232,7 @@ namespace CppSharp @@ -231,6 +232,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserOptions> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserOptions>();
private readonly bool __ownsNativeInstance;
@ -255,6 +257,7 @@ namespace CppSharp @@ -255,6 +257,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ParserOptions(ParserOptions.Internal* native, bool isInternalImpl = false)
@ -266,28 +269,38 @@ namespace CppSharp @@ -266,28 +269,38 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(140);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0(__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ParserOptions __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance || force)
Internal.dtor_0(__Instance);
if (__ownsNativeInstance)
{
Marshal.FreeHGlobal(__Instance);
}
}
public string getArguments(uint i)
{
var __ret = Internal.getArguments_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -306,7 +319,6 @@ namespace CppSharp @@ -306,7 +319,6 @@ namespace CppSharp
public string getIncludeDirs(uint i)
{
var __ret = Internal.getIncludeDirs_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -325,7 +337,6 @@ namespace CppSharp @@ -325,7 +337,6 @@ namespace CppSharp
public string getSystemIncludeDirs(uint i)
{
var __ret = Internal.getSystemIncludeDirs_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -344,7 +355,6 @@ namespace CppSharp @@ -344,7 +355,6 @@ namespace CppSharp
public string getDefines(uint i)
{
var __ret = Internal.getDefines_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -363,7 +373,6 @@ namespace CppSharp @@ -363,7 +373,6 @@ namespace CppSharp
public string getUndefines(uint i)
{
var __ret = Internal.getUndefines_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -382,7 +391,6 @@ namespace CppSharp @@ -382,7 +391,6 @@ namespace CppSharp
public string getLibraryDirs(uint i)
{
var __ret = Internal.getLibraryDirs_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -412,7 +420,6 @@ namespace CppSharp @@ -412,7 +420,6 @@ namespace CppSharp
get
{
var __ret = Internal.getFileName_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -474,7 +481,6 @@ namespace CppSharp @@ -474,7 +481,6 @@ namespace CppSharp
get
{
var __ret = Internal.getTargetTriple_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -490,7 +496,12 @@ namespace CppSharp @@ -490,7 +496,12 @@ namespace CppSharp
{
get
{
return (((Internal*) __Instance)->ASTContext == IntPtr.Zero) ? null : CppSharp.Parser.AST.ASTContext.__CreateInstance(((Internal*) __Instance)->ASTContext);
ASTContext __result0;
if (((Internal*) __Instance)->ASTContext == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AST.ASTContext.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->ASTContext))
__result0 = (ASTContext) CppSharp.Parser.AST.ASTContext.NativeToManagedMap[((Internal*) __Instance)->ASTContext];
else __result0 = CppSharp.Parser.AST.ASTContext.__CreateInstance(((Internal*) __Instance)->ASTContext);
return __result0;
}
set
@ -642,6 +653,7 @@ namespace CppSharp @@ -642,6 +653,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserDiagnostic> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserDiagnostic>();
private readonly bool __ownsNativeInstance;
@ -666,6 +678,7 @@ namespace CppSharp @@ -666,6 +678,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ParserDiagnostic(ParserDiagnostic.Internal* native, bool isInternalImpl = false)
@ -677,30 +690,40 @@ namespace CppSharp @@ -677,30 +690,40 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(60);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0(__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ParserDiagnostic __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance || force)
Internal.dtor_0(__Instance);
if (__ownsNativeInstance)
{
Marshal.FreeHGlobal(__Instance);
}
}
public string FileName
{
get
{
var __ret = Internal.getFileName_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -717,7 +740,6 @@ namespace CppSharp @@ -717,7 +740,6 @@ namespace CppSharp
get
{
var __ret = Internal.getMessage_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -823,6 +845,7 @@ namespace CppSharp @@ -823,6 +845,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserResult> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserResult>();
private readonly bool __ownsNativeInstance;
@ -847,6 +870,7 @@ namespace CppSharp @@ -847,6 +870,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ParserResult(ParserResult.Internal* native, bool isInternalImpl = false)
@ -858,23 +882,34 @@ namespace CppSharp @@ -858,23 +882,34 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(28);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0(__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ParserResult __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance || force)
Internal.dtor_0(__Instance);
if (__ownsNativeInstance)
{
Marshal.FreeHGlobal(__Instance);
}
}
public CppSharp.Parser.ParserDiagnostic getDiagnostics(uint i)
{
@ -920,7 +955,12 @@ namespace CppSharp @@ -920,7 +955,12 @@ namespace CppSharp
{
get
{
return (((Internal*) __Instance)->ASTContext == IntPtr.Zero) ? null : CppSharp.Parser.AST.ASTContext.__CreateInstance(((Internal*) __Instance)->ASTContext);
ASTContext __result0;
if (((Internal*) __Instance)->ASTContext == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AST.ASTContext.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->ASTContext))
__result0 = (ASTContext) CppSharp.Parser.AST.ASTContext.NativeToManagedMap[((Internal*) __Instance)->ASTContext];
else __result0 = CppSharp.Parser.AST.ASTContext.__CreateInstance(((Internal*) __Instance)->ASTContext);
return __result0;
}
set
@ -933,7 +973,12 @@ namespace CppSharp @@ -933,7 +973,12 @@ namespace CppSharp
{
get
{
return (((Internal*) __Instance)->Library == IntPtr.Zero) ? null : CppSharp.Parser.AST.NativeLibrary.__CreateInstance(((Internal*) __Instance)->Library);
NativeLibrary __result0;
if (((Internal*) __Instance)->Library == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AST.NativeLibrary.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->Library))
__result0 = (NativeLibrary) CppSharp.Parser.AST.NativeLibrary.NativeToManagedMap[((Internal*) __Instance)->Library];
else __result0 = CppSharp.Parser.AST.NativeLibrary.__CreateInstance(((Internal*) __Instance)->Library);
return __result0;
}
set
@ -970,6 +1015,7 @@ namespace CppSharp @@ -970,6 +1015,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ClangParser> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ClangParser>();
private readonly bool __ownsNativeInstance;
@ -994,6 +1040,7 @@ namespace CppSharp @@ -994,6 +1040,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ClangParser(ClangParser.Internal* native, bool isInternalImpl = false)
@ -1005,44 +1052,66 @@ namespace CppSharp @@ -1005,44 +1052,66 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(1);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (__ownsNativeInstance)
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
Marshal.FreeHGlobal(__Instance);
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ClangParser __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
}
public static CppSharp.Parser.ParserResult ParseHeader(CppSharp.Parser.ParserOptions Opts)
{
var arg0 = ReferenceEquals(Opts, null) ? global::System.IntPtr.Zero : Opts.__Instance;
var __ret = Internal.ParseHeader_0(arg0);
if (__ret == global::System.IntPtr.Zero) return null;
return (__ret == IntPtr.Zero) ? null : CppSharp.Parser.ParserResult.__CreateInstance(__ret);
ParserResult __result0;
if (__ret == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.ParserResult.NativeToManagedMap.ContainsKey(__ret))
__result0 = (ParserResult) CppSharp.Parser.ParserResult.NativeToManagedMap[__ret];
else __result0 = CppSharp.Parser.ParserResult.__CreateInstance(__ret);
return __result0;
}
public static CppSharp.Parser.ParserResult ParseLibrary(CppSharp.Parser.ParserOptions Opts)
{
var arg0 = ReferenceEquals(Opts, null) ? global::System.IntPtr.Zero : Opts.__Instance;
var __ret = Internal.ParseLibrary_0(arg0);
if (__ret == global::System.IntPtr.Zero) return null;
return (__ret == IntPtr.Zero) ? null : CppSharp.Parser.ParserResult.__CreateInstance(__ret);
ParserResult __result0;
if (__ret == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.ParserResult.NativeToManagedMap.ContainsKey(__ret))
__result0 = (ParserResult) CppSharp.Parser.ParserResult.NativeToManagedMap[__ret];
else __result0 = CppSharp.Parser.ParserResult.__CreateInstance(__ret);
return __result0;
}
public static CppSharp.Parser.ParserTargetInfo GetTargetInfo(CppSharp.Parser.ParserOptions Opts)
{
var arg0 = ReferenceEquals(Opts, null) ? global::System.IntPtr.Zero : Opts.__Instance;
var __ret = Internal.GetTargetInfo_0(arg0);
if (__ret == global::System.IntPtr.Zero) return null;
return (__ret == IntPtr.Zero) ? null : CppSharp.Parser.ParserTargetInfo.__CreateInstance(__ret);
ParserTargetInfo __result0;
if (__ret == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.ParserTargetInfo.NativeToManagedMap.ContainsKey(__ret))
__result0 = (ParserTargetInfo) CppSharp.Parser.ParserTargetInfo.NativeToManagedMap[__ret];
else __result0 = CppSharp.Parser.ParserTargetInfo.__CreateInstance(__ret);
return __result0;
}
}
}

20
src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Target.cs

@ -171,6 +171,7 @@ namespace CppSharp @@ -171,6 +171,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserTargetInfo> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserTargetInfo>();
private readonly bool __ownsNativeInstance;
@ -195,6 +196,7 @@ namespace CppSharp @@ -195,6 +196,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ParserTargetInfo(ParserTargetInfo.Internal* native, bool isInternalImpl = false)
@ -206,30 +208,40 @@ namespace CppSharp @@ -206,30 +208,40 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(176);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_1(__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ParserTargetInfo __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance || force)
Internal.dtor_0(__Instance);
if (__ownsNativeInstance)
{
Marshal.FreeHGlobal(__Instance);
}
}
public string ABI
{
get
{
var __ret = Internal.getABI_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}

1540
src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/AST.cs

File diff suppressed because it is too large Load Diff

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

@ -231,6 +231,7 @@ namespace CppSharp @@ -231,6 +231,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserOptions> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserOptions>();
private readonly bool __ownsNativeInstance;
@ -255,6 +256,7 @@ namespace CppSharp @@ -255,6 +256,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ParserOptions(ParserOptions.Internal* native, bool isInternalImpl = false)
@ -266,28 +268,38 @@ namespace CppSharp @@ -266,28 +268,38 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(224);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0(__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ParserOptions __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance || force)
Internal.dtor_0(__Instance);
if (__ownsNativeInstance)
{
Marshal.FreeHGlobal(__Instance);
}
}
public string getArguments(uint i)
{
var __ret = Internal.getArguments_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -306,7 +318,6 @@ namespace CppSharp @@ -306,7 +318,6 @@ namespace CppSharp
public string getIncludeDirs(uint i)
{
var __ret = Internal.getIncludeDirs_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -325,7 +336,6 @@ namespace CppSharp @@ -325,7 +336,6 @@ namespace CppSharp
public string getSystemIncludeDirs(uint i)
{
var __ret = Internal.getSystemIncludeDirs_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -344,7 +354,6 @@ namespace CppSharp @@ -344,7 +354,6 @@ namespace CppSharp
public string getDefines(uint i)
{
var __ret = Internal.getDefines_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -363,7 +372,6 @@ namespace CppSharp @@ -363,7 +372,6 @@ namespace CppSharp
public string getUndefines(uint i)
{
var __ret = Internal.getUndefines_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -382,7 +390,6 @@ namespace CppSharp @@ -382,7 +390,6 @@ namespace CppSharp
public string getLibraryDirs(uint i)
{
var __ret = Internal.getLibraryDirs_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -412,7 +419,6 @@ namespace CppSharp @@ -412,7 +419,6 @@ namespace CppSharp
get
{
var __ret = Internal.getFileName_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -474,7 +480,6 @@ namespace CppSharp @@ -474,7 +480,6 @@ namespace CppSharp
get
{
var __ret = Internal.getTargetTriple_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -490,7 +495,12 @@ namespace CppSharp @@ -490,7 +495,12 @@ namespace CppSharp
{
get
{
return (((Internal*) __Instance)->ASTContext == IntPtr.Zero) ? null : CppSharp.Parser.AST.ASTContext.__CreateInstance(((Internal*) __Instance)->ASTContext);
ASTContext __result0;
if (((Internal*) __Instance)->ASTContext == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AST.ASTContext.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->ASTContext))
__result0 = (ASTContext) CppSharp.Parser.AST.ASTContext.NativeToManagedMap[((Internal*) __Instance)->ASTContext];
else __result0 = CppSharp.Parser.AST.ASTContext.__CreateInstance(((Internal*) __Instance)->ASTContext);
return __result0;
}
set
@ -642,6 +652,7 @@ namespace CppSharp @@ -642,6 +652,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserDiagnostic> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserDiagnostic>();
private readonly bool __ownsNativeInstance;
@ -666,6 +677,7 @@ namespace CppSharp @@ -666,6 +677,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ParserDiagnostic(ParserDiagnostic.Internal* native, bool isInternalImpl = false)
@ -677,30 +689,40 @@ namespace CppSharp @@ -677,30 +689,40 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(64);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0(__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ParserDiagnostic __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance || force)
Internal.dtor_0(__Instance);
if (__ownsNativeInstance)
{
Marshal.FreeHGlobal(__Instance);
}
}
public string FileName
{
get
{
var __ret = Internal.getFileName_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -717,7 +739,6 @@ namespace CppSharp @@ -717,7 +739,6 @@ namespace CppSharp
get
{
var __ret = Internal.getMessage_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -823,6 +844,7 @@ namespace CppSharp @@ -823,6 +844,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserResult> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserResult>();
private readonly bool __ownsNativeInstance;
@ -847,6 +869,7 @@ namespace CppSharp @@ -847,6 +869,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ParserResult(ParserResult.Internal* native, bool isInternalImpl = false)
@ -858,23 +881,34 @@ namespace CppSharp @@ -858,23 +881,34 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(56);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0(__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ParserResult __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance || force)
Internal.dtor_0(__Instance);
if (__ownsNativeInstance)
{
Marshal.FreeHGlobal(__Instance);
}
}
public CppSharp.Parser.ParserDiagnostic getDiagnostics(uint i)
{
@ -920,7 +954,12 @@ namespace CppSharp @@ -920,7 +954,12 @@ namespace CppSharp
{
get
{
return (((Internal*) __Instance)->ASTContext == IntPtr.Zero) ? null : CppSharp.Parser.AST.ASTContext.__CreateInstance(((Internal*) __Instance)->ASTContext);
ASTContext __result0;
if (((Internal*) __Instance)->ASTContext == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AST.ASTContext.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->ASTContext))
__result0 = (ASTContext) CppSharp.Parser.AST.ASTContext.NativeToManagedMap[((Internal*) __Instance)->ASTContext];
else __result0 = CppSharp.Parser.AST.ASTContext.__CreateInstance(((Internal*) __Instance)->ASTContext);
return __result0;
}
set
@ -933,7 +972,12 @@ namespace CppSharp @@ -933,7 +972,12 @@ namespace CppSharp
{
get
{
return (((Internal*) __Instance)->Library == IntPtr.Zero) ? null : CppSharp.Parser.AST.NativeLibrary.__CreateInstance(((Internal*) __Instance)->Library);
NativeLibrary __result0;
if (((Internal*) __Instance)->Library == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AST.NativeLibrary.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->Library))
__result0 = (NativeLibrary) CppSharp.Parser.AST.NativeLibrary.NativeToManagedMap[((Internal*) __Instance)->Library];
else __result0 = CppSharp.Parser.AST.NativeLibrary.__CreateInstance(((Internal*) __Instance)->Library);
return __result0;
}
set
@ -970,6 +1014,7 @@ namespace CppSharp @@ -970,6 +1014,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ClangParser> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ClangParser>();
private readonly bool __ownsNativeInstance;
@ -994,6 +1039,7 @@ namespace CppSharp @@ -994,6 +1039,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ClangParser(ClangParser.Internal* native, bool isInternalImpl = false)
@ -1005,44 +1051,66 @@ namespace CppSharp @@ -1005,44 +1051,66 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(1);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (__ownsNativeInstance)
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
Marshal.FreeHGlobal(__Instance);
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ClangParser __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
}
public static CppSharp.Parser.ParserResult ParseHeader(CppSharp.Parser.ParserOptions Opts)
{
var arg0 = ReferenceEquals(Opts, null) ? global::System.IntPtr.Zero : Opts.__Instance;
var __ret = Internal.ParseHeader_0(arg0);
if (__ret == global::System.IntPtr.Zero) return null;
return (__ret == IntPtr.Zero) ? null : CppSharp.Parser.ParserResult.__CreateInstance(__ret);
ParserResult __result0;
if (__ret == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.ParserResult.NativeToManagedMap.ContainsKey(__ret))
__result0 = (ParserResult) CppSharp.Parser.ParserResult.NativeToManagedMap[__ret];
else __result0 = CppSharp.Parser.ParserResult.__CreateInstance(__ret);
return __result0;
}
public static CppSharp.Parser.ParserResult ParseLibrary(CppSharp.Parser.ParserOptions Opts)
{
var arg0 = ReferenceEquals(Opts, null) ? global::System.IntPtr.Zero : Opts.__Instance;
var __ret = Internal.ParseLibrary_0(arg0);
if (__ret == global::System.IntPtr.Zero) return null;
return (__ret == IntPtr.Zero) ? null : CppSharp.Parser.ParserResult.__CreateInstance(__ret);
ParserResult __result0;
if (__ret == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.ParserResult.NativeToManagedMap.ContainsKey(__ret))
__result0 = (ParserResult) CppSharp.Parser.ParserResult.NativeToManagedMap[__ret];
else __result0 = CppSharp.Parser.ParserResult.__CreateInstance(__ret);
return __result0;
}
public static CppSharp.Parser.ParserTargetInfo GetTargetInfo(CppSharp.Parser.ParserOptions Opts)
{
var arg0 = ReferenceEquals(Opts, null) ? global::System.IntPtr.Zero : Opts.__Instance;
var __ret = Internal.GetTargetInfo_0(arg0);
if (__ret == global::System.IntPtr.Zero) return null;
return (__ret == IntPtr.Zero) ? null : CppSharp.Parser.ParserTargetInfo.__CreateInstance(__ret);
ParserTargetInfo __result0;
if (__ret == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.ParserTargetInfo.NativeToManagedMap.ContainsKey(__ret))
__result0 = (ParserTargetInfo) CppSharp.Parser.ParserTargetInfo.NativeToManagedMap[__ret];
else __result0 = CppSharp.Parser.ParserTargetInfo.__CreateInstance(__ret);
return __result0;
}
}
}

20
src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Target.cs

@ -171,6 +171,7 @@ namespace CppSharp @@ -171,6 +171,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserTargetInfo> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserTargetInfo>();
private readonly bool __ownsNativeInstance;
@ -195,6 +196,7 @@ namespace CppSharp @@ -195,6 +196,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ParserTargetInfo(ParserTargetInfo.Internal* native, bool isInternalImpl = false)
@ -206,30 +208,40 @@ namespace CppSharp @@ -206,30 +208,40 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(176);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_1(__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ParserTargetInfo __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance || force)
Internal.dtor_0(__Instance);
if (__ownsNativeInstance)
{
Marshal.FreeHGlobal(__Instance);
}
}
public string ABI
{
get
{
var __ret = Internal.getABI_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}

1540
src/CppParser/Bindings/CSharp/x86_64-linux-gnu/AST.cs

File diff suppressed because it is too large Load Diff

130
src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppParser.cs

@ -231,6 +231,7 @@ namespace CppSharp @@ -231,6 +231,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserOptions> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserOptions>();
private readonly bool __ownsNativeInstance;
@ -255,6 +256,7 @@ namespace CppSharp @@ -255,6 +256,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ParserOptions(ParserOptions.Internal* native, bool isInternalImpl = false)
@ -266,28 +268,38 @@ namespace CppSharp @@ -266,28 +268,38 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(192);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0(__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ParserOptions __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance || force)
Internal.dtor_0(__Instance);
if (__ownsNativeInstance)
{
Marshal.FreeHGlobal(__Instance);
}
}
public string getArguments(uint i)
{
var __ret = Internal.getArguments_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -306,7 +318,6 @@ namespace CppSharp @@ -306,7 +318,6 @@ namespace CppSharp
public string getIncludeDirs(uint i)
{
var __ret = Internal.getIncludeDirs_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -325,7 +336,6 @@ namespace CppSharp @@ -325,7 +336,6 @@ namespace CppSharp
public string getSystemIncludeDirs(uint i)
{
var __ret = Internal.getSystemIncludeDirs_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -344,7 +354,6 @@ namespace CppSharp @@ -344,7 +354,6 @@ namespace CppSharp
public string getDefines(uint i)
{
var __ret = Internal.getDefines_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -363,7 +372,6 @@ namespace CppSharp @@ -363,7 +372,6 @@ namespace CppSharp
public string getUndefines(uint i)
{
var __ret = Internal.getUndefines_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -382,7 +390,6 @@ namespace CppSharp @@ -382,7 +390,6 @@ namespace CppSharp
public string getLibraryDirs(uint i)
{
var __ret = Internal.getLibraryDirs_0(__Instance, i);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -412,7 +419,6 @@ namespace CppSharp @@ -412,7 +419,6 @@ namespace CppSharp
get
{
var __ret = Internal.getFileName_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -474,7 +480,6 @@ namespace CppSharp @@ -474,7 +480,6 @@ namespace CppSharp
get
{
var __ret = Internal.getTargetTriple_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -490,7 +495,12 @@ namespace CppSharp @@ -490,7 +495,12 @@ namespace CppSharp
{
get
{
return (((Internal*) __Instance)->ASTContext == IntPtr.Zero) ? null : CppSharp.Parser.AST.ASTContext.__CreateInstance(((Internal*) __Instance)->ASTContext);
ASTContext __result0;
if (((Internal*) __Instance)->ASTContext == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AST.ASTContext.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->ASTContext))
__result0 = (ASTContext) CppSharp.Parser.AST.ASTContext.NativeToManagedMap[((Internal*) __Instance)->ASTContext];
else __result0 = CppSharp.Parser.AST.ASTContext.__CreateInstance(((Internal*) __Instance)->ASTContext);
return __result0;
}
set
@ -642,6 +652,7 @@ namespace CppSharp @@ -642,6 +652,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserDiagnostic> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserDiagnostic>();
private readonly bool __ownsNativeInstance;
@ -666,6 +677,7 @@ namespace CppSharp @@ -666,6 +677,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ParserDiagnostic(ParserDiagnostic.Internal* native, bool isInternalImpl = false)
@ -677,30 +689,40 @@ namespace CppSharp @@ -677,30 +689,40 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(32);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0(__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ParserDiagnostic __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance || force)
Internal.dtor_0(__Instance);
if (__ownsNativeInstance)
{
Marshal.FreeHGlobal(__Instance);
}
}
public string FileName
{
get
{
var __ret = Internal.getFileName_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -717,7 +739,6 @@ namespace CppSharp @@ -717,7 +739,6 @@ namespace CppSharp
get
{
var __ret = Internal.getMessage_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}
@ -823,6 +844,7 @@ namespace CppSharp @@ -823,6 +844,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserResult> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserResult>();
private readonly bool __ownsNativeInstance;
@ -847,6 +869,7 @@ namespace CppSharp @@ -847,6 +869,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ParserResult(ParserResult.Internal* native, bool isInternalImpl = false)
@ -858,23 +881,34 @@ namespace CppSharp @@ -858,23 +881,34 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(56);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0(__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ParserResult __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance || force)
Internal.dtor_0(__Instance);
if (__ownsNativeInstance)
{
Marshal.FreeHGlobal(__Instance);
}
}
public CppSharp.Parser.ParserDiagnostic getDiagnostics(uint i)
{
@ -920,7 +954,12 @@ namespace CppSharp @@ -920,7 +954,12 @@ namespace CppSharp
{
get
{
return (((Internal*) __Instance)->ASTContext == IntPtr.Zero) ? null : CppSharp.Parser.AST.ASTContext.__CreateInstance(((Internal*) __Instance)->ASTContext);
ASTContext __result0;
if (((Internal*) __Instance)->ASTContext == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AST.ASTContext.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->ASTContext))
__result0 = (ASTContext) CppSharp.Parser.AST.ASTContext.NativeToManagedMap[((Internal*) __Instance)->ASTContext];
else __result0 = CppSharp.Parser.AST.ASTContext.__CreateInstance(((Internal*) __Instance)->ASTContext);
return __result0;
}
set
@ -933,7 +972,12 @@ namespace CppSharp @@ -933,7 +972,12 @@ namespace CppSharp
{
get
{
return (((Internal*) __Instance)->Library == IntPtr.Zero) ? null : CppSharp.Parser.AST.NativeLibrary.__CreateInstance(((Internal*) __Instance)->Library);
NativeLibrary __result0;
if (((Internal*) __Instance)->Library == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AST.NativeLibrary.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->Library))
__result0 = (NativeLibrary) CppSharp.Parser.AST.NativeLibrary.NativeToManagedMap[((Internal*) __Instance)->Library];
else __result0 = CppSharp.Parser.AST.NativeLibrary.__CreateInstance(((Internal*) __Instance)->Library);
return __result0;
}
set
@ -970,6 +1014,7 @@ namespace CppSharp @@ -970,6 +1014,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ClangParser> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ClangParser>();
private readonly bool __ownsNativeInstance;
@ -994,6 +1039,7 @@ namespace CppSharp @@ -994,6 +1039,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ClangParser(ClangParser.Internal* native, bool isInternalImpl = false)
@ -1005,44 +1051,66 @@ namespace CppSharp @@ -1005,44 +1051,66 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(1);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (__ownsNativeInstance)
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
Marshal.FreeHGlobal(__Instance);
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ClangParser __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
}
public static CppSharp.Parser.ParserResult ParseHeader(CppSharp.Parser.ParserOptions Opts)
{
var arg0 = ReferenceEquals(Opts, null) ? global::System.IntPtr.Zero : Opts.__Instance;
var __ret = Internal.ParseHeader_0(arg0);
if (__ret == global::System.IntPtr.Zero) return null;
return (__ret == IntPtr.Zero) ? null : CppSharp.Parser.ParserResult.__CreateInstance(__ret);
ParserResult __result0;
if (__ret == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.ParserResult.NativeToManagedMap.ContainsKey(__ret))
__result0 = (ParserResult) CppSharp.Parser.ParserResult.NativeToManagedMap[__ret];
else __result0 = CppSharp.Parser.ParserResult.__CreateInstance(__ret);
return __result0;
}
public static CppSharp.Parser.ParserResult ParseLibrary(CppSharp.Parser.ParserOptions Opts)
{
var arg0 = ReferenceEquals(Opts, null) ? global::System.IntPtr.Zero : Opts.__Instance;
var __ret = Internal.ParseLibrary_0(arg0);
if (__ret == global::System.IntPtr.Zero) return null;
return (__ret == IntPtr.Zero) ? null : CppSharp.Parser.ParserResult.__CreateInstance(__ret);
ParserResult __result0;
if (__ret == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.ParserResult.NativeToManagedMap.ContainsKey(__ret))
__result0 = (ParserResult) CppSharp.Parser.ParserResult.NativeToManagedMap[__ret];
else __result0 = CppSharp.Parser.ParserResult.__CreateInstance(__ret);
return __result0;
}
public static CppSharp.Parser.ParserTargetInfo GetTargetInfo(CppSharp.Parser.ParserOptions Opts)
{
var arg0 = ReferenceEquals(Opts, null) ? global::System.IntPtr.Zero : Opts.__Instance;
var __ret = Internal.GetTargetInfo_0(arg0);
if (__ret == global::System.IntPtr.Zero) return null;
return (__ret == IntPtr.Zero) ? null : CppSharp.Parser.ParserTargetInfo.__CreateInstance(__ret);
ParserTargetInfo __result0;
if (__ret == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.ParserTargetInfo.NativeToManagedMap.ContainsKey(__ret))
__result0 = (ParserTargetInfo) CppSharp.Parser.ParserTargetInfo.NativeToManagedMap[__ret];
else __result0 = CppSharp.Parser.ParserTargetInfo.__CreateInstance(__ret);
return __result0;
}
}
}

20
src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Target.cs

@ -171,6 +171,7 @@ namespace CppSharp @@ -171,6 +171,7 @@ namespace CppSharp
}
public global::System.IntPtr __Instance { get; protected set; }
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserTargetInfo> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, ParserTargetInfo>();
private readonly bool __ownsNativeInstance;
@ -195,6 +196,7 @@ namespace CppSharp @@ -195,6 +196,7 @@ namespace CppSharp
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected ParserTargetInfo(ParserTargetInfo.Internal* native, bool isInternalImpl = false)
@ -206,30 +208,40 @@ namespace CppSharp @@ -206,30 +208,40 @@ namespace CppSharp
{
__Instance = Marshal.AllocHGlobal(160);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_2(__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
DestroyNativeInstance(false);
}
public virtual void DestroyNativeInstance()
{
DestroyNativeInstance(true);
}
private void DestroyNativeInstance(bool force)
{
CppSharp.Parser.ParserTargetInfo __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance || force)
Internal.dtor_0(__Instance);
if (__ownsNativeInstance)
{
Marshal.FreeHGlobal(__Instance);
}
}
public string ABI
{
get
{
var __ret = Internal.getABI_0(__Instance);
if (__ret == global::System.IntPtr.Zero) return null;
return Marshal.PtrToStringAnsi(__ret);
}

7
src/CppParser/Parser.cpp

@ -2565,7 +2565,12 @@ AST::Expression* Parser::WalkExpression(clang::Expr* Expr) @@ -2565,7 +2565,12 @@ AST::Expression* Parser::WalkExpression(clang::Expr* Expr)
switch (Expr->getStmtClass())
{
case Stmt::BinaryOperatorClass:
return new AST::Expression(GetStringFromStatement(Expr), StatementClass::BinaryOperator);
{
auto BinaryOperator = cast<clang::BinaryOperator>(Expr);
return new AST::BinaryOperator(GetStringFromStatement(Expr),
WalkExpression(BinaryOperator->getLHS()), WalkExpression(BinaryOperator->getRHS()),
BinaryOperator->getOpcodeStr().str());
}
case Stmt::DeclRefExprClass:
return new AST::Expression(GetStringFromStatement(Expr), StatementClass::DeclRefExprClass,
WalkDeclaration(cast<DeclRefExpr>(Expr)->getDecl()));

17
src/Generator/Passes/HandleDefaultParamValuesPass.cs

@ -54,6 +54,9 @@ namespace CppSharp.Passes @@ -54,6 +54,9 @@ namespace CppSharp.Passes
if (defaultConstruct == true)
continue;
if (CheckForBinaryOperator(parameter.DefaultArgument, desugared))
continue;
if (CheckForEnumValue(parameter.DefaultArgument, desugared))
continue;
@ -176,6 +179,18 @@ namespace CppSharp.Passes @@ -176,6 +179,18 @@ namespace CppSharp.Passes
return decl.IsValueType ? true : (bool?) null;
}
private bool CheckForBinaryOperator(Expression arg, Type desugared)
{
if (arg.Class != StatementClass.BinaryOperator) return false;
var binaryOperator = (BinaryOperator) arg;
CheckForEnumValue(binaryOperator.LHS, desugared);
CheckForEnumValue(binaryOperator.RHS, desugared);
arg.String = string.Format("{0} {1} {2}", binaryOperator.LHS.String,
binaryOperator.OpcodeStr, binaryOperator.RHS.String);
return true;
}
private bool CheckForEnumValue(Expression arg, Type desugared)
{
var enumItem = arg.Declaration as Enumeration.Item;
@ -188,7 +203,7 @@ namespace CppSharp.Passes @@ -188,7 +203,7 @@ namespace CppSharp.Passes
}
var call = arg.Declaration as Function;
if ((call != null || arg.Class == StatementClass.BinaryOperator) && arg.String != "0")
if (call != null && arg.String != "0")
{
string @params = regexFunctionParams.Match(arg.String).Groups[1].Value;
TranslateEnumExpression(arg, desugared, @params);

4
tests/CSharpTemp/CSharpTemp.cpp

@ -374,6 +374,10 @@ void MethodsWithDefaultValues::defaultDoubleWithoutF(double d1, double d2) @@ -374,6 +374,10 @@ void MethodsWithDefaultValues::defaultDoubleWithoutF(double d1, double d2)
{
}
void MethodsWithDefaultValues::defaultIntExpressionWithEnum(int i)
{
}
int MethodsWithDefaultValues::getA()
{
return m_foo.A;

1
tests/CSharpTemp/CSharpTemp.h

@ -286,6 +286,7 @@ public: @@ -286,6 +286,7 @@ public:
void rotate4x4Matrix(float angle, float x, float y, float z = 0.0f);
void defaultPointerToValueType(QGenericArgument* pointer = 0);
void defaultDoubleWithoutF(double d1 = 1.0, double d2 = 1.);
void defaultIntExpressionWithEnum(int i = Qt::GlobalColor::black + 1);
int getA();
private:
Foo m_foo;

Loading…
Cancel
Save