# Generated by ffi-gen. Please do not change this file by hand.

require 'ffi'

module LLVM
  extend FFI::Library
  ffi_lib 'LLVM-3.0'
  
  def self.attach_function(name, *_)
    begin; super; rescue FFI::NotFoundError => e
      (class << self; self; end).class_eval { define_method(name) { |*_| raise e } }
    end
  end
  
  # This should map exactly onto the C++ enumerator LTOStatus.
  # 
  # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:llvm_lto_status).</em>
  # 
  # === Options:
  # :unknown ::
  #   
  # :opt_success ::
  #   
  # :read_success ::
  #   
  # :read_failure ::
  #   
  # :write_failure ::
  #   
  # :no_target ::
  #   
  # :no_work ::
  #   
  # :module_merge_failure ::
  #   
  # :asm_failure ::
  #   
  # :null_object ::
  #   Added C-specific error codes
  # 
  # @method _enum_llvm_lto_status_
  # @return [Symbol]
  # @scope class
  enum :llvm_lto_status, [
    :unknown, 0,
    :opt_success, 1,
    :read_success, 2,
    :read_failure, 3,
    :write_failure, 4,
    :no_target, 5,
    :no_work, 6,
    :module_merge_failure, 7,
    :asm_failure, 8,
    :null_object, 9
  ]
  
  # extern "C" helps, because dlopen() interface uses name to find the symbol.
  # 
  # @method llvm_create_optimizer()
  # @return [FFI::Pointer(LlvmLtoT)] 
  # @scope class
  attach_function :llvm_create_optimizer, :llvm_create_optimizer, [], :pointer
  
  # (Not documented)
  # 
  # @method llvm_destroy_optimizer(lto)
  # @param [FFI::Pointer(LlvmLtoT)] lto 
  # @return [nil] 
  # @scope class
  attach_function :llvm_destroy_optimizer, :llvm_destroy_optimizer, [:pointer], :void
  
  # (Not documented)
  # 
  # @method llvm_read_object_file(lto, input_filename)
  # @param [FFI::Pointer(LlvmLtoT)] lto 
  # @param [String] input_filename 
  # @return [Symbol from _enum_llvm_lto_status_] 
  # @scope class
  attach_function :llvm_read_object_file, :llvm_read_object_file, [:pointer, :string], :llvm_lto_status
  
  # (Not documented)
  # 
  # @method llvm_optimize_modules(lto, output_filename)
  # @param [FFI::Pointer(LlvmLtoT)] lto 
  # @param [String] output_filename 
  # @return [Symbol from _enum_llvm_lto_status_] 
  # @scope class
  attach_function :llvm_optimize_modules, :llvm_optimize_modules, [:pointer, :string], :llvm_lto_status
  
end
