ffi-clang 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +4 -0
  3. data/ext/rakefile.rb +4 -0
  4. data/ext/teapot.rb +4 -3
  5. data/lib/ffi/clang/clang_version.rb +9 -19
  6. data/lib/ffi/clang/code_completion.rb +4 -18
  7. data/lib/ffi/clang/comment.rb +7 -19
  8. data/lib/ffi/clang/compilation_database.rb +4 -18
  9. data/lib/ffi/clang/cursor.rb +92 -25
  10. data/lib/ffi/clang/diagnostic.rb +8 -21
  11. data/lib/ffi/clang/file.rb +4 -18
  12. data/lib/ffi/clang/index.rb +9 -20
  13. data/lib/ffi/clang/lib/clang_version.rb +5 -19
  14. data/lib/ffi/clang/lib/code_completion.rb +4 -18
  15. data/lib/ffi/clang/lib/comment.rb +7 -20
  16. data/lib/ffi/clang/lib/compilation_database.rb +4 -18
  17. data/lib/ffi/clang/lib/cursor.rb +185 -41
  18. data/lib/ffi/clang/lib/diagnostic.rb +8 -28
  19. data/lib/ffi/clang/lib/file.rb +5 -20
  20. data/lib/ffi/clang/lib/inclusions.rb +5 -19
  21. data/lib/ffi/clang/lib/index.rb +6 -20
  22. data/lib/ffi/clang/lib/source_location.rb +5 -20
  23. data/lib/ffi/clang/lib/source_range.rb +5 -22
  24. data/lib/ffi/clang/lib/string.rb +6 -20
  25. data/lib/ffi/clang/lib/token.rb +4 -18
  26. data/lib/ffi/clang/lib/translation_unit.rb +7 -21
  27. data/lib/ffi/clang/lib/type.rb +8 -20
  28. data/lib/ffi/clang/lib.rb +31 -23
  29. data/lib/ffi/clang/source_location.rb +7 -20
  30. data/lib/ffi/clang/source_range.rb +7 -22
  31. data/lib/ffi/clang/token.rb +4 -18
  32. data/lib/ffi/clang/translation_unit.rb +17 -23
  33. data/lib/ffi/clang/type.rb +7 -19
  34. data/lib/ffi/clang/unsaved_file.rb +6 -20
  35. data/lib/ffi/clang/version.rb +7 -21
  36. data/lib/ffi/clang.rb +9 -20
  37. data/license.md +38 -0
  38. data/readme.md +46 -0
  39. data.tar.gz.sig +0 -0
  40. metadata +78 -81
  41. metadata.gz.sig +2 -0
  42. data/.gitignore +0 -19
  43. data/.rspec +0 -5
  44. data/.travis.yml +0 -30
  45. data/Gemfile +0 -13
  46. data/README.md +0 -74
  47. data/Rakefile +0 -12
  48. data/examples/docs.cpp +0 -25
  49. data/examples/docs.rb +0 -31
  50. data/ffi-clang.gemspec +0 -26
  51. data/spec/ffi/clang/code_completion_spec.rb +0 -181
  52. data/spec/ffi/clang/comment_spec.rb +0 -453
  53. data/spec/ffi/clang/compilation_database_spec.rb +0 -176
  54. data/spec/ffi/clang/cursor_spec.rb +0 -701
  55. data/spec/ffi/clang/diagnostic_spec.rb +0 -89
  56. data/spec/ffi/clang/file_spec.rb +0 -82
  57. data/spec/ffi/clang/fixtures/a.c +0 -7
  58. data/spec/ffi/clang/fixtures/canonical.c +0 -5
  59. data/spec/ffi/clang/fixtures/class.cpp +0 -8
  60. data/spec/ffi/clang/fixtures/compile_commands.json +0 -17
  61. data/spec/ffi/clang/fixtures/completion.cxx +0 -8
  62. data/spec/ffi/clang/fixtures/docs.c +0 -1
  63. data/spec/ffi/clang/fixtures/docs.cc +0 -1
  64. data/spec/ffi/clang/fixtures/docs.h +0 -54
  65. data/spec/ffi/clang/fixtures/list.c +0 -11
  66. data/spec/ffi/clang/fixtures/location1.c +0 -7
  67. data/spec/ffi/clang/fixtures/simple.ast +0 -0
  68. data/spec/ffi/clang/fixtures/simple.c +0 -3
  69. data/spec/ffi/clang/fixtures/test.cxx +0 -62
  70. data/spec/ffi/clang/index_spec.rb +0 -90
  71. data/spec/ffi/clang/source_location_spec.rb +0 -138
  72. data/spec/ffi/clang/source_range_spec.rb +0 -74
  73. data/spec/ffi/clang/token_spec.rb +0 -82
  74. data/spec/ffi/clang/translation_unit_spec.rb +0 -214
  75. data/spec/ffi/clang/type_spec.rb +0 -273
  76. data/spec/ffi/clang/version_spec.rb +0 -28
  77. data/spec/spec_helper.rb +0 -51
