[clang] [clang-bindings] Add strict typing to clang Python bindings (#76664) (PR #78114)

Jannick Kremer via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 9 14:22:16 PDT 2024


================
@@ -665,867 +1312,858 @@ class CursorKind(BaseEnumeration):
     A CursorKind describes the kind of entity that a cursor points to.
     """
 
-    # The required BaseEnumeration declarations.
-    _kinds = []
-    _name_map = None
-
     @staticmethod
-    def get_all_kinds():
+    def get_all_kinds() -> list[CursorKind]:
         """Return all CursorKind enumeration instances."""
-        return [x for x in CursorKind._kinds if not x is None]
+        return [x for x in CursorKind]
 
-    def is_declaration(self):
+    def is_declaration(self) -> bool:
         """Test if this is a declaration kind."""
         return conf.lib.clang_isDeclaration(self)
 
-    def is_reference(self):
+    def is_reference(self) -> bool:
         """Test if this is a reference kind."""
         return conf.lib.clang_isReference(self)
 
-    def is_expression(self):
+    def is_expression(self) -> bool:
         """Test if this is an expression kind."""
         return conf.lib.clang_isExpression(self)
 
-    def is_statement(self):
+    def is_statement(self) -> bool:
         """Test if this is a statement kind."""
         return conf.lib.clang_isStatement(self)
 
-    def is_attribute(self):
+    def is_attribute(self) -> bool:
         """Test if this is an attribute kind."""
         return conf.lib.clang_isAttribute(self)
 
-    def is_invalid(self):
+    def is_invalid(self) -> bool:
         """Test if this is an invalid kind."""
         return conf.lib.clang_isInvalid(self)
 
-    def is_translation_unit(self):
+    def is_translation_unit(self) -> bool:
         """Test if this is a translation unit kind."""
         return conf.lib.clang_isTranslationUnit(self)
 
-    def is_preprocessing(self):
+    def is_preprocessing(self) -> bool:
         """Test if this is a preprocessing kind."""
         return conf.lib.clang_isPreprocessing(self)
 
-    def is_unexposed(self):
+    def is_unexposed(self) -> bool:
         """Test if this is an unexposed kind."""
         return conf.lib.clang_isUnexposed(self)
 
-    def __repr__(self):
-        return "CursorKind.%s" % (self.name,)
+    ###
+    # Declaration Kinds
 
+    # A declaration whose specific kind is not exposed via this interface.
+    #
+    # Unexposed declarations have the same operations as any other kind of
+    # declaration; one can extract their location information, spelling, find their
+    # definitions, etc. However, the specific kind of the declaration is not
+    # reported.
+    UNEXPOSED_DECL = 1
 
-###
-# Declaration Kinds
+    # A C or C++ struct.
+    STRUCT_DECL = 2
 
-# A declaration whose specific kind is not exposed via this interface.
-#
-# Unexposed declarations have the same operations as any other kind of
-# declaration; one can extract their location information, spelling, find their
-# definitions, etc. However, the specific kind of the declaration is not
-# reported.
-CursorKind.UNEXPOSED_DECL = CursorKind(1)
+    # A C or C++ union.
+    UNION_DECL = 3
 
-# A C or C++ struct.
-CursorKind.STRUCT_DECL = CursorKind(2)
+    # A C++ class.
+    CLASS_DECL = 4
 
-# A C or C++ union.
-CursorKind.UNION_DECL = CursorKind(3)
+    # An enumeration.
+    ENUM_DECL = 5
 
-# A C++ class.
-CursorKind.CLASS_DECL = CursorKind(4)
+    # A field (in C) or non-static data member (in C++) in a struct, union, or C++
+    # class.
+    FIELD_DECL = 6
 
-# An enumeration.
-CursorKind.ENUM_DECL = CursorKind(5)
+    # An enumerator constant.
+    ENUM_CONSTANT_DECL = 7
 
-# A field (in C) or non-static data member (in C++) in a struct, union, or C++
-# class.
-CursorKind.FIELD_DECL = CursorKind(6)
+    # A function.
+    FUNCTION_DECL = 8
 
-# An enumerator constant.
-CursorKind.ENUM_CONSTANT_DECL = CursorKind(7)
+    # A variable.
+    VAR_DECL = 9
 
-# A function.
-CursorKind.FUNCTION_DECL = CursorKind(8)
+    # A function or method parameter.
+    PARM_DECL = 10
 
-# A variable.
-CursorKind.VAR_DECL = CursorKind(9)
+    # An Objective-C @interface.
+    OBJC_INTERFACE_DECL = 11
 
-# A function or method parameter.
-CursorKind.PARM_DECL = CursorKind(10)
+    # An Objective-C @interface for a category.
+    OBJC_CATEGORY_DECL = 12
 
-# An Objective-C @interface.
-CursorKind.OBJC_INTERFACE_DECL = CursorKind(11)
+    # An Objective-C @protocol declaration.
+    OBJC_PROTOCOL_DECL = 13
 
-# An Objective-C @interface for a category.
-CursorKind.OBJC_CATEGORY_DECL = CursorKind(12)
+    # An Objective-C @property declaration.
+    OBJC_PROPERTY_DECL = 14
 
-# An Objective-C @protocol declaration.
-CursorKind.OBJC_PROTOCOL_DECL = CursorKind(13)
+    # An Objective-C instance variable.
+    OBJC_IVAR_DECL = 15
 
-# An Objective-C @property declaration.
-CursorKind.OBJC_PROPERTY_DECL = CursorKind(14)
+    # An Objective-C instance method.
+    OBJC_INSTANCE_METHOD_DECL = 16
 
-# An Objective-C instance variable.
-CursorKind.OBJC_IVAR_DECL = CursorKind(15)
+    # An Objective-C class method.
+    OBJC_CLASS_METHOD_DECL = 17
 
-# An Objective-C instance method.
-CursorKind.OBJC_INSTANCE_METHOD_DECL = CursorKind(16)
+    # An Objective-C @implementation.
+    OBJC_IMPLEMENTATION_DECL = 18
 
-# An Objective-C class method.
-CursorKind.OBJC_CLASS_METHOD_DECL = CursorKind(17)
+    # An Objective-C @implementation for a category.
+    OBJC_CATEGORY_IMPL_DECL = 19
 
-# An Objective-C @implementation.
-CursorKind.OBJC_IMPLEMENTATION_DECL = CursorKind(18)
+    # A typedef.
+    TYPEDEF_DECL = 20
 
-# An Objective-C @implementation for a category.
-CursorKind.OBJC_CATEGORY_IMPL_DECL = CursorKind(19)
+    # A C++ class method.
+    CXX_METHOD = 21
 
-# A typedef.
-CursorKind.TYPEDEF_DECL = CursorKind(20)
+    # A C++ namespace.
+    NAMESPACE = 22
 
-# A C++ class method.
-CursorKind.CXX_METHOD = CursorKind(21)
+    # A linkage specification, e.g. 'extern "C"'.
+    LINKAGE_SPEC = 23
 
-# A C++ namespace.
-CursorKind.NAMESPACE = CursorKind(22)
+    # A C++ constructor.
+    CONSTRUCTOR = 24
 
-# A linkage specification, e.g. 'extern "C"'.
-CursorKind.LINKAGE_SPEC = CursorKind(23)
+    # A C++ destructor.
+    DESTRUCTOR = 25
 
-# A C++ constructor.
-CursorKind.CONSTRUCTOR = CursorKind(24)
+    # A C++ conversion function.
+    CONVERSION_FUNCTION = 26
 
-# A C++ destructor.
-CursorKind.DESTRUCTOR = CursorKind(25)
+    # A C++ template type parameter
+    TEMPLATE_TYPE_PARAMETER = 27
 
-# A C++ conversion function.
-CursorKind.CONVERSION_FUNCTION = CursorKind(26)
+    # A C++ non-type template parameter.
+    TEMPLATE_NON_TYPE_PARAMETER = 28
 
-# A C++ template type parameter
-CursorKind.TEMPLATE_TYPE_PARAMETER = CursorKind(27)
+    # A C++ template template parameter.
+    TEMPLATE_TEMPLATE_PARAMETER = 29
 
-# A C++ non-type template parameter.
-CursorKind.TEMPLATE_NON_TYPE_PARAMETER = CursorKind(28)
+    # A C++ function template.
+    FUNCTION_TEMPLATE = 30
 
-# A C++ template template parameter.
-CursorKind.TEMPLATE_TEMPLATE_PARAMETER = CursorKind(29)
+    # A C++ class template.
+    CLASS_TEMPLATE = 31
 
-# A C++ function template.
-CursorKind.FUNCTION_TEMPLATE = CursorKind(30)
+    # A C++ class template partial specialization.
+    CLASS_TEMPLATE_PARTIAL_SPECIALIZATION = 32
 
-# A C++ class template.
-CursorKind.CLASS_TEMPLATE = CursorKind(31)
+    # A C++ namespace alias declaration.
+    NAMESPACE_ALIAS = 33
 
-# A C++ class template partial specialization.
-CursorKind.CLASS_TEMPLATE_PARTIAL_SPECIALIZATION = CursorKind(32)
+    # A C++ using directive
+    USING_DIRECTIVE = 34
 
-# A C++ namespace alias declaration.
-CursorKind.NAMESPACE_ALIAS = CursorKind(33)
+    # A C++ using declaration
+    USING_DECLARATION = 35
 
-# A C++ using directive
-CursorKind.USING_DIRECTIVE = CursorKind(34)
+    # A Type alias decl.
+    TYPE_ALIAS_DECL = 36
 
-# A C++ using declaration
-CursorKind.USING_DECLARATION = CursorKind(35)
+    # A Objective-C synthesize decl
+    OBJC_SYNTHESIZE_DECL = 37
 
-# A Type alias decl.
-CursorKind.TYPE_ALIAS_DECL = CursorKind(36)
+    # A Objective-C dynamic decl
+    OBJC_DYNAMIC_DECL = 38
 
-# A Objective-C synthesize decl
-CursorKind.OBJC_SYNTHESIZE_DECL = CursorKind(37)
+    # A C++ access specifier decl.
+    CXX_ACCESS_SPEC_DECL = 39
 
-# A Objective-C dynamic decl
-CursorKind.OBJC_DYNAMIC_DECL = CursorKind(38)
+    ###
+    # Reference Kinds
 
-# A C++ access specifier decl.
-CursorKind.CXX_ACCESS_SPEC_DECL = CursorKind(39)
+    OBJC_SUPER_CLASS_REF = 40
+    OBJC_PROTOCOL_REF = 41
+    OBJC_CLASS_REF = 42
 
+    # A reference to a type declaration.
+    #
+    # A type reference occurs anywhere where a type is named but not
+    # declared. For example, given:
+    #   typedef unsigned size_type;
+    #   size_type size;
+    #
+    # The typedef is a declaration of size_type (CXCursor_TypedefDecl),
+    # while the type of the variable "size" is referenced. The cursor
+    # referenced by the type of size is the typedef for size_type.
+    TYPE_REF = 43
+    CXX_BASE_SPECIFIER = 44
 
-###
-# Reference Kinds
+    # A reference to a class template, function template, template
+    # template parameter, or class template partial specialization.
+    TEMPLATE_REF = 45
 
-CursorKind.OBJC_SUPER_CLASS_REF = CursorKind(40)
-CursorKind.OBJC_PROTOCOL_REF = CursorKind(41)
-CursorKind.OBJC_CLASS_REF = CursorKind(42)
+    # A reference to a namespace or namepsace alias.
+    NAMESPACE_REF = 46
 
-# A reference to a type declaration.
-#
-# A type reference occurs anywhere where a type is named but not
-# declared. For example, given:
-#   typedef unsigned size_type;
-#   size_type size;
-#
-# The typedef is a declaration of size_type (CXCursor_TypedefDecl),
-# while the type of the variable "size" is referenced. The cursor
-# referenced by the type of size is the typedef for size_type.
-CursorKind.TYPE_REF = CursorKind(43)
-CursorKind.CXX_BASE_SPECIFIER = CursorKind(44)
+    # A reference to a member of a struct, union, or class that occurs in
+    # some non-expression context, e.g., a designated initializer.
+    MEMBER_REF = 47
 
-# A reference to a class template, function template, template
-# template parameter, or class template partial specialization.
-CursorKind.TEMPLATE_REF = CursorKind(45)
+    # A reference to a labeled statement.
+    LABEL_REF = 48
 
-# A reference to a namespace or namepsace alias.
-CursorKind.NAMESPACE_REF = CursorKind(46)
+    # A reference to a set of overloaded functions or function templates
+    # that has not yet been resolved to a specific function or function template.
+    OVERLOADED_DECL_REF = 49
 
-# A reference to a member of a struct, union, or class that occurs in
-# some non-expression context, e.g., a designated initializer.
-CursorKind.MEMBER_REF = CursorKind(47)
+    # A reference to a variable that occurs in some non-expression
+    # context, e.g., a C++ lambda capture list.
+    VARIABLE_REF = 50
 
-# A reference to a labeled statement.
-CursorKind.LABEL_REF = CursorKind(48)
+    ###
+    # Invalid/Error Kinds
 
-# A reference to a set of overloaded functions or function templates
-# that has not yet been resolved to a specific function or function template.
-CursorKind.OVERLOADED_DECL_REF = CursorKind(49)
+    INVALID_FILE = 70
+    NO_DECL_FOUND = 71
+    NOT_IMPLEMENTED = 72
+    INVALID_CODE = 73
 
-# A reference to a variable that occurs in some non-expression
-# context, e.g., a C++ lambda capture list.
-CursorKind.VARIABLE_REF = CursorKind(50)
+    ###
+    # Expression Kinds
 
-###
-# Invalid/Error Kinds
+    # An expression whose specific kind is not exposed via this interface.
+    #
+    # Unexposed expressions have the same operations as any other kind of
+    # expression; one can extract their location information, spelling, children,
+    # etc. However, the specific kind of the expression is not reported.
+    UNEXPOSED_EXPR = 100
 
-CursorKind.INVALID_FILE = CursorKind(70)
-CursorKind.NO_DECL_FOUND = CursorKind(71)
-CursorKind.NOT_IMPLEMENTED = CursorKind(72)
-CursorKind.INVALID_CODE = CursorKind(73)
+    # An expression that refers to some value declaration, such as a function,
+    # variable, or enumerator.
+    DECL_REF_EXPR = 101
 
-###
-# Expression Kinds
+    # An expression that refers to a member of a struct, union, class, Objective-C
+    # class, etc.
+    MEMBER_REF_EXPR = 102
 
-# An expression whose specific kind is not exposed via this interface.
-#
-# Unexposed expressions have the same operations as any other kind of
-# expression; one can extract their location information, spelling, children,
-# etc. However, the specific kind of the expression is not reported.
-CursorKind.UNEXPOSED_EXPR = CursorKind(100)
+    # An expression that calls a function.
+    CALL_EXPR = 103
 
-# An expression that refers to some value declaration, such as a function,
-# variable, or enumerator.
-CursorKind.DECL_REF_EXPR = CursorKind(101)
+    # An expression that sends a message to an Objective-C object or class.
+    OBJC_MESSAGE_EXPR = 104
 
-# An expression that refers to a member of a struct, union, class, Objective-C
-# class, etc.
-CursorKind.MEMBER_REF_EXPR = CursorKind(102)
+    # An expression that represents a block literal.
+    BLOCK_EXPR = 105
 
-# An expression that calls a function.
-CursorKind.CALL_EXPR = CursorKind(103)
+    # An integer literal.
+    INTEGER_LITERAL = 106
 
-# An expression that sends a message to an Objective-C object or class.
-CursorKind.OBJC_MESSAGE_EXPR = CursorKind(104)
+    # A floating point number literal.
+    FLOATING_LITERAL = 107
 
-# An expression that represents a block literal.
-CursorKind.BLOCK_EXPR = CursorKind(105)
+    # An imaginary number literal.
+    IMAGINARY_LITERAL = 108
 
-# An integer literal.
-CursorKind.INTEGER_LITERAL = CursorKind(106)
+    # A string literal.
+    STRING_LITERAL = 109
 
-# A floating point number literal.
-CursorKind.FLOATING_LITERAL = CursorKind(107)
+    # A character literal.
+    CHARACTER_LITERAL = 110
 
-# An imaginary number literal.
-CursorKind.IMAGINARY_LITERAL = CursorKind(108)
+    # A parenthesized expression, e.g. "(1)".
+    #
+    # This AST node is only formed if full location information is requested.
+    PAREN_EXPR = 111
 
-# A string literal.
-CursorKind.STRING_LITERAL = CursorKind(109)
+    # This represents the unary-expression's (except sizeof and
+    # alignof).
+    UNARY_OPERATOR = 112
 
-# A character literal.
-CursorKind.CHARACTER_LITERAL = CursorKind(110)
+    # [C99 6.5.2.1] Array Subscripting.
+    ARRAY_SUBSCRIPT_EXPR = 113
 
-# A parenthesized expression, e.g. "(1)".
-#
-# This AST node is only formed if full location information is requested.
-CursorKind.PAREN_EXPR = CursorKind(111)
+    # A builtin binary operation expression such as "x + y" or "x <= y".
+    BINARY_OPERATOR = 114
 
-# This represents the unary-expression's (except sizeof and
-# alignof).
-CursorKind.UNARY_OPERATOR = CursorKind(112)
+    # Compound assignment such as "+=".
+    COMPOUND_ASSIGNMENT_OPERATOR = 115
 
-# [C99 6.5.2.1] Array Subscripting.
-CursorKind.ARRAY_SUBSCRIPT_EXPR = CursorKind(113)
+    # The ?: ternary operator.
+    CONDITIONAL_OPERATOR = 116
 
-# A builtin binary operation expression such as "x + y" or
-# "x <= y".
-CursorKind.BINARY_OPERATOR = CursorKind(114)
+    # An explicit cast in C (C99 6.5.4) or a C-style cast in C++
+    # (C++ [expr.cast]), which uses the syntax (Type)expr.
+    #
+    # For example: (int)f.
+    CSTYLE_CAST_EXPR = 117
 
-# Compound assignment such as "+=".
-CursorKind.COMPOUND_ASSIGNMENT_OPERATOR = CursorKind(115)
+    # [C99 6.5.2.5]
+    COMPOUND_LITERAL_EXPR = 118
 
-# The ?: ternary operator.
-CursorKind.CONDITIONAL_OPERATOR = CursorKind(116)
+    # Describes an C or C++ initializer list.
+    INIT_LIST_EXPR = 119
 
-# An explicit cast in C (C99 6.5.4) or a C-style cast in C++
-# (C++ [expr.cast]), which uses the syntax (Type)expr.
-#
-# For example: (int)f.
-CursorKind.CSTYLE_CAST_EXPR = CursorKind(117)
+    # The GNU address of label extension, representing &&label.
+    ADDR_LABEL_EXPR = 120
 
-# [C99 6.5.2.5]
-CursorKind.COMPOUND_LITERAL_EXPR = CursorKind(118)
+    # This is the GNU Statement Expression extension: ({int X=4; X;})
+    StmtExpr = 121
 
-# Describes an C or C++ initializer list.
-CursorKind.INIT_LIST_EXPR = CursorKind(119)
+    # Represents a C11 generic selection.
+    GENERIC_SELECTION_EXPR = 122
 
-# The GNU address of label extension, representing &&label.
-CursorKind.ADDR_LABEL_EXPR = CursorKind(120)
+    # Implements the GNU __null extension, which is a name for a null
+    # pointer constant that has integral type (e.g., int or long) and is the same
+    # size and alignment as a pointer.
+    #
+    # The __null extension is typically only used by system headers, which define
+    # NULL as __null in C++ rather than using 0 (which is an integer that may not
+    # match the size of a pointer).
+    GNU_NULL_EXPR = 123
 
-# This is the GNU Statement Expression extension: ({int X=4; X;})
-CursorKind.StmtExpr = CursorKind(121)
+    # C++'s static_cast<> expression.
+    CXX_STATIC_CAST_EXPR = 124
 
-# Represents a C11 generic selection.
-CursorKind.GENERIC_SELECTION_EXPR = CursorKind(122)
+    # C++'s dynamic_cast<> expression.
+    CXX_DYNAMIC_CAST_EXPR = 125
 
-# Implements the GNU __null extension, which is a name for a null
-# pointer constant that has integral type (e.g., int or long) and is the same
-# size and alignment as a pointer.
-#
-# The __null extension is typically only used by system headers, which define
-# NULL as __null in C++ rather than using 0 (which is an integer that may not
-# match the size of a pointer).
-CursorKind.GNU_NULL_EXPR = CursorKind(123)
+    # C++'s reinterpret_cast<> expression.
+    CXX_REINTERPRET_CAST_EXPR = 126
 
-# C++'s static_cast<> expression.
-CursorKind.CXX_STATIC_CAST_EXPR = CursorKind(124)
+    # C++'s const_cast<> expression.
+    CXX_CONST_CAST_EXPR = 127
 
-# C++'s dynamic_cast<> expression.
-CursorKind.CXX_DYNAMIC_CAST_EXPR = CursorKind(125)
+    # Represents an explicit C++ type conversion that uses "functional"
+    # notion (C++ [expr.type.conv]).
+    #
+    # Example:
+    # \code
+    #   x = int(0.5);
+    # \endcode
+    CXX_FUNCTIONAL_CAST_EXPR = 128
 
-# C++'s reinterpret_cast<> expression.
-CursorKind.CXX_REINTERPRET_CAST_EXPR = CursorKind(126)
+    # A C++ typeid expression (C++ [expr.typeid]).
+    CXX_TYPEID_EXPR = 129
 
-# C++'s const_cast<> expression.
-CursorKind.CXX_CONST_CAST_EXPR = CursorKind(127)
+    # [C++ 2.13.5] C++ Boolean Literal.
+    CXX_BOOL_LITERAL_EXPR = 130
 
-# Represents an explicit C++ type conversion that uses "functional"
-# notion (C++ [expr.type.conv]).
-#
-# Example:
-# \code
-#   x = int(0.5);
-# \endcode
-CursorKind.CXX_FUNCTIONAL_CAST_EXPR = CursorKind(128)
+    # [C++0x 2.14.7] C++ Pointer Literal.
+    CXX_NULL_PTR_LITERAL_EXPR = 131
 
-# A C++ typeid expression (C++ [expr.typeid]).
-CursorKind.CXX_TYPEID_EXPR = CursorKind(129)
+    # Represents the "this" expression in C++
+    CXX_THIS_EXPR = 132
 
-# [C++ 2.13.5] C++ Boolean Literal.
-CursorKind.CXX_BOOL_LITERAL_EXPR = CursorKind(130)
+    # [C++ 15] C++ Throw Expression.
+    #
+    # This handles 'throw' and 'throw' assignment-expression. When
+    # assignment-expression isn't present, Op will be null.
+    CXX_THROW_EXPR = 133
 
-# [C++0x 2.14.7] C++ Pointer Literal.
-CursorKind.CXX_NULL_PTR_LITERAL_EXPR = CursorKind(131)
+    # A new expression for memory allocation and constructor calls, e.g:
+    # "new CXXNewExpr(foo)".
+    CXX_NEW_EXPR = 134
 
-# Represents the "this" expression in C++
-CursorKind.CXX_THIS_EXPR = CursorKind(132)
+    # A delete expression for memory deallocation and destructor calls,
+    # e.g. "delete[] pArray".
+    CXX_DELETE_EXPR = 135
 
-# [C++ 15] C++ Throw Expression.
-#
-# This handles 'throw' and 'throw' assignment-expression. When
-# assignment-expression isn't present, Op will be null.
-CursorKind.CXX_THROW_EXPR = CursorKind(133)
+    # Represents a unary expression.
+    CXX_UNARY_EXPR = 136
 
-# A new expression for memory allocation and constructor calls, e.g:
-# "new CXXNewExpr(foo)".
-CursorKind.CXX_NEW_EXPR = CursorKind(134)
+    # ObjCStringLiteral, used for Objective-C string literals i.e. "foo".
+    OBJC_STRING_LITERAL = 137
 
-# A delete expression for memory deallocation and destructor calls,
-# e.g. "delete[] pArray".
-CursorKind.CXX_DELETE_EXPR = CursorKind(135)
+    # ObjCEncodeExpr, used for in Objective-C.
+    OBJC_ENCODE_EXPR = 138
 
-# Represents a unary expression.
-CursorKind.CXX_UNARY_EXPR = CursorKind(136)
+    # ObjCSelectorExpr used for in Objective-C.
+    OBJC_SELECTOR_EXPR = 139
 
-# ObjCStringLiteral, used for Objective-C string literals i.e. "foo".
-CursorKind.OBJC_STRING_LITERAL = CursorKind(137)
+    # Objective-C's protocol expression.
+    OBJC_PROTOCOL_EXPR = 140
 
-# ObjCEncodeExpr, used for in Objective-C.
-CursorKind.OBJC_ENCODE_EXPR = CursorKind(138)
+    # An Objective-C "bridged" cast expression, which casts between
+    # Objective-C pointers and C pointers, transferring ownership in the process.
+    #
+    # \code
+    #   NSString *str = (__bridge_transfer NSString *)CFCreateString();
+    # \endcode
+    OBJC_BRIDGE_CAST_EXPR = 141
 
-# ObjCSelectorExpr used for in Objective-C.
-CursorKind.OBJC_SELECTOR_EXPR = CursorKind(139)
+    # Represents a C++0x pack expansion that produces a sequence of
+    # expressions.
+    #
+    # A pack expansion expression contains a pattern (which itself is an
+    # expression) followed by an ellipsis. For example:
+    PACK_EXPANSION_EXPR = 142
 
-# Objective-C's protocol expression.
-CursorKind.OBJC_PROTOCOL_EXPR = CursorKind(140)
+    # Represents an expression that computes the length of a parameter
+    # pack.
+    SIZE_OF_PACK_EXPR = 143
 
-# An Objective-C "bridged" cast expression, which casts between
-# Objective-C pointers and C pointers, transferring ownership in the process.
-#
-# \code
-#   NSString *str = (__bridge_transfer NSString *)CFCreateString();
-# \endcode
-CursorKind.OBJC_BRIDGE_CAST_EXPR = CursorKind(141)
+    # Represents a C++ lambda expression that produces a local function
+    # object.
+    #
+    #  \code
+    #  void abssort(float *x, unsigned N) {
+    #    std::sort(x, x + N,
+    #              [](float a, float b) {
+    #                return std::abs(a) < std::abs(b);
+    #              });
+    #  }
+    #  \endcode
+    LAMBDA_EXPR = 144
 
-# Represents a C++0x pack expansion that produces a sequence of
-# expressions.
-#
-# A pack expansion expression contains a pattern (which itself is an
-# expression) followed by an ellipsis. For example:
-CursorKind.PACK_EXPANSION_EXPR = CursorKind(142)
+    # Objective-c Boolean Literal.
+    OBJ_BOOL_LITERAL_EXPR = 145
 
-# Represents an expression that computes the length of a parameter
-# pack.
-CursorKind.SIZE_OF_PACK_EXPR = CursorKind(143)
+    # Represents the "self" expression in a ObjC method.
+    OBJ_SELF_EXPR = 146
 
-# Represents a C++ lambda expression that produces a local function
-# object.
-#
-#  \code
-#  void abssort(float *x, unsigned N) {
-#    std::sort(x, x + N,
-#              [](float a, float b) {
-#                return std::abs(a) < std::abs(b);
-#              });
-#  }
-#  \endcode
-CursorKind.LAMBDA_EXPR = CursorKind(144)
+    # OpenMP 4.0 [2.4, Array Section].
+    OMP_ARRAY_SECTION_EXPR = 147
 
-# Objective-c Boolean Literal.
-CursorKind.OBJ_BOOL_LITERAL_EXPR = CursorKind(145)
+    # Represents an @available(...) check.
+    OBJC_AVAILABILITY_CHECK_EXPR = 148
 
-# Represents the "self" expression in a ObjC method.
-CursorKind.OBJ_SELF_EXPR = CursorKind(146)
+    # Fixed point literal.
+    FIXED_POINT_LITERAL = 149
 
-# OpenMP 4.0 [2.4, Array Section].
-CursorKind.OMP_ARRAY_SECTION_EXPR = CursorKind(147)
+    # OpenMP 5.0 [2.1.4, Array Shaping].
+    OMP_ARRAY_SHAPING_EXPR = 150
 
-# Represents an @available(...) check.
-CursorKind.OBJC_AVAILABILITY_CHECK_EXPR = CursorKind(148)
+    # OpenMP 5.0 [2.1.6 Iterators].
+    OMP_ITERATOR_EXPR = 151
 
-# Fixed point literal.
-CursorKind.FIXED_POINT_LITERAL = CursorKind(149)
+    # OpenCL's addrspace_cast<> expression.
+    CXX_ADDRSPACE_CAST_EXPR = 152
 
-# OpenMP 5.0 [2.1.4, Array Shaping].
-CursorKind.OMP_ARRAY_SHAPING_EXPR = CursorKind(150)
+    # Expression that references a C++20 concept.
+    CONCEPT_SPECIALIZATION_EXPR = 153
 
-# OpenMP 5.0 [2.1.6 Iterators].
-CursorKind.OMP_ITERATOR_EXPR = CursorKind(151)
+    # Expression that references a C++20 requires expression.
+    REQUIRES_EXPR = 154
 
-# OpenCL's addrspace_cast<> expression.
-CursorKind.CXX_ADDRSPACE_CAST_EXPR = CursorKind(152)
+    # Expression that references a C++20 parenthesized list aggregate initializer.
+    CXX_PAREN_LIST_INIT_EXPR = 155
 
-# Expression that references a C++20 concept.
-CursorKind.CONCEPT_SPECIALIZATION_EXPR = CursorKind(153)
+    # Represents a C++26 pack indexing expression.
+    PACK_INDEXING_EXPR = 156
 
-# Expression that references a C++20 requires expression.
-CursorKind.REQUIRES_EXPR = CursorKind(154)
+    # A statement whose specific kind is not exposed via this interface.
+    #
+    # Unexposed statements have the same operations as any other kind of statement;
+    # one can extract their location information, spelling, children, etc. However,
+    # the specific kind of the statement is not reported.
+    UNEXPOSED_STMT = 200
 
-# Expression that references a C++20 parenthesized list aggregate initializer.
-CursorKind.CXX_PAREN_LIST_INIT_EXPR = CursorKind(155)
+    # A labelled statement in a function.
+    LABEL_STMT = 201
 
-# Represents a C++26 pack indexing expression.
-CursorKind.PACK_INDEXING_EXPR = CursorKind(156)
+    # A compound statement
+    COMPOUND_STMT = 202
 
-# A statement whose specific kind is not exposed via this interface.
-#
-# Unexposed statements have the same operations as any other kind of statement;
-# one can extract their location information, spelling, children, etc. However,
-# the specific kind of the statement is not reported.
-CursorKind.UNEXPOSED_STMT = CursorKind(200)
+    # A case statement.
+    CASE_STMT = 203
 
-# A labelled statement in a function.
-CursorKind.LABEL_STMT = CursorKind(201)
+    # A default statement.
+    DEFAULT_STMT = 204
 
-# A compound statement
-CursorKind.COMPOUND_STMT = CursorKind(202)
+    # An if statement.
+    IF_STMT = 205
 
-# A case statement.
-CursorKind.CASE_STMT = CursorKind(203)
+    # A switch statement.
+    SWITCH_STMT = 206
 
-# A default statement.
-CursorKind.DEFAULT_STMT = CursorKind(204)
+    # A while statement.
+    WHILE_STMT = 207
 
-# An if statement.
-CursorKind.IF_STMT = CursorKind(205)
+    # A do statement.
+    DO_STMT = 208
 
-# A switch statement.
-CursorKind.SWITCH_STMT = CursorKind(206)
+    # A for statement.
+    FOR_STMT = 209
 
-# A while statement.
-CursorKind.WHILE_STMT = CursorKind(207)
+    # A goto statement.
+    GOTO_STMT = 210
 
-# A do statement.
-CursorKind.DO_STMT = CursorKind(208)
+    # An indirect goto statement.
+    INDIRECT_GOTO_STMT = 211
 
-# A for statement.
-CursorKind.FOR_STMT = CursorKind(209)
+    # A continue statement.
+    CONTINUE_STMT = 212
 
-# A goto statement.
-CursorKind.GOTO_STMT = CursorKind(210)
+    # A break statement.
+    BREAK_STMT = 213
 
-# An indirect goto statement.
-CursorKind.INDIRECT_GOTO_STMT = CursorKind(211)
+    # A return statement.
+    RETURN_STMT = 214
 
-# A continue statement.
-CursorKind.CONTINUE_STMT = CursorKind(212)
+    # A GNU-style inline assembler statement.
+    ASM_STMT = 215
 
-# A break statement.
-CursorKind.BREAK_STMT = CursorKind(213)
+    # Objective-C's overall @try- at catch-@finally statement.
+    OBJC_AT_TRY_STMT = 216
 
-# A return statement.
-CursorKind.RETURN_STMT = CursorKind(214)
+    # Objective-C's @catch statement.
+    OBJC_AT_CATCH_STMT = 217
 
-# A GNU-style inline assembler statement.
-CursorKind.ASM_STMT = CursorKind(215)
+    # Objective-C's @finally statement.
+    OBJC_AT_FINALLY_STMT = 218
 
-# Objective-C's overall @try- at catch-@finally statement.
-CursorKind.OBJC_AT_TRY_STMT = CursorKind(216)
+    # Objective-C's @throw statement.
+    OBJC_AT_THROW_STMT = 219
 
-# Objective-C's @catch statement.
-CursorKind.OBJC_AT_CATCH_STMT = CursorKind(217)
+    # Objective-C's @synchronized statement.
+    OBJC_AT_SYNCHRONIZED_STMT = 220
 
-# Objective-C's @finally statement.
-CursorKind.OBJC_AT_FINALLY_STMT = CursorKind(218)
+    # Objective-C's autorelease pool statement.
+    OBJC_AUTORELEASE_POOL_STMT = 221
 
-# Objective-C's @throw statement.
-CursorKind.OBJC_AT_THROW_STMT = CursorKind(219)
+    # Objective-C's for collection statement.
+    OBJC_FOR_COLLECTION_STMT = 222
 
-# Objective-C's @synchronized statement.
-CursorKind.OBJC_AT_SYNCHRONIZED_STMT = CursorKind(220)
+    # C++'s catch statement.
+    CXX_CATCH_STMT = 223
 
-# Objective-C's autorelease pool statement.
-CursorKind.OBJC_AUTORELEASE_POOL_STMT = CursorKind(221)
+    # C++'s try statement.
+    CXX_TRY_STMT = 224
 
-# Objective-C's for collection statement.
-CursorKind.OBJC_FOR_COLLECTION_STMT = CursorKind(222)
+    # C++'s for (* : *) statement.
+    CXX_FOR_RANGE_STMT = 225
 
-# C++'s catch statement.
-CursorKind.CXX_CATCH_STMT = CursorKind(223)
+    # Windows Structured Exception Handling's try statement.
+    SEH_TRY_STMT = 226
 
-# C++'s try statement.
-CursorKind.CXX_TRY_STMT = CursorKind(224)
+    # Windows Structured Exception Handling's except statement.
+    SEH_EXCEPT_STMT = 227
 
-# C++'s for (* : *) statement.
-CursorKind.CXX_FOR_RANGE_STMT = CursorKind(225)
+    # Windows Structured Exception Handling's finally statement.
+    SEH_FINALLY_STMT = 228
 
-# Windows Structured Exception Handling's try statement.
-CursorKind.SEH_TRY_STMT = CursorKind(226)
+    # A MS inline assembly statement extension.
+    MS_ASM_STMT = 229
 
-# Windows Structured Exception Handling's except statement.
-CursorKind.SEH_EXCEPT_STMT = CursorKind(227)
+    # The null statement.
+    NULL_STMT = 230
 
-# Windows Structured Exception Handling's finally statement.
-CursorKind.SEH_FINALLY_STMT = CursorKind(228)
+    # Adaptor class for mixing declarations with statements and expressions.
+    DECL_STMT = 231
 
-# A MS inline assembly statement extension.
-CursorKind.MS_ASM_STMT = CursorKind(229)
+    # OpenMP parallel directive.
+    OMP_PARALLEL_DIRECTIVE = 232
 
-# The null statement.
-CursorKind.NULL_STMT = CursorKind(230)
+    # OpenMP SIMD directive.
+    OMP_SIMD_DIRECTIVE = 233
 
-# Adaptor class for mixing declarations with statements and expressions.
-CursorKind.DECL_STMT = CursorKind(231)
+    # OpenMP for directive.
+    OMP_FOR_DIRECTIVE = 234
 
-# OpenMP parallel directive.
-CursorKind.OMP_PARALLEL_DIRECTIVE = CursorKind(232)
+    # OpenMP sections directive.
+    OMP_SECTIONS_DIRECTIVE = 235
 
-# OpenMP SIMD directive.
-CursorKind.OMP_SIMD_DIRECTIVE = CursorKind(233)
+    # OpenMP section directive.
+    OMP_SECTION_DIRECTIVE = 236
 
-# OpenMP for directive.
-CursorKind.OMP_FOR_DIRECTIVE = CursorKind(234)
+    # OpenMP single directive.
+    OMP_SINGLE_DIRECTIVE = 237
 
-# OpenMP sections directive.
-CursorKind.OMP_SECTIONS_DIRECTIVE = CursorKind(235)
+    # OpenMP parallel for directive.
+    OMP_PARALLEL_FOR_DIRECTIVE = 238
 
-# OpenMP section directive.
-CursorKind.OMP_SECTION_DIRECTIVE = CursorKind(236)
+    # OpenMP parallel sections directive.
+    OMP_PARALLEL_SECTIONS_DIRECTIVE = 239
 
-# OpenMP single directive.
-CursorKind.OMP_SINGLE_DIRECTIVE = CursorKind(237)
+    # OpenMP task directive.
+    OMP_TASK_DIRECTIVE = 240
 
-# OpenMP parallel for directive.
-CursorKind.OMP_PARALLEL_FOR_DIRECTIVE = CursorKind(238)
+    # OpenMP master directive.
+    OMP_MASTER_DIRECTIVE = 241
 
-# OpenMP parallel sections directive.
-CursorKind.OMP_PARALLEL_SECTIONS_DIRECTIVE = CursorKind(239)
+    # OpenMP critical directive.
+    OMP_CRITICAL_DIRECTIVE = 242
 
-# OpenMP task directive.
-CursorKind.OMP_TASK_DIRECTIVE = CursorKind(240)
+    # OpenMP taskyield directive.
+    OMP_TASKYIELD_DIRECTIVE = 243
 
-# OpenMP master directive.
-CursorKind.OMP_MASTER_DIRECTIVE = CursorKind(241)
+    # OpenMP barrier directive.
+    OMP_BARRIER_DIRECTIVE = 244
 
-# OpenMP critical directive.
-CursorKind.OMP_CRITICAL_DIRECTIVE = CursorKind(242)
+    # OpenMP taskwait directive.
+    OMP_TASKWAIT_DIRECTIVE = 245
 
-# OpenMP taskyield directive.
-CursorKind.OMP_TASKYIELD_DIRECTIVE = CursorKind(243)
+    # OpenMP flush directive.
+    OMP_FLUSH_DIRECTIVE = 246
 
-# OpenMP barrier directive.
-CursorKind.OMP_BARRIER_DIRECTIVE = CursorKind(244)
+    # Windows Structured Exception Handling's leave statement.
+    SEH_LEAVE_STMT = 247
 
-# OpenMP taskwait directive.
-CursorKind.OMP_TASKWAIT_DIRECTIVE = CursorKind(245)
+    # OpenMP ordered directive.
+    OMP_ORDERED_DIRECTIVE = 248
 
-# OpenMP flush directive.
-CursorKind.OMP_FLUSH_DIRECTIVE = CursorKind(246)
+    # OpenMP atomic directive.
+    OMP_ATOMIC_DIRECTIVE = 249
 
-# Windows Structured Exception Handling's leave statement.
-CursorKind.SEH_LEAVE_STMT = CursorKind(247)
+    # OpenMP for SIMD directive.
+    OMP_FOR_SIMD_DIRECTIVE = 250
 
-# OpenMP ordered directive.
-CursorKind.OMP_ORDERED_DIRECTIVE = CursorKind(248)
+    # OpenMP parallel for SIMD directive.
+    OMP_PARALLELFORSIMD_DIRECTIVE = 251
 
-# OpenMP atomic directive.
-CursorKind.OMP_ATOMIC_DIRECTIVE = CursorKind(249)
+    # OpenMP target directive.
+    OMP_TARGET_DIRECTIVE = 252
 
-# OpenMP for SIMD directive.
-CursorKind.OMP_FOR_SIMD_DIRECTIVE = CursorKind(250)
+    # OpenMP teams directive.
+    OMP_TEAMS_DIRECTIVE = 253
 
-# OpenMP parallel for SIMD directive.
-CursorKind.OMP_PARALLELFORSIMD_DIRECTIVE = CursorKind(251)
+    # OpenMP taskgroup directive.
+    OMP_TASKGROUP_DIRECTIVE = 254
 
-# OpenMP target directive.
-CursorKind.OMP_TARGET_DIRECTIVE = CursorKind(252)
+    # OpenMP cancellation point directive.
+    OMP_CANCELLATION_POINT_DIRECTIVE = 255
 
-# OpenMP teams directive.
-CursorKind.OMP_TEAMS_DIRECTIVE = CursorKind(253)
+    # OpenMP cancel directive.
+    OMP_CANCEL_DIRECTIVE = 256
 
-# OpenMP taskgroup directive.
-CursorKind.OMP_TASKGROUP_DIRECTIVE = CursorKind(254)
+    # OpenMP target data directive.
+    OMP_TARGET_DATA_DIRECTIVE = 257
 
-# OpenMP cancellation point directive.
-CursorKind.OMP_CANCELLATION_POINT_DIRECTIVE = CursorKind(255)
+    # OpenMP taskloop directive.
+    OMP_TASK_LOOP_DIRECTIVE = 258
 
-# OpenMP cancel directive.
-CursorKind.OMP_CANCEL_DIRECTIVE = CursorKind(256)
+    # OpenMP taskloop simd directive.
+    OMP_TASK_LOOP_SIMD_DIRECTIVE = 259
 
-# OpenMP target data directive.
-CursorKind.OMP_TARGET_DATA_DIRECTIVE = CursorKind(257)
+    # OpenMP distribute directive.
+    OMP_DISTRIBUTE_DIRECTIVE = 260
 
-# OpenMP taskloop directive.
-CursorKind.OMP_TASK_LOOP_DIRECTIVE = CursorKind(258)
+    # OpenMP target enter data directive.
+    OMP_TARGET_ENTER_DATA_DIRECTIVE = 261
 
-# OpenMP taskloop simd directive.
-CursorKind.OMP_TASK_LOOP_SIMD_DIRECTIVE = CursorKind(259)
+    # OpenMP target exit data directive.
+    OMP_TARGET_EXIT_DATA_DIRECTIVE = 262
 
-# OpenMP distribute directive.
-CursorKind.OMP_DISTRIBUTE_DIRECTIVE = CursorKind(260)
+    # OpenMP target parallel directive.
+    OMP_TARGET_PARALLEL_DIRECTIVE = 263
 
-# OpenMP target enter data directive.
-CursorKind.OMP_TARGET_ENTER_DATA_DIRECTIVE = CursorKind(261)
+    # OpenMP target parallel for directive.
+    OMP_TARGET_PARALLELFOR_DIRECTIVE = 264
 
-# OpenMP target exit data directive.
-CursorKind.OMP_TARGET_EXIT_DATA_DIRECTIVE = CursorKind(262)
+    # OpenMP target update directive.
+    OMP_TARGET_UPDATE_DIRECTIVE = 265
 
-# OpenMP target parallel directive.
-CursorKind.OMP_TARGET_PARALLEL_DIRECTIVE = CursorKind(263)
+    # OpenMP distribute parallel for directive.
+    OMP_DISTRIBUTE_PARALLELFOR_DIRECTIVE = 266
 
-# OpenMP target parallel for directive.
-CursorKind.OMP_TARGET_PARALLELFOR_DIRECTIVE = CursorKind(264)
+    # OpenMP distribute parallel for simd directive.
+    OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE = 267
 
-# OpenMP target update directive.
-CursorKind.OMP_TARGET_UPDATE_DIRECTIVE = CursorKind(265)
+    # OpenMP distribute simd directive.
+    OMP_DISTRIBUTE_SIMD_DIRECTIVE = 268
 
-# OpenMP distribute parallel for directive.
-CursorKind.OMP_DISTRIBUTE_PARALLELFOR_DIRECTIVE = CursorKind(266)
+    # OpenMP target parallel for simd directive.
+    OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE = 269
 
-# OpenMP distribute parallel for simd directive.
-CursorKind.OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE = CursorKind(267)
+    # OpenMP target simd directive.
+    OMP_TARGET_SIMD_DIRECTIVE = 270
 
-# OpenMP distribute simd directive.
-CursorKind.OMP_DISTRIBUTE_SIMD_DIRECTIVE = CursorKind(268)
+    # OpenMP teams distribute directive.
+    OMP_TEAMS_DISTRIBUTE_DIRECTIVE = 271
 
-# OpenMP target parallel for simd directive.
-CursorKind.OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE = CursorKind(269)
+    # OpenMP teams distribute simd directive.
+    OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE = 272
----------------
DeinAlptraum wrote:

Note that I changed the enum name here. It had the same name as variant 271 which was a mistake apparently (see https://clang.llvm.org/doxygen/Index_8h_source.html, line 2010). This failed the type check due to duplicate variant name. 

https://github.com/llvm/llvm-project/pull/78114


More information about the cfe-commits mailing list