FunctionType

public struct FunctionType : IRType
extension FunctionType: Equatable

FunctionType represents a function’s type signature. It consists of a return type and a list of formal parameter types. The return type of a function type is a void type or first class type — except for LabelType and MetadataType.

  • The list of argument types.

    Declaration

    Swift

    public let parameterTypes: [IRType]
  • The return type of this function type.

    Declaration

    Swift

    public let returnType: IRType
  • Returns whether this function is variadic.

    Declaration

    Swift

    public let isVariadic: Bool
  • Creates a function type with the given argument types and return type.

    Note

    The context of this type is taken from it’s returnType

    Declaration

    Swift

    @available(*, deprecated, renamed: "FunctionType.init(_:_:variadic:﹚", message: "Use the more concise initializer instead")
    public init(argTypes: [IRType], returnType: IRType, isVarArg: Bool = false)

    Parameters

    argTypes

    A list of the argument types of the function type.

    returnType

    The return type of the function type.

    isVarArg

    Indicates whether this function type is variadic. Defaults to false.

  • Creates a function type with the given argument types and return type.

    Note

    The context of this type is taken from it’s returnType

    Declaration

    Swift

    public init(
      _ parameterTypes: [IRType],
      _ returnType: IRType,
      variadic: Bool = false
    )

    Parameters

    parameterTypes

    A list of the argument types of the function type.

    returnType

    The return type of the function type.

    variadic

    Indicates whether this function type is variadic. Defaults to false.

  • Retrieves the underlying LLVM type object.

    Declaration

    Swift

    public func asLLVM() -> LLVMTypeRef

Legacy Accessors

  • The list of argument types.

    Declaration

    Swift

    @available(*, deprecated, message: "Use FunctionType.parameterTypes instead")
    public var argTypes: [IRType] { get }
  • Returns whether this function is variadic.

    Declaration

    Swift

    @available(*, deprecated, message: "Use FunctionType.isVariadic instead")
    public var isVarArg: Bool { get }
  • Declaration

    Swift

    public static func == (lhs: FunctionType, rhs: FunctionType) -> Bool