From 9b87460a2deb83d6f57104cb45ea9514b001ef53 Mon Sep 17 00:00:00 2001 From: ds5678 <49847914+ds5678@users.noreply.github.com> Date: Wed, 11 Jun 2025 16:15:41 -0700 Subject: [PATCH 1/2] Mark two properties as not browsable in the debugger --- sources/LLVMSharp.Interop/Extensions/LLVMValueRef.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/LLVMSharp.Interop/Extensions/LLVMValueRef.cs b/sources/LLVMSharp.Interop/Extensions/LLVMValueRef.cs index 41edce3..365d578 100644 --- a/sources/LLVMSharp.Interop/Extensions/LLVMValueRef.cs +++ b/sources/LLVMSharp.Interop/Extensions/LLVMValueRef.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. using System; +using System.Diagnostics; using static LLVMSharp.Interop.LLVMTailCallKind; namespace LLVMSharp.Interop; @@ -167,6 +168,7 @@ public readonly uint InstructionCallConv } } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] // Justification: causes native allocation public readonly LLVMValueRef InstructionClone => (Handle != IntPtr.Zero) ? LLVM.InstructionClone(this) : default; public readonly LLVMOpcode InstructionOpcode => (Handle != IntPtr.Zero) ? LLVM.GetInstructionOpcode(this) : default; @@ -548,6 +550,7 @@ public readonly string Section } } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] // Justification: can throw public readonly uint SuccessorsCount => (IsAInstruction != null) ? LLVM.GetNumSuccessors(this) : default; public readonly LLVMBasicBlockRef SwitchDefaultDest => (IsASwitchInst != null) ? LLVM.GetSwitchDefaultDest(this) : default; From 6591df26d6bc03a82dbaf0bdfe9a1a3a12c7ec6c Mon Sep 17 00:00:00 2001 From: ds5678 <49847914+ds5678@users.noreply.github.com> Date: Thu, 12 Jun 2025 14:16:06 -0700 Subject: [PATCH 2/2] Add attributes to some properties in LLVMTypeRef --- sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs b/sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs index 54b41a4..4b4f40a 100644 --- a/sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs +++ b/sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. using System; +using System.Diagnostics; namespace LLVMSharp.Interop; @@ -38,6 +39,7 @@ public unsafe partial struct LLVMTypeRef(IntPtr handle) : IEquatable LLVM.X86AMXType(); + [DebuggerBrowsable(DebuggerBrowsableState.Never)] // Justification: causes native allocation public readonly LLVMValueRef AlignOf => (Handle != IntPtr.Zero) ? LLVM.AlignOf(this) : default; public readonly uint ArrayLength => (Kind == LLVMTypeKind.LLVMArrayTypeKind) ? LLVM.GetArrayLength(this) : default; @@ -64,10 +66,12 @@ public unsafe partial struct LLVMTypeRef(IntPtr handle) : IEquatable (Kind == LLVMTypeKind.LLVMPointerTypeKind) ? LLVM.GetPointerAddressSpace(this) : default; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] // Justification: causes native allocation public readonly LLVMValueRef Poison => (Handle != IntPtr.Zero) ? LLVM.GetPoison(this) : default; public readonly LLVMTypeRef ReturnType => (Kind == LLVMTypeKind.LLVMFunctionTypeKind) ? LLVM.GetReturnType(this) : default; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] // Justification: causes native allocation public readonly LLVMValueRef SizeOf => (Handle != IntPtr.Zero) ? LLVM.SizeOf(this) : default; public readonly uint StructElementTypesCount => (Kind == LLVMTypeKind.LLVMStructTypeKind) ? LLVM.CountStructElementTypes(this) : default; @@ -94,6 +98,7 @@ public readonly string StructName public readonly uint SubtypesCount => (Handle != IntPtr.Zero) ? LLVM.GetNumContainedTypes(this) : default; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] // Justification: causes native allocation public readonly LLVMValueRef Undef => (Handle != IntPtr.Zero) ? LLVM.GetUndef(this) : default; public readonly uint VectorSize => (Kind == LLVMTypeKind.LLVMVectorTypeKind) ? LLVM.GetVectorSize(this) : default;