@@ -1,25 +1,16 @@
1
- # Copyright, 2010-2012 by Jari Bakken.
2
- # Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com>
3
- # Copyright, 2013, by Garry C. Marshall. <http://www.meaningfulname.net>
4
- # Copyright, 2014, by Masahiro Sano.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2013, by Garry Marshall.
5
+ # Copyright, 2013-2022, by Samuel Williams.
6
+ # Copyright, 2013, by Carlos Martín Nieto.
7
+ # Copyright, 2013, by Dave Wilkinson.
8
+ # Copyright, 2013, by Takeshi Watanabe.
9
+ # Copyright, 2013-2014, by Masahiro Sano.
10
+ # Copyright, 2014, by George Pimm.
11
+ # Copyright, 2014, by Niklas Therning.
12
+ # Copyright, 2019, by Michael Metivier.
13
+ # Copyright, 2020, by Luikore.
23
14
 
24
15
  require_relative 'translation_unit'
25
16
  require_relative 'diagnostic'
@@ -29,22 +20,30 @@ require_relative 'type'
29
20
  module FFI
30
21
  module Clang
31
22
  module Lib
23
+ # In Clang 15 the enum value changed from 300 to 350!
24
+ CUSOR_TRANSLATION_UNIT = Clang.clang_version < Gem::Version.new('15.0.0') ? 300 : 350
25
+
32
26
  enum :cursor_kind, [
33
27
  :cursor_unexposed_decl, 1,
34
28
  :cursor_struct, 2,
29
+ # :cusor_struct_decl, :cursor_struct
35
30
  :cursor_union, 3,
31
+ # :cusor_union_decl, :cursor_union
36
32
  :cursor_class_decl, 4,
37
33
  :cursor_enum_decl, 5,
38
34
  :cursor_field_decl, 6,
39
35
  :cursor_enum_constant_decl, 7,
40
36
  :cursor_function, 8,
37
+ # :cursor_function_decl, :cursor_function,
41
38
  :cursor_variable, 9,
39
+ # :cursor_var_decl, :cursor_variable,
42
40
  :cursor_parm_decl, 10,
43
41
  :cursor_obj_c_interface_decl, 11,
44
42
  :cursor_obj_c_category_decl, 12,
45
43
  :cursor_obj_c_protocol_decl, 13,
46
44
  :cursor_obj_c_property_decl, 14,
47
45
  :cursor_obj_c_instance_var_decl, 15,
46
+ # :cursor_obj_c_ivar_decl, :cursor_obj_c_instance_var_decl,
48
47
  :cursor_obj_c_instance_method_decl, 16,
49
48
  :cursor_obj_c_class_method_decl, 17,
50
49
  :cursor_obj_c_implementation_decl, 18,
@@ -69,6 +68,9 @@ module FFI
69
68
  :cursor_obj_c_synthesize_decl, 37,
70
69
  :cursor_obj_c_dynamic_decl, 38,
71
70
  :cursor_cxx_access_specifier, 39,
71
+ # :cursor_first_decl, :cursor_unexposed_decl,
72
+ # :cursor_last_decl, :cursor_cxx_access_specifier,
73
+ :cursor_first_ref, 40,
72
74
  :cursor_obj_c_super_class_ref, 40,
73
75
  :cursor_obj_c_protocol_ref, 41,
74
76
  :cursor_obj_c_class_ref, 42,
@@ -80,10 +82,14 @@ module FFI
80
82
  :cursor_label_ref, 48,
81
83
  :cursor_overloaded_decl_ref, 49,
82
84
  :cursor_variable_ref, 50,
85
+ # :cursor_last_ref, :cursor_variable_ref,
86
+ :cursor_first_invalid, 70,
83
87
  :cursor_invalid_file, 70,
84
88
  :cursor_no_decl_found, 71,
85
89
  :cursor_not_implemented, 72,
86
90
  :cursor_invalid_code, 73,
91
+ # :cursor_last_invalid, :cursor_invalid_code,
92
+ :cursor_first_expr, 100,
87
93
  :cursor_unexposed_expr, 100,
88
94
  :cursor_decl_ref_expr, 101,
89
95
  :cursor_member_ref_expr, 102,
@@ -113,25 +119,33 @@ module FFI
113
119
  :cursor_cxx_reinterpret_cast_expr, 126,
114
120
  :cursor_cxx_const_cast_expr, 127,
115
121
  :cursor_cxx_functional_cast_expr, 128,
116
- :cursor_cxx_typeid_expr, 129,
117
- :cursor_cxx_bool_literal_expr, 130,
118
- :cursor_cxx_null_ptr_literal_expr, 131,
119
- :cursor_cxx_this_expr, 132,
120
- :cursor_cxx_throw_expr, 133,
121
- :cursor_cxx_new_expr, 134,
122
- :cursor_cxx_delete_expr, 135,
123
- :cursor_unary_expr, 136,
124
- :cursor_obj_c_string_literal, 137,
125
- :cursor_obj_c_encode_expr, 138,
126
- :cursor_obj_c_selector_expr, 139,
127
- :cursor_obj_c_protocol_expr, 140,
128
- :cursor_obj_c_bridged_cast_expr, 141,
129
- :cursor_pack_expansion_expr, 142,
130
- :cursor_size_of_pack_expr, 143,
131
- :cursor_lambda_expr, 144,
132
- :cursor_obj_c_bool_literal_expr, 145,
133
- :cursor_obj_c_self_expr, 146,
122
+ :cursor_cxx_addrspace_cast_expr, 129,
123
+ :cursor_cxx_typeid_expr, 130,
124
+ :cursor_cxx_bool_literal_expr, 131,
125
+ :cursor_cxx_null_ptr_literal_expr, 132,
126
+ :cursor_cxx_this_expr, 133,
127
+ :cursor_cxx_throw_expr, 134,
128
+ :cursor_cxx_new_expr, 135,
129
+ :cursor_cxx_delete_expr, 136,
130
+ :cursor_unary_expr, 137,
131
+ :cursor_obj_c_string_literal, 138,
132
+ :cursor_obj_c_encode_expr, 139,
133
+ :cursor_obj_c_selector_expr, 140,
134
+ :cursor_obj_c_protocol_expr, 141,
135
+ :cursor_obj_c_bridged_cast_expr, 142,
136
+ :cursor_pack_expansion_expr, 143,
137
+ :cursor_size_of_pack_expr, 144,
138
+ :cursor_lambda_expr, 145,
139
+ :cursor_obj_c_bool_literal_expr, 146,
140
+ :cursor_obj_c_self_expr, 147,
141
+ :cursor_omp_array_section_expr, 148,
142
+ :cursor_obj_c_availability_check_expr, 149,
143
+ :cursor_fixed_point_literal, 150,
144
+ :cursor_omp_array_shaping_expr, 151,
145
+ :cursor_omp_iterator_expr, 152,
146
+ # :cursor_last_expr, :cursor_omp_iterator_expr,
134
147
  :cursor_unexposed_stmt, 200,
148
+ # :cursor_first_stmt, :cursor_unexposed_stmt,
135
149
  :cursor_label_stmt, 201,
136
150
  :cursor_compound_stmt, 202,
137
151
  :cursor_case_stmt, 203,
@@ -147,6 +161,7 @@ module FFI
147
161
  :cursor_break_stmt, 213,
148
162
  :cursor_return_stmt, 214,
149
163
  :cursor_gcc_asm_stmt, 215,
164
+ # :cursor_asm_stmt, :cursor_gcc_asm_stmt,
150
165
  :cursor_obj_c_at_try_stmt, 216,
151
166
  :cursor_obj_c_at_catch_stmt, 217,
152
167
  :cursor_obj_c_at_finally_stmt, 218,
@@ -164,7 +179,64 @@ module FFI
164
179
  :cursor_null_stmt, 230,
165
180
  :cursor_decl_stmt, 231,
166
181
  :cursor_omp_parallel_directive, 232,
167
- :cursor_translation_unit, 300,
182
+ :cursor_omp_simd_directive, 233,
183
+ :cursor_omp_for_directive, 234,
184
+ :cursor_omp_sections_directive, 235,
185
+ :cursor_omp_section_directive, 236,
186
+ :cursor_omp_single_directive, 237,
187
+ :cursor_omp_parallel_for_directive, 238,
188
+ :cursor_omp_parallel_sections_directive, 239,
189
+ :cursor_omp_task_directive, 240,
190
+ :cursor_omp_master_directive, 241,
191
+ :cursor_omp_critical_directive, 242,
192
+ :cursor_omp_taskyield_directive, 243,
193
+ :cursor_omp_barrier_directive, 244,
194
+ :cursor_omp_taskwait_directive, 245,
195
+ :cursor_omp_flush_directive, 246,
196
+ :cursor_seh_leave_stmt, 247,
197
+ :cursor_omp_ordered_directive, 248,
198
+ :cursor_omp_atomic_directive, 249,
199
+ :cursor_omp_for_simd_directive, 250,
200
+ :cursor_omp_parallel_for_simd_directive, 251,
201
+ :cursor_omp_target_directive, 252,
202
+ :cursor_omp_teams_directive, 253,
203
+ :cursor_omp_taskgroup_directive, 254,
204
+ :cursor_omp_cancellation_point_directive, 255,
205
+ :cursor_omp_cancel_directive, 256,
206
+ :cursor_omp_target_data_directive, 257,
207
+ :cursor_omp_task_loop_directive, 258,
208
+ :cursor_omp_task_loop_simd_directive, 259,
209
+ :cursor_omp_distribute_directive, 260,
210
+ :cursor_omp_target_enter_data_directive, 261,
211
+ :cursor_omp_target_exit_data_directive, 262,
212
+ :cursor_omp_target_parallel_directive, 263,
213
+ :cursor_omp_target_parallel_for_directive, 264,
214
+ :cursor_omp_target_update_directive, 265,
215
+ :cursor_omp_distribute_parallel_for_directive, 266,
216
+ :cursor_omp_distribute_parallel_for_simd_directive, 267,
217
+ :cursor_omp_distribute_simd_directive, 268,
218
+ :cursor_omp_target_parallel_for_simd_directive, 269,
219
+ :cursor_omp_target_simd_directive, 270,
220
+ :cursor_omp_teams_distribute_directive, 271,
221
+ :cursor_omp_teams_distribute_simd_directive, 272,
222
+ :cursor_omp_teams_distribute_parallel_for_simd_directive, 273,
223
+ :cursor_omp_teams_distribute_parallel_for_directive, 274,
224
+ :cursor_omp_target_teams_directive, 275,
225
+ :cursor_omp_target_teams_distribute_directive, 276,
226
+ :cursor_omp_target_teams_distribute_parallel_for_directive, 277,
227
+ :cursor_omp_target_teams_distribute_parallel_for_simd_directive, 278,
228
+ :cursor_omp_target_teams_distribute_simd_directive, 279,
229
+ :cursor_builtin_bit_cast_expr, 280,
230
+ :cursor_omp_master_task_loop_directive, 281,
231
+ :cursor_omp_parallel_master_task_loop_directive, 282,
232
+ :cursor_omp_master_task_loop_simd_directive, 283,
233
+ :cursor_omp_parallel_master_task_loop_simd_directive, 284,
234
+ :cursor_omp_parallel_master_directive, 285,
235
+ :cursor_omp_depobj_directive, 286,
236
+ :cursor_omp_scan_directive, 287,
237
+ # :cursor_last_stmt, :cursor_omp_scan_directive,
238
+ :cursor_translation_unit, CUSOR_TRANSLATION_UNIT,
239
+ :cursor_first_attr, 400,
168
240
  :cursor_unexposed_attr, 400,
169
241
  :cursor_ibaction_attr, 401,
170
242
  :cursor_iboutlet_attr, 402,
@@ -174,11 +246,54 @@ module FFI
174
246
  :cursor_annotate_attr, 406,
175
247
  :cursor_asm_label_attr, 407,
176
248
  :cursor_packed_attr, 408,
249
+ :cursor_pure_attr, 409,
250
+ :cursor_const_attr, 410,
251
+ :cursor_no_duplicate_attr, 411,
252
+ :cursor_cuda_constant_attr, 412,
253
+ :cursor_cuda_device_attr, 413,
254
+ :cursor_cuda_global_attr, 414,
255
+ :cursor_cuda_host_attr, 415,
256
+ :cursor_cuda_shared_attr, 416,
257
+ :cursor_visibility_attr, 417,
258
+ :cursor_dll_export, 418,
259
+ :cursor_dll_import, 419,
260
+ :cursor_ns_returns_retained, 420,
261
+ :cursor_ns_returns_not_retained, 421,
262
+ :cursor_ns_returns_autoreleased, 422,
263
+ :cursor_ns_consumes_self, 423,
264
+ :cursor_ns_consumed, 424,
265
+ :cursor_obj_c_exception, 425,
266
+ :cursor_obj_c_ns_object, 426,
267
+ :cursor_obj_c_independent_class, 427,
268
+ :cursor_obj_c_precise_lifetime, 428,
269
+ :cursor_obj_c_returns_inner_pointer, 429,
270
+ :cursor_obj_c_requires_super, 430,
271
+ :cursor_obj_c_root_class, 431,
272
+ :cursor_obj_c_subclassing_restricted, 432,
273
+ :cursor_obj_c_explicit_protocol_impl, 433,
274
+ :cursor_obj_c_designated_initializer, 434,
275
+ :cursor_obj_c_runtime_visible, 435,
276
+ :cursor_obj_c_boxable, 436,
277
+ :cursor_flag_enum, 437,
278
+ :cursor_convergent_attr, 438,
279
+ :cursor_warn_unused_attr, 439,
280
+ :cursor_warn_unused_result_attr, 440,
281
+ :cursor_aligned_attr, 441,
282
+ # :cursor_last_attr, :cursor_aligned_attr,
177
283
  :cursor_preprocessing_directive, 500,
178
284
  :cursor_macro_definition, 501,
179
285
  :cursor_macro_expansion, 502,
286
+ # :cursor_macro_instantiation, :cursor_macro_expansion,
180
287
  :cursor_inclusion_directive, 503,
288
+ # :cursor_first_preprocessing, :cursor_preprocessing_directive,
289
+ # :cursor_last_preprocessing, :cursor_inclusion_directive,
181
290
  :cursor_module_import_decl, 600,
291
+ :cursor_type_alias_template_decl, 601,
292
+ :cursor_static_assert, 602,
293
+ :cursor_friend_decl, 603,
294
+ # :cursor_first_extra_decl, :cursor_module_import_decl,
295
+ # :cursor_last_extra_decl, :cursor_friend_decl,
296
+ :cursor_overload_candidate, 700
182
297
  ]
