Skip to content

Mark some properties as not browsable in the debugger #233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs
Original file line number Diff line number Diff line change
@@ -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;

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

public static LLVMTypeRef X86AMX => 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;
Expand All @@ -64,10 +66,12 @@ public unsafe partial struct LLVMTypeRef(IntPtr handle) : IEquatable<LLVMTypeRef

public readonly uint PointerAddressSpace => (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;
Expand All @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions sources/LLVMSharp.Interop/Extensions/LLVMValueRef.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down