diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py index 4ff7f318416b7..f06eff1e0c1b0 100644 --- a/clang/bindings/python/clang/cindex.py +++ b/clang/bindings/python/clang/cindex.py @@ -3952,6 +3952,7 @@ def set_property(self, property, value): ("clang_equalRanges", [SourceRange, SourceRange], bool), ("clang_equalTypes", [Type, Type], bool), ("clang_formatDiagnostic", [Diagnostic, c_uint], _CXString), + ("clang_getAddressSpace", [Type], c_uint), ("clang_getArgType", [Type, c_uint], Type), ("clang_getArrayElementType", [Type], Type), ("clang_getArraySize", [Type], c_longlong), @@ -3970,8 +3971,10 @@ def set_property(self, property, value): ("clang_getCursorAvailability", [Cursor], c_int), ("clang_getCursorDefinition", [Cursor], Cursor), ("clang_getCursorDisplayName", [Cursor], _CXString), + ("clang_getCursorExceptionSpecificationType", [Cursor], c_int), ("clang_getCursorExtent", [Cursor], SourceRange), ("clang_getCursorLexicalParent", [Cursor], Cursor), + ("clang_getCursorLinkage", [Cursor], c_int), ("clang_getCursorLocation", [Cursor], SourceLocation), ("clang_getCursorPrettyPrinted", [Cursor, PrintingPolicy], _CXString), ("clang_getCursorPrintingPolicy", [Cursor], c_object_p), @@ -3980,6 +3983,7 @@ def set_property(self, property, value): ("clang_getCursorResultType", [Cursor], Type), ("clang_getCursorSemanticParent", [Cursor], Cursor), ("clang_getCursorSpelling", [Cursor], _CXString), + ("clang_getCursorTLSKind", [Cursor], c_int), ("clang_getCursorType", [Cursor], Type), ("clang_getCursorUSR", [Cursor], _CXString), ("clang_Cursor_getMangling", [Cursor], _CXString), @@ -4005,6 +4009,7 @@ def set_property(self, property, value): ("clang_getEnumConstantDeclUnsignedValue", [Cursor], c_ulonglong), ("clang_getEnumConstantDeclValue", [Cursor], c_longlong), ("clang_getEnumDeclIntegerType", [Cursor], Type), + ("clang_getExceptionSpecificationType", [Type], c_int), ("clang_getFile", [TranslationUnit, c_interop_string], c_object_p), ("clang_getFileName", [File], _CXString), ("clang_getFileTime", [File], c_uint), @@ -4101,6 +4106,7 @@ def set_property(self, property, value): ("clang_Cursor_getBriefCommentText", [Cursor], _CXString), ("clang_Cursor_getRawCommentText", [Cursor], _CXString), ("clang_Cursor_getOffsetOfField", [Cursor], c_longlong), + ("clang_Cursor_getStorageClass", [Cursor], c_int), ("clang_Cursor_isAnonymous", [Cursor], bool), ("clang_Cursor_isAnonymousRecordDecl", [Cursor], bool), ("clang_Cursor_isBitField", [Cursor], bool), 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..5e88ebf9d8448 --- /dev/null +++ b/clang/bindings/python/tests/cindex/test_lib.py @@ -0,0 +1,31 @@ +import os + +import clang.cindex + +if "CLANG_LIBRARY_PATH" in os.environ: + clang.cindex.Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"]) + +import unittest +import ast + + +class TestLib(unittest.TestCase): + def test_functions_registered(self): + def get_function_spelling(node): + # The call expressions we are interested in have + # their spelling in .attr, not .id + if hasattr(node, "attr"): + return node.attr + return "" + + filename = clang.cindex.__file__ + with open(filename) as file: + root = ast.parse(file.read()) + functions = [ + get_function_spelling(node.func) + for node in ast.walk(root) + if isinstance(node, ast.Call) + ] + used_functions = set([func for func in functions if func.startswith("clang_")]) + registered_functions = set([item[0] for item in clang.cindex.FUNCTION_LIST]) + self.assertEqual(used_functions - registered_functions, set())