ffi-clang 0.10.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eed14776878ea1dd5fe61ec2b8c9bb57be78116944d5943722077dd958e65b90
4
- data.tar.gz: 15acda164aae15f941ae12031e1f68a8a220f0b5e48c6ed07737e0d8a733893d
3
+ metadata.gz: 37f934d60fbdb3b3595b30bce1e3aa64606bb6a98a7e096e4d26f9deec4bdbf0
4
+ data.tar.gz: 5e82c4739b554e83fbb1753a4a7ccaa976d7e271b9ddde53d68f389e03d21f22
5
5
  SHA512:
6
- metadata.gz: bb918188b02394a8d21f863f1b989a2cb96789f11c97d83c417258ac25a590e63297daf7e7fb6851f06e4890051f9130b9c75d850f1662ad29f6652a244bceb4
7
- data.tar.gz: 6b48dabf35dc7606859f18f4267800f4e6de1a2eec1496e3e89cbad282727cb8f80c4820b1405e772bad59bfd8559a98076804e2320b453d65e0d22104ba9bd0
6
+ metadata.gz: '09dfa50b6c4e1ba906d0a6114ab54d3f3e7b32af7ed23a1d5d149c879ff01a6131bf48280e2bc4b4002e04522c5665123383b9f6a786c390908c8a4202c9e6e9'
7
+ data.tar.gz: 92ab385b15e7ba6d548b796c175032c693fd467f2e308bdd76f5ba2edd10736ec184f7af7db8e7b2a9f03d3000d5aab6fd84737b212775edf8aa093859310fcb
checksums.yaml.gz.sig CHANGED
Binary file
@@ -146,6 +146,9 @@ module FFI
146
146
 
147
147
  def qualified_name
148
148
  if self.kind != :cursor_translation_unit
149
+ if self.semantic_parent.kind == :cursor_invalid_file
150
+ raise(ArgumentError, "Invalid semantic parent: #{self}")
151
+ end
149
152
  result = self.semantic_parent.qualified_name
150
153
  result ? "#{result}::#{self.spelling}" : self.spelling
151
154
  end
@@ -298,6 +301,10 @@ module FFI
298
301
  Lib.visit_children(@cursor, adapter, nil)
299
302
  end
300
303
 
304
+ def visit_children(&block)
305
+ each(false, &block)
306
+ end
307
+
301
308
  def ancestors_by_kind(*kinds)
302
309
  result = Array.new
303
310
 
@@ -341,6 +348,10 @@ module FFI
341
348
  Lib.get_cursor_linkage(@cursor)
342
349
  end
343
350
 
351
+ def exception_specification
352
+ Lib.get_cursor_exception_specification_type(@cursor)
353
+ end
354
+
344
355
  def availability
345
356
  Lib.get_cursor_availability(@cursor)
346
357
  end
@@ -319,6 +319,19 @@ module FFI
319
319
  :external, 4,
320
320
  ]
321
321
 
322
+ enum :exception_specification_type, [
323
+ :none,
324
+ :dynamic_none,
325
+ :dynamic,
326
+ :ms_any,
327
+ :basic_noexcept,
328
+ :computed_noexcept,
329
+ :unevaluated,
330
+ :uninstantiated,
331
+ :unparsed,
332
+ :no_throw
333
+ ]
334
+
322
335
  class CXCursor < FFI::Struct
323
336
  layout(
324
337
  :kind, :cursor_kind,
@@ -454,6 +467,7 @@ module FFI
454
467
 
455
468
  attach_function :get_cursor_availability, :clang_getCursorAvailability, [CXCursor.by_value], :availability
456
469
  attach_function :get_cursor_linkage, :clang_getCursorLinkage, [CXCursor.by_value], :linkage_kind
470
+ attach_function :get_cursor_exception_specification_type, :clang_getCursorExceptionSpecificationType, [CXCursor.by_value], :exception_specification_type
457
471
  attach_function :get_included_file, :clang_getIncludedFile, [CXCursor.by_value], :CXFile
458
472
  attach_function :get_cursor_hash, :clang_hashCursor, [CXCursor.by_value], :uint
459
473
 
@@ -169,6 +169,20 @@ module FFI
169
169
  :layout_error_undeduced, -6
170
170
  ]
171
171
 
172
+ # Also defined in cursor.rb
173
+ enum :exception_specification_type, [
174
+ :none,
175
+ :dynamic_none,
176
+ :dynamic,
177
+ :ms_any,
178
+ :basic_noexcept,
179
+ :computed_noexcept,
180
+ :unevaluated,
181
+ :uninstantiated,
182
+ :unparsed,
183
+ :no_throw
184
+ ]
185
+
172
186
  class CXType < FFI::Struct
