diff options
| author | Thomas Applencourt <tapplencourt@anl.gov> | 2025-11-07 03:00:54 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-07 13:00:54 +0400 |
| commit | a04ceb02ad316cc4f2e6edfdeacc089526751608 (patch) | |
| tree | c84b6b4659c9f739c9934e72cab83f9ebc4c880d /lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h | |
| parent | 4508f44af7529dbba8e3762325b2c416ff9f20c6 (diff) | |
| download | llvm-a04ceb02ad316cc4f2e6edfdeacc089526751608.zip llvm-a04ceb02ad316cc4f2e6edfdeacc089526751608.tar.gz llvm-a04ceb02ad316cc4f2e6edfdeacc089526751608.tar.bz2 | |
[libclang/python] Return actual C types from libclang functions instead of Python bool (#166446)
In the previous implementation, 43 libclang functions are registered in
FUNCTION_LIST with return type ctypes.c_bool. However, none of these
functions actually return a C bool type; instead, they return unsigned
or signed integers (unsigned int / int) on the C side.
Although ctypes automatically casts nonzero integers to True and zero to
False, this implicit conversion hides the "true" c-return type.
This PR updates those functions to use their proper “native” ctypes
return types (c_uint or c_int) and updates the corresponding Python
convenience wrappers to explicitly cast their results using the bool
constructor.
As a side effect, the related `# type: ignore` annotations have been
removed, as they are no longer necessary.
Some libclang functions are used directly without any intermediate
Python wrapper. These functions (`clang_equalCursors`,
`clang_equalLocations`, `clang_equalRanges`, `clang_equalTypes`,
`clang_File_isEqual`, and `clang_isFileMultipleIncludeGuarded`) are now
explicitly cast to bool at their call sites. Note that
`clang_isFileMultipleIncludeGuarded` is never called in the binding.
Thix fix #164915.
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h')
0 files changed, 0 insertions, 0 deletions
