<commit_before>module LLVM
  class Value
    # @private
    def self.from_ptr(ptr)
      new(ptr) unless ptr.null?
    end

    private_class_method :new

    # @private
    def initialize(ptr)
      @ptr = ptr
    end

    # @private
    def to_ptr
      @ptr
    end

    # Checks if the value is equal to other.
    def ==(other)
      case other
      when LLVM::Value
        @ptr == other.to_ptr
      else
        false
      end
    end

    # Checks if the value is equal to other.
    def eql?(other)
      other.instance_of?(self.class) && self == other
    end

    # Returns the Value type. This is abstract and is overidden by its subclasses.
    def self.type
      raise NotImplementedError, "#{self.name}.type() is abstract."
    end

    def self.to_ptr<commit_msg>Value.hash should be overridden so that it can be used as a hash key.<commit_after>module LLVM
  class Value
    # @private
    def self.from_ptr(ptr)
      new(ptr) unless ptr.null?
    end

    private_class_method :new

    # @private
    def initialize(ptr)
      @ptr = ptr
    end

    # @private
    def to_ptr
      @ptr
    end

    # Checks if the value is equal to other.
    def ==(other)
      case other
      when LLVM::Value
        @ptr == other.to_ptr
      else
        false
      end
    end
    
    def hash
      @ptr.address.hash
    end

    # Checks if the value is equal to other.
    def eql?(other)
      other.instance_of?(self.class) && self == other
    end

    # Returns the Value type. This is abstract and is overidden by its subclasses.
    def self.type
      raise NotImplementedError, "#{self.name}.type() is abstract."
    end

    def self.to_ptr
{'fraction_non_alphanumeric': 0.07954545454545454, 'fraction_numerical': 0.0, 'mean_word_length': 1.9506172839506173, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1269241', 'n_tokens_mistral': 533, 'n_tokens_neox': 521, 'n_words': 178}