https://github.com/DeinAlptraum created https://github.com/llvm/llvm-project/pull/140015
Add a few library functions that were not previously registered to the `CDLL` object. The current behavior relies on the default `restype` to work. Add a test to check that all library functions are properly registered. This is not 100% reliable: for a yet unkown reason, `clang_getCursorTLSKind` is not in the list of attributes of the library object, despite working as intended even when not registered. >From c3c0adfe4a7dce3568a81594588be53d761b5980 Mon Sep 17 00:00:00 2001 From: Jannick Kremer <jannick.kre...@mailbox.org> Date: Thu, 15 May 2025 15:58:00 +0900 Subject: [PATCH] [libclang/python] Ensure all library functions are registered --- clang/bindings/python/tests/cindex/test_lib.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 clang/bindings/python/tests/cindex/test_lib.py diff --git a/clang/bindings/python/tests/cindex/test_lib.py b/clang/bindings/python/tests/cindex/test_lib.py new file mode 100644 index 0000000000000..f8f892731500b --- /dev/null +++ b/clang/bindings/python/tests/cindex/test_lib.py @@ -0,0 +1,17 @@ +import os + +from clang.cindex import Config, conf, FUNCTION_LIST + +if "CLANG_LIBRARY_PATH" in os.environ: + Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"]) + +import unittest + + +class TestIndex(unittest.TestCase): + def test_functions_registered(self): + IGNORED = set(["_FuncPtr", "_name", "_handle"]) + lib_functions = set(vars(conf.lib).keys()) + registered_functions = set([item[0] for item in FUNCTION_LIST]) + unregistered_functions = lib_functions - registered_functions - IGNORED + self.assertEqual(unregistered_functions, set()) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits