[clang] [libclang/python] Add type annotations to the TranslationUnit class (PR #180876)

Jannick Kremer via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 18 06:05:47 PST 2026


================
@@ -3797,18 +3825,22 @@ def codeComplete(
             return CodeCompletionResults(ptr)
         return None
 
-    def get_tokens(self, locations=None, extent=None):
+    def get_tokens(
+        self,
+        locations: tuple[SourceLocation, SourceLocation] | None = None,
+        extent: SourceRange | None = None,
+    ) -> Iterator[Token]:
         """Obtain tokens in this translation unit.
 
         This is a generator for Token instances. The caller specifies a range
         of source code to obtain tokens for. The range can be specified as a
         2-tuple of SourceLocation or as a SourceRange. If both are defined,
         behavior is undefined.
----------------
DeinAlptraum wrote:

Done

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


More information about the cfe-commits mailing list