Skip to content
9 changes: 9 additions & 0 deletions clang/bindings/python/clang/cindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 conf.lib.clang_Cursor_isFunctionInlined(self) # type: ignore [no-any-return]

@cursor_null_guard
def has_attrs(self) -> bool:
"""
Expand Down Expand Up @@ -4308,6 +4316,7 @@ def set_property(self, property, value):
("clang_Cursor_isAnonymous", [Cursor], bool),
("clang_Cursor_isAnonymousRecordDecl", [Cursor], bool),
("clang_Cursor_isBitField", [Cursor], bool),
("clang_Cursor_isFunctionInlined", [Cursor], bool),
("clang_Location_isInSystemHeader", [SourceLocation], bool),
("clang_PrintingPolicy_dispose", [PrintingPolicy]),
("clang_PrintingPolicy_getProperty", [PrintingPolicy, c_int], c_uint),
Expand Down
5 changes: 5 additions & 0 deletions clang/bindings/python/tests/cindex/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,11 @@ def test_storage_class(self):
cursor = get_cursor(tu, "reg")
self.assertEqual(cursor.storage_class, StorageClass.REGISTER)

def test_function_inlined(self):
tu = get_tu("inline void foo(void);")
cursor = get_cursor(tu, "foo")
self.assertEqual(cursor.is_function_inlined(), True)

def test_availability(self):
tu = get_tu("class A { A(A const&) = delete; };", lang="cpp")

Expand Down
1 change: 1 addition & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ Sanitizers

Python Binding Changes
----------------------
- Exposed ``clang_Cursor_is_function_inlined``.
- Exposed ``clang_getCursorLanguage`` via ``Cursor.language``.
- Add all missing ``CursorKind``s, ``TypeKind``s and
``ExceptionSpecificationKind``s from ``Index.h``
Expand Down
Loading