"""
This type stub file was generated by pyright.
"""

from llvmlite.binding import ffi

def parse_assembly(llvmir, context=...):  # -> ModuleRef:
    """
    Create Module from a LLVM IR string
    """
    ...

def parse_bitcode(bitcode, context=...):  # -> ModuleRef:
    """
    Create Module from a LLVM *bitcode* (a bytes object).
    """
    ...

class ModuleRef(ffi.ObjectRef):
    """
    A reference to a LLVM module.
    """
    def __init__(self, module_ptr, context) -> None: ...
    def as_bitcode(self):  # -> bytes:
        """
        Return the module's LLVM bitcode, as a bytes object.
        """
        ...

    def get_function(self, name):  # -> ValueRef:
        """
        Get a ValueRef pointing to the function named *name*.
        NameError is raised if the symbol isn't found.
        """
        ...

    def get_global_variable(self, name):  # -> ValueRef:
        """
        Get a ValueRef pointing to the global variable named *name*.
        NameError is raised if the symbol isn't found.
        """
        ...

    def get_struct_type(self, name):  # -> TypeRef:
        """
        Get a TypeRef pointing to a structure type named *name*.
        NameError is raised if the struct type isn't found.
        """
        ...

    def verify(self):  # -> None:
        """
        Verify the module IR's correctness.  RuntimeError is raised on error.
        """
        ...

    @property
    def name(self):
        """
        The module's identifier.
        """
        ...

    @name.setter
    def name(self, value):  # -> None:
        ...
    @property
    def source_file(self):
        """
        The module's original source file name
        """
        ...

    @property
    def data_layout(self):  # -> str:
        """
        This module's data layout specification, as a string.
        """
        ...

    @data_layout.setter
    def data_layout(self, strrep):  # -> None:
        ...
    @property
    def triple(self):  # -> str:
        """
        This module's target "triple" specification, as a string.
        """
        ...

    @triple.setter
    def triple(self, strrep):  # -> None:
        ...
    def link_in(self, other, preserve=...):  # -> None:
        """
        Link the *other* module into this one.  The *other* module will
        be destroyed unless *preserve* is true.
        """
        ...

    @property
    def global_variables(self):  # -> _GlobalsIterator:
        """
        Return an iterator over this module's global variables.
        The iterator will yield a ValueRef for each global variable.

        Note that global variables don't include functions
        (a function is a "global value" but not a "global variable" in
         LLVM parlance)
        """
        ...

    @property
    def functions(self):  # -> _FunctionsIterator:
        """
        Return an iterator over this module's functions.
        The iterator will yield a ValueRef for each function.
        """
        ...

    @property
    def struct_types(self):  # -> _TypesIterator:
        """
        Return an iterator over the struct types defined in
        the module. The iterator will yield a TypeRef.
        """
        ...

    def clone(self):  # -> ModuleRef:
        ...

class _Iterator(ffi.ObjectRef):
    kind = ...
    def __init__(self, ptr, parents) -> None: ...
    def __next__(self):  # -> ValueRef:
        ...

    next = ...
    def __iter__(self):  # -> Self:
        ...

class _GlobalsIterator(_Iterator):
    kind = ...

class _FunctionsIterator(_Iterator):
    kind = ...

class _TypesIterator(_Iterator):
    kind = ...
    def __next__(self):  # -> TypeRef:
        ...

    next = ...
