Skip to content
Merged
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
9 changes: 5 additions & 4 deletions sources/LLVMSharp.Interop/Extensions/LLVMValueRef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ public readonly LLVMLinkage Linkage
}
}

public readonly uint MDNodeOperandsCount => (Kind == LLVMValueKind.LLVMMetadataAsValueValueKind) ? LLVM.GetMDNodeNumOperands(this) : default;
public readonly uint MDNodeOperandsCount => (IsAMDNode == null) ? LLVM.GetMDNodeNumOperands(this) : default;

public readonly string Name
{
Expand Down Expand Up @@ -895,19 +895,20 @@ public readonly void GetBasicBlocks(Span<LLVMBasicBlockRef> destination)

public readonly LLVMValueRef[] GetMDNodeOperands()
{
if (Kind != LLVMValueKind.LLVMMetadataAsValueValueKind)
uint count = MDNodeOperandsCount;
if (count == 0)
{
return [];
}

var destination = new LLVMValueRef[MDNodeOperandsCount];
var destination = new LLVMValueRef[count];
GetMDNodeOperands(destination);
return destination;
}

public readonly void GetMDNodeOperands(Span<LLVMValueRef> destination)
{
if (Kind != LLVMValueKind.LLVMMetadataAsValueValueKind)
if (IsAMDNode == null)
{
return;
}
Expand Down
Loading