[clang] [libclang/python] Do not rely on `ctypes`' `errcheck` (PR #105490)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 12 10:16:54 PDT 2024
================
@@ -3743,82 +3765,62 @@ def write_main_file_to_stdout(self):
("clang_equalLocations", [SourceLocation, SourceLocation], bool),
("clang_equalRanges", [SourceRange, SourceRange], bool),
("clang_equalTypes", [Type, Type], bool),
- ("clang_formatDiagnostic", [Diagnostic, c_uint], _CXString, _CXString.from_result),
- ("clang_getArgType", [Type, c_uint], Type, Type.from_result),
- ("clang_getArrayElementType", [Type], Type, Type.from_result),
+ ("clang_formatDiagnostic", [Diagnostic, c_uint], _CXString),
+ ("clang_getArgType", [Type, c_uint], Type),
+ ("clang_getArrayElementType", [Type], Type),
("clang_getArraySize", [Type], c_longlong),
("clang_getFieldDeclBitWidth", [Cursor], c_int),
- ("clang_getCanonicalCursor", [Cursor], Cursor, Cursor.from_cursor_result),
- ("clang_getCanonicalType", [Type], Type, Type.from_result),
+ ("clang_getCanonicalCursor", [Cursor], Cursor),
+ ("clang_getCanonicalType", [Type], Type),
("clang_getChildDiagnostics", [Diagnostic], c_object_p),
("clang_getCompletionAvailability", [c_void_p], c_int),
- ("clang_getCompletionBriefComment", [c_void_p], _CXString, _CXString.from_result),
+ ("clang_getCompletionBriefComment", [c_void_p], _CXString),
("clang_getCompletionChunkCompletionString", [c_void_p, c_int], c_object_p),
("clang_getCompletionChunkKind", [c_void_p, c_int], c_int),
- (
- "clang_getCompletionChunkText",
- [c_void_p, c_int],
- _CXString,
- _CXString.from_result,
- ),
+ ("clang_getCompletionChunkText", [c_void_p, c_int], _CXString),
("clang_getCompletionPriority", [c_void_p], c_int),
- (
- "clang_getCString",
- [_CXString],
- c_interop_string,
- c_interop_string.to_python_string,
- ),
+ ("clang_getCString", [_CXString], c_interop_string),
("clang_getCursor", [TranslationUnit, SourceLocation], Cursor),
("clang_getCursorAvailability", [Cursor], c_int),
- ("clang_getCursorDefinition", [Cursor], Cursor, Cursor.from_result),
- ("clang_getCursorDisplayName", [Cursor], _CXString, _CXString.from_result),
+ ("clang_getCursorDefinition", [Cursor], Cursor),
+ ("clang_getCursorDisplayName", [Cursor], _CXString),
("clang_getCursorExtent", [Cursor], SourceRange),
- ("clang_getCursorLexicalParent", [Cursor], Cursor, Cursor.from_cursor_result),
+ ("clang_getCursorLexicalParent", [Cursor], Cursor),
("clang_getCursorLocation", [Cursor], SourceLocation),
- ("clang_getCursorReferenced", [Cursor], Cursor, Cursor.from_result),
+ ("clang_getCursorReferenced", [Cursor], Cursor),
("clang_getCursorReferenceNameRange", [Cursor, c_uint, c_uint], SourceRange),
- ("clang_getCursorResultType", [Cursor], Type, Type.from_result),
- ("clang_getCursorSemanticParent", [Cursor], Cursor, Cursor.from_cursor_result),
- ("clang_getCursorSpelling", [Cursor], _CXString, _CXString.from_result),
- ("clang_getCursorType", [Cursor], Type, Type.from_result),
- ("clang_getCursorUSR", [Cursor], _CXString, _CXString.from_result),
- ("clang_Cursor_getMangling", [Cursor], _CXString, _CXString.from_result),
+ ("clang_getCursorResultType", [Cursor], Type),
+ ("clang_getCursorSemanticParent", [Cursor], Cursor),
+ ("clang_getCursorSpelling", [Cursor], _CXString),
+ ("clang_getCursorType", [Cursor], Type),
+ ("clang_getCursorUSR", [Cursor], _CXString),
+ ("clang_Cursor_getMangling", [Cursor], _CXString),
# ("clang_getCXTUResourceUsage",
# [TranslationUnit],
# CXTUResourceUsage),
("clang_getCXXAccessSpecifier", [Cursor], c_uint),
- ("clang_getDeclObjCTypeEncoding", [Cursor], _CXString, _CXString.from_result),
+ ("clang_getDeclObjCTypeEncoding", [Cursor], _CXString),
("clang_getDiagnostic", [c_object_p, c_uint], c_object_p),
("clang_getDiagnosticCategory", [Diagnostic], c_uint),
- ("clang_getDiagnosticCategoryText", [Diagnostic], _CXString, _CXString.from_result),
- (
- "clang_getDiagnosticFixIt",
- [Diagnostic, c_uint, POINTER(SourceRange)],
- _CXString,
- _CXString.from_result,
- ),
+ ("clang_getDiagnosticCategoryText", [Diagnostic], _CXString),
+ ("clang_getDiagnosticFixIt", [Diagnostic, c_uint, POINTER(SourceRange)], _CXString),
("clang_getDiagnosticInSet", [c_object_p, c_uint], c_object_p),
("clang_getDiagnosticLocation", [Diagnostic], SourceLocation),
("clang_getDiagnosticNumFixIts", [Diagnostic], c_uint),
("clang_getDiagnosticNumRanges", [Diagnostic], c_uint),
- (
- "clang_getDiagnosticOption",
- [Diagnostic, POINTER(_CXString)],
- _CXString,
- _CXString.from_result,
- ),
+ ("clang_getDiagnosticOption", [Diagnostic, POINTER(_CXString)], _CXString),
("clang_getDiagnosticRange", [Diagnostic, c_uint], SourceRange),
("clang_getDiagnosticSeverity", [Diagnostic], c_int),
- ("clang_getDiagnosticSpelling", [Diagnostic], _CXString, _CXString.from_result),
- ("clang_getElementType", [Type], Type, Type.from_result),
+ ("clang_getDiagnosticSpelling", [Diagnostic], _CXString),
+ ("clang_getElementType", [Type], Type),
("clang_getEnumConstantDeclUnsignedValue", [Cursor], c_ulonglong),
("clang_getEnumConstantDeclValue", [Cursor], c_longlong),
- ("clang_getEnumDeclIntegerType", [Cursor], Type, Type.from_result),
+ ("clang_getEnumDeclIntegerType", [Cursor], Type),
("clang_getFile", [TranslationUnit, c_interop_string], c_object_p),
- ("clang_getFileName", [File], _CXString, _CXString.from_result),
+ ("clang_getFileName", [File], _CXString),
("clang_getFileTime", [File], c_uint),
- ("clang_getIBOutletCollectionType", [Cursor], Type, Type.from_result),
- ("clang_getIncludedFile", [Cursor], c_object_p, File.from_result),
+ ("clang_getIBOutletCollectionType", [Cursor], Type),
----------------
Endilll wrote:
I'd rather take it as an indication that our Python wrapper is incomplete.
In any case, this is for a later PR.
https://github.com/llvm/llvm-project/pull/105490
More information about the cfe-commits
mailing list