================
@@ -3605,25 +3622,32 @@ def get_includes(self):
headers.
"""
- def visitor(fobj, lptr, depth, includes):
+ def visitor(
+ fobj: CObjP,
+ lptr: _Pointer[SourceLocation],
+ depth: int,
+ includes: list[FileInclusion],
+ ) -> None:
if depth > 0:
loc = lptr.contents
includes.append(FileInclusion(loc.file, File(fobj), loc, depth))
# Automatically adapt CIndex/ctype pointers to python objects
- includes = []
+ includes: list[FileInclusion] = []
conf.lib.clang_getInclusions(
self, translation_unit_includes_callback(visitor), includes
)
return iter(includes)
- def get_file(self, filename):
+ def get_file(self, filename: StrBytesPath) -> File:
"""Obtain a File from this translation unit."""
return File.from_name(self, filename)
----------------
DeinAlptraum wrote:
The `filename` is just passed to `os.fspath` in there, so the annotation as `StrBytesPath` works
https://github.com/llvm/llvm-project/pull/180876