Trung Nguyen
199a73bc6e
CSharpSources: Dereference pointer variables
...
Dereference pointers when generating getters for pointer variables.
Otherwise, the managed instance would point to the pointer itself
rather than the object at the native instance's address.
3 years ago
Trung Nguyen
add3aba684
CSharp: More default parameter fixes ( #1747 )
...
- Expression generation for `ConstructorReference` now also recursively
calls `VisitExpression` for the argument if only one argument is
detected. This allows correct overload generation for functions taking
a variable as the default parameter value.
- Default parameters of pointer-to-enumeration types are now correctly
generated similar to primitive types.
3 years ago
Trung Nguyen
1ce9cb7e7f
CSharpExpressionPrinter: Recurse into operands ( #1745 )
...
* CSharpExpressionPrinter: Recurse into operands
Recursively call `VisitExpression` on the LHS and RHS of a binary
operator expression. This fixes the generation for complex default
parameters involving things other than two enumeration members.
* CSharpSources: Use `const` when possible
Generate `const` instead of `static` members when possible.
This allows generated members to be used when compile-time constants are
required, such as default parameters.
3 years ago
Trung Nguyen
169f8686a9
CSharpExpressionPrinter: Wrap expression in parenthesis ( #1741 )
...
Wrap default parameter expressions in parentheses to ensure whole expressions are casted instead of only the first operand.
3 years ago
João Matos
4417dd987a
Code cleanups and improvements ( #1713 )
...
* Code cleanups.
* Run GetterSetterToPropertyPass for more generators.
* Fixed compile warning when compiling parser bindings.
* Cleanup driver code.
* Remove dead 32-bit code.
* Reduce verbosity when Options.Quiet is set.
* Remove test compile-time warnings.
* Move .NET tests to tests/dotnet.
* Remove unused AST viewer code and premake-qt submodule.
* Move tests2/ contents to tests/.
4 years ago
josetr
567a0df8c7
Fix FunctionToInstanceMethod
4 years ago
josetr
fd058db061
Rename tests
4 years ago
josetr
e160b3a296
Add generate function template specializations whitelist
4 years ago
Fabio Anderegg
a642691348
Call destructor on copied arguments when calling C# method from C++ (MS ABIs only) ( #1685 )
...
* on MS abi call destructor on copy-by-value arguments after call to c# function
* add tests for destructor call on call by value from c++ to c#
* copy-by-value destructor call using Dispose() instead of Internal.dtor to handle destructors in base class
4 years ago
josetr
060afd53fc
Add partial `ref` param support
4 years ago
josetr
17f69fdf64
Add test for function templates
4 years ago
josetr
0d92eaef16
Use TemplatedDecl.Parameters cuz Class.TemplateParameters may not be available at this point
4 years ago
josetr
06d311dc89
Fix anonymous unions inside template classes
4 years ago
josetr
37bd7e0155
Add `GenerateNativeToManaged` per-class option
4 years ago
josetr
3414294ab8
Fix FunctionToStaticMethod bug
4 years ago
josetr
eb5031bf4c
Format files
5 years ago
Joe Hull
1edd5ee5ee
Avoid ArgumentOutOfRangeException in ExpressionHelper.CheckForString ( #1649 )
5 years ago
Joe Hull
81351632d5
Use WeakReference<T> in NativeToManagedMap to allow finalizers to run. ( #1648 )
5 years ago
Dimitar Dobrev
1acb23813d
Generate valid C# for independent specialisations with nested fields
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
f1915b3066
Generate valid C# for templates with external specializations only
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
9b90f1c77b
Generate valid C# for nested in external specializations
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
c84a6c606e
Generate valid C# for independent external specializations
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
3b0eb1800c
Generate valid C# for nested external specializations
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
aab63d0aa3
Generate valid C# for unresolvable base templates
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
69e766be5d
Generate valid C# for classes with dependent fields nested in templates with independent fields
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
a69f6d1d6d
Generate valid C++ for specialisations with void
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
5552f2b484
Generate valid C# for pure functions returning or taking dependent pointers
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Ahmed Elsayed
caaf89d34a
Fix a crash when processing templates with variable arguments ( #1641 )
5 years ago
Dimitar Dobrev
0d84877068
Simplify code by not specially handling void**
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
634c231853
Generate valid C# for unions in templates with non-type args
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
540c16576f
Fix a test for the new msvc in vs 2022
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
0b8f252d1b
Generate valid C# for fields with types system template specializations
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
ad6557792f
Simplify handling of initialisation of variables
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
132ed7e25b
Generate valid C# for variables which use float
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
ac5001ddca
Generate valid C# for variables with > 1 arg
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
9a17dbee1b
Generate valid C++ for variadic functions
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
5e328da9e7
Fix C# layouts for classes with nameless unions
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
5a21a7facd
Generate valid C# for copy ctors with extra args
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
50cba5552c
Generate valid C# for destructors of templates with dependent fields
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
a2aeaed92a
Rename templates only used through aliases
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
09190268bc
Generate valid C# for internal fields of type external specialization
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
c8c415b977
Generate valid C# for static object-typed fields
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
12f456e4c4
Trim specializations only used in ignored types
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
2da9e49fe8
Instantiate specialized classes nested in templates
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
eca0db1765
Generate valid C++ for protected inline functions
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
4397cae7b2
Generate valid C++ for parameters by value
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
722a1d735d
Generate valid C++ for conversion operators in name-spaced classes
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
3aab30f572
Add built-in compilation of extra symbols
...
Fixes https://github.com/mono/CppSharp/issues/1456 and https://github.com/mono/CppSharp/issues/1253 .
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
1e60113327
Fix naming for function pointers with strings
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago
Dimitar Dobrev
0e963aa03f
Generate valid C# for default args: typedefed refs to enums assigned empty ctors
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
5 years ago