From f2f48dc1a348c16e624b1b736e3688fa2b426d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Matos?= Date: Mon, 12 Feb 2024 14:49:57 +0000 Subject: [PATCH 1/2] Update LLVM.md Fix documentation. --- docs/LLVM.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/LLVM.md b/docs/LLVM.md index 4a3d625afe..bbeaec6c67 100644 --- a/docs/LLVM.md +++ b/docs/LLVM.md @@ -54,9 +54,7 @@ Make sure to use the revisions specified below, or you will most likely get comp Required LLVM/Clang commits: -[LLVM: see /build/llvm/LLVM-commit.](https://github.com/mono/CppSharp/tree/master/build/LLVM-commit) - -[Clang: see /build/Clang-commit.](https://github.com/mono/CppSharp/tree/master/build/Clang-commit) +[LLVM: see /build/llvm/LLVM-commit.](https://github.com/mono/CppSharp/tree/master/build/llvm/LLVM-commit) To change to the revisions specified above you can run the following commands: From 4c1d5443e9f26e879a53dd3d78894432aa25b0bb Mon Sep 17 00:00:00 2001 From: Lewis Jordan Date: Fri, 16 Feb 2024 15:00:25 +0000 Subject: [PATCH 2/2] Fixed issue with ref returns (cherry picked from commit cbd37c99e3780de751c0e3780a30dfb0f4ab17cf) --- src/Generator/Generators/CSharp/CSharpSources.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index eb52336d07..a5cf6d70d0 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -414,7 +414,16 @@ public override bool VisitClassDecl(Class @class) if (@class.IsValueType) { WriteLine($"private {@class.Name}.{Helpers.InternalStruct} {Helpers.InstanceField};"); - WriteLine($"internal ref {@class.Name}.{Helpers.InternalStruct} {Helpers.InstanceIdentifier} => ref {Helpers.InstanceField};"); + WriteLine($"internal ref {@class.Name}.{Helpers.InternalStruct} {Helpers.InstanceIdentifier}"); + WriteOpenBraceAndIndent(); + WriteLine("get"); + WriteOpenBraceAndIndent(); + WriteLine($"fixed ({@class.Name}.{Helpers.InternalStruct}* ptr = &__instance)"); + WriteOpenBraceAndIndent(); + WriteLine("return ref *ptr;"); + UnindentAndWriteCloseBrace(); + UnindentAndWriteCloseBrace(); + UnindentAndWriteCloseBrace(); } else {