183
298
 
184
299
  enum :access_specifier, [
@@ -250,6 +365,15 @@ module FFI
250
365
  )
251
366
  end
252
367
 
368
+ enum :visitor_result, [:break, :continue]
369
+
370
+ class CXCursorAndRangeVisitor < FFI::Struct
371
+ layout(
372
+ :context, :pointer,
373
+ :visit, callback([:pointer, CXCursor.by_value, CXSourceRange.by_value], :visitor_result),
374
+ )
375
+ end
376
+
253
377
  enum :cxx_access_specifier, [:invalid, :public, :protected, :private]
254
378
  attach_function :get_cxx_access_specifier, :clang_getCXXAccessSpecifier, [CXCursor.by_value], :cxx_access_specifier
255
379
 
@@ -312,6 +436,9 @@ module FFI
312
436
  callback :visit_children_function, [CXCursor.by_value, CXCursor.by_value, :pointer], :child_visit_result
313
437
  attach_function :visit_children, :clang_visitChildren, [CXCursor.by_value, :visit_children_function, :pointer], :uint
314
438
 
439
+ enum :result, [:success, :invalid, :visit_break]
440
+ attach_function :find_references_in_file, :clang_findReferencesInFile, [CXCursor.by_value, :CXFile, CXCursorAndRangeVisitor.by_value], :result
441
+
315
442
  attach_function :get_cursor_type, :clang_getCursorType, [CXCursor.by_value], CXType.by_value
