lib/ffi/clang/lib/cursor.rb in ffi-clang-0.7.0 vs lib/ffi/clang/lib/cursor.rb in ffi-clang-0.8.0

- old
+ new

@@ -1,36 +1,30 @@ -# Copyright, 2010-2012 by Jari Bakken. -# Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com> -# Copyright, 2013, by Garry C. Marshall. <http://www.meaningfulname.net> -# Copyright, 2014, by Masahiro Sano. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. +# frozen_string_literal: true +# Released under the MIT License. +# Copyright, 2013, by Garry Marshall. +# Copyright, 2013-2022, by Samuel Williams. +# Copyright, 2013, by Carlos Martín Nieto. +# Copyright, 2013, by Dave Wilkinson. +# Copyright, 2013, by Takeshi Watanabe. +# Copyright, 2013-2014, by Masahiro Sano. +# Copyright, 2014, by George Pimm. +# Copyright, 2014, by Niklas Therning. +# Copyright, 2019, by Michael Metivier. +# Copyright, 2020, by Luikore. + require_relative 'translation_unit' require_relative 'diagnostic' require_relative 'comment' require_relative 'type' module FFI module Clang module Lib + # In Clang 15 the enum value changed from 300 to 350! + CUSOR_TRANSLATION_UNIT = Clang.clang_version < Gem::Version.new('15.0.0') ? 300 : 350 + enum :cursor_kind, [ :cursor_unexposed_decl, 1, :cursor_struct, 2, # :cusor_struct_decl, :cursor_struct :cursor_union, 3, @@ -239,11 +233,11 @@ :cursor_omp_parallel_master_task_loop_simd_directive, 284, :cursor_omp_parallel_master_directive, 285, :cursor_omp_depobj_directive, 286, :cursor_omp_scan_directive, 287, # :cursor_last_stmt, :cursor_omp_scan_directive, - :cursor_translation_unit, 300, + :cursor_translation_unit, CUSOR_TRANSLATION_UNIT, :cursor_first_attr, 400, :cursor_unexposed_attr, 400, :cursor_ibaction_attr, 401, :cursor_iboutlet_attr, 402, :cursor_iboutlet_collection_attr, 403, @@ -480,8 +474,25 @@ attach_function :get_typedef_decl_unerlying_type, :clang_getTypedefDeclUnderlyingType, [CXCursor.by_value], CXType.by_value attach_function :get_enum_type, :clang_getEnumDeclIntegerType, [CXCursor.by_value], CXType.by_value attach_function :get_num_args, :clang_Cursor_getNumArguments, [CXCursor.by_value], :int + + attach_function :is_converting_constructor, :clang_CXXConstructor_isConvertingConstructor, [CXCursor.by_value], :uint + attach_function :is_copy_constructor, :clang_CXXConstructor_isCopyConstructor, [CXCursor.by_value], :uint + attach_function :is_default_constructor, :clang_CXXConstructor_isDefaultConstructor, [CXCursor.by_value], :uint + attach_function :is_move_constructor, :clang_CXXConstructor_isMoveConstructor, [CXCursor.by_value], :uint + attach_function :is_mutable, :clang_CXXField_isMutable, [CXCursor.by_value], :uint + attach_function :is_defaulted, :clang_CXXMethod_isDefaulted, [CXCursor.by_value], :uint + attach_function :is_abstract, :clang_CXXRecord_isAbstract, [CXCursor.by_value], :uint + attach_function :is_enum_scoped, :clang_EnumDecl_isScoped, [CXCursor.by_value], :uint + attach_function :is_const, :clang_CXXMethod_isConst, [CXCursor.by_value], :uint + + if Clang.clang_version >= Gem::Version.new('16.0.0') + attach_function :is_deleted, :clang_CXXMethod_isDeleted, [CXCursor.by_value], :uint + attach_function :is_copy_assignment_operator, :clang_CXXMethod_isCopyAssignmentOperator, [CXCursor.by_value], :uint + attach_function :is_move_assignment_operator, :clang_CXXMethod_isMoveAssignmentOperator, [CXCursor.by_value], :uint + attach_function :is_explicit, :clang_CXXMethod_isExplicit, [CXCursor.by_value], :uint + end end end end