Skip to content

Add Equatable instances for all IRTypes #169

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

Merged
merged 1 commit into from
Dec 21, 2018
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
6 changes: 6 additions & 0 deletions Sources/LLVM/ArrayType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,9 @@ public struct ArrayType: IRType {
return LLVMArrayType(elementType.asLLVM(), UInt32(count))
}
}

extension ArrayType: Equatable {
public static func == (lhs: ArrayType, rhs: ArrayType) -> Bool {
return lhs.asLLVM() == rhs.asLLVM()
}
}
6 changes: 6 additions & 0 deletions Sources/LLVM/FloatType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,9 @@ public struct FloatType: IRType {
}
}
}

extension FloatType: Equatable {
public static func == (lhs: FloatType, rhs: FloatType) -> Bool {
return lhs.asLLVM() == rhs.asLLVM()
}
}
6 changes: 6 additions & 0 deletions Sources/LLVM/FunctionType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,9 @@ public struct FunctionType: IRType {
}
}
}

extension FunctionType: Equatable {
public static func == (lhs: FunctionType, rhs: FunctionType) -> Bool {
return lhs.asLLVM() == rhs.asLLVM()
}
}
6 changes: 6 additions & 0 deletions Sources/LLVM/IntType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,9 @@ public struct IntType: IRType {
return LLVMIntTypeInContext(context.llvm, UInt32(width))
}
}

extension IntType: Equatable {
public static func == (lhs: IntType, rhs: IntType) -> Bool {
return lhs.asLLVM() == rhs.asLLVM()
}
}
6 changes: 6 additions & 0 deletions Sources/LLVM/LabelType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ public struct LabelType: IRType {
return LLVMLabelTypeInContext(context.llvm)
}
}

extension LabelType: Equatable {
public static func == (lhs: LabelType, rhs: LabelType) -> Bool {
return lhs.asLLVM() == rhs.asLLVM()
}
}
6 changes: 6 additions & 0 deletions Sources/LLVM/MetadataType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ public struct MetadataType: IRType {
return LLVMMetadataTypeInContext(context.llvm)
}
}

extension MetadataType: Equatable {
public static func == (lhs: MetadataType, rhs: MetadataType) -> Bool {
return lhs.asLLVM() == rhs.asLLVM()
}
}
6 changes: 6 additions & 0 deletions Sources/LLVM/PointerType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ public struct PointerType: IRType {
return LLVMPointerType(pointee.asLLVM(), UInt32(addressSpace))
}
}

extension PointerType: Equatable {
public static func == (lhs: PointerType, rhs: PointerType) -> Bool {
return lhs.asLLVM() == rhs.asLLVM()
}
}
6 changes: 6 additions & 0 deletions Sources/LLVM/StructType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,9 @@ public struct StructType: IRType {
return LLVMIsPackedStruct(self.llvm) != 0
}
}

extension StructType: Equatable {
public static func == (lhs: StructType, rhs: StructType) -> Bool {
return lhs.asLLVM() == rhs.asLLVM()
}
}
6 changes: 6 additions & 0 deletions Sources/LLVM/TokenType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ public struct TokenType: IRType {
return LLVMTokenTypeInContext(context.llvm)
}
}

extension TokenType: Equatable {
public static func == (lhs: TokenType, rhs: TokenType) -> Bool {
return lhs.asLLVM() == rhs.asLLVM()
}
}
6 changes: 6 additions & 0 deletions Sources/LLVM/VectorType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ public struct VectorType: IRType {
return LLVMVectorType(elementType.asLLVM(), UInt32(count))
}
}

extension VectorType: Equatable {
public static func == (lhs: VectorType, rhs: VectorType) -> Bool {
return lhs.asLLVM() == rhs.asLLVM()
}
}
6 changes: 6 additions & 0 deletions Sources/LLVM/VoidType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ public struct VoidType: IRType {
return LLVMVoidTypeInContext(context.llvm)
}
}

extension VoidType: Equatable {
public static func == (lhs: VoidType, rhs: VoidType) -> Bool {
return lhs.asLLVM() == rhs.asLLVM()
}
}
6 changes: 6 additions & 0 deletions Sources/LLVM/X86MMXType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ public struct X86MMXType: IRType {
return LLVMX86MMXTypeInContext(context.llvm)
}
}

extension X86MMXType: Equatable {
public static func == (lhs: X86MMXType, rhs: X86MMXType) -> Bool {
return lhs.asLLVM() == rhs.asLLVM()
}
}