From 4fb1d602b96d607e90c1050db290933631d83c6e Mon Sep 17 00:00:00 2001 From: kamomehettapi <179056474+kamomehettapi@users.noreply.github.com> Date: Mon, 3 Feb 2025 03:07:02 -0600 Subject: [PATCH] Upgrade llvm version to v19.1.3. (#77) --- .github/workflows/libclang-alpine-amd64.yml | 2 +- .github/workflows/libclang-linux-aarch64.yml | 2 +- .github/workflows/libclang-linux-amd64.yml | 2 +- .github/workflows/libclang-linux-arm.yml | 2 +- .github/workflows/libclang-macosx-amd64.yml | 2 +- .github/workflows/libclang-macosx-arm64.yml | 2 +- .../workflows/libclang-windows-aarch64.yml | 2 +- .github/workflows/libclang-windows-amd64.yml | 2 +- docs/conf.py | 4 +- docs/index.rst | 2 +- python/clang/cindex.py | 1806 +++++++++-------- scripts/data/clang_bindings.patch | 131 -- scripts/update_python_clang_bindings.sh | 3 +- setup.py | 2 +- setup_ext.py | 2 +- 15 files changed, 922 insertions(+), 1044 deletions(-) diff --git a/.github/workflows/libclang-alpine-amd64.yml b/.github/workflows/libclang-alpine-amd64.yml index b91ebdf..5d9ea36 100644 --- a/.github/workflows/libclang-alpine-amd64.yml +++ b/.github/workflows/libclang-alpine-amd64.yml @@ -3,7 +3,7 @@ name: libclang-alpine-amd64 on: [push, pull_request] env: - LLVM_VER: 18.1.1 + LLVM_VER: 19.1.3 concurrency: group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} diff --git a/.github/workflows/libclang-linux-aarch64.yml b/.github/workflows/libclang-linux-aarch64.yml index 59121d4..0a8a8be 100644 --- a/.github/workflows/libclang-linux-aarch64.yml +++ b/.github/workflows/libclang-linux-aarch64.yml @@ -3,7 +3,7 @@ name: libclang-linux-aarch64 on: [push, pull_request] env: - LLVM_VER: 18.1.1 + LLVM_VER: 19.1.3 concurrency: group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} diff --git a/.github/workflows/libclang-linux-amd64.yml b/.github/workflows/libclang-linux-amd64.yml index c05998c..f608888 100644 --- a/.github/workflows/libclang-linux-amd64.yml +++ b/.github/workflows/libclang-linux-amd64.yml @@ -3,7 +3,7 @@ name: libclang-linux-amd64 on: [push, pull_request] env: - LLVM_VER: 18.1.1 + LLVM_VER: 19.1.3 concurrency: group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} diff --git a/.github/workflows/libclang-linux-arm.yml b/.github/workflows/libclang-linux-arm.yml index 5af8216..d5c705e 100644 --- a/.github/workflows/libclang-linux-arm.yml +++ b/.github/workflows/libclang-linux-arm.yml @@ -3,7 +3,7 @@ name: libclang-linux-arm on: [push, pull_request] env: - LLVM_VER: 18.1.1 + LLVM_VER: 19.1.3 concurrency: group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} diff --git a/.github/workflows/libclang-macosx-amd64.yml b/.github/workflows/libclang-macosx-amd64.yml index 1485c8a..31a05ef 100644 --- a/.github/workflows/libclang-macosx-amd64.yml +++ b/.github/workflows/libclang-macosx-amd64.yml @@ -3,7 +3,7 @@ name: libclang-macosx-amd64 on: [push, pull_request] env: - LLVM_VER: 18.1.1 + LLVM_VER: 19.1.3 MACOSX_DEPLOYMENT_TARGET: "10.9" concurrency: diff --git a/.github/workflows/libclang-macosx-arm64.yml b/.github/workflows/libclang-macosx-arm64.yml index be791ff..58777e0 100644 --- a/.github/workflows/libclang-macosx-arm64.yml +++ b/.github/workflows/libclang-macosx-arm64.yml @@ -3,7 +3,7 @@ name: libclang-macosx-arm64 on: [push, pull_request] env: - LLVM_VER: 18.1.1 + LLVM_VER: 19.1.3 MACOSX_DEPLOYMENT_TARGET: "10.15" concurrency: diff --git a/.github/workflows/libclang-windows-aarch64.yml b/.github/workflows/libclang-windows-aarch64.yml index 5f88239..043fc6d 100644 --- a/.github/workflows/libclang-windows-aarch64.yml +++ b/.github/workflows/libclang-windows-aarch64.yml @@ -3,7 +3,7 @@ name: libclang-windows-aarch64 on: [push, pull_request] env: - LLVM_VER: 18.1.1 + LLVM_VER: 19.1.3 concurrency: group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} diff --git a/.github/workflows/libclang-windows-amd64.yml b/.github/workflows/libclang-windows-amd64.yml index bbb484f..b70b278 100644 --- a/.github/workflows/libclang-windows-amd64.yml +++ b/.github/workflows/libclang-windows-amd64.yml @@ -3,7 +3,7 @@ name: libclang-windows-amd64 on: [push, pull_request] env: - LLVM_VER: 18.1.1 + LLVM_VER: 19.1.3 concurrency: group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} diff --git a/docs/conf.py b/docs/conf.py index 5441988..26c42d5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -63,9 +63,9 @@ # built documents. # # The short X.Y version. -version = '18.1.1' +version = '19.1.3' # The full version, including alpha/beta/rc tags. -release = '18.1.1' +release = '19.1.3' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/index.rst b/docs/index.rst index baf405d..30e85d1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,5 +1,5 @@ :Date: 2021-04-17 -:Version: 18.1.1 +:Version: 19.1.3 :Authors: - The LLVM Team .. meta:: diff --git a/python/clang/cindex.py b/python/clang/cindex.py index 66eeac8..b9c1cc1 100644 --- a/python/clang/cindex.py +++ b/python/clang/cindex.py @@ -64,10 +64,9 @@ from ctypes import * -import clang.enumerations - import collections.abc import os +from enum import Enum # Python 3 strings are unicode, translate them to/from utf8 for C-interop. @@ -572,107 +571,51 @@ def get_tokens(tu, extent): yield token -class TokenKind: - """Describes a specific type of a Token.""" - - _value_map = {} # int -> TokenKind - - def __init__(self, value, name): - """Create a new TokenKind instance from a numeric value and a name.""" - self.value = value - self.name = name - - def __repr__(self): - return "TokenKind.%s" % (self.name,) - - @staticmethod - def from_value(value): - """Obtain a registered TokenKind instance from its value.""" - result = TokenKind._value_map.get(value, None) - - if result is None: - raise ValueError("Unknown TokenKind: %d" % value) - - return result - - @staticmethod - def register(value, name): - """Register a new TokenKind enumeration. - - This should only be called at module load time by code within this - package. - """ - if value in TokenKind._value_map: - raise ValueError("TokenKind already registered: %d" % value) - - kind = TokenKind(value, name) - TokenKind._value_map[value] = kind - setattr(TokenKind, name, kind) - - ### Cursor Kinds ### -class BaseEnumeration: +class BaseEnumeration(Enum): """ Common base class for named enumerations held in sync with Index.h values. - - Subclasses must define their own _kinds and _name_map members, as: - _kinds = [] - _name_map = None - These values hold the per-subclass instances and value-to-name mappings, - respectively. - """ - def __init__(self, value): - if value >= len(self.__class__._kinds): - self.__class__._kinds += [None] * (value - len(self.__class__._kinds) + 1) - if self.__class__._kinds[value] is not None: - raise ValueError( - "{0} value {1} already loaded".format(str(self.__class__), value) - ) - self.value = value - self.__class__._kinds[value] = self - self.__class__._name_map = None def from_param(self): return self.value - @property - def name(self): - """Get the enumeration name of this cursor kind.""" - if self._name_map is None: - self._name_map = {} - for key, value in self.__class__.__dict__.items(): - if isinstance(value, self.__class__): - self._name_map[value] = key - return self._name_map[self] - @classmethod def from_id(cls, id): - if id >= len(cls._kinds) or cls._kinds[id] is None: - raise ValueError("Unknown template argument kind %d" % id) - return cls._kinds[id] + return cls(id) def __repr__(self): return "%s.%s" % ( - self.__class__, + self.__class__.__name__, self.name, ) +class TokenKind(BaseEnumeration): + """Describes a specific type of a Token.""" + + @classmethod + def from_value(cls, value): + """Obtain a registered TokenKind instance from its value.""" + return cls.from_id(value) + + PUNCTUATION = 0 + KEYWORD = 1 + IDENTIFIER = 2 + LITERAL = 3 + COMMENT = 4 + + 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(): """Return all CursorKind enumeration instances.""" - return [x for x in CursorKind._kinds if not x is None] + return list(CursorKind) def is_declaration(self): """Test if this is a declaration kind.""" @@ -710,789 +653,820 @@ def is_unexposed(self): """Test if this is an unexposed kind.""" return conf.lib.clang_isUnexposed(self) - def __repr__(self): - return "CursorKind.%s" % (self.name,) + ### + # Declaration Kinds -### -# 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 -# 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++ struct. + STRUCT_DECL = 2 -# A C or C++ struct. -CursorKind.STRUCT_DECL = CursorKind(2) + # A C or C++ union. + UNION_DECL = 3 -# A C or C++ union. -CursorKind.UNION_DECL = CursorKind(3) + # A C++ class. + CLASS_DECL = 4 -# A C++ class. -CursorKind.CLASS_DECL = CursorKind(4) + # An enumeration. + ENUM_DECL = 5 -# An enumeration. -CursorKind.ENUM_DECL = CursorKind(5) + # A field (in C) or non-static data member (in C++) in a struct, union, or + # C++ class. + FIELD_DECL = 6 -# A field (in C) or non-static data member (in C++) in a struct, union, or C++ -# class. -CursorKind.FIELD_DECL = CursorKind(6) + # An enumerator constant. + ENUM_CONSTANT_DECL = 7 -# An enumerator constant. -CursorKind.ENUM_CONSTANT_DECL = CursorKind(7) + # A function. + FUNCTION_DECL = 8 -# A function. -CursorKind.FUNCTION_DECL = CursorKind(8) + # A variable. + VAR_DECL = 9 -# A variable. -CursorKind.VAR_DECL = CursorKind(9) + # A function or method parameter. + PARM_DECL = 10 -# A function or method parameter. -CursorKind.PARM_DECL = CursorKind(10) + # An Objective-C @interface. + OBJC_INTERFACE_DECL = 11 -# An Objective-C @interface. -CursorKind.OBJC_INTERFACE_DECL = CursorKind(11) + # An Objective-C @interface for a category. + OBJC_CATEGORY_DECL = 12 -# An Objective-C @interface for a category. -CursorKind.OBJC_CATEGORY_DECL = CursorKind(12) + # An Objective-C @protocol declaration. + OBJC_PROTOCOL_DECL = 13 -# An Objective-C @protocol declaration. -CursorKind.OBJC_PROTOCOL_DECL = CursorKind(13) + # An Objective-C @property declaration. + OBJC_PROPERTY_DECL = 14 -# An Objective-C @property declaration. -CursorKind.OBJC_PROPERTY_DECL = CursorKind(14) + # An Objective-C instance variable. + OBJC_IVAR_DECL = 15 -# An Objective-C instance variable. -CursorKind.OBJC_IVAR_DECL = CursorKind(15) + # An Objective-C instance method. + OBJC_INSTANCE_METHOD_DECL = 16 -# An Objective-C instance method. -CursorKind.OBJC_INSTANCE_METHOD_DECL = CursorKind(16) + # An Objective-C class method. + OBJC_CLASS_METHOD_DECL = 17 -# An Objective-C class method. -CursorKind.OBJC_CLASS_METHOD_DECL = CursorKind(17) + # An Objective-C @implementation. + OBJC_IMPLEMENTATION_DECL = 18 -# An Objective-C @implementation. -CursorKind.OBJC_IMPLEMENTATION_DECL = CursorKind(18) + # An Objective-C @implementation for a category. + OBJC_CATEGORY_IMPL_DECL = 19 -# An Objective-C @implementation for a category. -CursorKind.OBJC_CATEGORY_IMPL_DECL = CursorKind(19) + # A typedef. + TYPEDEF_DECL = 20 -# A typedef. -CursorKind.TYPEDEF_DECL = CursorKind(20) + # A C++ class method. + CXX_METHOD = 21 -# A C++ class method. -CursorKind.CXX_METHOD = CursorKind(21) + # A C++ namespace. + NAMESPACE = 22 -# A C++ namespace. -CursorKind.NAMESPACE = CursorKind(22) + # A linkage specification, e.g. 'extern "C"'. + LINKAGE_SPEC = 23 -# A linkage specification, e.g. 'extern "C"'. -CursorKind.LINKAGE_SPEC = CursorKind(23) + # A C++ constructor. + CONSTRUCTOR = 24 -# A C++ constructor. -CursorKind.CONSTRUCTOR = CursorKind(24) + # A C++ destructor. + DESTRUCTOR = 25 -# A C++ destructor. -CursorKind.DESTRUCTOR = CursorKind(25) + # A C++ conversion function. + CONVERSION_FUNCTION = 26 -# A C++ conversion function. -CursorKind.CONVERSION_FUNCTION = CursorKind(26) + # A C++ template type parameter + TEMPLATE_TYPE_PARAMETER = 27 -# A C++ template type parameter -CursorKind.TEMPLATE_TYPE_PARAMETER = CursorKind(27) + # A C++ non-type template parameter. + TEMPLATE_NON_TYPE_PARAMETER = 28 -# A C++ non-type template parameter. -CursorKind.TEMPLATE_NON_TYPE_PARAMETER = CursorKind(28) + # A C++ template template parameter. + TEMPLATE_TEMPLATE_PARAMETER = 29 -# A C++ template template parameter. -CursorKind.TEMPLATE_TEMPLATE_PARAMETER = CursorKind(29) + # A C++ function template. + FUNCTION_TEMPLATE = 30 -# A C++ function template. -CursorKind.FUNCTION_TEMPLATE = CursorKind(30) + # A C++ class template. + CLASS_TEMPLATE = 31 -# A C++ class template. -CursorKind.CLASS_TEMPLATE = CursorKind(31) + # A C++ class template partial specialization. + CLASS_TEMPLATE_PARTIAL_SPECIALIZATION = 32 -# A C++ class template partial specialization. -CursorKind.CLASS_TEMPLATE_PARTIAL_SPECIALIZATION = CursorKind(32) + # A C++ namespace alias declaration. + NAMESPACE_ALIAS = 33 -# A C++ namespace alias declaration. -CursorKind.NAMESPACE_ALIAS = CursorKind(33) + # A C++ using directive + USING_DIRECTIVE = 34 -# A C++ using directive -CursorKind.USING_DIRECTIVE = CursorKind(34) + # A C++ using declaration + USING_DECLARATION = 35 -# A C++ using declaration -CursorKind.USING_DECLARATION = CursorKind(35) + # A Type alias decl. + TYPE_ALIAS_DECL = 36 -# A Type alias decl. -CursorKind.TYPE_ALIAS_DECL = CursorKind(36) + # A Objective-C synthesize decl + OBJC_SYNTHESIZE_DECL = 37 -# A Objective-C synthesize decl -CursorKind.OBJC_SYNTHESIZE_DECL = CursorKind(37) + # A Objective-C dynamic decl + OBJC_DYNAMIC_DECL = 38 -# A Objective-C dynamic decl -CursorKind.OBJC_DYNAMIC_DECL = CursorKind(38) + # A C++ access specifier decl. + CXX_ACCESS_SPEC_DECL = 39 -# A C++ access specifier decl. -CursorKind.CXX_ACCESS_SPEC_DECL = CursorKind(39) + ### + # Reference Kinds -### -# Reference Kinds + OBJC_SUPER_CLASS_REF = 40 + OBJC_PROTOCOL_REF = 41 + OBJC_CLASS_REF = 42 -CursorKind.OBJC_SUPER_CLASS_REF = CursorKind(40) -CursorKind.OBJC_PROTOCOL_REF = CursorKind(41) -CursorKind.OBJC_CLASS_REF = CursorKind(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 -# 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 class template, function template, template + # template parameter, or class template partial specialization. + TEMPLATE_REF = 45 -# 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 namespace or namepsace alias. + NAMESPACE_REF = 46 -# A reference to a namespace or namepsace alias. -CursorKind.NAMESPACE_REF = CursorKind(46) + # 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 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 labeled statement. + LABEL_REF = 48 -# A reference to a labeled statement. -CursorKind.LABEL_REF = CursorKind(48) + # 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 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) + # 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 variable that occurs in some non-expression -# context, e.g., a C++ lambda capture list. -CursorKind.VARIABLE_REF = CursorKind(50) + ### + # Invalid/Error Kinds -### -# Invalid/Error Kinds + INVALID_FILE = 70 + NO_DECL_FOUND = 71 + NOT_IMPLEMENTED = 72 + INVALID_CODE = 73 -CursorKind.INVALID_FILE = CursorKind(70) -CursorKind.NO_DECL_FOUND = CursorKind(71) -CursorKind.NOT_IMPLEMENTED = CursorKind(72) -CursorKind.INVALID_CODE = CursorKind(73) + ### + # Expression Kinds -### -# Expression 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 -# 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 refers to some value declaration, such as a function, + # variable, or enumerator. + DECL_REF_EXPR = 101 -# An expression that refers to some value declaration, such as a function, -# variable, or enumerator. -CursorKind.DECL_REF_EXPR = CursorKind(101) + # An expression that refers to a member of a struct, union, class, + # Objective-C class, etc. + MEMBER_REF_EXPR = 102 -# 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 calls a function. + CALL_EXPR = 103 -# An expression that calls a function. -CursorKind.CALL_EXPR = CursorKind(103) + # An expression that sends a message to an Objective-C object or class. + OBJC_MESSAGE_EXPR = 104 -# An expression that sends a message to an Objective-C object or class. -CursorKind.OBJC_MESSAGE_EXPR = CursorKind(104) + # An expression that represents a block literal. + BLOCK_EXPR = 105 -# An expression that represents a block literal. -CursorKind.BLOCK_EXPR = CursorKind(105) + # An integer literal. + INTEGER_LITERAL = 106 -# An integer literal. -CursorKind.INTEGER_LITERAL = CursorKind(106) + # A floating point number literal. + FLOATING_LITERAL = 107 -# A floating point number literal. -CursorKind.FLOATING_LITERAL = CursorKind(107) + # An imaginary number literal. + IMAGINARY_LITERAL = 108 -# An imaginary number literal. -CursorKind.IMAGINARY_LITERAL = CursorKind(108) + # A string literal. + STRING_LITERAL = 109 -# A string literal. -CursorKind.STRING_LITERAL = CursorKind(109) + # A character literal. + CHARACTER_LITERAL = 110 -# A character literal. -CursorKind.CHARACTER_LITERAL = CursorKind(110) + # A parenthesized expression, e.g. "(1)". + # + # This AST node is only formed if full location information is requested. + PAREN_EXPR = 111 -# A parenthesized expression, e.g. "(1)". -# -# This AST node is only formed if full location information is requested. -CursorKind.PAREN_EXPR = CursorKind(111) + # This represents the unary-expression's (except sizeof and + # alignof). + UNARY_OPERATOR = 112 -# This represents the unary-expression's (except sizeof and -# alignof). -CursorKind.UNARY_OPERATOR = CursorKind(112) + # [C99 6.5.2.1] Array Subscripting. + ARRAY_SUBSCRIPT_EXPR = 113 -# [C99 6.5.2.1] Array Subscripting. -CursorKind.ARRAY_SUBSCRIPT_EXPR = CursorKind(113) + # A builtin binary operation expression such as "x + y" or "x <= y". + BINARY_OPERATOR = 114 -# A builtin binary operation expression such as "x + y" or -# "x <= y". -CursorKind.BINARY_OPERATOR = CursorKind(114) + # Compound assignment such as "+=". + COMPOUND_ASSIGNMENT_OPERATOR = 115 -# Compound assignment such as "+=". -CursorKind.COMPOUND_ASSIGNMENT_OPERATOR = CursorKind(115) + # The ?: ternary operator. + CONDITIONAL_OPERATOR = 116 -# The ?: ternary operator. -CursorKind.CONDITIONAL_OPERATOR = CursorKind(116) + # 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 -# 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) + # [C99 6.5.2.5] + COMPOUND_LITERAL_EXPR = 118 -# [C99 6.5.2.5] -CursorKind.COMPOUND_LITERAL_EXPR = CursorKind(118) + # Describes an C or C++ initializer list. + INIT_LIST_EXPR = 119 -# Describes an C or C++ initializer list. -CursorKind.INIT_LIST_EXPR = CursorKind(119) + # The GNU address of label extension, representing &&label. + ADDR_LABEL_EXPR = 120 -# The GNU address of label extension, representing &&label. -CursorKind.ADDR_LABEL_EXPR = CursorKind(120) + # This is the GNU Statement Expression extension: ({int X=4; X;}) + StmtExpr = 121 -# This is the GNU Statement Expression extension: ({int X=4; X;}) -CursorKind.StmtExpr = CursorKind(121) + # Represents a C11 generic selection. + GENERIC_SELECTION_EXPR = 122 -# Represents a C11 generic selection. -CursorKind.GENERIC_SELECTION_EXPR = CursorKind(122) + # 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 -# 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 static_cast<> expression. + CXX_STATIC_CAST_EXPR = 124 -# C++'s static_cast<> expression. -CursorKind.CXX_STATIC_CAST_EXPR = CursorKind(124) + # C++'s dynamic_cast<> expression. + CXX_DYNAMIC_CAST_EXPR = 125 -# C++'s dynamic_cast<> expression. -CursorKind.CXX_DYNAMIC_CAST_EXPR = CursorKind(125) + # C++'s reinterpret_cast<> expression. + CXX_REINTERPRET_CAST_EXPR = 126 -# C++'s reinterpret_cast<> expression. -CursorKind.CXX_REINTERPRET_CAST_EXPR = CursorKind(126) + # C++'s const_cast<> expression. + CXX_CONST_CAST_EXPR = 127 -# C++'s const_cast<> expression. -CursorKind.CXX_CONST_CAST_EXPR = CursorKind(127) + # 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 -# 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) + # A C++ typeid expression (C++ [expr.typeid]). + CXX_TYPEID_EXPR = 129 -# A C++ typeid expression (C++ [expr.typeid]). -CursorKind.CXX_TYPEID_EXPR = CursorKind(129) + # [C++ 2.13.5] C++ Boolean Literal. + CXX_BOOL_LITERAL_EXPR = 130 -# [C++ 2.13.5] C++ Boolean Literal. -CursorKind.CXX_BOOL_LITERAL_EXPR = CursorKind(130) + # [C++0x 2.14.7] C++ Pointer Literal. + CXX_NULL_PTR_LITERAL_EXPR = 131 -# [C++0x 2.14.7] C++ Pointer Literal. -CursorKind.CXX_NULL_PTR_LITERAL_EXPR = CursorKind(131) + # Represents the "this" expression in C++ + CXX_THIS_EXPR = 132 -# Represents the "this" expression in C++ -CursorKind.CXX_THIS_EXPR = CursorKind(132) + # [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++ 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) + # A new expression for memory allocation and constructor calls, e.g: + # "new CXXNewExpr(foo)". + CXX_NEW_EXPR = 134 -# A new expression for memory allocation and constructor calls, e.g: -# "new CXXNewExpr(foo)". -CursorKind.CXX_NEW_EXPR = CursorKind(134) + # A delete expression for memory deallocation and destructor calls, + # e.g. "delete[] pArray". + CXX_DELETE_EXPR = 135 -# A delete expression for memory deallocation and destructor calls, -# e.g. "delete[] pArray". -CursorKind.CXX_DELETE_EXPR = CursorKind(135) + # Represents a unary expression. + CXX_UNARY_EXPR = 136 -# Represents a unary expression. -CursorKind.CXX_UNARY_EXPR = CursorKind(136) + # ObjCStringLiteral, used for Objective-C string literals i.e. "foo". + OBJC_STRING_LITERAL = 137 -# ObjCStringLiteral, used for Objective-C string literals i.e. "foo". -CursorKind.OBJC_STRING_LITERAL = CursorKind(137) + # ObjCEncodeExpr, used for in Objective-C. + OBJC_ENCODE_EXPR = 138 -# ObjCEncodeExpr, used for in Objective-C. -CursorKind.OBJC_ENCODE_EXPR = CursorKind(138) + # ObjCSelectorExpr used for in Objective-C. + OBJC_SELECTOR_EXPR = 139 -# ObjCSelectorExpr used for in Objective-C. -CursorKind.OBJC_SELECTOR_EXPR = CursorKind(139) + # Objective-C's protocol expression. + OBJC_PROTOCOL_EXPR = 140 -# Objective-C's protocol expression. -CursorKind.OBJC_PROTOCOL_EXPR = CursorKind(140) + # 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 -# 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++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 -# 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) + # Represents an expression that computes the length of a parameter + # pack. + SIZE_OF_PACK_EXPR = 143 -# Represents an expression that computes the length of a parameter -# pack. -CursorKind.SIZE_OF_PACK_EXPR = CursorKind(143) + # 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++ 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) + # Objective-c Boolean Literal. + OBJ_BOOL_LITERAL_EXPR = 145 -# Objective-c Boolean Literal. -CursorKind.OBJ_BOOL_LITERAL_EXPR = CursorKind(145) + # Represents the "self" expression in a ObjC method. + OBJ_SELF_EXPR = 146 -# Represents the "self" expression in a ObjC method. -CursorKind.OBJ_SELF_EXPR = CursorKind(146) + # OpenMP 4.0 [2.4, Array Section]. + OMP_ARRAY_SECTION_EXPR = 147 -# OpenMP 4.0 [2.4, Array Section]. -CursorKind.OMP_ARRAY_SECTION_EXPR = CursorKind(147) + # Represents an @available(...) check. + OBJC_AVAILABILITY_CHECK_EXPR = 148 -# Represents an @available(...) check. -CursorKind.OBJC_AVAILABILITY_CHECK_EXPR = CursorKind(148) + # Fixed point literal. + FIXED_POINT_LITERAL = 149 -# Fixed point literal -CursorKind.FIXED_POINT_LITERAL = CursorKind(149) + # OpenMP 5.0 [2.1.4, Array Shaping]. + OMP_ARRAY_SHAPING_EXPR = 150 -# OpenMP 5.0 [2.1.4, Array Shaping]. -CursorKind.OMP_ARRAY_SHAPING_EXPR = CursorKind(150) + # OpenMP 5.0 [2.1.6 Iterators]. + OMP_ITERATOR_EXPR = 151 -# OpenMP 5.0 [2.1.6 Iterators] -CursorKind.OMP_ITERATOR_EXPR = CursorKind(151) + # OpenCL's addrspace_cast<> expression. + CXX_ADDRSPACE_CAST_EXPR = 152 -# OpenCL's addrspace_cast<> expression. -CursorKind.CXX_ADDRSPACE_CAST_EXPR = CursorKind(152) + # Expression that references a C++20 concept. + CONCEPT_SPECIALIZATION_EXPR = 153 -# Expression that references a C++20 concept. -CursorKind.CONCEPT_SPECIALIZATION_EXPR = CursorKind(153) + # Expression that references a C++20 requires expression. + REQUIRES_EXPR = 154 -# Expression that references a C++20 concept. -CursorKind.REQUIRES_EXPR = CursorKind(154) + # Expression that references a C++20 parenthesized list aggregate + # initializer. + CXX_PAREN_LIST_INIT_EXPR = 155 -# 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) + # Represents a C++26 pack indexing expression. + PACK_INDEXING_EXPR = 156 -# A labelled statement in a function. -CursorKind.LABEL_STMT = CursorKind(201) + # 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 -# A compound statement -CursorKind.COMPOUND_STMT = CursorKind(202) + # A labelled statement in a function. + LABEL_STMT = 201 -# A case statement. -CursorKind.CASE_STMT = CursorKind(203) + # A compound statement + COMPOUND_STMT = 202 -# A default statement. -CursorKind.DEFAULT_STMT = CursorKind(204) + # A case statement. + CASE_STMT = 203 -# An if statement. -CursorKind.IF_STMT = CursorKind(205) + # A default statement. + DEFAULT_STMT = 204 -# A switch statement. -CursorKind.SWITCH_STMT = CursorKind(206) + # An if statement. + IF_STMT = 205 -# A while statement. -CursorKind.WHILE_STMT = CursorKind(207) + # A switch statement. + SWITCH_STMT = 206 -# A do statement. -CursorKind.DO_STMT = CursorKind(208) + # A while statement. + WHILE_STMT = 207 -# A for statement. -CursorKind.FOR_STMT = CursorKind(209) + # A do statement. + DO_STMT = 208 -# A goto statement. -CursorKind.GOTO_STMT = CursorKind(210) + # A for statement. + FOR_STMT = 209 -# An indirect goto statement. -CursorKind.INDIRECT_GOTO_STMT = CursorKind(211) + # A goto statement. + GOTO_STMT = 210 -# A continue statement. -CursorKind.CONTINUE_STMT = CursorKind(212) + # An indirect goto statement. + INDIRECT_GOTO_STMT = 211 -# A break statement. -CursorKind.BREAK_STMT = CursorKind(213) + # A continue statement. + CONTINUE_STMT = 212 -# A return statement. -CursorKind.RETURN_STMT = CursorKind(214) + # A break statement. + BREAK_STMT = 213 -# A GNU-style inline assembler statement. -CursorKind.ASM_STMT = CursorKind(215) + # A return statement. + RETURN_STMT = 214 -# Objective-C's overall @try-@catch-@finally statement. -CursorKind.OBJC_AT_TRY_STMT = CursorKind(216) + # A GNU-style inline assembler statement. + ASM_STMT = 215 -# Objective-C's @catch statement. -CursorKind.OBJC_AT_CATCH_STMT = CursorKind(217) + # Objective-C's overall @try-@catch-@finally statement. + OBJC_AT_TRY_STMT = 216 -# Objective-C's @finally statement. -CursorKind.OBJC_AT_FINALLY_STMT = CursorKind(218) + # Objective-C's @catch statement. + OBJC_AT_CATCH_STMT = 217 -# Objective-C's @throw statement. -CursorKind.OBJC_AT_THROW_STMT = CursorKind(219) + # Objective-C's @finally statement. + OBJC_AT_FINALLY_STMT = 218 -# Objective-C's @synchronized statement. -CursorKind.OBJC_AT_SYNCHRONIZED_STMT = CursorKind(220) + # Objective-C's @throw statement. + OBJC_AT_THROW_STMT = 219 -# Objective-C's autorelease pool statement. -CursorKind.OBJC_AUTORELEASE_POOL_STMT = CursorKind(221) + # Objective-C's @synchronized statement. + OBJC_AT_SYNCHRONIZED_STMT = 220 -# Objective-C's for collection statement. -CursorKind.OBJC_FOR_COLLECTION_STMT = CursorKind(222) + # Objective-C's autorelease pool statement. + OBJC_AUTORELEASE_POOL_STMT = 221 -# C++'s catch statement. -CursorKind.CXX_CATCH_STMT = CursorKind(223) + # Objective-C's for collection statement. + OBJC_FOR_COLLECTION_STMT = 222 -# C++'s try statement. -CursorKind.CXX_TRY_STMT = CursorKind(224) + # C++'s catch statement. + CXX_CATCH_STMT = 223 -# C++'s for (* : *) statement. -CursorKind.CXX_FOR_RANGE_STMT = CursorKind(225) + # C++'s try statement. + CXX_TRY_STMT = 224 -# Windows Structured Exception Handling's try statement. -CursorKind.SEH_TRY_STMT = CursorKind(226) + # C++'s for (* : *) statement. + CXX_FOR_RANGE_STMT = 225 -# Windows Structured Exception Handling's except statement. -CursorKind.SEH_EXCEPT_STMT = CursorKind(227) + # Windows Structured Exception Handling's try statement. + SEH_TRY_STMT = 226 -# Windows Structured Exception Handling's finally statement. -CursorKind.SEH_FINALLY_STMT = CursorKind(228) + # Windows Structured Exception Handling's except statement. + SEH_EXCEPT_STMT = 227 -# A MS inline assembly statement extension. -CursorKind.MS_ASM_STMT = CursorKind(229) + # Windows Structured Exception Handling's finally statement. + SEH_FINALLY_STMT = 228 -# The null statement. -CursorKind.NULL_STMT = CursorKind(230) + # A MS inline assembly statement extension. + MS_ASM_STMT = 229 -# Adaptor class for mixing declarations with statements and expressions. -CursorKind.DECL_STMT = CursorKind(231) + # The null statement. + NULL_STMT = 230 -# OpenMP parallel directive. -CursorKind.OMP_PARALLEL_DIRECTIVE = CursorKind(232) + # Adaptor class for mixing declarations with statements and expressions. + DECL_STMT = 231 -# OpenMP SIMD directive. -CursorKind.OMP_SIMD_DIRECTIVE = CursorKind(233) + # OpenMP parallel directive. + OMP_PARALLEL_DIRECTIVE = 232 -# OpenMP for directive. -CursorKind.OMP_FOR_DIRECTIVE = CursorKind(234) + # OpenMP SIMD directive. + OMP_SIMD_DIRECTIVE = 233 -# OpenMP sections directive. -CursorKind.OMP_SECTIONS_DIRECTIVE = CursorKind(235) + # OpenMP for directive. + OMP_FOR_DIRECTIVE = 234 -# OpenMP section directive. -CursorKind.OMP_SECTION_DIRECTIVE = CursorKind(236) + # OpenMP sections directive. + OMP_SECTIONS_DIRECTIVE = 235 -# OpenMP single directive. -CursorKind.OMP_SINGLE_DIRECTIVE = CursorKind(237) + # OpenMP section directive. + OMP_SECTION_DIRECTIVE = 236 -# OpenMP parallel for directive. -CursorKind.OMP_PARALLEL_FOR_DIRECTIVE = CursorKind(238) + # OpenMP single directive. + OMP_SINGLE_DIRECTIVE = 237 -# OpenMP parallel sections directive. -CursorKind.OMP_PARALLEL_SECTIONS_DIRECTIVE = CursorKind(239) + # OpenMP parallel for directive. + OMP_PARALLEL_FOR_DIRECTIVE = 238 -# OpenMP task directive. -CursorKind.OMP_TASK_DIRECTIVE = CursorKind(240) + # OpenMP parallel sections directive. + OMP_PARALLEL_SECTIONS_DIRECTIVE = 239 -# OpenMP master directive. -CursorKind.OMP_MASTER_DIRECTIVE = CursorKind(241) + # OpenMP task directive. + OMP_TASK_DIRECTIVE = 240 -# OpenMP critical directive. -CursorKind.OMP_CRITICAL_DIRECTIVE = CursorKind(242) + # OpenMP master directive. + OMP_MASTER_DIRECTIVE = 241 -# OpenMP taskyield directive. -CursorKind.OMP_TASKYIELD_DIRECTIVE = CursorKind(243) + # OpenMP critical directive. + OMP_CRITICAL_DIRECTIVE = 242 -# OpenMP barrier directive. -CursorKind.OMP_BARRIER_DIRECTIVE = CursorKind(244) + # OpenMP taskyield directive. + OMP_TASKYIELD_DIRECTIVE = 243 -# OpenMP taskwait directive. -CursorKind.OMP_TASKWAIT_DIRECTIVE = CursorKind(245) + # OpenMP barrier directive. + OMP_BARRIER_DIRECTIVE = 244 -# OpenMP flush directive. -CursorKind.OMP_FLUSH_DIRECTIVE = CursorKind(246) + # OpenMP taskwait directive. + OMP_TASKWAIT_DIRECTIVE = 245 -# Windows Structured Exception Handling's leave statement. -CursorKind.SEH_LEAVE_STMT = CursorKind(247) + # OpenMP flush directive. + OMP_FLUSH_DIRECTIVE = 246 -# OpenMP ordered directive. -CursorKind.OMP_ORDERED_DIRECTIVE = CursorKind(248) + # Windows Structured Exception Handling's leave statement. + SEH_LEAVE_STMT = 247 -# OpenMP atomic directive. -CursorKind.OMP_ATOMIC_DIRECTIVE = CursorKind(249) + # OpenMP ordered directive. + OMP_ORDERED_DIRECTIVE = 248 -# OpenMP for SIMD directive. -CursorKind.OMP_FOR_SIMD_DIRECTIVE = CursorKind(250) + # OpenMP atomic directive. + OMP_ATOMIC_DIRECTIVE = 249 -# OpenMP parallel for SIMD directive. -CursorKind.OMP_PARALLELFORSIMD_DIRECTIVE = CursorKind(251) + # OpenMP for SIMD directive. + OMP_FOR_SIMD_DIRECTIVE = 250 -# OpenMP target directive. -CursorKind.OMP_TARGET_DIRECTIVE = CursorKind(252) + # OpenMP parallel for SIMD directive. + OMP_PARALLELFORSIMD_DIRECTIVE = 251 -# OpenMP teams directive. -CursorKind.OMP_TEAMS_DIRECTIVE = CursorKind(253) + # OpenMP target directive. + OMP_TARGET_DIRECTIVE = 252 -# OpenMP taskgroup directive. -CursorKind.OMP_TASKGROUP_DIRECTIVE = CursorKind(254) + # OpenMP teams directive. + OMP_TEAMS_DIRECTIVE = 253 -# OpenMP cancellation point directive. -CursorKind.OMP_CANCELLATION_POINT_DIRECTIVE = CursorKind(255) + # OpenMP taskgroup directive. + OMP_TASKGROUP_DIRECTIVE = 254 -# OpenMP cancel directive. -CursorKind.OMP_CANCEL_DIRECTIVE = CursorKind(256) + # OpenMP cancellation point directive. + OMP_CANCELLATION_POINT_DIRECTIVE = 255 -# OpenMP target data directive. -CursorKind.OMP_TARGET_DATA_DIRECTIVE = CursorKind(257) + # OpenMP cancel directive. + OMP_CANCEL_DIRECTIVE = 256 -# OpenMP taskloop directive. -CursorKind.OMP_TASK_LOOP_DIRECTIVE = CursorKind(258) + # OpenMP target data directive. + OMP_TARGET_DATA_DIRECTIVE = 257 -# OpenMP taskloop simd directive. -CursorKind.OMP_TASK_LOOP_SIMD_DIRECTIVE = CursorKind(259) + # OpenMP taskloop directive. + OMP_TASK_LOOP_DIRECTIVE = 258 -# OpenMP distribute directive. -CursorKind.OMP_DISTRIBUTE_DIRECTIVE = CursorKind(260) + # OpenMP taskloop simd directive. + OMP_TASK_LOOP_SIMD_DIRECTIVE = 259 -# OpenMP target enter data directive. -CursorKind.OMP_TARGET_ENTER_DATA_DIRECTIVE = CursorKind(261) + # OpenMP distribute directive. + OMP_DISTRIBUTE_DIRECTIVE = 260 -# OpenMP target exit data directive. -CursorKind.OMP_TARGET_EXIT_DATA_DIRECTIVE = CursorKind(262) + # OpenMP target enter data directive. + OMP_TARGET_ENTER_DATA_DIRECTIVE = 261 -# OpenMP target parallel directive. -CursorKind.OMP_TARGET_PARALLEL_DIRECTIVE = CursorKind(263) + # OpenMP target exit data directive. + OMP_TARGET_EXIT_DATA_DIRECTIVE = 262 -# OpenMP target parallel for directive. -CursorKind.OMP_TARGET_PARALLELFOR_DIRECTIVE = CursorKind(264) + # OpenMP target parallel directive. + OMP_TARGET_PARALLEL_DIRECTIVE = 263 -# OpenMP target update directive. -CursorKind.OMP_TARGET_UPDATE_DIRECTIVE = CursorKind(265) + # OpenMP target parallel for directive. + OMP_TARGET_PARALLELFOR_DIRECTIVE = 264 -# OpenMP distribute parallel for directive. -CursorKind.OMP_DISTRIBUTE_PARALLELFOR_DIRECTIVE = CursorKind(266) + # OpenMP target update directive. + OMP_TARGET_UPDATE_DIRECTIVE = 265 -# OpenMP distribute parallel for simd directive. -CursorKind.OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE = CursorKind(267) + # OpenMP distribute parallel for directive. + OMP_DISTRIBUTE_PARALLELFOR_DIRECTIVE = 266 -# OpenMP distribute simd directive. -CursorKind.OMP_DISTRIBUTE_SIMD_DIRECTIVE = CursorKind(268) + # OpenMP distribute parallel for simd directive. + OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE = 267 -# OpenMP target parallel for simd directive. -CursorKind.OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE = CursorKind(269) + # OpenMP distribute simd directive. + OMP_DISTRIBUTE_SIMD_DIRECTIVE = 268 -# OpenMP target simd directive. -CursorKind.OMP_TARGET_SIMD_DIRECTIVE = CursorKind(270) + # OpenMP target parallel for simd directive. + OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE = 269 -# OpenMP teams distribute directive. -CursorKind.OMP_TEAMS_DISTRIBUTE_DIRECTIVE = CursorKind(271) + # OpenMP target simd directive. + OMP_TARGET_SIMD_DIRECTIVE = 270 -# OpenMP teams distribute simd directive. -CursorKind.OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE = CursorKind(272) + # OpenMP teams distribute directive. + OMP_TEAMS_DISTRIBUTE_DIRECTIVE = 271 -# OpenMP teams distribute parallel for simd directive. -CursorKind.OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE = CursorKind(273) + # OpenMP teams distribute simd directive. + OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE = 272 -# OpenMP teams distribute parallel for directive. -CursorKind.OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE = CursorKind(274) + # OpenMP teams distribute parallel for simd directive. + OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE = 273 -# OpenMP target teams directive. -CursorKind.OMP_TARGET_TEAMS_DIRECTIVE = CursorKind(275) + # OpenMP teams distribute parallel for directive. + OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE = 274 -# OpenMP target teams distribute directive. -CursorKind.OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE = CursorKind(276) + # OpenMP target teams directive. + OMP_TARGET_TEAMS_DIRECTIVE = 275 -# OpenMP target teams distribute parallel for directive. -CursorKind.OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE = CursorKind(277) + # OpenMP target teams distribute directive. + OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE = 276 -# OpenMP target teams distribute parallel for simd directive. -CursorKind.OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE = CursorKind(278) + # OpenMP target teams distribute parallel for directive. + OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE = 277 -# OpenMP target teams distribute simd directive. -CursorKind.OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE = CursorKind(279) + # OpenMP target teams distribute parallel for simd directive. + OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE = 278 -# C++2a std::bit_cast expression. -CursorKind.BUILTIN_BIT_CAST_EXPR = CursorKind(280) + # OpenMP target teams distribute simd directive. + OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE = 279 -# OpenMP master taskloop directive. -CursorKind.OMP_MASTER_TASK_LOOP_DIRECTIVE = CursorKind(281) + # C++2a std::bit_cast expression. + BUILTIN_BIT_CAST_EXPR = 280 -# OpenMP parallel master taskloop directive. -CursorKind.OMP_PARALLEL_MASTER_TASK_LOOP_DIRECTIVE = CursorKind(282) + # OpenMP master taskloop directive. + OMP_MASTER_TASK_LOOP_DIRECTIVE = 281 -# OpenMP master taskloop simd directive. -CursorKind.OMP_MASTER_TASK_LOOP_SIMD_DIRECTIVE = CursorKind(283) + # OpenMP parallel master taskloop directive. + OMP_PARALLEL_MASTER_TASK_LOOP_DIRECTIVE = 282 -# OpenMP parallel master taskloop simd directive. -CursorKind.OMP_PARALLEL_MASTER_TASK_LOOP_SIMD_DIRECTIVE = CursorKind(284) + # OpenMP master taskloop simd directive. + OMP_MASTER_TASK_LOOP_SIMD_DIRECTIVE = 283 -# OpenMP parallel master directive. -CursorKind.OMP_PARALLEL_MASTER_DIRECTIVE = CursorKind(285) + # OpenMP parallel master taskloop simd directive. + OMP_PARALLEL_MASTER_TASK_LOOP_SIMD_DIRECTIVE = 284 -# OpenMP depobj directive. -CursorKind.OMP_DEPOBJ_DIRECTIVE = CursorKind(286) + # OpenMP parallel master directive. + OMP_PARALLEL_MASTER_DIRECTIVE = 285 -# OpenMP scan directive. -CursorKind.OMP_SCAN_DIRECTIVE = CursorKind(287) + # OpenMP depobj directive. + OMP_DEPOBJ_DIRECTIVE = 286 -# OpenMP tile directive. -CursorKind.OMP_TILE_DIRECTIVE = CursorKind(288) + # OpenMP scan directive. + OMP_SCAN_DIRECTIVE = 287 -# OpenMP canonical loop. -CursorKind.OMP_CANONICAL_LOOP = CursorKind(289) + # OpenMP tile directive. + OMP_TILE_DIRECTIVE = 288 -# OpenMP interop directive. -CursorKind.OMP_INTEROP_DIRECTIVE = CursorKind(290) + # OpenMP canonical loop. + OMP_CANONICAL_LOOP = 289 -# OpenMP dispatch directive. -CursorKind.OMP_DISPATCH_DIRECTIVE = CursorKind(291) + # OpenMP interop directive. + OMP_INTEROP_DIRECTIVE = 290 -# OpenMP masked directive. -CursorKind.OMP_MASKED_DIRECTIVE = CursorKind(292) + # OpenMP dispatch directive. + OMP_DISPATCH_DIRECTIVE = 291 -# OpenMP unroll directive. -CursorKind.OMP_UNROLL_DIRECTIVE = CursorKind(293) + # OpenMP masked directive. + OMP_MASKED_DIRECTIVE = 292 -# OpenMP metadirective directive. -CursorKind.OMP_META_DIRECTIVE = CursorKind(294) + # OpenMP unroll directive. + OMP_UNROLL_DIRECTIVE = 293 -# OpenMP loop directive. -CursorKind.OMP_GENERIC_LOOP_DIRECTIVE = CursorKind(295) + # OpenMP metadirective directive. + OMP_META_DIRECTIVE = 294 -# OpenMP teams loop directive. -CursorKind.OMP_TEAMS_GENERIC_LOOP_DIRECTIVE = CursorKind(296) + # OpenMP loop directive. + OMP_GENERIC_LOOP_DIRECTIVE = 295 -# OpenMP target teams loop directive. -CursorKind.OMP_TARGET_TEAMS_GENERIC_LOOP_DIRECTIVE = CursorKind(297) + # OpenMP teams loop directive. + OMP_TEAMS_GENERIC_LOOP_DIRECTIVE = 296 -# OpenMP parallel loop directive. -CursorKind.OMP_PARALLEL_GENERIC_LOOP_DIRECTIVE = CursorKind(298) + # OpenMP target teams loop directive. + OMP_TARGET_TEAMS_GENERIC_LOOP_DIRECTIVE = 297 -# OpenMP target parallel loop directive. -CursorKind.OMP_TARGET_PARALLEL_GENERIC_LOOP_DIRECTIVE = CursorKind(299) + # OpenMP parallel loop directive. + OMP_PARALLEL_GENERIC_LOOP_DIRECTIVE = 298 -# OpenMP parallel masked directive. -CursorKind.OMP_PARALLEL_MASKED_DIRECTIVE = CursorKind(300) + # OpenMP target parallel loop directive. + OMP_TARGET_PARALLEL_GENERIC_LOOP_DIRECTIVE = 299 -# OpenMP masked taskloop directive. -CursorKind.OMP_MASKED_TASK_LOOP_DIRECTIVE = CursorKind(301) + # OpenMP parallel masked directive. + OMP_PARALLEL_MASKED_DIRECTIVE = 300 -# OpenMP masked taskloop simd directive. -CursorKind.OMP_MASKED_TASK_LOOP_SIMD_DIRECTIVE = CursorKind(302) + # OpenMP masked taskloop directive. + OMP_MASKED_TASK_LOOP_DIRECTIVE = 301 -# OpenMP parallel masked taskloop directive. -CursorKind.OMP_PARALLEL_MASKED_TASK_LOOP_DIRECTIVE = CursorKind(303) + # OpenMP masked taskloop simd directive. + OMP_MASKED_TASK_LOOP_SIMD_DIRECTIVE = 302 -# OpenMP parallel masked taskloop simd directive. -CursorKind.OMP_PARALLEL_MASKED_TASK_LOOP_SIMD_DIRECTIVE = CursorKind(304) + # OpenMP parallel masked taskloop directive. + OMP_PARALLEL_MASKED_TASK_LOOP_DIRECTIVE = 303 -### -# Other Kinds + # OpenMP parallel masked taskloop simd directive. + OMP_PARALLEL_MASKED_TASK_LOOP_SIMD_DIRECTIVE = 304 -# Cursor that represents the translation unit itself. -# -# The translation unit cursor exists primarily to act as the root cursor for -# traversing the contents of a translation unit. -CursorKind.TRANSLATION_UNIT = CursorKind(350) - -### -# Attributes - -# An attribute whoe specific kind is note exposed via this interface -CursorKind.UNEXPOSED_ATTR = CursorKind(400) - -CursorKind.IB_ACTION_ATTR = CursorKind(401) -CursorKind.IB_OUTLET_ATTR = CursorKind(402) -CursorKind.IB_OUTLET_COLLECTION_ATTR = CursorKind(403) - -CursorKind.CXX_FINAL_ATTR = CursorKind(404) -CursorKind.CXX_OVERRIDE_ATTR = CursorKind(405) -CursorKind.ANNOTATE_ATTR = CursorKind(406) -CursorKind.ASM_LABEL_ATTR = CursorKind(407) -CursorKind.PACKED_ATTR = CursorKind(408) -CursorKind.PURE_ATTR = CursorKind(409) -CursorKind.CONST_ATTR = CursorKind(410) -CursorKind.NODUPLICATE_ATTR = CursorKind(411) -CursorKind.CUDACONSTANT_ATTR = CursorKind(412) -CursorKind.CUDADEVICE_ATTR = CursorKind(413) -CursorKind.CUDAGLOBAL_ATTR = CursorKind(414) -CursorKind.CUDAHOST_ATTR = CursorKind(415) -CursorKind.CUDASHARED_ATTR = CursorKind(416) - -CursorKind.VISIBILITY_ATTR = CursorKind(417) - -CursorKind.DLLEXPORT_ATTR = CursorKind(418) -CursorKind.DLLIMPORT_ATTR = CursorKind(419) -CursorKind.CONVERGENT_ATTR = CursorKind(438) -CursorKind.WARN_UNUSED_ATTR = CursorKind(439) -CursorKind.WARN_UNUSED_RESULT_ATTR = CursorKind(440) -CursorKind.ALIGNED_ATTR = CursorKind(441) - -### -# Preprocessing -CursorKind.PREPROCESSING_DIRECTIVE = CursorKind(500) -CursorKind.MACRO_DEFINITION = CursorKind(501) -CursorKind.MACRO_INSTANTIATION = CursorKind(502) -CursorKind.INCLUSION_DIRECTIVE = CursorKind(503) - -### -# Extra declaration - -# A module import declaration. -CursorKind.MODULE_IMPORT_DECL = CursorKind(600) -# A type alias template declaration -CursorKind.TYPE_ALIAS_TEMPLATE_DECL = CursorKind(601) -# A static_assert or _Static_assert node -CursorKind.STATIC_ASSERT = CursorKind(602) -# A friend declaration -CursorKind.FRIEND_DECL = CursorKind(603) -# A concept declaration -CursorKind.CONCEPT_DECL = CursorKind(604) - -# A code completion overload candidate. -CursorKind.OVERLOAD_CANDIDATE = CursorKind(700) + # OpenMP error directive. + OMP_ERROR_DIRECTIVE = 305 + + # OpenMP scope directive. + OMP_SCOPE_DIRECTIVE = 306 + + # OpenACC Compute Construct. + OPEN_ACC_COMPUTE_DIRECTIVE = 320 + + ### + # Other Kinds + + # Cursor that represents the translation unit itself. + # + # The translation unit cursor exists primarily to act as the root cursor for + # traversing the contents of a translation unit. + TRANSLATION_UNIT = 350 + + ### + # Attributes + + # An attribute whoe specific kind is note exposed via this interface + UNEXPOSED_ATTR = 400 + + IB_ACTION_ATTR = 401 + IB_OUTLET_ATTR = 402 + IB_OUTLET_COLLECTION_ATTR = 403 + + CXX_FINAL_ATTR = 404 + CXX_OVERRIDE_ATTR = 405 + ANNOTATE_ATTR = 406 + ASM_LABEL_ATTR = 407 + PACKED_ATTR = 408 + PURE_ATTR = 409 + CONST_ATTR = 410 + NODUPLICATE_ATTR = 411 + CUDACONSTANT_ATTR = 412 + CUDADEVICE_ATTR = 413 + CUDAGLOBAL_ATTR = 414 + CUDAHOST_ATTR = 415 + CUDASHARED_ATTR = 416 + + VISIBILITY_ATTR = 417 + + DLLEXPORT_ATTR = 418 + DLLIMPORT_ATTR = 419 + NS_RETURNS_RETAINED = 420 + NS_RETURNS_NOT_RETAINED = 421 + NS_RETURNS_AUTORELEASED = 422 + NS_CONSUMES_SELF = 423 + NS_CONSUMED = 424 + OBJC_EXCEPTION = 425 + OBJC_NSOBJECT = 426 + OBJC_INDEPENDENT_CLASS = 427 + OBJC_PRECISE_LIFETIME = 428 + OBJC_RETURNS_INNER_POINTER = 429 + OBJC_REQUIRES_SUPER = 430 + OBJC_ROOT_CLASS = 431 + OBJC_SUBCLASSING_RESTRICTED = 432 + OBJC_EXPLICIT_PROTOCOL_IMPL = 433 + OBJC_DESIGNATED_INITIALIZER = 434 + OBJC_RUNTIME_VISIBLE = 435 + OBJC_BOXABLE = 436 + FLAG_ENUM = 437 + CONVERGENT_ATTR = 438 + WARN_UNUSED_ATTR = 439 + WARN_UNUSED_RESULT_ATTR = 440 + ALIGNED_ATTR = 441 + + ### + # Preprocessing + PREPROCESSING_DIRECTIVE = 500 + MACRO_DEFINITION = 501 + MACRO_INSTANTIATION = 502 + INCLUSION_DIRECTIVE = 503 + + ### + # Extra declaration + + # A module import declaration. + MODULE_IMPORT_DECL = 600 + # A type alias template declaration + TYPE_ALIAS_TEMPLATE_DECL = 601 + # A static_assert or _Static_assert node + STATIC_ASSERT = 602 + # A friend declaration + FRIEND_DECL = 603 + # A concept declaration + CONCEPT_DECL = 604 + + # A code completion overload candidate. + OVERLOAD_CANDIDATE = 700 ### Template Argument Kinds ### class TemplateArgumentKind(BaseEnumeration): @@ -1501,16 +1475,16 @@ class TemplateArgumentKind(BaseEnumeration): represents. """ - # The required BaseEnumeration declarations. - _kinds = [] - _name_map = None - - -TemplateArgumentKind.NULL = TemplateArgumentKind(0) -TemplateArgumentKind.TYPE = TemplateArgumentKind(1) -TemplateArgumentKind.DECLARATION = TemplateArgumentKind(2) -TemplateArgumentKind.NULLPTR = TemplateArgumentKind(3) -TemplateArgumentKind.INTEGRAL = TemplateArgumentKind(4) + NULL = 0 + TYPE = 1 + DECLARATION = 2 + NULLPTR = 3 + INTEGRAL = 4 + TEMPLATE = 5 + TEMPLATE_EXPANSION = 6 + EXPRESSION = 7 + PACK = 8 + INVALID = 9 ### Exception Specification Kinds ### class ExceptionSpecificationKind(BaseEnumeration): @@ -1519,23 +1493,15 @@ class ExceptionSpecificationKind(BaseEnumeration): that a function has. """ - # The required BaseEnumeration declarations. - _kinds = [] - _name_map = None - - def __repr__(self): - return "ExceptionSpecificationKind.{}".format(self.name) - - -ExceptionSpecificationKind.NONE = ExceptionSpecificationKind(0) -ExceptionSpecificationKind.DYNAMIC_NONE = ExceptionSpecificationKind(1) -ExceptionSpecificationKind.DYNAMIC = ExceptionSpecificationKind(2) -ExceptionSpecificationKind.MS_ANY = ExceptionSpecificationKind(3) -ExceptionSpecificationKind.BASIC_NOEXCEPT = ExceptionSpecificationKind(4) -ExceptionSpecificationKind.COMPUTED_NOEXCEPT = ExceptionSpecificationKind(5) -ExceptionSpecificationKind.UNEVALUATED = ExceptionSpecificationKind(6) -ExceptionSpecificationKind.UNINSTANTIATED = ExceptionSpecificationKind(7) -ExceptionSpecificationKind.UNPARSED = ExceptionSpecificationKind(8) + NONE = 0 + DYNAMIC_NONE = 1 + DYNAMIC = 2 + MS_ANY = 3 + BASIC_NOEXCEPT = 4 + COMPUTED_NOEXCEPT = 5 + UNEVALUATED = 6 + UNINSTANTIATED = 7 + UNPARSED = 8 ### Cursors ### @@ -1857,6 +1823,18 @@ def availability(self): return AvailabilityKind.from_id(self._availability) + @property + def binary_operator(self): + """ + Retrieves the opcode if this cursor points to a binary operator + :return: + """ + + if not hasattr(self, "_binopcode"): + self._binopcode = conf.lib.clang_Cursor_getBinaryOpcode(self) + + return BinaryOperator.from_id(self._binopcode) + @property def access_specifier(self): """ @@ -2147,55 +2125,68 @@ def from_cursor_result(res, fn, args): return res -class StorageClass: +class BinaryOperator(BaseEnumeration): """ - Describes the storage class of a declaration + Describes the BinaryOperator of a declaration """ - # The unique kind objects, index by id. - _kinds = [] - _name_map = None - - def __init__(self, value): - if value >= len(StorageClass._kinds): - StorageClass._kinds += [None] * (value - len(StorageClass._kinds) + 1) - if StorageClass._kinds[value] is not None: - raise ValueError("StorageClass already loaded") - self.value = value - StorageClass._kinds[value] = self - StorageClass._name_map = None - - def from_param(self): - return self.value + def __nonzero__(self): + """Allows checks of the kind ```if cursor.binary_operator:```""" + return self.value != 0 @property - def name(self): - """Get the enumeration name of this storage class.""" - if self._name_map is None: - self._name_map = {} - for key, value in StorageClass.__dict__.items(): - if isinstance(value, StorageClass): - self._name_map[value] = key - return self._name_map[self] - - @staticmethod - def from_id(id): - if id >= len(StorageClass._kinds) or not StorageClass._kinds[id]: - raise ValueError("Unknown storage class %d" % id) - return StorageClass._kinds[id] - - def __repr__(self): - return "StorageClass.%s" % (self.name,) - + def is_assignment(self): + return BinaryOperator.Assign.value <= self.value < BinaryOperator.Comma.value + + Invalid = 0 + PtrMemD = 1 + PtrMemI = 2 + Mul = 3 + Div = 4 + Rem = 5 + Add = 6 + Sub = 7 + Shl = 8 + Shr = 9 + Cmp = 10 + LT = 11 + GT = 12 + LE = 13 + GE = 14 + EQ = 15 + NE = 16 + And = 17 + Xor = 18 + Or = 19 + LAnd = 20 + LOr = 21 + Assign = 22 + MulAssign = 23 + DivAssign = 24 + RemAssign = 25 + AddAssign = 26 + SubAssign = 27 + ShlAssign = 28 + ShrAssign = 29 + AndAssign = 30 + XorAssign = 31 + OrAssign = 32 + Comma = 33 + + +class StorageClass(BaseEnumeration): + """ + Describes the storage class of a declaration + """ -StorageClass.INVALID = StorageClass(0) -StorageClass.NONE = StorageClass(1) -StorageClass.EXTERN = StorageClass(2) -StorageClass.STATIC = StorageClass(3) -StorageClass.PRIVATEEXTERN = StorageClass(4) -StorageClass.OPENCLWORKGROUPLOCAL = StorageClass(5) -StorageClass.AUTO = StorageClass(6) -StorageClass.REGISTER = StorageClass(7) + INVALID = 0 + NONE = 1 + EXTERN = 2 + STATIC = 3 + PRIVATEEXTERN = 4 + OPENCLWORKGROUPLOCAL = 5 + AUTO = 6 + REGISTER = 7 ### Availability Kinds ### @@ -2205,18 +2196,10 @@ class AvailabilityKind(BaseEnumeration): Describes the availability of an entity. """ - # The unique kind objects, indexed by id. - _kinds = [] - _name_map = None - - def __repr__(self): - return "AvailabilityKind.%s" % (self.name,) - - -AvailabilityKind.AVAILABLE = AvailabilityKind(0) -AvailabilityKind.DEPRECATED = AvailabilityKind(1) -AvailabilityKind.NOT_AVAILABLE = AvailabilityKind(2) -AvailabilityKind.NOT_ACCESSIBLE = AvailabilityKind(3) + AVAILABLE = 0 + DEPRECATED = 1 + NOT_AVAILABLE = 2 + NOT_ACCESSIBLE = 3 ### C++ access specifiers ### @@ -2226,22 +2209,11 @@ class AccessSpecifier(BaseEnumeration): Describes the access of a C++ class member """ - # The unique kind objects, index by id. - _kinds = [] - _name_map = None - - def from_param(self): - return self.value - - def __repr__(self): - return "AccessSpecifier.%s" % (self.name,) - - -AccessSpecifier.INVALID = AccessSpecifier(0) -AccessSpecifier.PUBLIC = AccessSpecifier(1) -AccessSpecifier.PROTECTED = AccessSpecifier(2) -AccessSpecifier.PRIVATE = AccessSpecifier(3) -AccessSpecifier.NONE = AccessSpecifier(4) + INVALID = 0 + PUBLIC = 1 + PROTECTED = 2 + PRIVATE = 3 + NONE = 4 ### Type Kinds ### @@ -2251,175 +2223,151 @@ class TypeKind(BaseEnumeration): Describes the kind of type. """ - # The unique kind objects, indexed by id. - _kinds = [] - _name_map = None - @property def spelling(self): """Retrieve the spelling of this TypeKind.""" return conf.lib.clang_getTypeKindSpelling(self.value) - def __repr__(self): - return "TypeKind.%s" % (self.name,) - - -TypeKind.INVALID = TypeKind(0) -TypeKind.UNEXPOSED = TypeKind(1) -TypeKind.VOID = TypeKind(2) -TypeKind.BOOL = TypeKind(3) -TypeKind.CHAR_U = TypeKind(4) -TypeKind.UCHAR = TypeKind(5) -TypeKind.CHAR16 = TypeKind(6) -TypeKind.CHAR32 = TypeKind(7) -TypeKind.USHORT = TypeKind(8) -TypeKind.UINT = TypeKind(9) -TypeKind.ULONG = TypeKind(10) -TypeKind.ULONGLONG = TypeKind(11) -TypeKind.UINT128 = TypeKind(12) -TypeKind.CHAR_S = TypeKind(13) -TypeKind.SCHAR = TypeKind(14) -TypeKind.WCHAR = TypeKind(15) -TypeKind.SHORT = TypeKind(16) -TypeKind.INT = TypeKind(17) -TypeKind.LONG = TypeKind(18) -TypeKind.LONGLONG = TypeKind(19) -TypeKind.INT128 = TypeKind(20) -TypeKind.FLOAT = TypeKind(21) -TypeKind.DOUBLE = TypeKind(22) -TypeKind.LONGDOUBLE = TypeKind(23) -TypeKind.NULLPTR = TypeKind(24) -TypeKind.OVERLOAD = TypeKind(25) -TypeKind.DEPENDENT = TypeKind(26) -TypeKind.OBJCID = TypeKind(27) -TypeKind.OBJCCLASS = TypeKind(28) -TypeKind.OBJCSEL = TypeKind(29) -TypeKind.FLOAT128 = TypeKind(30) -TypeKind.HALF = TypeKind(31) -TypeKind.IBM128 = TypeKind(40) -TypeKind.COMPLEX = TypeKind(100) -TypeKind.POINTER = TypeKind(101) -TypeKind.BLOCKPOINTER = TypeKind(102) -TypeKind.LVALUEREFERENCE = TypeKind(103) -TypeKind.RVALUEREFERENCE = TypeKind(104) -TypeKind.RECORD = TypeKind(105) -TypeKind.ENUM = TypeKind(106) -TypeKind.TYPEDEF = TypeKind(107) -TypeKind.OBJCINTERFACE = TypeKind(108) -TypeKind.OBJCOBJECTPOINTER = TypeKind(109) -TypeKind.FUNCTIONNOPROTO = TypeKind(110) -TypeKind.FUNCTIONPROTO = TypeKind(111) -TypeKind.CONSTANTARRAY = TypeKind(112) -TypeKind.VECTOR = TypeKind(113) -TypeKind.INCOMPLETEARRAY = TypeKind(114) -TypeKind.VARIABLEARRAY = TypeKind(115) -TypeKind.DEPENDENTSIZEDARRAY = TypeKind(116) -TypeKind.MEMBERPOINTER = TypeKind(117) -TypeKind.AUTO = TypeKind(118) -TypeKind.ELABORATED = TypeKind(119) -TypeKind.PIPE = TypeKind(120) -TypeKind.OCLIMAGE1DRO = TypeKind(121) -TypeKind.OCLIMAGE1DARRAYRO = TypeKind(122) -TypeKind.OCLIMAGE1DBUFFERRO = TypeKind(123) -TypeKind.OCLIMAGE2DRO = TypeKind(124) -TypeKind.OCLIMAGE2DARRAYRO = TypeKind(125) -TypeKind.OCLIMAGE2DDEPTHRO = TypeKind(126) -TypeKind.OCLIMAGE2DARRAYDEPTHRO = TypeKind(127) -TypeKind.OCLIMAGE2DMSAARO = TypeKind(128) -TypeKind.OCLIMAGE2DARRAYMSAARO = TypeKind(129) -TypeKind.OCLIMAGE2DMSAADEPTHRO = TypeKind(130) -TypeKind.OCLIMAGE2DARRAYMSAADEPTHRO = TypeKind(131) -TypeKind.OCLIMAGE3DRO = TypeKind(132) -TypeKind.OCLIMAGE1DWO = TypeKind(133) -TypeKind.OCLIMAGE1DARRAYWO = TypeKind(134) -TypeKind.OCLIMAGE1DBUFFERWO = TypeKind(135) -TypeKind.OCLIMAGE2DWO = TypeKind(136) -TypeKind.OCLIMAGE2DARRAYWO = TypeKind(137) -TypeKind.OCLIMAGE2DDEPTHWO = TypeKind(138) -TypeKind.OCLIMAGE2DARRAYDEPTHWO = TypeKind(139) -TypeKind.OCLIMAGE2DMSAAWO = TypeKind(140) -TypeKind.OCLIMAGE2DARRAYMSAAWO = TypeKind(141) -TypeKind.OCLIMAGE2DMSAADEPTHWO = TypeKind(142) -TypeKind.OCLIMAGE2DARRAYMSAADEPTHWO = TypeKind(143) -TypeKind.OCLIMAGE3DWO = TypeKind(144) -TypeKind.OCLIMAGE1DRW = TypeKind(145) -TypeKind.OCLIMAGE1DARRAYRW = TypeKind(146) -TypeKind.OCLIMAGE1DBUFFERRW = TypeKind(147) -TypeKind.OCLIMAGE2DRW = TypeKind(148) -TypeKind.OCLIMAGE2DARRAYRW = TypeKind(149) -TypeKind.OCLIMAGE2DDEPTHRW = TypeKind(150) -TypeKind.OCLIMAGE2DARRAYDEPTHRW = TypeKind(151) -TypeKind.OCLIMAGE2DMSAARW = TypeKind(152) -TypeKind.OCLIMAGE2DARRAYMSAARW = TypeKind(153) -TypeKind.OCLIMAGE2DMSAADEPTHRW = TypeKind(154) -TypeKind.OCLIMAGE2DARRAYMSAADEPTHRW = TypeKind(155) -TypeKind.OCLIMAGE3DRW = TypeKind(156) -TypeKind.OCLSAMPLER = TypeKind(157) -TypeKind.OCLEVENT = TypeKind(158) -TypeKind.OCLQUEUE = TypeKind(159) -TypeKind.OCLRESERVEID = TypeKind(160) - -TypeKind.EXTVECTOR = TypeKind(176) -TypeKind.ATOMIC = TypeKind(177) - + INVALID = 0 + UNEXPOSED = 1 + VOID = 2 + BOOL = 3 + CHAR_U = 4 + UCHAR = 5 + CHAR16 = 6 + CHAR32 = 7 + USHORT = 8 + UINT = 9 + ULONG = 10 + ULONGLONG = 11 + UINT128 = 12 + CHAR_S = 13 + SCHAR = 14 + WCHAR = 15 + SHORT = 16 + INT = 17 + LONG = 18 + LONGLONG = 19 + INT128 = 20 + FLOAT = 21 + DOUBLE = 22 + LONGDOUBLE = 23 + NULLPTR = 24 + OVERLOAD = 25 + DEPENDENT = 26 + OBJCID = 27 + OBJCCLASS = 28 + OBJCSEL = 29 + FLOAT128 = 30 + HALF = 31 + IBM128 = 40 + COMPLEX = 100 + POINTER = 101 + BLOCKPOINTER = 102 + LVALUEREFERENCE = 103 + RVALUEREFERENCE = 104 + RECORD = 105 + ENUM = 106 + TYPEDEF = 107 + OBJCINTERFACE = 108 + OBJCOBJECTPOINTER = 109 + FUNCTIONNOPROTO = 110 + FUNCTIONPROTO = 111 + CONSTANTARRAY = 112 + VECTOR = 113 + INCOMPLETEARRAY = 114 + VARIABLEARRAY = 115 + DEPENDENTSIZEDARRAY = 116 + MEMBERPOINTER = 117 + AUTO = 118 + ELABORATED = 119 + PIPE = 120 + OCLIMAGE1DRO = 121 + OCLIMAGE1DARRAYRO = 122 + OCLIMAGE1DBUFFERRO = 123 + OCLIMAGE2DRO = 124 + OCLIMAGE2DARRAYRO = 125 + OCLIMAGE2DDEPTHRO = 126 + OCLIMAGE2DARRAYDEPTHRO = 127 + OCLIMAGE2DMSAARO = 128 + OCLIMAGE2DARRAYMSAARO = 129 + OCLIMAGE2DMSAADEPTHRO = 130 + OCLIMAGE2DARRAYMSAADEPTHRO = 131 + OCLIMAGE3DRO = 132 + OCLIMAGE1DWO = 133 + OCLIMAGE1DARRAYWO = 134 + OCLIMAGE1DBUFFERWO = 135 + OCLIMAGE2DWO = 136 + OCLIMAGE2DARRAYWO = 137 + OCLIMAGE2DDEPTHWO = 138 + OCLIMAGE2DARRAYDEPTHWO = 139 + OCLIMAGE2DMSAAWO = 140 + OCLIMAGE2DARRAYMSAAWO = 141 + OCLIMAGE2DMSAADEPTHWO = 142 + OCLIMAGE2DARRAYMSAADEPTHWO = 143 + OCLIMAGE3DWO = 144 + OCLIMAGE1DRW = 145 + OCLIMAGE1DARRAYRW = 146 + OCLIMAGE1DBUFFERRW = 147 + OCLIMAGE2DRW = 148 + OCLIMAGE2DARRAYRW = 149 + OCLIMAGE2DDEPTHRW = 150 + OCLIMAGE2DARRAYDEPTHRW = 151 + OCLIMAGE2DMSAARW = 152 + OCLIMAGE2DARRAYMSAARW = 153 + OCLIMAGE2DMSAADEPTHRW = 154 + OCLIMAGE2DARRAYMSAADEPTHRW = 155 + OCLIMAGE3DRW = 156 + OCLSAMPLER = 157 + OCLEVENT = 158 + OCLQUEUE = 159 + OCLRESERVEID = 160 + + OBJCOBJECT = 161 + OBJCTYPEPARAM = 162 + ATTRIBUTED = 163 + + OCLINTELSUBGROUPAVCMCEPAYLOAD = 164 + OCLINTELSUBGROUPAVCIMEPAYLOAD = 165 + OCLINTELSUBGROUPAVCREFPAYLOAD = 166 + OCLINTELSUBGROUPAVCSICPAYLOAD = 167 + OCLINTELSUBGROUPAVCMCERESULT = 168 + OCLINTELSUBGROUPAVCIMERESULT = 169 + OCLINTELSUBGROUPAVCREFRESULT = 170 + OCLINTELSUBGROUPAVCSICRESULT = 171 + OCLINTELSUBGROUPAVCIMERESULTSINGLEREFERENCESTREAMOUT = 172 + OCLINTELSUBGROUPAVCIMERESULTSDUALREFERENCESTREAMOUT = 173 + OCLINTELSUBGROUPAVCIMERESULTSSINGLEREFERENCESTREAMIN = 174 + OCLINTELSUBGROUPAVCIMEDUALREFERENCESTREAMIN = 175 + + EXTVECTOR = 176 + ATOMIC = 177 + BTFTAGATTRIBUTED = 178 class RefQualifierKind(BaseEnumeration): """Describes a specific ref-qualifier of a type.""" - # The unique kind objects, indexed by id. - _kinds = [] - _name_map = None - - def from_param(self): - return self.value - - def __repr__(self): - return "RefQualifierKind.%s" % (self.name,) - - -RefQualifierKind.NONE = RefQualifierKind(0) -RefQualifierKind.LVALUE = RefQualifierKind(1) -RefQualifierKind.RVALUE = RefQualifierKind(2) + NONE = 0 + LVALUE = 1 + RVALUE = 2 class LinkageKind(BaseEnumeration): """Describes the kind of linkage of a cursor.""" - # The unique kind objects, indexed by id. - _kinds = [] - _name_map = None - - def from_param(self): - return self.value - - def __repr__(self): - return "LinkageKind.%s" % (self.name,) - - -LinkageKind.INVALID = LinkageKind(0) -LinkageKind.NO_LINKAGE = LinkageKind(1) -LinkageKind.INTERNAL = LinkageKind(2) -LinkageKind.UNIQUE_EXTERNAL = LinkageKind(3) -LinkageKind.EXTERNAL = LinkageKind(4) + INVALID = 0 + NO_LINKAGE = 1 + INTERNAL = 2 + UNIQUE_EXTERNAL = 3 + EXTERNAL = 4 class TLSKind(BaseEnumeration): """Describes the kind of thread-local storage (TLS) of a cursor.""" - # The unique kind objects, indexed by id. - _kinds = [] - _name_map = None - - def from_param(self): - return self.value - - def __repr__(self): - return "TLSKind.%s" % (self.name,) - - -TLSKind.NONE = TLSKind(0) -TLSKind.DYNAMIC = TLSKind(1) -TLSKind.STATIC = TLSKind(2) + NONE = 0 + DYNAMIC = 1 + STATIC = 2 class Type(Structure): @@ -3625,6 +3573,65 @@ def cursor(self): return cursor +class Rewriter(ClangObject): + """ + The Rewriter is a wrapper class around clang::Rewriter + + It enables rewriting buffers. + """ + + @staticmethod + def create(tu): + """ + Creates a new Rewriter + Parameters: + tu -- The translation unit for the target AST. + """ + return Rewriter(conf.lib.clang_CXRewriter_create(tu)) + + def __init__(self, ptr): + ClangObject.__init__(self, ptr) + + def __del__(self): + conf.lib.clang_CXRewriter_dispose(self) + + def insert_text_before(self, loc, insert): + """ + Insert the specified string at the specified location in + the original buffer. + """ + conf.lib.clang_CXRewriter_insertTextBefore(self, loc, insert) + + def replace_text(self, extent, replacement): + """ + This method replaces a range of characters in the input buffer with + a new string. + """ + conf.lib.clang_CXRewriter_replaceText(self, extent, replacement) + + def remove_text(self, extent): + """ + Remove the specified text region. + """ + conf.lib.clang_CXRewriter_removeText(self, extent) + + def overwrite_changed_files(self): + """ + Save all changed files to disk. + + Returns 1 if any files were not saved successfully, + returns 0 otherwise. + """ + return conf.lib.clang_CXRewriter_overwriteChangedFiles(self) + + def write_main_file_to_stdout(self): + """ + Writes the main file to stdout. + """ + sys.stdout.flush() + conf.lib.clang_CXRewriter_writeMainFileToStdOut(self) + + # Now comes the plumbing to hook up the C library. # Register callback types in common container. @@ -3690,6 +3697,13 @@ def cursor(self): ("clang_codeCompleteGetNumDiagnostics", [CodeCompletionResults], c_int), ("clang_createIndex", [c_int, c_int], c_object_p), ("clang_createTranslationUnit", [Index, c_interop_string], c_object_p), + ("clang_CXRewriter_create", [TranslationUnit], c_object_p), + ("clang_CXRewriter_dispose", [Rewriter]), + ("clang_CXRewriter_insertTextBefore", [Rewriter, SourceLocation, c_interop_string]), + ("clang_CXRewriter_overwriteChangedFiles", [Rewriter], c_int), + ("clang_CXRewriter_removeText", [Rewriter, SourceRange]), + ("clang_CXRewriter_replaceText", [Rewriter, SourceRange, c_interop_string]), + ("clang_CXRewriter_writeMainFileToStdOut", [Rewriter]), ("clang_CXXConstructor_isConvertingConstructor", [Cursor], bool), ("clang_CXXConstructor_isCopyConstructor", [Cursor], bool), ("clang_CXXConstructor_isDefaultConstructor", [Cursor], bool), @@ -3897,6 +3911,7 @@ def cursor(self): ("clang_Cursor_getTemplateArgumentUnsignedValue", [Cursor, c_uint], c_ulonglong), ("clang_Cursor_isAnonymous", [Cursor], bool), ("clang_Cursor_isBitField", [Cursor], bool), + ("clang_Cursor_getBinaryOpcode", [Cursor], c_int), ("clang_Cursor_getBriefCommentText", [Cursor], _CXString, _CXString.from_result), ("clang_Cursor_getRawCommentText", [Cursor], _CXString, _CXString.from_result), ("clang_Cursor_getOffsetOfField", [Cursor], c_longlong), @@ -4062,16 +4077,11 @@ def function_exists(self, name): return True -def register_enumerations(): - for name, value in clang.enumerations.TokenKinds: - TokenKind.register(value, name) - - conf = Config() -register_enumerations() __all__ = [ "AvailabilityKind", + "BinaryOperator", "Config", "CodeCompletionResults", "CompilationDatabase", diff --git a/scripts/data/clang_bindings.patch b/scripts/data/clang_bindings.patch index 6164bb6..b86c755 100644 --- a/scripts/data/clang_bindings.patch +++ b/scripts/data/clang_bindings.patch @@ -1,137 +1,6 @@ diff -aruN a/python/clang/cindex.py b/python/clang/cindex.py --- a/python/clang/cindex.py 2024-03-17 21:19:17 +++ b/python/clang/cindex.py 2024-03-17 21:18:28 -@@ -1090,7 +1090,24 @@ - - # Represents an @available(...) check. - CursorKind.OBJC_AVAILABILITY_CHECK_EXPR = CursorKind(148) -+ -+# Fixed point literal -+CursorKind.FIXED_POINT_LITERAL = CursorKind(149) -+ -+# OpenMP 5.0 [2.1.4, Array Shaping]. -+CursorKind.OMP_ARRAY_SHAPING_EXPR = CursorKind(150) -+ -+# OpenMP 5.0 [2.1.6 Iterators] -+CursorKind.OMP_ITERATOR_EXPR = CursorKind(151) -+ -+# OpenCL's addrspace_cast<> expression. -+CursorKind.CXX_ADDRSPACE_CAST_EXPR = CursorKind(152) -+ -+# Expression that references a C++20 concept. -+CursorKind.CONCEPT_SPECIALIZATION_EXPR = CursorKind(153) - -+# Expression that references a C++20 concept. -+CursorKind.REQUIRES_EXPR = CursorKind(154) - - # A statement whose specific kind is not exposed via this interface. - # -@@ -1312,6 +1329,105 @@ - # OpenMP teams distribute directive. - CursorKind.OMP_TEAMS_DISTRIBUTE_DIRECTIVE = CursorKind(271) - -+# OpenMP teams distribute simd directive. -+CursorKind.OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE = CursorKind(272) -+ -+# OpenMP teams distribute parallel for simd directive. -+CursorKind.OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE = CursorKind(273) -+ -+# OpenMP teams distribute parallel for directive. -+CursorKind.OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE = CursorKind(274) -+ -+# OpenMP target teams directive. -+CursorKind.OMP_TARGET_TEAMS_DIRECTIVE = CursorKind(275) -+ -+# OpenMP target teams distribute directive. -+CursorKind.OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE = CursorKind(276) -+ -+# OpenMP target teams distribute parallel for directive. -+CursorKind.OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE = CursorKind(277) -+ -+# OpenMP target teams distribute parallel for simd directive. -+CursorKind.OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE = CursorKind(278) -+ -+# OpenMP target teams distribute simd directive. -+CursorKind.OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE = CursorKind(279) -+ -+# C++2a std::bit_cast expression. -+CursorKind.BUILTIN_BIT_CAST_EXPR = CursorKind(280) -+ -+# OpenMP master taskloop directive. -+CursorKind.OMP_MASTER_TASK_LOOP_DIRECTIVE = CursorKind(281) -+ -+# OpenMP parallel master taskloop directive. -+CursorKind.OMP_PARALLEL_MASTER_TASK_LOOP_DIRECTIVE = CursorKind(282) -+ -+# OpenMP master taskloop simd directive. -+CursorKind.OMP_MASTER_TASK_LOOP_SIMD_DIRECTIVE = CursorKind(283) -+ -+# OpenMP parallel master taskloop simd directive. -+CursorKind.OMP_PARALLEL_MASTER_TASK_LOOP_SIMD_DIRECTIVE = CursorKind(284) -+ -+# OpenMP parallel master directive. -+CursorKind.OMP_PARALLEL_MASTER_DIRECTIVE = CursorKind(285) -+ -+# OpenMP depobj directive. -+CursorKind.OMP_DEPOBJ_DIRECTIVE = CursorKind(286) -+ -+# OpenMP scan directive. -+CursorKind.OMP_SCAN_DIRECTIVE = CursorKind(287) -+ -+# OpenMP tile directive. -+CursorKind.OMP_TILE_DIRECTIVE = CursorKind(288) -+ -+# OpenMP canonical loop. -+CursorKind.OMP_CANONICAL_LOOP = CursorKind(289) -+ -+# OpenMP interop directive. -+CursorKind.OMP_INTEROP_DIRECTIVE = CursorKind(290) -+ -+# OpenMP dispatch directive. -+CursorKind.OMP_DISPATCH_DIRECTIVE = CursorKind(291) -+ -+# OpenMP masked directive. -+CursorKind.OMP_MASKED_DIRECTIVE = CursorKind(292) -+ -+# OpenMP unroll directive. -+CursorKind.OMP_UNROLL_DIRECTIVE = CursorKind(293) -+ -+# OpenMP metadirective directive. -+CursorKind.OMP_META_DIRECTIVE = CursorKind(294) -+ -+# OpenMP loop directive. -+CursorKind.OMP_GENERIC_LOOP_DIRECTIVE = CursorKind(295) -+ -+# OpenMP teams loop directive. -+CursorKind.OMP_TEAMS_GENERIC_LOOP_DIRECTIVE = CursorKind(296) -+ -+# OpenMP target teams loop directive. -+CursorKind.OMP_TARGET_TEAMS_GENERIC_LOOP_DIRECTIVE = CursorKind(297) -+ -+# OpenMP parallel loop directive. -+CursorKind.OMP_PARALLEL_GENERIC_LOOP_DIRECTIVE = CursorKind(298) -+ -+# OpenMP target parallel loop directive. -+CursorKind.OMP_TARGET_PARALLEL_GENERIC_LOOP_DIRECTIVE = CursorKind(299) -+ -+# OpenMP parallel masked directive. -+CursorKind.OMP_PARALLEL_MASKED_DIRECTIVE = CursorKind(300) -+ -+# OpenMP masked taskloop directive. -+CursorKind.OMP_MASKED_TASK_LOOP_DIRECTIVE = CursorKind(301) -+ -+# OpenMP masked taskloop simd directive. -+CursorKind.OMP_MASKED_TASK_LOOP_SIMD_DIRECTIVE = CursorKind(302) -+ -+# OpenMP parallel masked taskloop directive. -+CursorKind.OMP_PARALLEL_MASKED_TASK_LOOP_DIRECTIVE = CursorKind(303) -+ -+# OpenMP parallel masked taskloop simd directive. -+CursorKind.OMP_PARALLEL_MASKED_TASK_LOOP_SIMD_DIRECTIVE = CursorKind(304) -+ - ### - # Other Kinds - @@ -1441,6 +1557,9 @@ return cursor diff --git a/scripts/update_python_clang_bindings.sh b/scripts/update_python_clang_bindings.sh index ea50166..03c5985 100755 --- a/scripts/update_python_clang_bindings.sh +++ b/scripts/update_python_clang_bindings.sh @@ -3,13 +3,12 @@ set -euo pipefail TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" -LLVM_VERSION="${LLVM_VERSION:-18.1.1}" +LLVM_VERSION="${LLVM_VERSION:-19.1.3}" LLVM_URL_PREFIX="https://raw.githubusercontent.com/llvm/llvm-project/llvmorg-${LLVM_VERSION}/clang/bindings/python" LISTING=( "clang/__init__.py" "clang/cindex.py" - "clang/enumerations.py" ) function run() { diff --git a/setup.py b/setup.py index 77b6fb0..1b46d74 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name='libclang', - version='18.1.1', + version='19.1.3', description='Clang Python Bindings, mirrored from the official LLVM repo: https://github.com/llvm/llvm-project/tree/main/clang/bindings/python, to make the installation process easier.', long_description=long_description, long_description_content_type='text/markdown', diff --git a/setup_ext.py b/setup_ext.py index 8831a0f..7ca353d 100644 --- a/setup_ext.py +++ b/setup_ext.py @@ -54,7 +54,7 @@ def run(self): setup( name='libclang', - version='18.1.1', + version='19.1.3', description='Clang Python Bindings, mirrored from the official LLVM repo: https://github.com/llvm/llvm-project/tree/main/clang/bindings/python, to make the installation process easier.', long_description=long_description, long_description_content_type='text/markdown',