Skip to content

Commit faedb6d

Browse files
Merge pull request #233 from ds5678/debugger-browsable-never
Mark some properties as not browsable in the debugger
2 parents 2733902 + d85a391 commit faedb6d

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

sources/LLVMSharp.Interop/Extensions/LLVMModuleRef.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
using System;
44
using System.Collections.Generic;
5+
using System.Diagnostics;
56
using System.Runtime.InteropServices;
67

78
namespace LLVMSharp.Interop;
89

10+
[DebuggerDisplay(nameof(LLVMModuleRef))] // ToString() will provide the actual content, which might be huge.
911
public unsafe partial struct LLVMModuleRef(IntPtr handle) : IDisposable, IEquatable<LLVMModuleRef>
1012
{
1113
public IntPtr Handle = handle;

sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// 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.
22

33
using System;
4+
using System.Diagnostics;
45

56
namespace LLVMSharp.Interop;
67

@@ -38,6 +39,7 @@ public unsafe partial struct LLVMTypeRef(IntPtr handle) : IEquatable<LLVMTypeRef
3839

3940
public static LLVMTypeRef X86AMX => LLVM.X86AMXType();
4041

42+
[DebuggerBrowsable(DebuggerBrowsableState.Never)] // Justification: causes native allocation
4143
public readonly LLVMValueRef AlignOf => (Handle != IntPtr.Zero) ? LLVM.AlignOf(this) : default;
4244

4345
public readonly uint ArrayLength => (Kind == LLVMTypeKind.LLVMArrayTypeKind) ? LLVM.GetArrayLength(this) : default;
@@ -64,10 +66,12 @@ public unsafe partial struct LLVMTypeRef(IntPtr handle) : IEquatable<LLVMTypeRef
6466

6567
public readonly uint PointerAddressSpace => (Kind == LLVMTypeKind.LLVMPointerTypeKind) ? LLVM.GetPointerAddressSpace(this) : default;
6668

69+
[DebuggerBrowsable(DebuggerBrowsableState.Never)] // Justification: causes native allocation
6770
public readonly LLVMValueRef Poison => (Handle != IntPtr.Zero) ? LLVM.GetPoison(this) : default;
6871

6972
public readonly LLVMTypeRef ReturnType => (Kind == LLVMTypeKind.LLVMFunctionTypeKind) ? LLVM.GetReturnType(this) : default;
7073

74+
[DebuggerBrowsable(DebuggerBrowsableState.Never)] // Justification: causes native allocation
7175
public readonly LLVMValueRef SizeOf => (Handle != IntPtr.Zero) ? LLVM.SizeOf(this) : default;
7276

7377
public readonly uint StructElementTypesCount => (Kind == LLVMTypeKind.LLVMStructTypeKind) ? LLVM.CountStructElementTypes(this) : default;
@@ -94,6 +98,7 @@ public readonly string StructName
9498

9599
public readonly uint SubtypesCount => (Handle != IntPtr.Zero) ? LLVM.GetNumContainedTypes(this) : default;
96100

101+
[DebuggerBrowsable(DebuggerBrowsableState.Never)] // Justification: causes native allocation
97102
public readonly LLVMValueRef Undef => (Handle != IntPtr.Zero) ? LLVM.GetUndef(this) : default;
98103

99104
public readonly uint VectorSize => (Kind == LLVMTypeKind.LLVMVectorTypeKind) ? LLVM.GetVectorSize(this) : default;

sources/LLVMSharp.Interop/Extensions/LLVMValueRef.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
using System;
44
using System.Collections.Generic;
5+
using System.Diagnostics;
56
using System.Linq;
67
using static LLVMSharp.Interop.LLVMTailCallKind;
78

@@ -173,6 +174,7 @@ public readonly uint InstructionCallConv
173174
}
174175
}
175176

177+
[DebuggerBrowsable(DebuggerBrowsableState.Never)] // Justification: causes native allocation
176178
public readonly LLVMValueRef InstructionClone => (Handle != IntPtr.Zero) ? LLVM.InstructionClone(this) : default;
177179

178180
public readonly LLVMOpcode InstructionOpcode => (Handle != IntPtr.Zero) ? LLVM.GetInstructionOpcode(this) : default;
@@ -564,6 +566,7 @@ public readonly string Section
564566
}
565567
}
566568

569+
[DebuggerBrowsable(DebuggerBrowsableState.Never)] // Justification: can throw
567570
public readonly LLVMMetadataRef Subprogram => (IsAFunction != null) ? LLVM.GetSubprogram(this) : default;
568571

569572
public readonly uint SuccessorsCount => (IsAInstruction != null) ? LLVM.GetNumSuccessors(this) : default;

0 commit comments

Comments
 (0)