================
@@ -3986,256 +3987,588 @@ def set_property(self, property, value):
 # Now comes the plumbing to hook up the C library.
 
 # Register callback types
-translation_unit_includes_callback = CFUNCTYPE(
+translation_unit_includes_callback: TypeAlias = CFUNCTYPE(  # type: ignore 
[valid-type]
     None, c_object_p, POINTER(SourceLocation), c_uint, py_object
 )
-cursor_visit_callback = CFUNCTYPE(c_int, Cursor, Cursor, py_object)
-fields_visit_callback = CFUNCTYPE(c_int, Cursor, py_object)
+cursor_visit_callback: TypeAlias = CFUNCTYPE(c_int, Cursor, Cursor, py_object) 
 # type: ignore [valid-type]
+fields_visit_callback: TypeAlias = CFUNCTYPE(c_int, Cursor, py_object)  # 
type: ignore [valid-type]
+
+
+def _get_annotations() -> list[LibFunc]:
+    def str_to_type(typename: str) -> type:
----------------
Endilll wrote:

Every line in this function feels very unfortunate. Maybe instead we use a 
different approach:
```python
class CPointer(_Pointer, typing.Generic):
  pass

def clang_CompilationDatabase_dispose(self, arg1: CPointer[c_void_p]) -> None: 
...
```

then use `typing.get_args()` to get the argument passed to `CPointer`.

https://github.com/llvm/llvm-project/pull/142120
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to