[clang] [libclang/python] Add type annotations for code completion classes (PR #140539)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 2 22:49:53 PDT 2025


================
@@ -3115,44 +3116,47 @@ def __repr__(self):
 class CodeCompletionResult(Structure):
     _fields_ = [("cursorKind", c_int), ("completionString", c_object_p)]
 
-    def __repr__(self):
+    def __repr__(self) -> str:
         return str(CompletionString(self.completionString))
 
     @property
-    def kind(self):
+    def kind(self) -> CursorKind:
         return CursorKind.from_id(self.cursorKind)
 
     @property
-    def string(self):
+    def string(self) -> CompletionString:
         return CompletionString(self.completionString)
 
 
 class CCRStructure(Structure):
     _fields_ = [("results", POINTER(CodeCompletionResult)), ("numResults", c_int)]
----------------
Endilll wrote:

`numResults` is defined as `unsigned`: https://github.com/llvm/llvm-project/blob/410764cff5d657e66a64a8250958db99fb721385/clang/include/clang-c/Index.h#L5527

https://github.com/llvm/llvm-project/pull/140539


More information about the cfe-commits mailing list