mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 19:08:21 +08:00
[libclang/python] Add isFunctionInlined support (#162882)
`cindex.py` was missing support for [isFunctionInlined](https://clang.llvm.org/doxygen/group__CINDEX__TYPES.html#ga963097b9aecabf5dce7554dff18b061d), this PR add it. --------- Co-authored-by: Vlad Serebrennikov <serebrennikov.vladislav@gmail.com>
This commit is contained in:
committed by
GitHub
parent
8761693919
commit
855a3e974d
@@ -2362,6 +2362,13 @@ class Cursor(Structure):
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
return bool(conf.lib.clang_Cursor_isFunctionInlined(self))
|
||||
|
||||
@cursor_null_guard
|
||||
def has_attrs(self) -> bool:
|
||||
"""
|
||||
@@ -4310,6 +4317,7 @@ FUNCTION_LIST: list[LibFunc] = [
|
||||
("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),
|
||||
|
||||
@@ -784,6 +784,21 @@ int count(int a, int b){
|
||||
cursor = get_cursor(tu, "reg")
|
||||
self.assertEqual(cursor.storage_class, StorageClass.REGISTER)
|
||||
|
||||
def test_function_inlined(self):
|
||||
tu = get_tu(
|
||||
"""
|
||||
inline void f_inline(void);
|
||||
void f_noninline(void);
|
||||
int d_noninline;
|
||||
"""
|
||||
)
|
||||
cursor = get_cursor(tu, "f_inline")
|
||||
self.assertEqual(cursor.is_function_inlined(), True)
|
||||
cursor = get_cursor(tu, "f_noninline")
|
||||
self.assertEqual(cursor.is_function_inlined(), False)
|
||||
cursor = get_cursor(tu, "d_noninline")
|
||||
self.assertEqual(cursor.is_function_inlined(), False)
|
||||
|
||||
def test_availability(self):
|
||||
tu = get_tu("class A { A(A const&) = delete; };", lang="cpp")
|
||||
|
||||
|
||||
@@ -659,6 +659,7 @@ Sanitizers
|
||||
|
||||
Python Binding Changes
|
||||
----------------------
|
||||
- Exposed ``clang_Cursor_isFunctionInlined``.
|
||||
- Exposed ``clang_getCursorLanguage`` via ``Cursor.language``.
|
||||
- Add all missing ``CursorKind``s, ``TypeKind``s and
|
||||
``ExceptionSpecificationKind``s from ``Index.h``
|
||||
|
||||
Reference in New Issue
Block a user