316
443
  attach_function :get_cursor_result_type, :clang_getCursorResultType, [CXCursor.by_value], CXType.by_value
317
444
  attach_function :get_typedef_decl_underlying_type, :clang_getTypedefDeclUnderlyingType, [CXCursor.by_value], CXType.by_value
@@ -349,6 +476,23 @@ module FFI
349
476
  attach_function :get_enum_type, :clang_getEnumDeclIntegerType, [CXCursor.by_value], CXType.by_value
350
477
 
351
478
  attach_function :get_num_args, :clang_Cursor_getNumArguments, [CXCursor.by_value], :int
479
+
480
+ attach_function :is_converting_constructor, :clang_CXXConstructor_isConvertingConstructor, [CXCursor.by_value], :uint
481
+ attach_function :is_copy_constructor, :clang_CXXConstructor_isCopyConstructor, [CXCursor.by_value], :uint
482
+ attach_function :is_default_constructor, :clang_CXXConstructor_isDefaultConstructor, [CXCursor.by_value], :uint
483
+ attach_function :is_move_constructor, :clang_CXXConstructor_isMoveConstructor, [CXCursor.by_value], :uint
484
+ attach_function :is_mutable, :clang_CXXField_isMutable, [CXCursor.by_value], :uint
485
+ attach_function :is_defaulted, :clang_CXXMethod_isDefaulted, [CXCursor.by_value], :uint
486
+ attach_function :is_abstract, :clang_CXXRecord_isAbstract, [CXCursor.by_value], :uint
487
+ attach_function :is_enum_scoped, :clang_EnumDecl_isScoped, [CXCursor.by_value], :uint
488
+ attach_function :is_const, :clang_CXXMethod_isConst, [CXCursor.by_value], :uint
489
+
490
+ if Clang.clang_version >= Gem::Version.new('16.0.0')
491
+ attach_function :is_deleted, :clang_CXXMethod_isDeleted, [CXCursor.by_value], :uint
492
+ attach_function :is_copy_assignment_operator, :clang_CXXMethod_isCopyAssignmentOperator, [CXCursor.by_value], :uint
493
+ attach_function :is_move_assignment_operator, :clang_CXXMethod_isMoveAssignmentOperator, [CXCursor.by_value], :uint
494
+ attach_function :is_explicit, :clang_CXXMethod_isExplicit, [CXCursor.by_value], :uint
495
+ end
352
496
  end
