Skip to content

Conversation

TApplencourt
Copy link
Contributor

cindex.py was missing support for isFunctionInlined.

I was not able to figure out why clang_Cursor_isFunctionInlined return c_uint, but other is function return bool for the binding, so I'm doing the same here.

Regards,
Thomas

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:as-a-library libclang and C++ API labels Oct 10, 2025
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot
Copy link
Member

llvmbot commented Oct 10, 2025

@llvm/pr-subscribers-clang

Author: Thomas Applencourt (TApplencourt)

Changes

cindex.py was missing support for isFunctionInlined.

I was not able to figure out why clang_Cursor_isFunctionInlined return c_uint, but other is function return bool for the binding, so I'm doing the same here.

Regards,
Thomas


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

1 Files Affected:

  • (modified) clang/bindings/python/clang/cindex.py (+8)
diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py
index 80140d2787608..015667b4decd9 100644
--- a/clang/bindings/python/clang/cindex.py
+++ b/clang/bindings/python/clang/cindex.py
@@ -2362,6 +2362,13 @@ def get_bitfield_width(self) -> int:
         """
         return conf.lib.clang_getFieldDeclBitWidth(self)  # type: ignore [no-any-return]
 
+    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]
+
     @cursor_null_guard
     def has_attrs(self) -> bool:
         """
@@ -4308,6 +4315,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], c_uint),
     ("clang_Location_isInSystemHeader", [SourceLocation], bool),
     ("clang_PrintingPolicy_dispose", [PrintingPolicy]),
     ("clang_PrintingPolicy_getProperty", [PrintingPolicy, c_int], c_uint),

@TApplencourt
Copy link
Contributor Author

Pinging @DeinAlptraum (or at least the git blame seem to imply that you are the one in charge :) sorry if it's not the case)

@TApplencourt TApplencourt changed the title Add isFunctionInlined support in Python Binding [libclang/python] Add isFunctionInlined support Oct 10, 2025
Copy link
Contributor

@DeinAlptraum DeinAlptraum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi and thanks for the PR! Yes, I am the right person to ping for the libclang-python bindings.

Please also

  1. Add a release note (clang/docs/ReleaseNotes.rst)
  2. Add test(s) for the new function

@TApplencourt
Copy link
Contributor Author

Release note added in 6edd33c

@DeinAlptraum
Copy link
Contributor

LGTM. @Endilll do you also want to take a look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:as-a-library libclang and C++ API clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants