ffi-clang 0.7.0 → 0.9.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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -0
- data/ext/rakefile.rb +4 -0
- data/ext/teapot.rb +4 -3
- data/lib/ffi/clang/clang_version.rb +10 -19
- data/lib/ffi/clang/code_completion.rb +8 -20
- data/lib/ffi/clang/comment.rb +7 -19
- data/lib/ffi/clang/compilation_database.rb +4 -18
- data/lib/ffi/clang/cursor.rb +117 -35
- data/lib/ffi/clang/diagnostic.rb +11 -23
- data/lib/ffi/clang/file.rb +4 -18
- data/lib/ffi/clang/index.rb +19 -23
- data/lib/ffi/clang/lib/clang_version.rb +5 -19
- data/lib/ffi/clang/lib/code_completion.rb +13 -26
- data/lib/ffi/clang/lib/comment.rb +7 -20
- data/lib/ffi/clang/lib/compilation_database.rb +4 -18
- data/lib/ffi/clang/lib/cursor.rb +102 -28
- data/lib/ffi/clang/lib/diagnostic.rb +7 -20
- data/lib/ffi/clang/lib/file.rb +7 -20
- data/lib/ffi/clang/lib/inclusions.rb +5 -19
- data/lib/ffi/clang/lib/index.rb +25 -20
- data/lib/ffi/clang/lib/printing_policy.rb +47 -0
- data/lib/ffi/clang/lib/source_location.rb +5 -20
- data/lib/ffi/clang/lib/source_range.rb +5 -22
- data/lib/ffi/clang/lib/string.rb +4 -20
- data/lib/ffi/clang/lib/token.rb +4 -18
- data/lib/ffi/clang/lib/translation_unit.rb +19 -21
- data/lib/ffi/clang/lib/type.rb +87 -22
- data/lib/ffi/clang/lib.rb +24 -28
- data/lib/ffi/clang/printing_policy.rb +36 -0
- data/lib/ffi/clang/source_location.rb +42 -38
- data/lib/ffi/clang/source_range.rb +7 -22
- data/lib/ffi/clang/token.rb +4 -18
- data/lib/ffi/clang/translation_unit.rb +10 -20
- data/lib/ffi/clang/type.rb +52 -25
- data/lib/ffi/clang/unsaved_file.rb +6 -20
- data/lib/ffi/clang/version.rb +7 -21
- data/lib/ffi/clang.rb +9 -20
- data/license.md +39 -0
- data/readme.md +56 -0
- data.tar.gz.sig +0 -0
- metadata +62 -116
- metadata.gz.sig +0 -0
- data/.editorconfig +0 -23
- data/.gitignore +0 -19
- data/.rspec +0 -5
- data/.travis.yml +0 -30
- data/Gemfile +0 -12
- data/README.md +0 -74
- data/Rakefile +0 -12
- data/examples/docs.cpp +0 -25
- data/examples/docs.rb +0 -31
- data/ffi-clang.gemspec +0 -25
- data/spec/ffi/clang/code_completion_spec.rb +0 -181
- data/spec/ffi/clang/comment_spec.rb +0 -453
- data/spec/ffi/clang/compilation_database_spec.rb +0 -180
- data/spec/ffi/clang/cursor_spec.rb +0 -741
- data/spec/ffi/clang/diagnostic_spec.rb +0 -89
- data/spec/ffi/clang/file_spec.rb +0 -82
- data/spec/ffi/clang/fixtures/a.c +0 -7
- data/spec/ffi/clang/fixtures/canonical.c +0 -5
- data/spec/ffi/clang/fixtures/class.cpp +0 -8
- data/spec/ffi/clang/fixtures/compile_commands.json +0 -17
- data/spec/ffi/clang/fixtures/completion.cxx +0 -8
- data/spec/ffi/clang/fixtures/docs.c +0 -1
- data/spec/ffi/clang/fixtures/docs.cc +0 -1
- data/spec/ffi/clang/fixtures/docs.h +0 -54
- data/spec/ffi/clang/fixtures/list.c +0 -11
- data/spec/ffi/clang/fixtures/location1.c +0 -7
- data/spec/ffi/clang/fixtures/simple.ast +0 -0
- data/spec/ffi/clang/fixtures/simple.c +0 -3
- data/spec/ffi/clang/fixtures/test.cxx +0 -62
- data/spec/ffi/clang/index_spec.rb +0 -90
- data/spec/ffi/clang/source_location_spec.rb +0 -138
- data/spec/ffi/clang/source_range_spec.rb +0 -74
- data/spec/ffi/clang/token_spec.rb +0 -82
- data/spec/ffi/clang/translation_unit_spec.rb +0 -220
- data/spec/ffi/clang/type_spec.rb +0 -273
- data/spec/ffi/clang/version_spec.rb +0 -28
- data/spec/spec_helper.rb +0 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7bac4481c13b37b86189208dd7e0589bd96a42059319828c22ae623025ccc75
|
4
|
+
data.tar.gz: 3d6cc4ebca61f93b710b5a8fcc80d6fa51eeb8aac466246775c5ba80d8274c32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 816df5fbe722de3c3bc513598455a076bc64a32ee0d4d1697bc51dca767d06b9645be1c6dba444bc50d9d3f073fc02b2d13c6afbce355617df03368dc416930c
|
7
|
+
data.tar.gz: ec3be8892d6710742e173e54cb6c4f498b28a5178ca7c15ad9c08aae66f67824a039820f7ddff0a21c8aa50221c286dbeef9a2132e140bebb8c5f65fc69928c9
|
checksums.yaml.gz.sig
ADDED
data/ext/rakefile.rb
CHANGED
data/ext/teapot.rb
CHANGED
@@ -1,22 +1,8 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
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, 2016-2024, by Samuel Williams.
|
5
|
+
# Copyright, 2023, by Charlie Savage.
|
20
6
|
|
21
7
|
require_relative 'lib/clang_version'
|
22
8
|
|
@@ -25,5 +11,10 @@ module FFI
|
|
25
11
|
def self.clang_version_string
|
26
12
|
Lib.extract_string Lib.get_clang_version
|
27
13
|
end
|
14
|
+
|
15
|
+
def self.clang_version
|
16
|
+
clang_version = self.clang_version_string.match(/\d+\.\d+\.\d+/)
|
17
|
+
Gem::Version.new(clang_version)
|
18
|
+
end
|
28
19
|
end
|
29
20
|
end
|
@@ -1,22 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
1
4
|
# Copyright, 2014, by Masahiro Sano.
|
2
|
-
#
|
3
|
-
#
|
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-2024, by Samuel Williams.
|
6
|
+
# Copyright, 2023-2024, by Charlie Savage.
|
20
7
|
|
21
8
|
require_relative 'lib/code_completion'
|
22
9
|
|
@@ -24,7 +11,7 @@ module FFI
|
|
24
11
|
module Clang
|
25
12
|
class CodeCompletion
|
26
13
|
def self.default_code_completion_options
|
27
|
-
Lib.opts_from
|
14
|
+
Lib.opts_from(Lib::CodeCompleteFlags, Lib.default_code_completion_options)
|
28
15
|
end
|
29
16
|
|
30
17
|
class Results < FFI::AutoPointer
|
@@ -41,7 +28,8 @@ module FFI
|
|
41
28
|
end
|
42
29
|
|
43
30
|
def self.release(pointer)
|
44
|
-
|
31
|
+
results = Lib::CXCodeCompleteResults.new(pointer)
|
32
|
+
Lib.dispose_code_complete_results(results)
|
45
33
|
end
|
46
34
|
|
47
35
|
def each(&block)
|
data/lib/ffi/clang/comment.rb
CHANGED
@@ -1,22 +1,10 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
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, 2013, by Carlos Martín Nieto.
|
5
|
+
# Copyright, 2013-2022, by Samuel Williams.
|
6
|
+
# Copyright, 2014, by George Pimm.
|
7
|
+
# Copyright, 2014, by Masahiro Sano.
|
20
8
|
|
21
9
|
require_relative 'lib/cursor'
|
22
10
|
require_relative 'lib/comment'
|
@@ -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
|
require_relative 'lib/compilation_database'
|
22
8
|
|
data/lib/ffi/clang/cursor.rb
CHANGED
@@ -1,28 +1,22 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2013, by Garry Marshall.
|
5
|
+
# Copyright, 2013-2024, by Samuel Williams.
|
6
|
+
# Copyright, 2013, by Carlos Martín Nieto.
|
7
|
+
# Copyright, 2013, by Dave Wilkinson.
|
8
|
+
# Copyright, 2013, by Takeshi Watanabe.
|
3
9
|
# Copyright, 2014, by Masahiro Sano.
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
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.
|
10
|
+
# Copyright, 2014, by George Pimm.
|
11
|
+
# Copyright, 2014, by Niklas Therning.
|
12
|
+
# Copyright, 2019, by Michael Metivier.
|
13
|
+
# Copyright, 2022, by Motonori Iwamuro.
|
14
|
+
# Copyright, 2023-2024, by Charlie Savage.
|
22
15
|
|
23
16
|
require_relative 'lib/cursor'
|
24
17
|
require_relative 'lib/code_completion'
|
25
18
|
|
19
|
+
require_relative 'printing_policy'
|
26
20
|
require_relative 'source_location'
|
27
21
|
require_relative 'source_range'
|
28
22
|
require_relative 'comment'
|
@@ -116,9 +110,22 @@ module FFI
|
|
116
110
|
Lib.is_unexposed(kind) != 0
|
117
111
|
end
|
118
112
|
|
119
|
-
def
|
113
|
+
def expansion_location
|
120
114
|
ExpansionLocation.new(Lib.get_cursor_location(@cursor))
|
121
115
|
end
|
116
|
+
alias :location :expansion_location
|
117
|
+
|
118
|
+
def presumed_location
|
119
|
+
PresumedLocation.new(Lib.get_cursor_location(@cursor))
|
120
|
+
end
|
121
|
+
|
122
|
+
def spelling_location
|
123
|
+
SpellingLocation.new(Lib.get_cursor_location(@cursor))
|
124
|
+
end
|
125
|
+
|
126
|
+
def file_location
|
127
|
+
FileLocation.new(Lib.get_cursor_location(@cursor))
|
128
|
+
end
|
122
129
|
|
123
130
|
def extent
|
124
131
|
SourceRange.new(Lib.get_cursor_extent(@cursor))
|
@@ -128,10 +135,21 @@ module FFI
|
|
128
135
|
Lib.extract_string Lib.get_cursor_display_name(@cursor)
|
129
136
|
end
|
130
137
|
|
138
|
+
def qualified_name
|
139
|
+
if self.kind != :cursor_translation_unit
|
140
|
+
result = self.semantic_parent.qualified_name
|
141
|
+
result ? "#{result}::#{self.spelling}" : self.spelling
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
131
145
|
def spelling
|
132
146
|
Lib.extract_string Lib.get_cursor_spelling(@cursor)
|
133
147
|
end
|
134
148
|
|
149
|
+
def printing_policy
|
150
|
+
PrintingPolicy.new(cursor)
|
151
|
+
end
|
152
|
+
|
135
153
|
def usr
|
136
154
|
Lib.extract_string Lib.get_cursor_usr(@cursor)
|
137
155
|
end
|
@@ -156,14 +174,6 @@ module FFI
|
|
156
174
|
Type.new Lib.get_typedef_decl_underlying_type(@cursor), @translation_unit
|
157
175
|
end
|
158
176
|
|
159
|
-
def enum_decl_integer_type
|
160
|
-
Type.new Lib.get_enum_decl_integer_type(@cursor), @translation_unit
|
161
|
-
end
|
162
|
-
|
163
|
-
def typedef_type
|
164
|
-
Type.new Lib.get_typedef_decl_unerlying_type(@cursor), @translation_unit
|
165
|
-
end
|
166
|
-
|
167
177
|
def virtual_base?
|
168
178
|
Lib.is_virtual_base(@cursor) != 0
|
169
179
|
end
|
@@ -201,7 +211,7 @@ module FFI
|
|
201
211
|
end
|
202
212
|
|
203
213
|
def enum_type
|
204
|
-
Type.new Lib.
|
214
|
+
Type.new Lib.get_enum_decl_integer_type(@cursor), @translation_unit
|
205
215
|
end
|
206
216
|
|
207
217
|
def specialized_template
|
@@ -216,6 +226,21 @@ module FFI
|
|
216
226
|
Cursor.new Lib.get_cursor_definition(@cursor), @translation_unit
|
217
227
|
end
|
218
228
|
|
229
|
+
def opaque_declaration?
|
230
|
+
# Is this a declaration that does not have a definition in the translation unit
|
231
|
+
self.declaration? && !self.definition? && self.definition.invalid?
|
232
|
+
end
|
233
|
+
|
234
|
+
def forward_declaration?
|
235
|
+
# Is this a forward declaration for a definition contained in the same translation_unit?
|
236
|
+
# https://joshpeterson.github.io/identifying-a-forward-declaration-with-libclang
|
237
|
+
#
|
238
|
+
# Possible alternate implementations?
|
239
|
+
# self.declaration? && !self.definition? && self.definition
|
240
|
+
# !self.definition? && self.definition
|
241
|
+
self.declaration? && !self.eql?(self.definition) && !self.definition.invalid?
|
242
|
+
end
|
243
|
+
|
219
244
|
def referenced
|
220
245
|
Cursor.new Lib.get_cursor_referenced(@cursor), @translation_unit
|
221
246
|
end
|
@@ -322,10 +347,6 @@ module FFI
|
|
322
347
|
overriddens
|
323
348
|
end
|
324
349
|
|
325
|
-
def hash
|
326
|
-
Lib.get_cursor_hash(@cursor)
|
327
|
-
end
|
328
|
-
|
329
350
|
def bitfield?
|
330
351
|
Lib.is_bit_field(@cursor) != 0
|
331
352
|
end
|
@@ -354,9 +375,14 @@ module FFI
|
|
354
375
|
Lib.cursor_get_num_arguments(@cursor)
|
355
376
|
end
|
356
377
|
|
357
|
-
def
|
378
|
+
def eql?(other)
|
358
379
|
Lib.are_equal(@cursor, other.cursor) != 0
|
359
380
|
end
|
381
|
+
alias == eql?
|
382
|
+
|
383
|
+
def hash
|
384
|
+
Lib.get_cursor_hash(@cursor)
|
385
|
+
end
|
360
386
|
|
361
387
|
def find_all(*kinds)
|
362
388
|
filter do |child, parent|
|
@@ -390,6 +416,10 @@ module FFI
|
|
390
416
|
end
|
391
417
|
end
|
392
418
|
|
419
|
+
def to_s
|
420
|
+
"Cursor <#{self.kind.to_s.gsub(/^cursor_/, '')}: #{self.spelling}>"
|
421
|
+
end
|
422
|
+
|
393
423
|
def to_a
|
394
424
|
filter.collect{|child, parent| child}
|
395
425
|
end
|
@@ -403,6 +433,58 @@ module FFI
|
|
403
433
|
refs
|
404
434
|
end
|
405
435
|
|
436
|
+
def converting_constructor?
|
437
|
+
Lib.is_converting_constructor(@cursor) != 0
|
438
|
+
end
|
439
|
+
|
440
|
+
def copy_constructor?
|
441
|
+
Lib.is_copy_constructor(@cursor) != 0
|
442
|
+
end
|
443
|
+
|
444
|
+
def default_constructor?
|
445
|
+
Lib.is_default_constructor(@cursor) != 0
|
446
|
+
end
|
447
|
+
|
448
|
+
def move_constructor?
|
449
|
+
Lib.is_move_constructor(@cursor) != 0
|
450
|
+
end
|
451
|
+
|
452
|
+
def mutable?
|
453
|
+
Lib.is_mutable(@cursor) != 0
|
454
|
+
end
|
455
|
+
|
456
|
+
def defaulted?
|
457
|
+
Lib.is_defaulted(@cursor) != 0
|
458
|
+
end
|
459
|
+
|
460
|
+
def deleted?
|
461
|
+
Lib.is_deleted(@cursor) != 0
|
462
|
+
end
|
463
|
+
|
464
|
+
def copy_assignment_operator?
|
465
|
+
Lib.is_copy_assignment_operator(@cursor) != 0
|
466
|
+
end
|
467
|
+
|
468
|
+
def move_assignment_operator?
|
469
|
+
Lib.is_move_assignment_operator(@cursor) != 0
|
470
|
+
end
|
471
|
+
|
472
|
+
def explicit?
|
473
|
+
Lib.is_explicit(@cursor) != 0
|
474
|
+
end
|
475
|
+
|
476
|
+
def abstract?
|
477
|
+
Lib.is_abstract(@cursor) != 0
|
478
|
+
end
|
479
|
+
|
480
|
+
def enum_scoped?
|
481
|
+
Lib.is_enum_scoped(@cursor) != 0
|
482
|
+
end
|
483
|
+
|
484
|
+
def const?
|
485
|
+
Lib.is_const(@cursor) != 0
|
486
|
+
end
|
487
|
+
|
406
488
|
class PlatformAvailability < AutoPointer
|
407
489
|
def initialize(memory_pointer)
|
408
490
|
pointer = FFI::Pointer.new(memory_pointer)
|
data/lib/ffi/clang/diagnostic.rb
CHANGED
@@ -1,24 +1,12 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
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.
|
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-2024, by Samuel Williams.
|
7
|
+
# Copyright, 2013, by Garry Marshall.
|
8
|
+
# Copyright, 2014, by Masahiro Sano.
|
9
|
+
# Copyright, 2023, by Charlie Savage.
|
22
10
|
|
23
11
|
require_relative 'lib/diagnostic'
|
24
12
|
require_relative 'source_range'
|
@@ -27,7 +15,7 @@ module FFI
|
|
27
15
|
module Clang
|
28
16
|
class Diagnostic < AutoPointer
|
29
17
|
def self.default_display_opts
|
30
|
-
Lib.opts_from
|
18
|
+
Lib.opts_from(Lib::DiagnosticDisplayOptions, Lib.default_diagnostic_display_options)
|
31
19
|
end
|
32
20
|
|
33
21
|
def initialize(translation_unit, pointer)
|
@@ -109,7 +97,7 @@ module FFI
|
|
109
97
|
if opts.empty?
|
110
98
|
Lib.default_diagnostic_display_options
|
111
99
|
else
|
112
|
-
Lib.bitmask_from
|
100
|
+
Lib.bitmask_from(Lib::DiagnosticDisplayOptions, opts)
|
113
101
|
end
|
114
102
|
end
|
115
103
|
end
|
data/lib/ffi/clang/file.rb
CHANGED
@@ -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
|
require_relative 'lib/file'
|
22
8
|
|
data/lib/ffi/clang/index.rb
CHANGED
@@ -1,24 +1,14 @@
|
|
1
|
-
#
|
2
|
-
|
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-2024, by Samuel Williams.
|
7
|
+
# Copyright, 2013, by Carlos Martín Nieto.
|
8
|
+
# Copyright, 2013, by Dave Wilkinson.
|
9
|
+
# Copyright, 2013, by Takeshi Watanabe.
|
3
10
|
# 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.
|
11
|
+
# Copyright, 2023, by Charlie Savage.
|
22
12
|
|
23
13
|
require_relative 'lib/index'
|
24
14
|
|
@@ -37,10 +27,16 @@ module FFI
|
|
37
27
|
command_line_args = Array(command_line_args)
|
38
28
|
unsaved_files = UnsavedFile.unsaved_pointer_from(unsaved)
|
39
29
|
|
40
|
-
|
30
|
+
translation_unit_pointer_out = FFI::MemoryPointer.new(:pointer)
|
41
31
|
|
42
|
-
|
32
|
+
error_code = Lib.parse_translation_unit2(self, source_file, args_pointer_from(command_line_args), command_line_args.size, unsaved_files, unsaved.length, options_bitmask_from(opts), translation_unit_pointer_out)
|
33
|
+
if error_code != :cx_error_success
|
34
|
+
error_name = Lib::ErrorCodes.from_native(error_code, nil)
|
35
|
+
message = "Error parsing file. Code: #{error_name}. File: #{source_file.inspect}"
|
36
|
+
raise(Error, message)
|
37
|
+
end
|
43
38
|
|
39
|
+
translation_unit_pointer = translation_unit_pointer_out.read_pointer
|
44
40
|
TranslationUnit.new translation_unit_pointer, self
|
45
41
|
end
|
46
42
|
|
@@ -64,7 +60,7 @@ module FFI
|
|
64
60
|
end
|
65
61
|
|
66
62
|
def options_bitmask_from(opts)
|
67
|
-
Lib.bitmask_from
|
63
|
+
Lib.bitmask_from(Lib::TranslationUnitFlags, opts)
|
68
64
|
end
|
69
65
|
end
|
70
66
|
end
|
@@ -1,22 +1,8 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
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 Masahiro Sano.
|
5
|
+
# Copyright, 2014-2022, by Samuel Williams.
|
20
6
|
|
21
7
|
require_relative 'string'
|
22
8
|
|
@@ -1,22 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
1
4
|
# Copyright, 2014, by Masahiro Sano.
|
2
|
-
#
|
3
|
-
#
|
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.
|
6
|
+
# Copyright, 2024, by Charlie Savage.
|
20
7
|
|
21
8
|
require_relative 'cursor'
|
22
9
|
require_relative 'diagnostic'
|
@@ -110,16 +97,16 @@ module FFI
|
|
110
97
|
attach_function :get_completion_brief_comment, :clang_getCompletionBriefComment, [:CXCompletionString], CXString.by_value
|
111
98
|
|
112
99
|
# CXCodeCompleteResults functions
|
113
|
-
attach_function :get_code_complete_get_num_diagnostics, :clang_codeCompleteGetNumDiagnostics, [CXCodeCompleteResults.
|
114
|
-
attach_function :get_code_complete_get_diagnostic, :clang_codeCompleteGetDiagnostic, [CXCodeCompleteResults.
|
115
|
-
attach_function :get_code_complete_get_contexts, :clang_codeCompleteGetContexts, [CXCodeCompleteResults.
|
116
|
-
attach_function :get_code_complete_get_container_kind, :clang_codeCompleteGetContainerKind, [CXCodeCompleteResults.
|
117
|
-
attach_function :get_code_complete_get_container_usr, :clang_codeCompleteGetContainerUSR, [CXCodeCompleteResults.
|
118
|
-
attach_function :get_code_complete_get_objc_selector, :clang_codeCompleteGetObjCSelector, [CXCodeCompleteResults.
|
100
|
+
attach_function :get_code_complete_get_num_diagnostics, :clang_codeCompleteGetNumDiagnostics, [CXCodeCompleteResults.by_ref], :uint
|
101
|
+
attach_function :get_code_complete_get_diagnostic, :clang_codeCompleteGetDiagnostic, [CXCodeCompleteResults.by_ref, :uint], :CXDiagnostic
|
102
|
+
attach_function :get_code_complete_get_contexts, :clang_codeCompleteGetContexts, [CXCodeCompleteResults.by_ref], :ulong_long
|
103
|
+
attach_function :get_code_complete_get_container_kind, :clang_codeCompleteGetContainerKind, [CXCodeCompleteResults.by_ref, :pointer], :cursor_kind
|
104
|
+
attach_function :get_code_complete_get_container_usr, :clang_codeCompleteGetContainerUSR, [CXCodeCompleteResults.by_ref], CXString.by_value
|
105
|
+
attach_function :get_code_complete_get_objc_selector, :clang_codeCompleteGetObjCSelector, [CXCodeCompleteResults.by_ref], CXString.by_value
|
119
106
|
|
120
107
|
# Other functions
|
121
|
-
attach_function :code_complete_at, :clang_codeCompleteAt, [:CXTranslationUnit, :string, :uint, :uint, :pointer, :uint, :uint], CXCodeCompleteResults.
|
122
|
-
attach_function :dispose_code_complete_results, :clang_disposeCodeCompleteResults, [CXCodeCompleteResults.
|
108
|
+
attach_function :code_complete_at, :clang_codeCompleteAt, [:CXTranslationUnit, :string, :uint, :uint, :pointer, :uint, :uint], CXCodeCompleteResults.by_ref
|
109
|
+
attach_function :dispose_code_complete_results, :clang_disposeCodeCompleteResults, [CXCodeCompleteResults.by_ref], :void
|
123
110
|
attach_function :get_cursor_completion_string, :clang_getCursorCompletionString, [CXCursor.by_value], :CXCompletionString
|
124
111
|
attach_function :default_code_completion_options, :clang_defaultCodeCompleteOptions, [], :uint
|
125
112
|
attach_function :sort_code_completion_results, :clang_sortCodeCompletionResults, [:pointer, :uint], :void
|