353
497
  end
354
498
  end
@@ -1,39 +1,19 @@
1
- # Copyright, 2010-2012 by Jari Bakken.
2
- # Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com>
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the "Software"), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in
12
- # all copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2013-2022, by Samuel Williams.
5
+ # Copyright, 2013, by Garry Marshall.
6
+ # Copyright, 2014, by Masahiro Sano.
7
+ # Copyright, 2020, by Luikore.
21
8
 
22
9
  require_relative 'translation_unit'
23
10
  require_relative 'source_location'
24
11
  require_relative 'string'
12
+ require_relative 'source_range'
25
13
 
26
14
  module FFI
27
15
  module Clang
28
16
  module Lib
29
- class CXSourceRange < FFI::Struct
30
- layout(
31
- :ptr_data, [:pointer, 2],
32
- :begin_int_data, :uint,
33
- :end_int_data, :uint
34
- )
35
- end
36
-
37
17
  typedef :pointer, :CXDiagnostic
38
18
  typedef :pointer, :CXDiagnosticSet
39
19
 
@@ -1,24 +1,9 @@
1
- # Copyright, 2010-2012 by Jari Bakken.
2
- # Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com>
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2013-2022, by Samuel Williams.
5
+ # Copyright, 2013, by Carlos Martín Nieto.
3
6
  # Copyright, 2014, by Masahiro Sano.
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
7
 