173
187
  layout(
174
188
  :kind, :kind,
@@ -206,6 +220,7 @@ module FFI
206
220
  attach_function :type_get_cxx_ref_qualifier, :clang_Type_getCXXRefQualifier, [CXType.by_value], :ref_qualifier_kind
207
221
 
208
222
  attach_function :get_fuction_type_calling_conv, :clang_getFunctionTypeCallingConv, [CXType.by_value], :calling_conv
223
+ attach_function :get_exception_specification_type, :clang_getExceptionSpecificationType, [CXType.by_value], :exception_specification_type
209
224
 
210
225
  attach_function :equal_types, :clang_equalTypes, [CXType.by_value, CXType.by_value], :uint
211
226
  end
data/lib/ffi/clang/lib.rb CHANGED
@@ -27,26 +27,10 @@ module FFI
27
27
 
28
28
  # If we aren't building for a specific version (e.g. travis) try to find llvm-config
29
29
  unless ENV['LLVM_VERSION']
30
- llvm_config ||= MakeMakefile.find_executable0("llvm-config")
30
+ llvm_config ||= MakeMakefile.find_executable("llvm-config")
31
31
  end
32
32
 
33
33
  libs = []
34
- begin
35
- xcode_dir = `xcode-select -p`.chomp
36
- %W[
37
- #{xcode_dir}/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib
38
- #{xcode_dir}/usr/lib/libclang.dylib
39
- ].each do |f|
40
- if File.exist? f
41
- libs << f
42
- break
43
- end
44
- end
45
- rescue Errno::ENOENT
46
- # Ignore
47
- end
48
-
49
- libs << "clang"
50
34
 
51
35
  if ENV['LIBCLANG']
52
36
  libs << ENV['LIBCLANG']
@@ -65,6 +49,23 @@ module FFI
65
49
  end
66
50
  end
67
51
 
52
+ begin
53
+ xcode_dir = `xcode-select -p`.chomp
54
+ %W[
55
+ #{xcode_dir}/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib
56
+ #{xcode_dir}/usr/lib/libclang.dylib
57
+ ].each do |f|
58
+ if File.exist? f
59
+ libs << f
60
+ break
61
+ end
62
+ end
63
+ rescue Errno::ENOENT
64
+ # Ignore
65
+ end
66
+
67
+ libs << "clang"
68
+
68
69
  ffi_lib libs
69
70
 
70
71
  def self.bitmask_from(enum, opts)
@@ -2,6 +2,8 @@ module FFI
2
2
  module Clang
3
3
  module Types
4
4
  class Function < Type
5
+ include Enumerable
6
+
5
7
  def variadic?
6
8
  Lib.is_function_type_variadic(@type) != 0
7
9
  end
@@ -14,6 +16,16 @@ module FFI
14
16
  Type.create Lib.get_arg_type(@type, i), @translation_unit
15
17
  end
16
18
 
19
+ def arg_types
20
+ return to_enum(:arg_types) unless block_given?
21
+
22
+ self.args_size.times do |i|
23
+ yield self.arg_type(i)
24
+ end
25
+
26
+ self
27
+ end
28
+
17
29
  def result_type
18
30
  Type.create Lib.get_result_type(@type), @translation_unit
19
31
  end
@@ -21,6 +33,10 @@ module FFI
21
33
  def calling_conv
22
34
  Lib.get_fuction_type_calling_conv(@type)
23
35
  end
36
+
37
+ def exception_specification
38
+ Lib.get_exception_specification_type(@type)
39
+ end
24
40
  end
25
41
  end
26
42
  end
@@ -14,7 +14,7 @@ module FFI
14
14
  class Type
15
15
  attr_reader :type, :translation_unit
16
16
 
17
- # Just hard code the types - they don't likely to change
17
+ # Just hard code the types - they are not likely to change
18
18
  def self.create(cxtype, translation_unit)
19
19
  case cxtype[:kind]
20
20
  when :type_pointer, :type_block_pointer, :type_obj_c_object_pointer, :type_member_pointer
@@ -85,6 +85,10 @@ module FFI
85
85
  Cursor.new Lib.get_type_declaration(@type), @translation_unit
86
86
  end
87
87
 
88
+ def non_reference_type
89
+ Type.create Lib.get_non_reference_type(@type),@translation_unit
90
+ end
91
+
88
92
  def ==(other)
89
93
  Lib.equal_types(@type, other.type) != 0
90
94
  end
@@ -7,6 +7,6 @@
7
7
 
8
8
  module FFI
9
9
  module Clang
10
- VERSION = "0.10.0"
10
+ VERSION = "0.12.0"
11
11
  end
12
12
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-clang
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -55,7 +55,7 @@ cert_chain:
55
55
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
56
56
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
57
57
  -----END CERTIFICATE-----
58
- date: 2024-06-14 00:00:00.000000000 Z
58
+ date: 2024-11-27 00:00:00.000000000 Z
59
59
  dependencies:
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: ffi
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []
146
- rubygems_version: 3.5.9
146
+ rubygems_version: 3.5.22
147
147
  signing_key:
148
148
  specification_version: 4
149
149
  summary: Ruby FFI bindings for libclang C interface.
metadata.gz.sig CHANGED
Binary file