Skip to content

Commit

Permalink
Set then enum value cursor_translation_unit based on the Clang version.
Browse files Browse the repository at this point in the history
  • Loading branch information
cfis committed Apr 27, 2023
1 parent cfcc909 commit f469965
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/ffi/clang/clang_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@ module Clang
def self.clang_version_string
Lib.extract_string Lib.get_clang_version
end

def self.clang_version
clang_version = self.clang_version_string.match(/\d+\.\d+\.\d+/)
Gem::Version.new(clang_version)
end
end
end
3 changes: 2 additions & 1 deletion lib/ffi/clang/lib/cursor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ module Lib
:cursor_omp_depobj_directive, 286,
:cursor_omp_scan_directive, 287,
# :cursor_last_stmt, :cursor_omp_scan_directive,
:cursor_translation_unit, 350,
In Clang 15 the enum value changed from 300 to 350!
:cursor_translation_unit, Clang.clang_version < Gem::Version.new('15.0.0') ? 300 : 350,
:cursor_first_attr, 400,
:cursor_unexposed_attr, 400,
:cursor_ibaction_attr, 401,
Expand Down

0 comments on commit f469965

Please sign in to comment.