lib/ffi/clang/lib/translation_unit.rb in ffi-clang-0.8.0 vs lib/ffi/clang/lib/translation_unit.rb in ffi-clang-0.9.0

- old
+ new

@@ -1,12 +1,13 @@ # frozen_string_literal: true # Released under the MIT License. -# Copyright, 2013-2022, by Samuel Williams. +# Copyright, 2013-2024, by Samuel Williams. # Copyright, 2014, by Masahiro Sano. # Copyright, 2019, by Hayden Purdy. # Copyright, 2022, by Motonori Iwamuro. +# Copyright, 2023, by Charlie Savage. require_relative 'index' module FFI module Clang @@ -26,11 +27,13 @@ :create_preamble_on_first_parse, 0x100, :keep_going, 0x200, :single_file_parse, 0x400, :limit_skip_function_bodies_to_preamble, 0x800, :include_attributed_type, 0x1000, - :visit_implicit_attributes, 0x2000 + :visit_implicit_attributes, 0x2000, + :ignore_non_errors_from_included_files, 0x4000, + :retain_excluded_conditional_blocks, 0x8000, ] SaveTranslationUnitFlags = enum [ :save_translation_unit_none, 0x0, ] @@ -61,10 +64,18 @@ :preprocessing_record, 12, :sourcemanager_data_structures, 13, :preprocessor_header_search, 14, ] + ErrorCodes = enum [ + :cx_error_success, 0, + :cx_error_failure, 1, + :cx_error_crashed, 2, + :cx_error_invalid_arguments, 3, + :cx_error_ast_read_error, 4, + ] + class CXTUResourceUsage < FFI::Struct layout( :data, :pointer, :numEntries, :uint, :entries, :pointer @@ -78,9 +89,10 @@ ) end # Source code translation units: attach_function :parse_translation_unit, :clang_parseTranslationUnit, [:CXIndex, :string, :pointer, :int, :pointer, :uint, :uint], :CXTranslationUnit + attach_function :parse_translation_unit2, :clang_parseTranslationUnit2, [:CXIndex, :string, :pointer, :int, :pointer, :uint, :uint, :pointer], ErrorCodes attach_function :create_translation_unit, :clang_createTranslationUnit, [:CXIndex, :string], :CXTranslationUnit attach_function :dispose_translation_unit, :clang_disposeTranslationUnit, [:CXTranslationUnit], :void attach_function :get_translation_unit_spelling, :clang_getTranslationUnitSpelling, [:CXTranslationUnit], CXString.by_value attach_function :default_editing_translation_unit_options, :clang_defaultEditingTranslationUnitOptions, [], :uint