Skip to content
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

Ensure that LLVMTypeRef passes parameters down properly #135

Merged
merged 1 commit into from
Apr 17, 2020
Merged
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
19 changes: 19 additions & 0 deletions Tests/LLVMSharp.UnitTests/Functions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information.

using LLVMSharp.Interop;
using NUnit.Framework;

namespace LLVMSharp.UnitTests
{
public class Functions
{
[Test]
public void ParamTypesRoundtrip()
{
var returnType = LLVMTypeRef.Int8;
var parameterTypes = new[] { LLVMTypeRef.Double };
var functionType = LLVMTypeRef.CreateFunction(returnType, parameterTypes);
Assert.AreEqual(parameterTypes, functionType.ParamTypes);
}
}
}
6 changes: 3 additions & 3 deletions sources/LLVMSharp/Interop.Extensions/LLVMTypeRef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public LLVMTypeRef[] ParamTypes

fixed (LLVMTypeRef* pDest = Dest)
{
LLVM.GetParamTypes(this, (LLVMOpaqueType**)&pDest);
LLVM.GetParamTypes(this, (LLVMOpaqueType**)pDest);
}

return Dest;
Expand Down Expand Up @@ -112,7 +112,7 @@ public LLVMTypeRef[] StructElementTypes

fixed (LLVMTypeRef* pDest = Dest)
{
LLVM.GetStructElementTypes(this, (LLVMOpaqueType**)&pDest);
LLVM.GetStructElementTypes(this, (LLVMOpaqueType**)pDest);
}

return Dest;
Expand Down Expand Up @@ -155,7 +155,7 @@ public LLVMTypeRef[] Subtypes

fixed (LLVMTypeRef* pArr = Arr)
{
LLVM.GetSubtypes(this, (LLVMOpaqueType**)&pArr);
LLVM.GetSubtypes(this, (LLVMOpaqueType**)pArr);
}

return Arr;
Expand Down