mirror of
https://github.com/intel/llvm.git
synced 2026-01-19 17:45:07 +08:00
[mlir][python] Add bindings for diagnostic handler.
I considered multiple approaches for this but settled on this one because I could make the lifetime management work in a reasonably easy way (others had issues with not being able to cast to a Python reference from a C++ constructor). We could stand to have more formatting helpers, but best to get the core mechanism in first. Differential Revision: https://reviews.llvm.org/D116568
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
# * Local edits to signatures and types that MyPy did not auto detect (or
|
||||
# detected incorrectly).
|
||||
|
||||
from typing import Any, Callable, ClassVar, Dict, List, Optional, Sequence
|
||||
from typing import Any, Callable, ClassVar, Dict, List, Optional, Sequence, Tuple
|
||||
|
||||
from typing import overload
|
||||
|
||||
@@ -43,6 +43,9 @@ __all__ = [
|
||||
"Dialect",
|
||||
"DialectDescriptor",
|
||||
"Dialects",
|
||||
"Diagnostic",
|
||||
"DiagnosticHandler",
|
||||
"DiagnosticSeverity",
|
||||
"DictAttr",
|
||||
"F16Type",
|
||||
"F32Type",
|
||||
@@ -425,8 +428,9 @@ class Context:
|
||||
def _get_live_count() -> int: ...
|
||||
def _get_live_module_count(self) -> int: ...
|
||||
def _get_live_operation_count(self) -> int: ...
|
||||
def attach_diagnostic_handler(self, callback: Callable[["Diagnostic"], bool]) -> "DiagnosticHandler": ...
|
||||
def enable_multithreading(self, enable: bool) -> None: ...
|
||||
def get_dialect_descriptor(name: dialect_name: str) -> "DialectDescriptor": ...
|
||||
def get_dialect_descriptor(dialect_name: str) -> "DialectDescriptor": ...
|
||||
def is_registered_operation(self, operation_name: str) -> bool: ...
|
||||
def __enter__(self) -> "Context": ...
|
||||
def __exit__(self, arg0: object, arg1: object, arg2: object) -> None: ...
|
||||
@@ -479,6 +483,31 @@ class Dialects:
|
||||
def __getattr__(self, arg0: str) -> "Dialect": ...
|
||||
def __getitem__(self, arg0: str) -> "Dialect": ...
|
||||
|
||||
class Diagnostic:
|
||||
@property
|
||||
def severity(self) -> "DiagnosticSeverity": ...
|
||||
@property
|
||||
def location(self) -> "Location": ...
|
||||
@property
|
||||
def message(self) -> str: ...
|
||||
@property
|
||||
def notes(self) -> Tuple["Diagnostic"]: ...
|
||||
|
||||
class DiagnosticHandler:
|
||||
def detach(self) -> None: ...
|
||||
@property
|
||||
def attached(self) -> bool: ...
|
||||
@property
|
||||
def had_error(self) -> bool: ...
|
||||
def __enter__(self) -> "DiagnosticHandler": ...
|
||||
def __exit__(self, arg0: object, arg1: object, arg2: object) -> None: ...
|
||||
|
||||
class DiagnosticSeverity:
|
||||
ERROR: "DiagnosticSeverity"
|
||||
WARNING: "DiagnosticSeverity"
|
||||
NOTE: "DiagnosticSeverity"
|
||||
REMARK: "DiagnosticSeverity"
|
||||
|
||||
# TODO: Auto-generated. Audit and fix.
|
||||
class DictAttr(Attribute):
|
||||
def __init__(self, cast_from_attr: Attribute) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user