* TypeMap: prepare refactoring into a modular design
* TypeMap: refactor C++ backend into common methods
* TypeMap: refactor CLI backend into common methods
* CLI.Gen.cs: fix omitted typemap from previous commit
* Common.Gen.cs: fixed silly modification while testing
* GeneratorKind: add FindGeneratorKindByID method
* TypeMapDatabase: heavy refactor: group typemaps by GeneratorKind
* TypeMap: refactor CSharp backend into common methods + migration
* TypeMap: cleanup patches from previous commits
* TypeMapDatabase: fix passing GeneratorKind to FindTypeMap calls
* Stdlib.CSharp.cs: move std::map typemap from Stdlib.CLI.cs
* TypeMapDatabase: improve parameter name
* Major refactoring: refactor GeneratorKind enum into a class
* Minor fix: add readonly
* Add Type property for GenerationKind + cleanup
* GeneratorKind: add Name property + refactor hardcoded names
* GeneratorKind: add CLIOptions property + refactor hardcoded options
* CppSharp.CLI: minor fix: use generator.ToLower()
* GeneratorKind: fix warning
- Operators in generic classes do not attempt to generate as extension methods anymore
- Empty `...Extensions` classes are no longer generated
- `string` as a template argument is correctly cast
- `MarshalCharAsManagedChar` option also generates correct casts
- Suppress warning regarding returning struct field by ref
- Eliminate some tabs that snuck into the test C++ header
* support clang 15.0.7
* Fix Premake archive logic to work with official releases.
* Try and upgrade CI to latest OS versions.
* Try and fix LLD link call in parser.
* CI fixes.
* Enable VS 2019 and VS 2022 for LLVM windows workflow.
* Update to a more recent LLVM revision.
* More build fixes.
* Use the system linker for linking symbols libraries outside Windows.
Builtin lld is giving some weird linking errors when linking with the
new LLVM version. We probably need to set some custom options. Using the
system linker should be a better idea anyway, more robust and future
proof.
---------
Co-authored-by: you74674 <you74674@gmail.com>
* Fix missing Attribute dtor in GCC 11.
Parser bindings are expecting this, yet this was optimized out under GCC
11.
* Improve error handling for failed library parsing.
* Make the converted declaration cache more robust.
We were getting a failure due to duplicated original pointers. Make it
take the declaration kind into account as a key to the cache.
* Change ConsoleDriver.Run to return a failure bool.
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.
* Generator: Customization for const char[]
Allow the user to choose whether `const char[]` should be marshalled as
`string` or a normal `char` array in C#.
A new option `MarshalConstCharArrayAsString` is added, and is `true`
by default.
This helps in situations where the original C++ API distinguishes
between C-strings and char arrays using the two different notations.
* CSharpMarshal: Fix unknown length array marshal
For unknown length arrays, also run a conversion loop if the primitive
type encountered needs conversion (e.g. `char` to `sbyte`).
* CSharpTypePrinter: Fix for boolean arrays
- 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.
* 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.