[clang] [libclang/python] Add isFunctionInlined support (PR #162882)

Jannick Kremer via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 10 23:33:05 PDT 2025


================
@@ -2362,6 +2362,14 @@ def get_bitfield_width(self) -> int:
         """
         return conf.lib.clang_getFieldDeclBitWidth(self)  # type: ignore [no-any-return]
 
+    @cursor_null_guard
+    def is_function_inlined(self) -> bool:
+        """
+        Check if the function is inlined
+        """
+        assert self.kind == TypeKind.FUNCTIONPROTO
+        return bool(conf.lib.clang_Cursor_isFunctionInlined(self))  # type: ignore [no-any-return]
----------------
DeinAlptraum wrote:

Regarding your question about `c_uint` and `bool`: I am not entirely sure about how this works myself, but I assume that `ctypes` does automatic C-style conversion of types where possible, so if you have a `c_uint` return for an interface that is registered as bool, you effectively get `bool(my_cuint)`, resulting in `True` for all values except 0.

Since other functions are also fine with this and follow that pattern, I would prefer defining the library function below as `bool` instead of `c_uint` as well (e.g. like `clang_Cursor_isBitField`), then you can remove the bool-cast here.

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


More information about the cfe-commits mailing list