23
8
  require_relative 'string'
24
9
  require_relative 'translation_unit'
@@ -1,22 +1,8 @@
1
- # Copyright, 2014, by Greg Hazel
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2014, by Greg Hazel.
5
+ # Copyright, 2014-2022, by Samuel Williams.
20
6
 
21
7
  require_relative 'file'
22
8
  require_relative 'source_location'
@@ -1,23 +1,9 @@
1
- # Copyright, 2010-2012 by Jari Bakken.
2
- # Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com>
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the "Software"), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in
12
- # all copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2010, by Jari Bakken.
5
+ # Copyright, 2012, by Hal Brodigan.
6
+ # Copyright, 2013-2022, by Samuel Williams.
21
7
 
22
8
  module FFI
23
9
  module Clang
@@ -1,24 +1,9 @@
1
- # Copyright, 2010-2012 by Jari Bakken.
2
- # Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com>
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2013, by Garry Marshall.
5
+ # Copyright, 2013-2022, by Samuel Williams.
3
6
  # Copyright, 2014, by Masahiro Sano.
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
7
 
23
8
  require_relative 'file'
24
9
 
@@ -1,26 +1,9 @@
1
- # -*- coding: utf-8 -*-
2
- # Copyright, 2010-2012 by Jari Bakken.
3
- # Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- # Copyright, 2013, by Garry C. Marshall. <http://www.meaningfulname.net>
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2013, by Garry Marshall.
5
+ # Copyright, 2013-2022, by Samuel Williams.
5
6
  # Copyright, 2014, by Masahiro Sano.
