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

Updating the libLLVM and LLVMSharp version to v9.0.0 #121

Merged
merged 8 commits into from
Nov 25, 2019
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<Company>Microsoft</Company>
<PackageOutputPath>$(BaseArtifactsPath)pkg/$(Configuration)/</PackageOutputPath>
<Product>LLVMSharp</Product>
<VersionPrefix>8.0.0</VersionPrefix>
<VersionPrefix>9.0.0</VersionPrefix>
<VersionSuffix>beta</VersionSuffix>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<!-- Package versions for package references across all projects -->
<ItemGroup>
<PackageReference Update="libLLVM" Version="8.0.0" />
<PackageReference Update="libLLVM" Version="9.0.0" />
<PackageReference Update="Microsoft.Bcl.HashCode" Version="1.0.0" />
<PackageReference Update="Microsoft.Net.Compilers.Toolset" Version="3.3.1" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.4.0" />
Expand Down
14 changes: 7 additions & 7 deletions sources/LLVMSharp/Interop.Extensions/LLVMAttributeRef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

using System;

namespace LLVMSharp
namespace LLVMSharp.Interop
{
public unsafe partial struct LLVMAttributeRef : IEquatable<LLVMAttributeRef>
{
public LLVMAttributeRef(IntPtr pointer)
public LLVMAttributeRef(IntPtr handle)
{
Pointer = pointer;
Handle = handle;
}

public IntPtr Pointer;
public IntPtr Handle;

public static implicit operator LLVMAttributeRef(LLVMOpaqueAttributeRef* value)
{
Expand All @@ -20,7 +20,7 @@ public static implicit operator LLVMAttributeRef(LLVMOpaqueAttributeRef* value)

public static implicit operator LLVMOpaqueAttributeRef*(LLVMAttributeRef value)
{
return (LLVMOpaqueAttributeRef*)value.Pointer;
return (LLVMOpaqueAttributeRef*)value.Handle;
}

public static bool operator ==(LLVMAttributeRef left, LLVMAttributeRef right) => left.Equals(right);
Expand All @@ -29,8 +29,8 @@ public static implicit operator LLVMAttributeRef(LLVMOpaqueAttributeRef* value)

public override bool Equals(object obj) => obj is LLVMAttributeRef other && Equals(other);

public bool Equals(LLVMAttributeRef other) => Pointer == other.Pointer;
public bool Equals(LLVMAttributeRef other) => Handle == other.Handle;

public override int GetHashCode() => Pointer.GetHashCode();
public override int GetHashCode() => Handle.GetHashCode();
}
}
38 changes: 18 additions & 20 deletions sources/LLVMSharp/Interop.Extensions/LLVMBasicBlockRef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

using System;

namespace LLVMSharp
namespace LLVMSharp.Interop
{
public unsafe partial struct LLVMBasicBlockRef : IEquatable<LLVMBasicBlockRef>
{
public LLVMBasicBlockRef(IntPtr pointer)
public LLVMBasicBlockRef(IntPtr handle)
{
Pointer = pointer;
Handle = handle;
}

public IntPtr Pointer;
public IntPtr Handle;

public static explicit operator LLVMBasicBlockRef(LLVMOpaqueValue* value)
{
Expand All @@ -25,27 +25,27 @@ public static implicit operator LLVMBasicBlockRef(LLVMOpaqueBasicBlock* value)

public static implicit operator LLVMOpaqueBasicBlock*(LLVMBasicBlockRef value)
{
return (LLVMOpaqueBasicBlock*)value.Pointer;
return (LLVMOpaqueBasicBlock*)value.Handle;
}

public static implicit operator LLVMOpaqueValue*(LLVMBasicBlockRef value)
{
return (LLVMOpaqueValue*)value.Pointer;
return (LLVMOpaqueValue*)value.Handle;
}

public LLVMValueRef FirstInstruction => (Pointer != IntPtr.Zero) ? LLVM.GetFirstInstruction(this) : default;
public LLVMValueRef FirstInstruction => (Handle != IntPtr.Zero) ? LLVM.GetFirstInstruction(this) : default;

public LLVMValueRef LastInstruction => (Pointer != IntPtr.Zero) ? LLVM.GetLastInstruction(this) : default;
public LLVMValueRef LastInstruction => (Handle != IntPtr.Zero) ? LLVM.GetLastInstruction(this) : default;

public LLVMBasicBlockRef Next => (Pointer != IntPtr.Zero) ? LLVM.GetNextBasicBlock(this) : default;
public LLVMBasicBlockRef Next => (Handle != IntPtr.Zero) ? LLVM.GetNextBasicBlock(this) : default;

public LLVMValueRef Parent => (Pointer != IntPtr.Zero) ? LLVM.GetBasicBlockParent(this) : default;
public LLVMValueRef Parent => (Handle != IntPtr.Zero) ? LLVM.GetBasicBlockParent(this) : default;

public LLVMBasicBlockRef Previous => (Pointer != IntPtr.Zero) ? LLVM.GetPreviousBasicBlock(this) : default;
public LLVMBasicBlockRef Previous => (Handle != IntPtr.Zero) ? LLVM.GetPreviousBasicBlock(this) : default;

public LLVMValueRef Terminator => (Pointer != IntPtr.Zero) ? LLVM.GetBasicBlockTerminator(this) : default;
public LLVMValueRef Terminator => (Handle != IntPtr.Zero) ? LLVM.GetBasicBlockTerminator(this) : default;

public static bool operator ==(LLVMBasicBlockRef left, LLVMBasicBlockRef right) => left.Pointer == right.Pointer;
public static bool operator ==(LLVMBasicBlockRef left, LLVMBasicBlockRef right) => left.Handle == right.Handle;

public static bool operator !=(LLVMBasicBlockRef left, LLVMBasicBlockRef right) => !(left == right);

Expand All @@ -57,16 +57,14 @@ public static implicit operator LLVMBasicBlockRef(LLVMOpaqueBasicBlock* value)

public override bool Equals(object obj) => obj is LLVMBasicBlockRef other && Equals(other);

public bool Equals(LLVMBasicBlockRef other) => Pointer == other.Pointer;
public bool Equals(LLVMBasicBlockRef other) => Handle == other.Handle;

public override int GetHashCode() => Pointer.GetHashCode();
public override int GetHashCode() => Handle.GetHashCode();

public LLVMBasicBlockRef InsertBasicBlock(string Name)
{
using (var marshaledName = new MarshaledString(Name))
{
return LLVM.InsertBasicBlock(this, marshaledName);
}
using var marshaledName = new MarshaledString(Name);
return LLVM.InsertBasicBlock(this, marshaledName);
}

public void MoveAfter(LLVMBasicBlockRef MovePos) => LLVM.MoveBasicBlockAfter(this, MovePos);
Expand All @@ -90,6 +88,6 @@ public string PrintToString()

public void RemoveFromParent() => LLVM.RemoveBasicBlockFromParent(this);

public override string ToString() => (Pointer != IntPtr.Zero) ? PrintToString() : string.Empty;
public override string ToString() => (Handle != IntPtr.Zero) ? PrintToString() : string.Empty;
}
}
26 changes: 26 additions & 0 deletions sources/LLVMSharp/Interop.Extensions/LLVMBinaryRef.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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 System;

namespace LLVMSharp.Interop
{
public unsafe partial struct LLVMBinaryRef
{
public LLVMBinaryRef(IntPtr handle)
{
Handle = handle;
}

public IntPtr Handle;

public static implicit operator LLVMBinaryRef(LLVMOpaqueBinary* Comdat)
{
return new LLVMBinaryRef((IntPtr)Comdat);
}

public static implicit operator LLVMOpaqueBinary*(LLVMBinaryRef Comdat)
{
return (LLVMOpaqueBinary*)Comdat.Handle;
}
}
}
Loading