6
- #
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the "Software"), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be included in
15
- # all copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- # THE SOFTWARE.
24
7
 
25
8
  require_relative 'source_location'
26
9
 
@@ -1,23 +1,9 @@
1
- # Copyright, 2010-2012 by Jari Bakken.
2
- # Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com>
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the "Software"), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in
12
- # all copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2010, by Jari Bakken.
5
+ # Copyright, 2012, by Hal Brodigan.
6
+ # Copyright, 2013-2022, by Samuel Williams.
21
7
 
22
8
  module FFI
23
9
  module Clang
@@ -1,22 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
1
4
  # Copyright, 2014, by Masahiro Sano.
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
5
+ # Copyright, 2014-2022, by Samuel Williams.
20
6
 
21
7
  module FFI
22
8
  module Clang
@@ -1,24 +1,10 @@
1
- # Copyright, 2010-2012 by Jari Bakken.
2
- # Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com>
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2013-2022, by Samuel Williams.
3
5
  # Copyright, 2014, by Masahiro Sano.
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
6
+ # Copyright, 2019, by Hayden Purdy.
7
+ # Copyright, 2022, by Motonori Iwamuro.
22
8
 
23
9
  require_relative 'index'
24
10
 
@@ -96,7 +82,7 @@ module FFI
96
82
  attach_function :parse_translation_unit, :clang_parseTranslationUnit, [:CXIndex, :string, :pointer, :int, :pointer, :uint, :uint], :CXTranslationUnit
97
83
  attach_function :create_translation_unit, :clang_createTranslationUnit, [:CXIndex, :string], :CXTranslationUnit
98
84
  attach_function :dispose_translation_unit, :clang_disposeTranslationUnit, [:CXTranslationUnit], :void
99
- attach_function :get_translation_unit_spelling, :clang_getTranslationUnitSpelling, [:CXTranslationUnit], :string
85
+ attach_function :get_translation_unit_spelling, :clang_getTranslationUnitSpelling, [:CXTranslationUnit], CXString.by_value
100
86
 
101
87
  attach_function :default_editing_translation_unit_options, :clang_defaultEditingTranslationUnitOptions, [], :uint
102
88
  attach_function :default_save_options, :clang_defaultSaveOptions, [:CXTranslationUnit], :uint
@@ -1,23 +1,11 @@
1
- # Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- # Copyright, 2014, by Masahiro Sano.
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the "Software"), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in
12
- # all copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2013, by Carlos Martín Nieto.
5
+ # Copyright, 2013-2022, by Samuel Williams.
6
+ # Copyright, 2013, by Takeshi Watanabe.
7
+ # Copyright, 2013-2014, by Masahiro Sano.
8
+ # Copyright, 2014, by Niklas Therning.
21
9
 
22
10
  module FFI
23
11
  module Clang