ffi_gen 0.7 → 0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ffi_gen.rb +109 -64
- data/lib/ffi_gen/clang.rb +662 -441
- metadata +4 -4
data/lib/ffi_gen.rb
CHANGED
@@ -64,26 +64,21 @@ class FFIGen
|
|
64
64
|
symbol = ":#{@generator.to_ruby_lowercase constant_name[prefix_length..(-1 - suffix_length)]}"
|
65
65
|
symbols << symbol
|
66
66
|
definitions << " #{symbol}#{constant_value ? ", #{constant_value}" : ""}"
|
67
|
-
|
68
|
-
symbol_descriptions << " # #{symbol}::\n # #{@generator.create_description_comment(description, ' # ', true)}"
|
69
|
-
end
|
70
|
-
|
71
|
-
enum_description = []
|
72
|
-
@comment.split("\n").map do |line|
|
73
|
-
enum_description << @generator.prepare_comment_line(line)
|
67
|
+
symbol_descriptions << " # #{symbol} ::\n # #{@generator.create_description_comment(constant_comment, ' # ', true)}\n"
|
74
68
|
end
|
75
69
|
|
76
70
|
str = ""
|
77
|
-
str << @generator.create_description_comment(
|
78
|
-
str << " #
|
79
|
-
str << " #
|
71
|
+
str << @generator.create_description_comment(@comment, ' # ')
|
72
|
+
str << " # \n"
|
73
|
+
str << " # === Options:\n#{symbol_descriptions.join} #\n"
|
74
|
+
str << " # @return [Array<Symbol>]\n"
|
80
75
|
str << " def self.#{@generator.to_ruby_lowercase @name}_enum\n [#{symbols.join(', ')}]\n end\n"
|
81
76
|
str << " enum :#{@generator.to_ruby_lowercase @name}, [\n#{definitions.join(",\n")}\n ]"
|
82
77
|
str
|
83
78
|
end
|
84
79
|
|
85
|
-
def type_name
|
86
|
-
"Symbol from #{@generator.to_ruby_lowercase @name}_enum"
|
80
|
+
def type_name(short)
|
81
|
+
short ? @name : "Symbol from #{@generator.to_ruby_lowercase @name}_enum"
|
87
82
|
end
|
88
83
|
|
89
84
|
def reference
|
@@ -94,23 +89,38 @@ class FFIGen
|
|
94
89
|
class Struct
|
95
90
|
attr_reader :fields
|
96
91
|
|
97
|
-
def initialize(generator, name)
|
92
|
+
def initialize(generator, name, comment)
|
98
93
|
@generator = generator
|
99
94
|
@name = name
|
95
|
+
@comment = comment
|
100
96
|
@fields = []
|
101
97
|
end
|
102
98
|
|
103
99
|
def to_s
|
104
|
-
|
105
|
-
|
100
|
+
field_definitions = []
|
101
|
+
field_descriptions = []
|
102
|
+
@fields.each do |(field_name, field_type, field_comment)|
|
103
|
+
symbol = ":#{@generator.to_ruby_lowercase field_name}"
|
104
|
+
field_definitions << "#{symbol}, #{@generator.to_ffi_type field_type}"
|
105
|
+
field_descriptions << " # #{symbol} ::\n # (#{@generator.to_type_name field_type}) #{@generator.create_description_comment(field_comment, ' # ', true)}\n"
|
106
|
+
end
|
107
|
+
|
108
|
+
str = ""
|
109
|
+
str << @generator.create_description_comment(@comment, ' # ')
|
110
|
+
str << " # \n"
|
111
|
+
str << " # = Fields:\n#{field_descriptions.join} #\n"
|
112
|
+
str << " class #{@generator.to_ruby_camelcase @name} < FFI::Struct\n"
|
113
|
+
str << " layout #{field_definitions.join(",\n ")}\n" unless @fields.empty?
|
114
|
+
str << " end"
|
115
|
+
str
|
106
116
|
end
|
107
117
|
|
108
|
-
def type_name
|
118
|
+
def type_name(short)
|
109
119
|
@generator.to_ruby_camelcase @name
|
110
120
|
end
|
111
121
|
|
112
122
|
def reference
|
113
|
-
"#{type_name}.by_value"
|
123
|
+
"#{type_name(false)}.by_value"
|
114
124
|
end
|
115
125
|
end
|
116
126
|
|
@@ -127,50 +137,55 @@ class FFIGen
|
|
127
137
|
end
|
128
138
|
|
129
139
|
def to_s
|
130
|
-
str = ""
|
131
|
-
|
132
140
|
ruby_name = @generator.to_ruby_lowercase @name
|
133
141
|
ruby_parameters = @parameters.map do |(name, type)|
|
134
142
|
ruby_param_type = @generator.to_type_name type
|
135
|
-
ruby_param_name = @generator.to_ruby_lowercase(name.empty? ?
|
143
|
+
ruby_param_name = @generator.to_ruby_lowercase(name.empty? ? @generator.to_type_name(type, true) : name)
|
136
144
|
[ruby_param_name, ruby_param_type, []]
|
137
145
|
end
|
138
146
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
if
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
else
|
153
|
-
current_description << "#{$1}: "
|
154
|
-
end
|
147
|
+
ffi_signature = "[#{@parameters.map{ |(name, type)| @generator.to_ffi_type type }.join(', ')}], #{@generator.to_ffi_type @return_type}"
|
148
|
+
|
149
|
+
function_description = []
|
150
|
+
return_value_description = []
|
151
|
+
current_description = function_description
|
152
|
+
@comment.split("\n").map do |line|
|
153
|
+
line = @generator.prepare_comment_line line
|
154
|
+
if line.gsub! /\\param (.*?) /, ''
|
155
|
+
index = @parameters.index { |(name, type)| name == $1 }
|
156
|
+
if index
|
157
|
+
current_description = ruby_parameters[index][2]
|
158
|
+
else
|
159
|
+
current_description << "#{$1}: "
|
155
160
|
end
|
156
|
-
current_description = return_value_description if line.gsub! '\\returns ', ''
|
157
|
-
current_description << line
|
158
161
|
end
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
str << " #
|
166
|
-
str << " #
|
167
|
-
|
162
|
+
current_description = return_value_description if line.gsub! '\\returns ', ''
|
163
|
+
current_description << line
|
164
|
+
end
|
165
|
+
|
166
|
+
str = ""
|
167
|
+
if @is_callback
|
168
|
+
str << " # <em>This is no real method. This entry is only for documentation of the callback.</em>\n"
|
169
|
+
str << " # \n"
|
170
|
+
end
|
171
|
+
str << @generator.create_description_comment(function_description, ' # ')
|
172
|
+
str << " # \n"
|
173
|
+
str << " # @method #{ruby_name}#{@is_callback ? '_callback' : ''}(#{ruby_parameters.map{ |(name, type, description)| name }.join(', ')})\n"
|
174
|
+
ruby_parameters.each do |(name, type, description)|
|
175
|
+
str << " # @param [#{type}] #{name} #{@generator.create_description_comment(description, ' # ', true)}\n"
|
176
|
+
end
|
177
|
+
str << " # @return [#{@generator.to_type_name @return_type}] #{@generator.create_description_comment(return_value_description, ' # ', true)}\n"
|
178
|
+
str << " # @scope class\n"
|
179
|
+
if @is_callback
|
180
|
+
str << " callback :#{ruby_name}, #{ffi_signature}"
|
181
|
+
else
|
182
|
+
str << " attach_function :#{ruby_name}, :#{@name}, #{ffi_signature}"
|
168
183
|
end
|
169
184
|
str
|
170
185
|
end
|
171
186
|
|
172
|
-
def type_name
|
173
|
-
"
|
187
|
+
def type_name(short)
|
188
|
+
"Proc(#{@generator.to_ruby_lowercase @name}_callback)"
|
174
189
|
end
|
175
190
|
|
176
191
|
def reference
|
@@ -235,7 +250,9 @@ class FFIGen
|
|
235
250
|
|
236
251
|
extent = Clang.get_cursor_extent declaration
|
237
252
|
comment_range = Clang.get_range previous_declaration_end, Clang.get_range_start(extent)
|
238
|
-
|
253
|
+
unless declaration[:kind] == :enum_decl or declaration[:kind] == :struct_decl # keep comment for typedef_decl
|
254
|
+
previous_declaration_end = Clang.get_range_end extent
|
255
|
+
end
|
239
256
|
|
240
257
|
next if not header_files.include? file
|
241
258
|
|
@@ -245,7 +262,7 @@ class FFIGen
|
|
245
262
|
comment = extract_comment translation_unit, comment_range
|
246
263
|
|
247
264
|
case declaration[:kind]
|
248
|
-
when :enum_decl
|
265
|
+
when :enum_decl, :struct_decl
|
249
266
|
read_named_declaration declaration, name, comment unless name.empty?
|
250
267
|
|
251
268
|
when :function_decl
|
@@ -302,7 +319,6 @@ class FFIGen
|
|
302
319
|
previous_constant_location = Clang.get_cursor_location declaration
|
303
320
|
Clang.get_children(declaration).each do |enum_constant|
|
304
321
|
constant_name = Clang.get_cursor_spelling(enum_constant).to_s_and_dispose
|
305
|
-
constant_location = Clang.get_cursor_location enum_constant
|
306
322
|
|
307
323
|
constant_value = nil
|
308
324
|
value_cursor = Clang.get_children(enum_constant).first
|
@@ -319,6 +335,7 @@ class FFIGen
|
|
319
335
|
next # skip those entries for now
|
320
336
|
end
|
321
337
|
|
338
|
+
constant_location = Clang.get_cursor_location enum_constant
|
322
339
|
constant_comment_range = Clang.get_range previous_constant_location, constant_location
|
323
340
|
constant_comment = extract_comment translation_unit, constant_comment_range
|
324
341
|
previous_constant_location = constant_location
|
@@ -327,13 +344,20 @@ class FFIGen
|
|
327
344
|
end
|
328
345
|
|
329
346
|
when :struct_decl
|
330
|
-
struct = Struct.new self, name
|
347
|
+
struct = Struct.new self, name, comment
|
331
348
|
@declarations[name] = struct
|
332
349
|
|
350
|
+
previous_field_location = Clang.get_cursor_location declaration
|
333
351
|
Clang.get_children(declaration).each do |field_decl|
|
334
352
|
field_name = Clang.get_cursor_spelling(field_decl).to_s_and_dispose
|
335
353
|
field_type = Clang.get_cursor_type field_decl
|
336
|
-
|
354
|
+
|
355
|
+
field_location = Clang.get_cursor_location field_decl
|
356
|
+
field_comment_range = Clang.get_range previous_field_location, field_location
|
357
|
+
field_comment = extract_comment translation_unit, field_comment_range
|
358
|
+
previous_field_location = field_location
|
359
|
+
|
360
|
+
struct.fields << [field_name, field_type, field_comment]
|
337
361
|
end
|
338
362
|
end
|
339
363
|
end
|
@@ -383,10 +407,10 @@ class FFIGen
|
|
383
407
|
end
|
384
408
|
end
|
385
409
|
|
386
|
-
def to_type_name(full_type)
|
410
|
+
def to_type_name(full_type, short = false)
|
387
411
|
declaration = Clang.get_type_declaration full_type
|
388
412
|
name = Clang.get_cursor_spelling(declaration).to_s_and_dispose
|
389
|
-
return @declarations[name].type_name if @declarations.has_key? name
|
413
|
+
return @declarations[name].type_name(short) if @declarations.has_key? name
|
390
414
|
|
391
415
|
canonical_type = Clang.get_canonical_type full_type
|
392
416
|
case canonical_type[:kind]
|
@@ -398,13 +422,31 @@ class FFIGen
|
|
398
422
|
pointee_type = Clang.get_pointee_type canonical_type
|
399
423
|
if pointee_type[:kind] == :char_s
|
400
424
|
"String"
|
401
|
-
elsif not name.empty?
|
402
|
-
"FFI::Pointer of #{to_ruby_camelcase name}"
|
403
425
|
else
|
404
|
-
|
405
|
-
|
406
|
-
|
426
|
+
pointer_depth = 0
|
427
|
+
pointer_target_name = ""
|
428
|
+
current_type = full_type
|
429
|
+
loop do
|
430
|
+
declaration = Clang.get_type_declaration current_type
|
431
|
+
pointer_target_name = to_ruby_camelcase Clang.get_cursor_spelling(declaration).to_s_and_dispose
|
432
|
+
break if not pointer_target_name.empty?
|
433
|
+
|
434
|
+
case current_type[:kind]
|
435
|
+
when :pointer
|
436
|
+
pointer_depth += 1
|
437
|
+
current_type = Clang.get_pointee_type current_type
|
438
|
+
when :unexposed
|
439
|
+
break
|
440
|
+
else
|
441
|
+
pointer_target_name = Clang.get_type_kind_spelling(current_type[:kind]).to_s_and_dispose
|
442
|
+
break
|
443
|
+
end
|
444
|
+
end
|
445
|
+
short ? pointer_target_name : "FFI::Pointer(#{'*' * pointer_depth}#{pointer_target_name})"
|
407
446
|
end
|
447
|
+
when :constant_array
|
448
|
+
element_type = Clang.get_array_element_type canonical_type
|
449
|
+
"Array<#{to_type_name element_type}>"
|
408
450
|
else
|
409
451
|
raise NotImplementedError, "No type name for type #{canonical_type[:kind]}"
|
410
452
|
end
|
@@ -438,12 +480,15 @@ class FFIGen
|
|
438
480
|
end
|
439
481
|
|
440
482
|
def create_description_comment(description, line_prefix, inline_mode = false)
|
483
|
+
if description.is_a? String
|
484
|
+
description = description.split("\n").map { |line| prepare_comment_line(line) }
|
485
|
+
end
|
486
|
+
|
441
487
|
description.shift while not description.empty? and description.first.strip.empty?
|
442
488
|
description.pop while not description.empty? and description.last.strip.empty?
|
443
|
-
|
489
|
+
description << "(Not documented)" if not inline_mode and description.empty?
|
444
490
|
|
445
491
|
str = ""
|
446
|
-
description << "" if not inline_mode # empty line at end
|
447
492
|
description.each_with_index do |line, index|
|
448
493
|
str << line_prefix if not inline_mode or index > 0
|
449
494
|
str << line
|
@@ -466,6 +511,6 @@ if __FILE__ == $0
|
|
466
511
|
cflags: `llvm-config --cflags`.split(" "),
|
467
512
|
prefixes: ["clang_", "CX"],
|
468
513
|
blacklist: ["clang_getExpansionLocation"],
|
469
|
-
output: "ffi_gen/clang.rb"
|
514
|
+
output: File.join(File.dirname(__FILE__), "ffi_gen/clang.rb")
|
470
515
|
)
|
471
516
|
end
|
data/lib/ffi_gen/clang.rb
CHANGED
@@ -6,23 +6,52 @@ module Clang
|
|
6
6
|
extend FFI::Library
|
7
7
|
ffi_lib 'clang'
|
8
8
|
|
9
|
+
# A single translation unit, which resides in an index.
|
10
|
+
#
|
11
|
+
# = Fields:
|
12
|
+
#
|
13
|
+
class TranslationUnitImpl < FFI::Struct
|
14
|
+
end
|
15
|
+
|
16
|
+
# Provides the contents of a file that has not yet been saved to disk.
|
17
|
+
#
|
18
|
+
# Each CXUnsavedFile instance provides the name of a file on the
|
19
|
+
# system along with the current contents of that file that have not
|
20
|
+
# yet been saved to disk.
|
21
|
+
#
|
22
|
+
# = Fields:
|
23
|
+
# :filename ::
|
24
|
+
# (String) The file whose contents have not yet been saved.
|
25
|
+
#
|
26
|
+
# This file must already exist in the file system.
|
27
|
+
# :contents ::
|
28
|
+
# (String) A buffer containing the unsaved contents of this file.
|
29
|
+
# :length ::
|
30
|
+
# (Integer) The length of the unsaved contents of this buffer.
|
31
|
+
#
|
32
|
+
class UnsavedFile < FFI::Struct
|
33
|
+
layout :filename, :string,
|
34
|
+
:contents, :string,
|
35
|
+
:length, :ulong
|
36
|
+
end
|
37
|
+
|
9
38
|
# Describes the availability of a particular entity, which indicates
|
10
39
|
# whether the use of this entity will result in a warning or error due to
|
11
40
|
# it being deprecated or unavailable.
|
12
41
|
#
|
13
42
|
# === Options:
|
14
|
-
# :available::
|
43
|
+
# :available ::
|
15
44
|
# The entity is available.
|
16
|
-
# :deprecated::
|
45
|
+
# :deprecated ::
|
17
46
|
# The entity is available, but has been deprecated (and its use is
|
18
47
|
# not recommended).
|
19
|
-
# :not_available::
|
48
|
+
# :not_available ::
|
20
49
|
# The entity is not available; any use of it will be an error.
|
21
|
-
# :not_accessible::
|
50
|
+
# :not_accessible ::
|
22
51
|
# The entity is available, but not accessible; any use of it will be
|
23
52
|
# an error.
|
24
53
|
#
|
25
|
-
# @return [Array
|
54
|
+
# @return [Array<Symbol>]
|
26
55
|
def self.availability_kind_enum
|
27
56
|
[:available, :deprecated, :not_available, :not_accessible]
|
28
57
|
end
|
@@ -33,6 +62,19 @@ module Clang
|
|
33
62
|
:not_accessible
|
34
63
|
]
|
35
64
|
|
65
|
+
# A character string.
|
66
|
+
#
|
67
|
+
# The \c CXString type is used to return strings from the interface when
|
68
|
+
# the ownership of that string might different from one call to the next.
|
69
|
+
# Use \c clang_getCString() to retrieve the string data and, once finished
|
70
|
+
# with the string data, call \c clang_disposeString() to free the string.
|
71
|
+
#
|
72
|
+
# = Fields:
|
73
|
+
# :data ::
|
74
|
+
# (FFI::Pointer(*Void))
|
75
|
+
# :private_flags ::
|
76
|
+
# (Integer)
|
77
|
+
#
|
36
78
|
class String < FFI::Struct
|
37
79
|
layout :data, :pointer,
|
38
80
|
:private_flags, :uint
|
@@ -93,7 +135,7 @@ module Clang
|
|
93
135
|
# @method create_index(exclude_declarations_from_pch, display_diagnostics)
|
94
136
|
# @param [Integer] exclude_declarations_from_pch
|
95
137
|
# @param [Integer] display_diagnostics
|
96
|
-
# @return [FFI::Pointer
|
138
|
+
# @return [FFI::Pointer(Index)]
|
97
139
|
# @scope class
|
98
140
|
attach_function :create_index, :clang_createIndex, [:int, :int], :pointer
|
99
141
|
|
@@ -103,7 +145,7 @@ module Clang
|
|
103
145
|
# within that index have been destroyed.
|
104
146
|
#
|
105
147
|
# @method dispose_index(index)
|
106
|
-
# @param [FFI::Pointer
|
148
|
+
# @param [FFI::Pointer(Index)] index
|
107
149
|
# @return [nil]
|
108
150
|
# @scope class
|
109
151
|
attach_function :dispose_index, :clang_disposeIndex, [:pointer], :void
|
@@ -111,7 +153,7 @@ module Clang
|
|
111
153
|
# Retrieve the complete file and path name of the given file.
|
112
154
|
#
|
113
155
|
# @method get_file_name(s_file)
|
114
|
-
# @param [FFI::Pointer
|
156
|
+
# @param [FFI::Pointer(File)] s_file
|
115
157
|
# @return [String]
|
116
158
|
# @scope class
|
117
159
|
attach_function :get_file_name, :clang_getFileName, [:pointer], String.by_value
|
@@ -119,7 +161,7 @@ module Clang
|
|
119
161
|
# Retrieve the last modification time of the given file.
|
120
162
|
#
|
121
163
|
# @method get_file_time(s_file)
|
122
|
-
# @param [FFI::Pointer
|
164
|
+
# @param [FFI::Pointer(File)] s_file
|
123
165
|
# @return [Integer]
|
124
166
|
# @scope class
|
125
167
|
attach_function :get_file_time, :clang_getFileTime, [:pointer], :long
|
@@ -129,8 +171,8 @@ module Clang
|
|
129
171
|
# #ifndef/#define/#endif macro guards or with #pragma once.
|
130
172
|
#
|
131
173
|
# @method is_file_multiple_include_guarded(tu, file)
|
132
|
-
# @param [FFI::Pointer
|
133
|
-
# @param [FFI::Pointer
|
174
|
+
# @param [FFI::Pointer(TranslationUnit)] tu
|
175
|
+
# @param [FFI::Pointer(File)] file
|
134
176
|
# @return [Integer]
|
135
177
|
# @scope class
|
136
178
|
attach_function :is_file_multiple_include_guarded, :clang_isFileMultipleIncludeGuarded, [:pointer, :pointer], :uint
|
@@ -138,18 +180,43 @@ module Clang
|
|
138
180
|
# Retrieve a file handle within the given translation unit.
|
139
181
|
#
|
140
182
|
# @method get_file(tu, file_name)
|
141
|
-
# @param [FFI::Pointer
|
183
|
+
# @param [FFI::Pointer(TranslationUnit)] tu the translation unit
|
142
184
|
# @param [String] file_name the name of the file.
|
143
|
-
# @return [FFI::Pointer
|
185
|
+
# @return [FFI::Pointer(File)] the file handle for the named file in the translation unit \p tu,
|
144
186
|
# or a NULL file handle if the file was not a part of this translation unit.
|
145
187
|
# @scope class
|
146
188
|
attach_function :get_file, :clang_getFile, [:pointer, :string], :pointer
|
147
189
|
|
190
|
+
# Identifies a specific source location within a translation
|
191
|
+
# unit.
|
192
|
+
#
|
193
|
+
# Use clang_getExpansionLocation() or clang_getSpellingLocation()
|
194
|
+
# to map a source location to a particular file, line, and column.
|
195
|
+
#
|
196
|
+
# = Fields:
|
197
|
+
# :ptr_data ::
|
198
|
+
# (Array<FFI::Pointer(*Void)>)
|
199
|
+
# :int_data ::
|
200
|
+
# (Integer)
|
201
|
+
#
|
148
202
|
class SourceLocation < FFI::Struct
|
149
203
|
layout :ptr_data, [:pointer, 2],
|
150
204
|
:int_data, :uint
|
151
205
|
end
|
152
206
|
|
207
|
+
# Identifies a half-open character range in the source code.
|
208
|
+
#
|
209
|
+
# Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the
|
210
|
+
# starting and end locations from a source range, respectively.
|
211
|
+
#
|
212
|
+
# = Fields:
|
213
|
+
# :ptr_data ::
|
214
|
+
# (Array<FFI::Pointer(*Void)>)
|
215
|
+
# :begin_int_data ::
|
216
|
+
# (Integer)
|
217
|
+
# :end_int_data ::
|
218
|
+
# (Integer)
|
219
|
+
#
|
153
220
|
class SourceRange < FFI::Struct
|
154
221
|
layout :ptr_data, [:pointer, 2],
|
155
222
|
:begin_int_data, :uint,
|
@@ -179,8 +246,8 @@ module Clang
|
|
179
246
|
# in a particular translation unit.
|
180
247
|
#
|
181
248
|
# @method get_location(tu, file, line, column)
|
182
|
-
# @param [FFI::Pointer
|
183
|
-
# @param [FFI::Pointer
|
249
|
+
# @param [FFI::Pointer(TranslationUnit)] tu
|
250
|
+
# @param [FFI::Pointer(File)] file
|
184
251
|
# @param [Integer] line
|
185
252
|
# @param [Integer] column
|
186
253
|
# @return [SourceLocation]
|
@@ -191,8 +258,8 @@ module Clang
|
|
191
258
|
# in a particular translation unit.
|
192
259
|
#
|
193
260
|
# @method get_location_for_offset(tu, file, offset)
|
194
|
-
# @param [FFI::Pointer
|
195
|
-
# @param [FFI::Pointer
|
261
|
+
# @param [FFI::Pointer(TranslationUnit)] tu
|
262
|
+
# @param [FFI::Pointer(File)] file
|
196
263
|
# @param [Integer] offset
|
197
264
|
# @return [SourceLocation]
|
198
265
|
# @scope class
|
@@ -255,16 +322,16 @@ module Clang
|
|
255
322
|
# @method get_presumed_location(location, filename, line, column)
|
256
323
|
# @param [SourceLocation] location the location within a source file that will be decomposed
|
257
324
|
# into its parts.
|
258
|
-
# @param [FFI::Pointer
|
325
|
+
# @param [FFI::Pointer(*String)] filename (out) if non-NULL, will be set to the filename of the
|
259
326
|
# source location. Note that filenames returned will be for "virtual" files,
|
260
327
|
# which don't necessarily exist on the machine running clang - e.g. when
|
261
328
|
# parsing preprocessed output obtained from a different environment. If
|
262
329
|
# a non-NULL value is passed in, remember to dispose of the returned value
|
263
330
|
# using \c clang_disposeString() once you've finished with it. For an invalid
|
264
331
|
# source location, an empty string is returned.
|
265
|
-
# @param [FFI::Pointer
|
332
|
+
# @param [FFI::Pointer(*UInt)] line (out) if non-NULL, will be set to the line number of the
|
266
333
|
# source location. For an invalid source location, zero is returned.
|
267
|
-
# @param [FFI::Pointer
|
334
|
+
# @param [FFI::Pointer(*UInt)] column (out) if non-NULL, will be set to the column number of the
|
268
335
|
# source location. For an invalid source location, zero is returned.
|
269
336
|
# @return [nil]
|
270
337
|
# @scope class
|
@@ -279,10 +346,10 @@ module Clang
|
|
279
346
|
#
|
280
347
|
# @method get_instantiation_location(location, file, line, column, offset)
|
281
348
|
# @param [SourceLocation] location
|
282
|
-
# @param [FFI::Pointer
|
283
|
-
# @param [FFI::Pointer
|
284
|
-
# @param [FFI::Pointer
|
285
|
-
# @param [FFI::Pointer
|
349
|
+
# @param [FFI::Pointer(*File)] file
|
350
|
+
# @param [FFI::Pointer(*UInt)] line
|
351
|
+
# @param [FFI::Pointer(*UInt)] column
|
352
|
+
# @param [FFI::Pointer(*UInt)] offset
|
286
353
|
# @return [nil]
|
287
354
|
# @scope class
|
288
355
|
attach_function :get_instantiation_location, :clang_getInstantiationLocation, [SourceLocation.by_value, :pointer, :pointer, :pointer, :pointer], :void
|
@@ -296,13 +363,13 @@ module Clang
|
|
296
363
|
# @method get_spelling_location(location, file, line, column, offset)
|
297
364
|
# @param [SourceLocation] location the location within a source file that will be decomposed
|
298
365
|
# into its parts.
|
299
|
-
# @param [FFI::Pointer
|
366
|
+
# @param [FFI::Pointer(*File)] file (out) if non-NULL, will be set to the file to which the given
|
300
367
|
# source location points.
|
301
|
-
# @param [FFI::Pointer
|
368
|
+
# @param [FFI::Pointer(*UInt)] line (out) if non-NULL, will be set to the line to which the given
|
302
369
|
# source location points.
|
303
|
-
# @param [FFI::Pointer
|
370
|
+
# @param [FFI::Pointer(*UInt)] column (out) if non-NULL, will be set to the column to which the given
|
304
371
|
# source location points.
|
305
|
-
# @param [FFI::Pointer
|
372
|
+
# @param [FFI::Pointer(*UInt)] offset (out) if non-NULL, will be set to the offset into the
|
306
373
|
# buffer to which the given source location points.
|
307
374
|
# @return [nil]
|
308
375
|
# @scope class
|
@@ -329,23 +396,23 @@ module Clang
|
|
329
396
|
# Describes the severity of a particular diagnostic.
|
330
397
|
#
|
331
398
|
# === Options:
|
332
|
-
# :ignored::
|
399
|
+
# :ignored ::
|
333
400
|
# A diagnostic that has been suppressed, e.g., by a command-line
|
334
401
|
# option.
|
335
|
-
# :note::
|
402
|
+
# :note ::
|
336
403
|
# This diagnostic is a note that should be attached to the
|
337
404
|
# previous (non-note) diagnostic.
|
338
|
-
# :warning::
|
405
|
+
# :warning ::
|
339
406
|
# This diagnostic indicates suspicious code that may not be
|
340
407
|
# wrong.
|
341
|
-
# :error::
|
408
|
+
# :error ::
|
342
409
|
# This diagnostic indicates that the code is ill-formed.
|
343
|
-
# :fatal::
|
410
|
+
# :fatal ::
|
344
411
|
# This diagnostic indicates that the code is ill-formed such
|
345
412
|
# that future parser recovery is unlikely to produce useful
|
346
413
|
# results.
|
347
414
|
#
|
348
|
-
# @return [Array
|
415
|
+
# @return [Array<Symbol>]
|
349
416
|
def self.diagnostic_severity_enum
|
350
417
|
[:ignored, :note, :warning, :error, :fatal]
|
351
418
|
end
|
@@ -361,7 +428,7 @@ module Clang
|
|
361
428
|
# translation unit.
|
362
429
|
#
|
363
430
|
# @method get_num_diagnostics(unit)
|
364
|
-
# @param [FFI::Pointer
|
431
|
+
# @param [FFI::Pointer(TranslationUnit)] unit
|
365
432
|
# @return [Integer]
|
366
433
|
# @scope class
|
367
434
|
attach_function :get_num_diagnostics, :clang_getNumDiagnostics, [:pointer], :uint
|
@@ -369,9 +436,9 @@ module Clang
|
|
369
436
|
# Retrieve a diagnostic associated with the given translation unit.
|
370
437
|
#
|
371
438
|
# @method get_diagnostic(unit, index)
|
372
|
-
# @param [FFI::Pointer
|
439
|
+
# @param [FFI::Pointer(TranslationUnit)] unit the translation unit to query.
|
373
440
|
# @param [Integer] index the zero-based diagnostic number to retrieve.
|
374
|
-
# @return [FFI::Pointer
|
441
|
+
# @return [FFI::Pointer(Diagnostic)] the requested diagnostic. This diagnostic must be freed
|
375
442
|
# via a call to \c clang_disposeDiagnostic().
|
376
443
|
# @scope class
|
377
444
|
attach_function :get_diagnostic, :clang_getDiagnostic, [:pointer, :uint], :pointer
|
@@ -379,7 +446,7 @@ module Clang
|
|
379
446
|
# Destroy a diagnostic.
|
380
447
|
#
|
381
448
|
# @method dispose_diagnostic(diagnostic)
|
382
|
-
# @param [FFI::Pointer
|
449
|
+
# @param [FFI::Pointer(Diagnostic)] diagnostic
|
383
450
|
# @return [nil]
|
384
451
|
# @scope class
|
385
452
|
attach_function :dispose_diagnostic, :clang_disposeDiagnostic, [:pointer], :void
|
@@ -390,7 +457,7 @@ module Clang
|
|
390
457
|
# behavior of \c clang_displayDiagnostic().
|
391
458
|
#
|
392
459
|
# === Options:
|
393
|
-
# :display_source_location::
|
460
|
+
# :display_source_location ::
|
394
461
|
# Display the source-location information where the
|
395
462
|
# diagnostic was located.
|
396
463
|
#
|
@@ -402,38 +469,38 @@ module Clang
|
|
402
469
|
# \endcode
|
403
470
|
#
|
404
471
|
# This option corresponds to the clang flag \c -fshow-source-location.
|
405
|
-
# :display_column::
|
472
|
+
# :display_column ::
|
406
473
|
# If displaying the source-location information of the
|
407
474
|
# diagnostic, also include the column number.
|
408
475
|
#
|
409
476
|
# This option corresponds to the clang flag \c -fshow-column.
|
410
|
-
# :display_source_ranges::
|
477
|
+
# :display_source_ranges ::
|
411
478
|
# If displaying the source-location information of the
|
412
479
|
# diagnostic, also include information about source ranges in a
|
413
480
|
# machine-parsable format.
|
414
481
|
#
|
415
482
|
# This option corresponds to the clang flag
|
416
483
|
# \c -fdiagnostics-print-source-range-info.
|
417
|
-
# :display_option::
|
484
|
+
# :display_option ::
|
418
485
|
# Display the option name associated with this diagnostic, if any.
|
419
486
|
#
|
420
487
|
# The option name displayed (e.g., -Wconversion) will be placed in brackets
|
421
488
|
# after the diagnostic text. This option corresponds to the clang flag
|
422
489
|
# \c -fdiagnostics-show-option.
|
423
|
-
# :display_category_id::
|
490
|
+
# :display_category_id ::
|
424
491
|
# Display the category number associated with this diagnostic, if any.
|
425
492
|
#
|
426
493
|
# The category number is displayed within brackets after the diagnostic text.
|
427
494
|
# This option corresponds to the clang flag
|
428
495
|
# \c -fdiagnostics-show-category=id.
|
429
|
-
# :display_category_name::
|
496
|
+
# :display_category_name ::
|
430
497
|
# Display the category name associated with this diagnostic, if any.
|
431
498
|
#
|
432
499
|
# The category name is displayed within brackets after the diagnostic text.
|
433
500
|
# This option corresponds to the clang flag
|
434
501
|
# \c -fdiagnostics-show-category=name.
|
435
502
|
#
|
436
|
-
# @return [Array
|
503
|
+
# @return [Array<Symbol>]
|
437
504
|
def self.diagnostic_display_options_enum
|
438
505
|
[:display_source_location, :display_column, :display_source_ranges, :display_option, :display_category_id, :display_category_name]
|
439
506
|
end
|
@@ -454,7 +521,7 @@ module Clang
|
|
454
521
|
# options that most closely mimics the behavior of the clang compiler.
|
455
522
|
#
|
456
523
|
# @method format_diagnostic(diagnostic, options)
|
457
|
-
# @param [FFI::Pointer
|
524
|
+
# @param [FFI::Pointer(Diagnostic)] diagnostic The diagnostic to print.
|
458
525
|
# @param [Integer] options A set of options that control the diagnostic display,
|
459
526
|
# created by combining \c CXDiagnosticDisplayOptions values.
|
460
527
|
# @return [String] A new string containing for formatted diagnostic.
|
@@ -473,7 +540,7 @@ module Clang
|
|
473
540
|
# Determine the severity of the given diagnostic.
|
474
541
|
#
|
475
542
|
# @method get_diagnostic_severity(diagnostic)
|
476
|
-
# @param [FFI::Pointer
|
543
|
+
# @param [FFI::Pointer(Diagnostic)] diagnostic
|
477
544
|
# @return [Symbol from diagnostic_severity_enum]
|
478
545
|
# @scope class
|
479
546
|
attach_function :get_diagnostic_severity, :clang_getDiagnosticSeverity, [:pointer], :diagnostic_severity
|
@@ -484,7 +551,7 @@ module Clang
|
|
484
551
|
# displaying the diagnostic on the command line.
|
485
552
|
#
|
486
553
|
# @method get_diagnostic_location(diagnostic)
|
487
|
-
# @param [FFI::Pointer
|
554
|
+
# @param [FFI::Pointer(Diagnostic)] diagnostic
|
488
555
|
# @return [SourceLocation]
|
489
556
|
# @scope class
|
490
557
|
attach_function :get_diagnostic_location, :clang_getDiagnosticLocation, [:pointer], SourceLocation.by_value
|
@@ -492,7 +559,7 @@ module Clang
|
|
492
559
|
# Retrieve the text of the given diagnostic.
|
493
560
|
#
|
494
561
|
# @method get_diagnostic_spelling(diagnostic)
|
495
|
-
# @param [FFI::Pointer
|
562
|
+
# @param [FFI::Pointer(Diagnostic)] diagnostic
|
496
563
|
# @return [String]
|
497
564
|
# @scope class
|
498
565
|
attach_function :get_diagnostic_spelling, :clang_getDiagnosticSpelling, [:pointer], String.by_value
|
@@ -501,8 +568,8 @@ module Clang
|
|
501
568
|
# diagnostic.
|
502
569
|
#
|
503
570
|
# @method get_diagnostic_option(diag, disable)
|
504
|
-
# @param [FFI::Pointer
|
505
|
-
# @param [FFI::Pointer
|
571
|
+
# @param [FFI::Pointer(Diagnostic)] diag The diagnostic to be queried.
|
572
|
+
# @param [FFI::Pointer(*String)] disable If non-NULL, will be set to the option that disables this
|
506
573
|
# diagnostic (if any).
|
507
574
|
# @return [String] A string that contains the command-line option used to enable this
|
508
575
|
# warning, such as "-Wconversion" or "-pedantic".
|
@@ -516,7 +583,7 @@ module Clang
|
|
516
583
|
# retrieves the category number for the given diagnostic.
|
517
584
|
#
|
518
585
|
# @method get_diagnostic_category(diagnostic)
|
519
|
-
# @param [FFI::Pointer
|
586
|
+
# @param [FFI::Pointer(Diagnostic)] diagnostic
|
520
587
|
# @return [Integer] The number of the category that contains this diagnostic, or zero
|
521
588
|
# if this diagnostic is uncategorized.
|
522
589
|
# @scope class
|
@@ -535,7 +602,7 @@ module Clang
|
|
535
602
|
# diagnostic.
|
536
603
|
#
|
537
604
|
# @method get_diagnostic_num_ranges(diagnostic)
|
538
|
-
# @param [FFI::Pointer
|
605
|
+
# @param [FFI::Pointer(Diagnostic)] diagnostic
|
539
606
|
# @return [Integer]
|
540
607
|
# @scope class
|
541
608
|
attach_function :get_diagnostic_num_ranges, :clang_getDiagnosticNumRanges, [:pointer], :uint
|
@@ -547,7 +614,7 @@ module Clang
|
|
547
614
|
# underlining them with '~' characters.
|
548
615
|
#
|
549
616
|
# @method get_diagnostic_range(diagnostic, range)
|
550
|
-
# @param [FFI::Pointer
|
617
|
+
# @param [FFI::Pointer(Diagnostic)] diagnostic the diagnostic whose range is being extracted.
|
551
618
|
# @param [Integer] range the zero-based index specifying which range to
|
552
619
|
# @return [SourceRange] the requested source range.
|
553
620
|
# @scope class
|
@@ -557,7 +624,7 @@ module Clang
|
|
557
624
|
# given diagnostic.
|
558
625
|
#
|
559
626
|
# @method get_diagnostic_num_fix_its(diagnostic)
|
560
|
-
# @param [FFI::Pointer
|
627
|
+
# @param [FFI::Pointer(Diagnostic)] diagnostic
|
561
628
|
# @return [Integer]
|
562
629
|
# @scope class
|
563
630
|
attach_function :get_diagnostic_num_fix_its, :clang_getDiagnosticNumFixIts, [:pointer], :uint
|
@@ -575,9 +642,9 @@ module Clang
|
|
575
642
|
# insert).
|
576
643
|
#
|
577
644
|
# @method get_diagnostic_fix_it(diagnostic, fix_it, replacement_range)
|
578
|
-
# @param [FFI::Pointer
|
645
|
+
# @param [FFI::Pointer(Diagnostic)] diagnostic The diagnostic whose fix-its are being queried.
|
579
646
|
# @param [Integer] fix_it The zero-based index of the fix-it.
|
580
|
-
# @param [FFI::Pointer
|
647
|
+
# @param [FFI::Pointer(*SourceRange)] replacement_range The source range whose contents will be
|
581
648
|
# replaced with the returned replacement string. Note that source
|
582
649
|
# ranges are half-open ranges (a, b), so the source code should be
|
583
650
|
# replaced from a and up to (but not including) b.
|
@@ -589,7 +656,7 @@ module Clang
|
|
589
656
|
# Get the original translation unit source file name.
|
590
657
|
#
|
591
658
|
# @method get_translation_unit_spelling(ct_unit)
|
592
|
-
# @param [FFI::Pointer
|
659
|
+
# @param [FFI::Pointer(TranslationUnit)] ct_unit
|
593
660
|
# @return [String]
|
594
661
|
# @scope class
|
595
662
|
attach_function :get_translation_unit_spelling, :clang_getTranslationUnitSpelling, [:pointer], String.by_value
|
@@ -610,34 +677,34 @@ module Clang
|
|
610
677
|
# '-o <output file>' (both '-o' and '<output file>' are ignored)
|
611
678
|
#
|
612
679
|
# @method create_translation_unit_from_source_file(c_idx, source_filename, num_clang_command_line_args, command_line_args, num_unsaved_files, unsaved_files)
|
613
|
-
# @param [FFI::Pointer
|
680
|
+
# @param [FFI::Pointer(Index)] c_idx The index object with which the translation unit will be
|
614
681
|
# associated.
|
615
682
|
# @param [String] source_filename - The name of the source file to load, or NULL if the
|
616
683
|
# source file is included in \p clang_command_line_args.
|
617
684
|
# @param [Integer] num_clang_command_line_args The number of command-line arguments in
|
618
685
|
# \p clang_command_line_args.
|
619
|
-
# @param [FFI::Pointer
|
686
|
+
# @param [FFI::Pointer(**Char_S)] command_line_args The command-line arguments that would be
|
620
687
|
# passed to the \c clang executable if it were being invoked out-of-process.
|
621
688
|
# These command-line options will be parsed and will affect how the translation
|
622
689
|
# unit is parsed. Note that the following options are ignored: '-c',
|
623
690
|
# '-emit-ast', '-fsyntex-only' (which is the default), and '-o <output file>'.
|
624
691
|
# @param [Integer] num_unsaved_files the number of unsaved file entries in \p
|
625
692
|
# unsaved_files.
|
626
|
-
# @param [FFI::Pointer
|
693
|
+
# @param [FFI::Pointer(*UnsavedFile)] unsaved_files the files that have not yet been saved to disk
|
627
694
|
# but may be required for code completion, including the contents of
|
628
695
|
# those files. The contents and name of these files (as specified by
|
629
696
|
# CXUnsavedFile) are copied when necessary, so the client only needs to
|
630
697
|
# guarantee their validity until the call to this function returns.
|
631
|
-
# @return [FFI::Pointer
|
698
|
+
# @return [FFI::Pointer(TranslationUnit)]
|
632
699
|
# @scope class
|
633
700
|
attach_function :create_translation_unit_from_source_file, :clang_createTranslationUnitFromSourceFile, [:pointer, :string, :int, :pointer, :uint, :pointer], :pointer
|
634
701
|
|
635
702
|
# Create a translation unit from an AST file (-emit-ast).
|
636
703
|
#
|
637
704
|
# @method create_translation_unit(index, ast_filename)
|
638
|
-
# @param [FFI::Pointer
|
705
|
+
# @param [FFI::Pointer(Index)] index
|
639
706
|
# @param [String] ast_filename
|
640
|
-
# @return [FFI::Pointer
|
707
|
+
# @return [FFI::Pointer(TranslationUnit)]
|
641
708
|
# @scope class
|
642
709
|
attach_function :create_translation_unit, :clang_createTranslationUnit, [:pointer, :string], :pointer
|
643
710
|
|
@@ -648,10 +715,10 @@ module Clang
|
|
648
715
|
# constructing the translation unit.
|
649
716
|
#
|
650
717
|
# === Options:
|
651
|
-
# :none::
|
718
|
+
# :none ::
|
652
719
|
# Used to indicate that no special translation-unit options are
|
653
720
|
# needed.
|
654
|
-
# :detailed_preprocessing_record::
|
721
|
+
# :detailed_preprocessing_record ::
|
655
722
|
# Used to indicate that the parser should construct a "detailed"
|
656
723
|
# preprocessing record, including all macro definitions and instantiations.
|
657
724
|
#
|
@@ -660,7 +727,7 @@ module Clang
|
|
660
727
|
# is usually not retained. However, it can be useful for
|
661
728
|
# applications that require more detailed information about the
|
662
729
|
# behavior of the preprocessor.
|
663
|
-
# :incomplete::
|
730
|
+
# :incomplete ::
|
664
731
|
# Used to indicate that the translation unit is incomplete.
|
665
732
|
#
|
666
733
|
# When a translation unit is considered "incomplete", semantic
|
@@ -670,7 +737,7 @@ module Clang
|
|
670
737
|
# instantiation of implicitly-instantiation function templates in
|
671
738
|
# C++. This option is typically used when parsing a header with the
|
672
739
|
# intent of producing a precompiled header.
|
673
|
-
# :precompiled_preamble::
|
740
|
+
# :precompiled_preamble ::
|
674
741
|
# Used to indicate that the translation unit should be built with an
|
675
742
|
# implicit precompiled header for the preamble.
|
676
743
|
#
|
@@ -683,24 +750,24 @@ module Clang
|
|
683
750
|
# preamble or the files in it have not changed, \c
|
684
751
|
# clang_reparseTranslationUnit() will re-use the implicit
|
685
752
|
# precompiled header to improve parsing performance.
|
686
|
-
# :cache_completion_results::
|
753
|
+
# :cache_completion_results ::
|
687
754
|
# Used to indicate that the translation unit should cache some
|
688
755
|
# code-completion results with each reparse of the source file.
|
689
756
|
#
|
690
757
|
# Caching of code-completion results is a performance optimization that
|
691
758
|
# introduces some overhead to reparsing but improves the performance of
|
692
759
|
# code-completion operations.
|
693
|
-
# :x_precompiled_preamble::
|
760
|
+
# :x_precompiled_preamble ::
|
694
761
|
# DEPRECATED: Enable precompiled preambles in C++.
|
695
762
|
#
|
696
763
|
# Note: this is a *temporary* option that is available only while
|
697
764
|
# we are testing C++ precompiled preamble support. It is deprecated.
|
698
|
-
# :x_chained_pch::
|
765
|
+
# :x_chained_pch ::
|
699
766
|
# DEPRECATED: Enabled chained precompiled preambles in C++.
|
700
767
|
#
|
701
768
|
# Note: this is a *temporary* option that is available only while
|
702
769
|
# we are testing C++ precompiled preamble support. It is deprecated.
|
703
|
-
# :nested_macro_expansions::
|
770
|
+
# :nested_macro_expansions ::
|
704
771
|
# Used to indicate that the "detailed" preprocessing record,
|
705
772
|
# if requested, should also contain nested macro expansions.
|
706
773
|
#
|
@@ -709,7 +776,7 @@ module Clang
|
|
709
776
|
# a large amount of storage to due preprocessor metaprogramming. Moreover,
|
710
777
|
# its fairly rare that this information is useful for libclang clients.
|
711
778
|
#
|
712
|
-
# @return [Array
|
779
|
+
# @return [Array<Symbol>]
|
713
780
|
def self.translation_unit_flags_enum
|
714
781
|
[:none, :detailed_preprocessing_record, :incomplete, :precompiled_preamble, :cache_completion_results, :x_precompiled_preamble, :x_chained_pch, :nested_macro_expansions]
|
715
782
|
end
|
@@ -750,18 +817,18 @@ module Clang
|
|
750
817
|
# way that the compiler is configured on the command line.
|
751
818
|
#
|
752
819
|
# @method parse_translation_unit(c_idx, source_filename, command_line_args, num_command_line_args, unsaved_files, num_unsaved_files, options)
|
753
|
-
# @param [FFI::Pointer
|
820
|
+
# @param [FFI::Pointer(Index)] c_idx The index object with which the translation unit will be
|
754
821
|
# associated.
|
755
822
|
# @param [String] source_filename The name of the source file to load, or NULL if the
|
756
823
|
# source file is included in \p command_line_args.
|
757
|
-
# @param [FFI::Pointer
|
824
|
+
# @param [FFI::Pointer(**Char_S)] command_line_args The command-line arguments that would be
|
758
825
|
# passed to the \c clang executable if it were being invoked out-of-process.
|
759
826
|
# These command-line options will be parsed and will affect how the translation
|
760
827
|
# unit is parsed. Note that the following options are ignored: '-c',
|
761
828
|
# '-emit-ast', '-fsyntex-only' (which is the default), and '-o <output file>'.
|
762
829
|
# @param [Integer] num_command_line_args The number of command-line arguments in
|
763
830
|
# \p command_line_args.
|
764
|
-
# @param [FFI::Pointer
|
831
|
+
# @param [FFI::Pointer(*UnsavedFile)] unsaved_files the files that have not yet been saved to disk
|
765
832
|
# but may be required for parsing, including the contents of
|
766
833
|
# those files. The contents and name of these files (as specified by
|
767
834
|
# CXUnsavedFile) are copied when necessary, so the client only needs to
|
@@ -771,7 +838,7 @@ module Clang
|
|
771
838
|
# @param [Integer] options A bitmask of options that affects how the translation unit
|
772
839
|
# is managed but not its compilation. This should be a bitwise OR of the
|
773
840
|
# CXTranslationUnit_XXX flags.
|
774
|
-
# @return [FFI::Pointer
|
841
|
+
# @return [FFI::Pointer(TranslationUnit)] A new translation unit describing the parsed code and containing
|
775
842
|
# any diagnostics produced by the compiler. If there is a failure from which
|
776
843
|
# the compiler cannot recover, returns NULL.
|
777
844
|
# @scope class
|
@@ -784,10 +851,10 @@ module Clang
|
|
784
851
|
# saving the translation unit.
|
785
852
|
#
|
786
853
|
# === Options:
|
787
|
-
# :save_translation_unit_none::
|
854
|
+
# :save_translation_unit_none ::
|
788
855
|
# Used to indicate that no special saving options are needed.
|
789
856
|
#
|
790
|
-
# @return [Array
|
857
|
+
# @return [Array<Symbol>]
|
791
858
|
def self.save_translation_unit_flags_enum
|
792
859
|
[:save_translation_unit_none]
|
793
860
|
end
|
@@ -804,7 +871,7 @@ module Clang
|
|
804
871
|
# the most commonly-requested data.
|
805
872
|
#
|
806
873
|
# @method default_save_options(tu)
|
807
|
-
# @param [FFI::Pointer
|
874
|
+
# @param [FFI::Pointer(TranslationUnit)] tu
|
808
875
|
# @return [Integer]
|
809
876
|
# @scope class
|
810
877
|
attach_function :default_save_options, :clang_defaultSaveOptions, [:pointer], :uint
|
@@ -813,25 +880,25 @@ module Clang
|
|
813
880
|
# \c clang_saveTranslationUnit().
|
814
881
|
#
|
815
882
|
# === Options:
|
816
|
-
# :none::
|
883
|
+
# :none ::
|
817
884
|
# Indicates that no error occurred while saving a translation unit.
|
818
|
-
# :unknown::
|
885
|
+
# :unknown ::
|
819
886
|
# Indicates that an unknown error occurred while attempting to save
|
820
887
|
# the file.
|
821
888
|
#
|
822
889
|
# This error typically indicates that file I/O failed when attempting to
|
823
890
|
# write the file.
|
824
|
-
# :translation_errors::
|
891
|
+
# :translation_errors ::
|
825
892
|
# Indicates that errors during translation prevented this attempt
|
826
893
|
# to save the translation unit.
|
827
894
|
#
|
828
895
|
# Errors that prevent the translation unit from being saved can be
|
829
896
|
# extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic().
|
830
|
-
# :invalid_tu::
|
897
|
+
# :invalid_tu ::
|
831
898
|
# Indicates that the translation unit to be saved was somehow
|
832
899
|
# invalid (e.g., NULL).
|
833
900
|
#
|
834
|
-
# @return [Array
|
901
|
+
# @return [Array<Symbol>]
|
835
902
|
def self.save_error_enum
|
836
903
|
[:none, :unknown, :translation_errors, :invalid_tu]
|
837
904
|
end
|
@@ -853,7 +920,7 @@ module Clang
|
|
853
920
|
# units.
|
854
921
|
#
|
855
922
|
# @method save_translation_unit(tu, file_name, options)
|
856
|
-
# @param [FFI::Pointer
|
923
|
+
# @param [FFI::Pointer(TranslationUnit)] tu The translation unit to save.
|
857
924
|
# @param [String] file_name The file to which the translation unit will be saved.
|
858
925
|
# @param [Integer] options A bitmask of options that affects how the translation unit
|
859
926
|
# is saved. This should be a bitwise OR of the
|
@@ -867,7 +934,7 @@ module Clang
|
|
867
934
|
# Destroy the specified CXTranslationUnit object.
|
868
935
|
#
|
869
936
|
# @method dispose_translation_unit(translation_unit)
|
870
|
-
# @param [FFI::Pointer
|
937
|
+
# @param [FFI::Pointer(TranslationUnit)] translation_unit
|
871
938
|
# @return [nil]
|
872
939
|
# @scope class
|
873
940
|
attach_function :dispose_translation_unit, :clang_disposeTranslationUnit, [:pointer], :void
|
@@ -879,10 +946,10 @@ module Clang
|
|
879
946
|
# reparsing the translation unit.
|
880
947
|
#
|
881
948
|
# === Options:
|
882
|
-
# :reparse_none::
|
949
|
+
# :reparse_none ::
|
883
950
|
# Used to indicate that no special reparsing options are needed.
|
884
951
|
#
|
885
|
-
# @return [Array
|
952
|
+
# @return [Array<Symbol>]
|
886
953
|
def self.reparse_flags_enum
|
887
954
|
[:reparse_none]
|
888
955
|
end
|
@@ -900,7 +967,7 @@ module Clang
|
|
900
967
|
# to the next.
|
901
968
|
#
|
902
969
|
# @method default_reparse_options(tu)
|
903
|
-
# @param [FFI::Pointer
|
970
|
+
# @param [FFI::Pointer(TranslationUnit)] tu
|
904
971
|
# @return [Integer]
|
905
972
|
# @scope class
|
906
973
|
attach_function :default_reparse_options, :clang_defaultReparseOptions, [:pointer], :uint
|
@@ -921,12 +988,12 @@ module Clang
|
|
921
988
|
# unit using this routine.
|
922
989
|
#
|
923
990
|
# @method reparse_translation_unit(tu, num_unsaved_files, unsaved_files, options)
|
924
|
-
# @param [FFI::Pointer
|
991
|
+
# @param [FFI::Pointer(TranslationUnit)] tu The translation unit whose contents will be re-parsed. The
|
925
992
|
# translation unit must originally have been built with
|
926
993
|
# \c clang_createTranslationUnitFromSourceFile().
|
927
994
|
# @param [Integer] num_unsaved_files The number of unsaved file entries in \p
|
928
995
|
# unsaved_files.
|
929
|
-
# @param [FFI::Pointer
|
996
|
+
# @param [FFI::Pointer(*UnsavedFile)] unsaved_files The files that have not yet been saved to disk
|
930
997
|
# but may be required for parsing, including the contents of
|
931
998
|
# those files. The contents and name of these files (as specified by
|
932
999
|
# CXUnsavedFile) are copied when necessary, so the client only needs to
|
@@ -944,36 +1011,36 @@ module Clang
|
|
944
1011
|
# Categorizes how memory is being used by a translation unit.
|
945
1012
|
#
|
946
1013
|
# === Options:
|
947
|
-
# :ast::
|
1014
|
+
# :ast ::
|
948
1015
|
#
|
949
|
-
# :identifiers::
|
1016
|
+
# :identifiers ::
|
950
1017
|
#
|
951
|
-
# :selectors::
|
1018
|
+
# :selectors ::
|
952
1019
|
#
|
953
|
-
# :global_completion_results::
|
1020
|
+
# :global_completion_results ::
|
954
1021
|
#
|
955
|
-
# :source_manager_content_cache::
|
1022
|
+
# :source_manager_content_cache ::
|
956
1023
|
#
|
957
|
-
# :ast_side_tables::
|
1024
|
+
# :ast_side_tables ::
|
958
1025
|
#
|
959
|
-
# :source_manager_membuffer_malloc::
|
1026
|
+
# :source_manager_membuffer_malloc ::
|
960
1027
|
#
|
961
|
-
# :source_manager_membuffer_m_map::
|
1028
|
+
# :source_manager_membuffer_m_map ::
|
962
1029
|
#
|
963
|
-
# :external_ast_source_membuffer_malloc::
|
1030
|
+
# :external_ast_source_membuffer_malloc ::
|
964
1031
|
#
|
965
|
-
# :external_ast_source_membuffer_m_map::
|
1032
|
+
# :external_ast_source_membuffer_m_map ::
|
966
1033
|
#
|
967
|
-
# :preprocessor::
|
1034
|
+
# :preprocessor ::
|
968
1035
|
#
|
969
|
-
# :preprocessing_record::
|
1036
|
+
# :preprocessing_record ::
|
970
1037
|
#
|
971
|
-
# :source_manager_data_structures::
|
1038
|
+
# :source_manager_data_structures ::
|
972
1039
|
#
|
973
|
-
# :preprocessor_header_search::
|
1040
|
+
# :preprocessor_header_search ::
|
974
1041
|
#
|
975
1042
|
#
|
976
|
-
# @return [Array
|
1043
|
+
# @return [Array<Symbol>]
|
977
1044
|
def self.tu_resource_usage_kind_enum
|
978
1045
|
[:ast, :identifiers, :selectors, :global_completion_results, :source_manager_content_cache, :ast_side_tables, :source_manager_membuffer_malloc, :source_manager_membuffer_m_map, :external_ast_source_membuffer_malloc, :external_ast_source_membuffer_m_map, :preprocessor, :preprocessing_record, :source_manager_data_structures, :preprocessor_header_search]
|
979
1046
|
end
|
@@ -1003,11 +1070,31 @@ module Clang
|
|
1003
1070
|
# @scope class
|
1004
1071
|
attach_function :get_tu_resource_usage_name, :clang_getTUResourceUsageName, [:tu_resource_usage_kind], :string
|
1005
1072
|
|
1073
|
+
# (Not documented)
|
1074
|
+
#
|
1075
|
+
# = Fields:
|
1076
|
+
# :kind ::
|
1077
|
+
# (Symbol from tu_resource_usage_kind_enum) The memory usage category.
|
1078
|
+
# :amount ::
|
1079
|
+
# (Integer) Amount of resources used.
|
1080
|
+
# The units will depend on the resource kind.
|
1081
|
+
#
|
1006
1082
|
class TUResourceUsageEntry < FFI::Struct
|
1007
1083
|
layout :kind, :tu_resource_usage_kind,
|
1008
1084
|
:amount, :ulong
|
1009
1085
|
end
|
1010
1086
|
|
1087
|
+
# The memory usage of a CXTranslationUnit, broken into categories.
|
1088
|
+
#
|
1089
|
+
# = Fields:
|
1090
|
+
# :data ::
|
1091
|
+
# (FFI::Pointer(*Void)) Private data member, used for queries.
|
1092
|
+
# :num_entries ::
|
1093
|
+
# (Integer) The number of entries in the 'entries' array.
|
1094
|
+
# :entries ::
|
1095
|
+
# (FFI::Pointer(*TUResourceUsageEntry)) An array of key-value pairs, representing the breakdown of memory
|
1096
|
+
# usage.
|
1097
|
+
#
|
1011
1098
|
class TUResourceUsage < FFI::Struct
|
1012
1099
|
layout :data, :pointer,
|
1013
1100
|
:num_entries, :uint,
|
@@ -1018,11 +1105,13 @@ module Clang
|
|
1018
1105
|
# should be released with clang_disposeCXTUResourceUsage().
|
1019
1106
|
#
|
1020
1107
|
# @method get_cxtu_resource_usage(tu)
|
1021
|
-
# @param [FFI::Pointer
|
1108
|
+
# @param [FFI::Pointer(TranslationUnit)] tu
|
1022
1109
|
# @return [TUResourceUsage]
|
1023
1110
|
# @scope class
|
1024
1111
|
attach_function :get_cxtu_resource_usage, :clang_getCXTUResourceUsage, [:pointer], TUResourceUsage.by_value
|
1025
1112
|
|
1113
|
+
# (Not documented)
|
1114
|
+
#
|
1026
1115
|
# @method dispose_cxtu_resource_usage(usage)
|
1027
1116
|
# @param [TUResourceUsage] usage
|
1028
1117
|
# @return [nil]
|
@@ -1032,7 +1121,7 @@ module Clang
|
|
1032
1121
|
# Describes the kind of entity that a cursor refers to.
|
1033
1122
|
#
|
1034
1123
|
# === Options:
|
1035
|
-
# :unexposed_decl::
|
1124
|
+
# :unexposed_decl ::
|
1036
1125
|
# A declaration whose specific kind is not exposed via this
|
1037
1126
|
# interface.
|
1038
1127
|
#
|
@@ -1040,92 +1129,92 @@ module Clang
|
|
1040
1129
|
# of declaration; one can extract their location information,
|
1041
1130
|
# spelling, find their definitions, etc. However, the specific kind
|
1042
1131
|
# of the declaration is not reported.
|
1043
|
-
# :struct_decl::
|
1132
|
+
# :struct_decl ::
|
1044
1133
|
# A C or C++ struct.
|
1045
|
-
# :union_decl::
|
1134
|
+
# :union_decl ::
|
1046
1135
|
# A C or C++ union.
|
1047
|
-
# :class_decl::
|
1136
|
+
# :class_decl ::
|
1048
1137
|
# A C++ class.
|
1049
|
-
# :enum_decl::
|
1138
|
+
# :enum_decl ::
|
1050
1139
|
# An enumeration.
|
1051
|
-
# :field_decl::
|
1140
|
+
# :field_decl ::
|
1052
1141
|
# A field (in C) or non-static data member (in C++) in a
|
1053
1142
|
# struct, union, or C++ class.
|
1054
|
-
# :enum_constant_decl::
|
1143
|
+
# :enum_constant_decl ::
|
1055
1144
|
# An enumerator constant.
|
1056
|
-
# :function_decl::
|
1145
|
+
# :function_decl ::
|
1057
1146
|
# A function.
|
1058
|
-
# :var_decl::
|
1147
|
+
# :var_decl ::
|
1059
1148
|
# A variable.
|
1060
|
-
# :parm_decl::
|
1149
|
+
# :parm_decl ::
|
1061
1150
|
# A function or method parameter.
|
1062
|
-
# :obj_c_interface_decl::
|
1151
|
+
# :obj_c_interface_decl ::
|
1063
1152
|
# An Objective-C @interface.
|
1064
|
-
# :obj_c_category_decl::
|
1153
|
+
# :obj_c_category_decl ::
|
1065
1154
|
# An Objective-C @interface for a category.
|
1066
|
-
# :obj_c_protocol_decl::
|
1155
|
+
# :obj_c_protocol_decl ::
|
1067
1156
|
# An Objective-C @protocol declaration.
|
1068
|
-
# :obj_c_property_decl::
|
1157
|
+
# :obj_c_property_decl ::
|
1069
1158
|
# An Objective-C @property declaration.
|
1070
|
-
# :obj_c_ivar_decl::
|
1159
|
+
# :obj_c_ivar_decl ::
|
1071
1160
|
# An Objective-C instance variable.
|
1072
|
-
# :obj_c_instance_method_decl::
|
1161
|
+
# :obj_c_instance_method_decl ::
|
1073
1162
|
# An Objective-C instance method.
|
1074
|
-
# :obj_c_class_method_decl::
|
1163
|
+
# :obj_c_class_method_decl ::
|
1075
1164
|
# An Objective-C class method.
|
1076
|
-
# :obj_c_implementation_decl::
|
1165
|
+
# :obj_c_implementation_decl ::
|
1077
1166
|
# An Objective-C @implementation.
|
1078
|
-
# :obj_c_category_impl_decl::
|
1167
|
+
# :obj_c_category_impl_decl ::
|
1079
1168
|
# An Objective-C @implementation for a category.
|
1080
|
-
# :typedef_decl::
|
1169
|
+
# :typedef_decl ::
|
1081
1170
|
# A typedef
|
1082
|
-
# :x_method::
|
1171
|
+
# :x_method ::
|
1083
1172
|
# A C++ class method.
|
1084
|
-
# :namespace::
|
1173
|
+
# :namespace ::
|
1085
1174
|
# A C++ namespace.
|
1086
|
-
# :linkage_spec::
|
1175
|
+
# :linkage_spec ::
|
1087
1176
|
# A linkage specification, e.g. 'extern "C"'.
|
1088
|
-
# :constructor::
|
1177
|
+
# :constructor ::
|
1089
1178
|
# A C++ constructor.
|
1090
|
-
# :destructor::
|
1179
|
+
# :destructor ::
|
1091
1180
|
# A C++ destructor.
|
1092
|
-
# :conversion_function::
|
1181
|
+
# :conversion_function ::
|
1093
1182
|
# A C++ conversion function.
|
1094
|
-
# :template_type_parameter::
|
1183
|
+
# :template_type_parameter ::
|
1095
1184
|
# A C++ template type parameter.
|
1096
|
-
# :non_type_template_parameter::
|
1185
|
+
# :non_type_template_parameter ::
|
1097
1186
|
# A C++ non-type template parameter.
|
1098
|
-
# :template_template_parameter::
|
1187
|
+
# :template_template_parameter ::
|
1099
1188
|
# A C++ template template parameter.
|
1100
|
-
# :function_template::
|
1189
|
+
# :function_template ::
|
1101
1190
|
# A C++ function template.
|
1102
|
-
# :class_template::
|
1191
|
+
# :class_template ::
|
1103
1192
|
# A C++ class template.
|
1104
|
-
# :class_template_partial_specialization::
|
1193
|
+
# :class_template_partial_specialization ::
|
1105
1194
|
# A C++ class template partial specialization.
|
1106
|
-
# :namespace_alias::
|
1195
|
+
# :namespace_alias ::
|
1107
1196
|
# A C++ namespace alias declaration.
|
1108
|
-
# :using_directive::
|
1197
|
+
# :using_directive ::
|
1109
1198
|
# A C++ using directive.
|
1110
|
-
# :using_declaration::
|
1199
|
+
# :using_declaration ::
|
1111
1200
|
# A C++ using declaration.
|
1112
|
-
# :type_alias_decl::
|
1201
|
+
# :type_alias_decl ::
|
1113
1202
|
# A C++ alias declaration
|
1114
|
-
# :obj_c_synthesize_decl::
|
1203
|
+
# :obj_c_synthesize_decl ::
|
1115
1204
|
# An Objective-C @synthesize definition.
|
1116
|
-
# :obj_c_dynamic_decl::
|
1205
|
+
# :obj_c_dynamic_decl ::
|
1117
1206
|
# An Objective-C @dynamic definition.
|
1118
|
-
# :x_access_specifier::
|
1207
|
+
# :x_access_specifier ::
|
1119
1208
|
# An access specifier.
|
1120
|
-
# :first_ref::
|
1209
|
+
# :first_ref ::
|
1121
1210
|
# References
|
1122
|
-
# :obj_c_super_class_ref::
|
1211
|
+
# :obj_c_super_class_ref ::
|
1123
1212
|
# Decl references
|
1124
|
-
# :obj_c_protocol_ref::
|
1213
|
+
# :obj_c_protocol_ref ::
|
1125
1214
|
#
|
1126
|
-
# :obj_c_class_ref::
|
1215
|
+
# :obj_c_class_ref ::
|
1127
1216
|
#
|
1128
|
-
# :type_ref::
|
1217
|
+
# :type_ref ::
|
1129
1218
|
# A reference to a type declaration.
|
1130
1219
|
#
|
1131
1220
|
# A type reference occurs anywhere where a type is named but not
|
@@ -1139,17 +1228,17 @@ module Clang
|
|
1139
1228
|
# The typedef is a declaration of size_type (CXCursor_TypedefDecl),
|
1140
1229
|
# while the type of the variable "size" is referenced. The cursor
|
1141
1230
|
# referenced by the type of size is the typedef for size_type.
|
1142
|
-
# :x_base_specifier::
|
1231
|
+
# :x_base_specifier ::
|
1143
1232
|
#
|
1144
|
-
# :template_ref::
|
1233
|
+
# :template_ref ::
|
1145
1234
|
# A reference to a class template, function template, template
|
1146
1235
|
# template parameter, or class template partial specialization.
|
1147
|
-
# :namespace_ref::
|
1236
|
+
# :namespace_ref ::
|
1148
1237
|
# A reference to a namespace or namespace alias.
|
1149
|
-
# :member_ref::
|
1238
|
+
# :member_ref ::
|
1150
1239
|
# A reference to a member of a struct, union, or class that occurs in
|
1151
1240
|
# some non-expression context, e.g., a designated initializer.
|
1152
|
-
# :label_ref::
|
1241
|
+
# :label_ref ::
|
1153
1242
|
# A reference to a labeled statement.
|
1154
1243
|
#
|
1155
1244
|
# This cursor kind is used to describe the jump to "start_over" in the
|
@@ -1163,7 +1252,7 @@ module Clang
|
|
1163
1252
|
# \endcode
|
1164
1253
|
#
|
1165
1254
|
# A label reference cursor refers to a label statement.
|
1166
|
-
# :overloaded_decl_ref::
|
1255
|
+
# :overloaded_decl_ref ::
|
1167
1256
|
# A reference to a set of overloaded functions or function templates
|
1168
1257
|
# that has not yet been resolved to a specific function or function template.
|
1169
1258
|
#
|
@@ -1198,19 +1287,19 @@ module Clang
|
|
1198
1287
|
# The functions \c clang_getNumOverloadedDecls() and
|
1199
1288
|
# \c clang_getOverloadedDecl() can be used to retrieve the definitions
|
1200
1289
|
# referenced by this cursor.
|
1201
|
-
# :first_invalid::
|
1290
|
+
# :first_invalid ::
|
1202
1291
|
# Error conditions
|
1203
|
-
# :invalid_file::
|
1292
|
+
# :invalid_file ::
|
1204
1293
|
#
|
1205
|
-
# :no_decl_found::
|
1294
|
+
# :no_decl_found ::
|
1206
1295
|
#
|
1207
|
-
# :not_implemented::
|
1296
|
+
# :not_implemented ::
|
1208
1297
|
#
|
1209
|
-
# :invalid_code::
|
1298
|
+
# :invalid_code ::
|
1210
1299
|
#
|
1211
|
-
# :first_expr::
|
1300
|
+
# :first_expr ::
|
1212
1301
|
# Expressions
|
1213
|
-
# :unexposed_expr::
|
1302
|
+
# :unexposed_expr ::
|
1214
1303
|
# An expression whose specific kind is not exposed via this
|
1215
1304
|
# interface.
|
1216
1305
|
#
|
@@ -1218,61 +1307,61 @@ module Clang
|
|
1218
1307
|
# of expression; one can extract their location information,
|
1219
1308
|
# spelling, children, etc. However, the specific kind of the
|
1220
1309
|
# expression is not reported.
|
1221
|
-
# :decl_ref_expr::
|
1310
|
+
# :decl_ref_expr ::
|
1222
1311
|
# An expression that refers to some value declaration, such
|
1223
1312
|
# as a function, varible, or enumerator.
|
1224
|
-
# :member_ref_expr::
|
1313
|
+
# :member_ref_expr ::
|
1225
1314
|
# An expression that refers to a member of a struct, union,
|
1226
1315
|
# class, Objective-C class, etc.
|
1227
|
-
# :call_expr::
|
1316
|
+
# :call_expr ::
|
1228
1317
|
# An expression that calls a function.
|
1229
|
-
# :obj_c_message_expr::
|
1318
|
+
# :obj_c_message_expr ::
|
1230
1319
|
# An expression that sends a message to an Objective-C
|
1231
1320
|
# object or class.
|
1232
|
-
# :block_expr::
|
1321
|
+
# :block_expr ::
|
1233
1322
|
# An expression that represents a block literal.
|
1234
|
-
# :integer_literal::
|
1323
|
+
# :integer_literal ::
|
1235
1324
|
# An integer literal.
|
1236
|
-
# :floating_literal::
|
1325
|
+
# :floating_literal ::
|
1237
1326
|
# A floating point number literal.
|
1238
|
-
# :imaginary_literal::
|
1327
|
+
# :imaginary_literal ::
|
1239
1328
|
# An imaginary number literal.
|
1240
|
-
# :string_literal::
|
1329
|
+
# :string_literal ::
|
1241
1330
|
# A string literal.
|
1242
|
-
# :character_literal::
|
1331
|
+
# :character_literal ::
|
1243
1332
|
# A character literal.
|
1244
|
-
# :paren_expr::
|
1333
|
+
# :paren_expr ::
|
1245
1334
|
# A parenthesized expression, e.g. "(1)".
|
1246
1335
|
#
|
1247
1336
|
# This AST node is only formed if full location information is requested.
|
1248
|
-
# :unary_operator::
|
1337
|
+
# :unary_operator ::
|
1249
1338
|
# This represents the unary-expression's (except sizeof and
|
1250
1339
|
# alignof).
|
1251
|
-
# :array_subscript_expr::
|
1340
|
+
# :array_subscript_expr ::
|
1252
1341
|
# (C99 6.5.2.1) Array Subscripting.
|
1253
|
-
# :binary_operator::
|
1342
|
+
# :binary_operator ::
|
1254
1343
|
# A builtin binary operation expression such as "x + y" or
|
1255
1344
|
# "x <= y".
|
1256
|
-
# :compound_assign_operator::
|
1345
|
+
# :compound_assign_operator ::
|
1257
1346
|
# Compound assignment such as "+=".
|
1258
|
-
# :conditional_operator::
|
1347
|
+
# :conditional_operator ::
|
1259
1348
|
# The ?: ternary operator.
|
1260
|
-
# :c_style_cast_expr::
|
1349
|
+
# :c_style_cast_expr ::
|
1261
1350
|
# An explicit cast in C (C99 6.5.4) or a C-style cast in C++
|
1262
1351
|
# (C++ (expr.cast)), which uses the syntax (Type)expr.
|
1263
1352
|
#
|
1264
1353
|
# For example: (int)f.
|
1265
|
-
# :compound_literal_expr::
|
1354
|
+
# :compound_literal_expr ::
|
1266
1355
|
# (C99 6.5.2.5)
|
1267
|
-
# :init_list_expr::
|
1356
|
+
# :init_list_expr ::
|
1268
1357
|
# Describes an C or C++ initializer list.
|
1269
|
-
# :addr_label_expr::
|
1358
|
+
# :addr_label_expr ::
|
1270
1359
|
# The GNU address of label extension, representing &&label.
|
1271
|
-
# :stmt_expr::
|
1360
|
+
# :stmt_expr ::
|
1272
1361
|
# This is the GNU Statement Expression extension: ({int X=4; X;})
|
1273
|
-
# :generic_selection_expr::
|
1362
|
+
# :generic_selection_expr ::
|
1274
1363
|
# Represents a C1X generic selection.
|
1275
|
-
# :gnu_null_expr::
|
1364
|
+
# :gnu_null_expr ::
|
1276
1365
|
# Implements the GNU __null extension, which is a name for a null
|
1277
1366
|
# pointer constant that has integral type (e.g., int or long) and is the same
|
1278
1367
|
# size and alignment as a pointer.
|
@@ -1280,15 +1369,15 @@ module Clang
|
|
1280
1369
|
# The __null extension is typically only used by system headers, which define
|
1281
1370
|
# NULL as __null in C++ rather than using 0 (which is an integer that may not
|
1282
1371
|
# match the size of a pointer).
|
1283
|
-
# :x_static_cast_expr::
|
1372
|
+
# :x_static_cast_expr ::
|
1284
1373
|
# C++'s static_cast<> expression.
|
1285
|
-
# :x_dynamic_cast_expr::
|
1374
|
+
# :x_dynamic_cast_expr ::
|
1286
1375
|
# C++'s dynamic_cast<> expression.
|
1287
|
-
# :x_reinterpret_cast_expr::
|
1376
|
+
# :x_reinterpret_cast_expr ::
|
1288
1377
|
# C++'s reinterpret_cast<> expression.
|
1289
|
-
# :x_const_cast_expr::
|
1378
|
+
# :x_const_cast_expr ::
|
1290
1379
|
# C++'s const_cast<> expression.
|
1291
|
-
# :x_functional_cast_expr::
|
1380
|
+
# :x_functional_cast_expr ::
|
1292
1381
|
# Represents an explicit C++ type conversion that uses "functional"
|
1293
1382
|
# notion (C++ (expr.type.conv)).
|
1294
1383
|
#
|
@@ -1296,43 +1385,43 @@ module Clang
|
|
1296
1385
|
# \code
|
1297
1386
|
# x = int(0.5);
|
1298
1387
|
# \endcode
|
1299
|
-
# :x_typeid_expr::
|
1388
|
+
# :x_typeid_expr ::
|
1300
1389
|
# A C++ typeid expression (C++ (expr.typeid)).
|
1301
|
-
# :x_bool_literal_expr::
|
1390
|
+
# :x_bool_literal_expr ::
|
1302
1391
|
# (C++ 2.13.5) C++ Boolean Literal.
|
1303
|
-
# :x_null_ptr_literal_expr::
|
1392
|
+
# :x_null_ptr_literal_expr ::
|
1304
1393
|
# (C++0x 2.14.7) C++ Pointer Literal.
|
1305
|
-
# :x_this_expr::
|
1394
|
+
# :x_this_expr ::
|
1306
1395
|
# Represents the "this" expression in C++
|
1307
|
-
# :x_throw_expr::
|
1396
|
+
# :x_throw_expr ::
|
1308
1397
|
# (C++ 15) C++ Throw Expression.
|
1309
1398
|
#
|
1310
1399
|
# This handles 'throw' and 'throw' assignment-expression. When
|
1311
1400
|
# assignment-expression isn't present, Op will be null.
|
1312
|
-
# :x_new_expr::
|
1401
|
+
# :x_new_expr ::
|
1313
1402
|
# A new expression for memory allocation and constructor calls, e.g:
|
1314
1403
|
# "new CXXNewExpr(foo)".
|
1315
|
-
# :x_delete_expr::
|
1404
|
+
# :x_delete_expr ::
|
1316
1405
|
# A delete expression for memory deallocation and destructor calls,
|
1317
1406
|
# e.g. "delete() pArray".
|
1318
|
-
# :unary_expr::
|
1407
|
+
# :unary_expr ::
|
1319
1408
|
# A unary expression.
|
1320
|
-
# :obj_c_string_literal::
|
1409
|
+
# :obj_c_string_literal ::
|
1321
1410
|
# ObjCStringLiteral, used for Objective-C string literals i.e. "foo".
|
1322
|
-
# :obj_c_encode_expr::
|
1411
|
+
# :obj_c_encode_expr ::
|
1323
1412
|
# ObjCEncodeExpr, used for in Objective-C.
|
1324
|
-
# :obj_c_selector_expr::
|
1413
|
+
# :obj_c_selector_expr ::
|
1325
1414
|
# ObjCSelectorExpr used for in Objective-C.
|
1326
|
-
# :obj_c_protocol_expr::
|
1415
|
+
# :obj_c_protocol_expr ::
|
1327
1416
|
# Objective-C's protocol expression.
|
1328
|
-
# :obj_c_bridged_cast_expr::
|
1417
|
+
# :obj_c_bridged_cast_expr ::
|
1329
1418
|
# An Objective-C "bridged" cast expression, which casts between
|
1330
1419
|
# Objective-C pointers and C pointers, transferring ownership in the process.
|
1331
1420
|
#
|
1332
1421
|
# \code
|
1333
1422
|
# NSString *str = (__bridge_transfer NSString *)CFCreateString();
|
1334
1423
|
# \endcode
|
1335
|
-
# :pack_expansion_expr::
|
1424
|
+
# :pack_expansion_expr ::
|
1336
1425
|
# Represents a C++0x pack expansion that produces a sequence of
|
1337
1426
|
# expressions.
|
1338
1427
|
#
|
@@ -1345,7 +1434,7 @@ module Clang
|
|
1345
1434
|
# f(static_cast<Types&&>(args)...);
|
1346
1435
|
# }
|
1347
1436
|
# \endcode
|
1348
|
-
# :size_of_pack_expr::
|
1437
|
+
# :size_of_pack_expr ::
|
1349
1438
|
# Represents an expression that computes the length of a parameter
|
1350
1439
|
# pack.
|
1351
1440
|
#
|
@@ -1355,9 +1444,9 @@ module Clang
|
|
1355
1444
|
# static const unsigned value = sizeof...(Types);
|
1356
1445
|
# };
|
1357
1446
|
# \endcode
|
1358
|
-
# :first_stmt::
|
1447
|
+
# :first_stmt ::
|
1359
1448
|
# Statements
|
1360
|
-
# :unexposed_stmt::
|
1449
|
+
# :unexposed_stmt ::
|
1361
1450
|
# A statement whose specific kind is not exposed via this
|
1362
1451
|
# interface.
|
1363
1452
|
#
|
@@ -1365,7 +1454,7 @@ module Clang
|
|
1365
1454
|
# statement; one can extract their location information, spelling,
|
1366
1455
|
# children, etc. However, the specific kind of the statement is not
|
1367
1456
|
# reported.
|
1368
|
-
# :label_stmt::
|
1457
|
+
# :label_stmt ::
|
1369
1458
|
# A labelled statement in a function.
|
1370
1459
|
#
|
1371
1460
|
# This cursor kind is used to describe the "start_over:" label statement in
|
@@ -1375,102 +1464,102 @@ module Clang
|
|
1375
1464
|
# start_over:
|
1376
1465
|
# ++counter;
|
1377
1466
|
# \endcode
|
1378
|
-
# :compound_stmt::
|
1467
|
+
# :compound_stmt ::
|
1379
1468
|
# A group of statements like { stmt stmt }.
|
1380
1469
|
#
|
1381
1470
|
# This cursor kind is used to describe compound statements, e.g. function
|
1382
1471
|
# bodies.
|
1383
|
-
# :case_stmt::
|
1472
|
+
# :case_stmt ::
|
1384
1473
|
# A case statment.
|
1385
|
-
# :default_stmt::
|
1474
|
+
# :default_stmt ::
|
1386
1475
|
# A default statement.
|
1387
|
-
# :if_stmt::
|
1476
|
+
# :if_stmt ::
|
1388
1477
|
# An if statement
|
1389
|
-
# :switch_stmt::
|
1478
|
+
# :switch_stmt ::
|
1390
1479
|
# A switch statement.
|
1391
|
-
# :while_stmt::
|
1480
|
+
# :while_stmt ::
|
1392
1481
|
# A while statement.
|
1393
|
-
# :do_stmt::
|
1482
|
+
# :do_stmt ::
|
1394
1483
|
# A do statement.
|
1395
|
-
# :for_stmt::
|
1484
|
+
# :for_stmt ::
|
1396
1485
|
# A for statement.
|
1397
|
-
# :goto_stmt::
|
1486
|
+
# :goto_stmt ::
|
1398
1487
|
# A goto statement.
|
1399
|
-
# :indirect_goto_stmt::
|
1488
|
+
# :indirect_goto_stmt ::
|
1400
1489
|
# An indirect goto statement.
|
1401
|
-
# :continue_stmt::
|
1490
|
+
# :continue_stmt ::
|
1402
1491
|
# A continue statement.
|
1403
|
-
# :break_stmt::
|
1492
|
+
# :break_stmt ::
|
1404
1493
|
# A break statement.
|
1405
|
-
# :return_stmt::
|
1494
|
+
# :return_stmt ::
|
1406
1495
|
# A return statement.
|
1407
|
-
# :asm_stmt::
|
1496
|
+
# :asm_stmt ::
|
1408
1497
|
# A GNU inline assembly statement extension.
|
1409
|
-
# :obj_c_at_try_stmt::
|
1498
|
+
# :obj_c_at_try_stmt ::
|
1410
1499
|
# Objective-C's overall @try-@catc-@finall statement.
|
1411
|
-
# :obj_c_at_catch_stmt::
|
1500
|
+
# :obj_c_at_catch_stmt ::
|
1412
1501
|
# Objective-C's @catch statement.
|
1413
|
-
# :obj_c_at_finally_stmt::
|
1502
|
+
# :obj_c_at_finally_stmt ::
|
1414
1503
|
# Objective-C's @finally statement.
|
1415
|
-
# :obj_c_at_throw_stmt::
|
1504
|
+
# :obj_c_at_throw_stmt ::
|
1416
1505
|
# Objective-C's @throw statement.
|
1417
|
-
# :obj_c_at_synchronized_stmt::
|
1506
|
+
# :obj_c_at_synchronized_stmt ::
|
1418
1507
|
# Objective-C's @synchronized statement.
|
1419
|
-
# :obj_c_autorelease_pool_stmt::
|
1508
|
+
# :obj_c_autorelease_pool_stmt ::
|
1420
1509
|
# Objective-C's autorelease pool statement.
|
1421
|
-
# :obj_c_for_collection_stmt::
|
1510
|
+
# :obj_c_for_collection_stmt ::
|
1422
1511
|
# Objective-C's collection statement.
|
1423
|
-
# :x_catch_stmt::
|
1512
|
+
# :x_catch_stmt ::
|
1424
1513
|
# C++'s catch statement.
|
1425
|
-
# :x_try_stmt::
|
1514
|
+
# :x_try_stmt ::
|
1426
1515
|
# C++'s try statement.
|
1427
|
-
# :x_for_range_stmt::
|
1516
|
+
# :x_for_range_stmt ::
|
1428
1517
|
# C++'s for (* : *) statement.
|
1429
|
-
# :seh_try_stmt::
|
1518
|
+
# :seh_try_stmt ::
|
1430
1519
|
# Windows Structured Exception Handling's try statement.
|
1431
|
-
# :seh_except_stmt::
|
1520
|
+
# :seh_except_stmt ::
|
1432
1521
|
# Windows Structured Exception Handling's except statement.
|
1433
|
-
# :seh_finally_stmt::
|
1522
|
+
# :seh_finally_stmt ::
|
1434
1523
|
# Windows Structured Exception Handling's finally statement.
|
1435
|
-
# :null_stmt::
|
1524
|
+
# :null_stmt ::
|
1436
1525
|
# The null satement ";": C99 6.8.3p3.
|
1437
1526
|
#
|
1438
1527
|
# This cursor kind is used to describe the null statement.
|
1439
|
-
# :decl_stmt::
|
1528
|
+
# :decl_stmt ::
|
1440
1529
|
# Adaptor class for mixing declarations with statements and
|
1441
1530
|
# expressions.
|
1442
|
-
# :translation_unit::
|
1531
|
+
# :translation_unit ::
|
1443
1532
|
# Cursor that represents the translation unit itself.
|
1444
1533
|
#
|
1445
1534
|
# The translation unit cursor exists primarily to act as the root
|
1446
1535
|
# cursor for traversing the contents of a translation unit.
|
1447
|
-
# :first_attr::
|
1536
|
+
# :first_attr ::
|
1448
1537
|
# Attributes
|
1449
|
-
# :unexposed_attr::
|
1538
|
+
# :unexposed_attr ::
|
1450
1539
|
# An attribute whose specific kind is not exposed via this
|
1451
1540
|
# interface.
|
1452
|
-
# :ib_action_attr::
|
1541
|
+
# :ib_action_attr ::
|
1453
1542
|
#
|
1454
|
-
# :ib_outlet_attr::
|
1543
|
+
# :ib_outlet_attr ::
|
1455
1544
|
#
|
1456
|
-
# :ib_outlet_collection_attr::
|
1545
|
+
# :ib_outlet_collection_attr ::
|
1457
1546
|
#
|
1458
|
-
# :x_final_attr::
|
1547
|
+
# :x_final_attr ::
|
1459
1548
|
#
|
1460
|
-
# :x_override_attr::
|
1549
|
+
# :x_override_attr ::
|
1461
1550
|
#
|
1462
|
-
# :annotate_attr::
|
1551
|
+
# :annotate_attr ::
|
1463
1552
|
#
|
1464
|
-
# :preprocessing_directive::
|
1553
|
+
# :preprocessing_directive ::
|
1465
1554
|
# Preprocessing
|
1466
|
-
# :macro_definition::
|
1555
|
+
# :macro_definition ::
|
1467
1556
|
#
|
1468
|
-
# :macro_expansion::
|
1557
|
+
# :macro_expansion ::
|
1469
1558
|
#
|
1470
|
-
# :inclusion_directive::
|
1559
|
+
# :inclusion_directive ::
|
1471
1560
|
#
|
1472
1561
|
#
|
1473
|
-
# @return [Array
|
1562
|
+
# @return [Array<Symbol>]
|
1474
1563
|
def self.cursor_kind_enum
|
1475
1564
|
[:unexposed_decl, :struct_decl, :union_decl, :class_decl, :enum_decl, :field_decl, :enum_constant_decl, :function_decl, :var_decl, :parm_decl, :obj_c_interface_decl, :obj_c_category_decl, :obj_c_protocol_decl, :obj_c_property_decl, :obj_c_ivar_decl, :obj_c_instance_method_decl, :obj_c_class_method_decl, :obj_c_implementation_decl, :obj_c_category_impl_decl, :typedef_decl, :x_method, :namespace, :linkage_spec, :constructor, :destructor, :conversion_function, :template_type_parameter, :non_type_template_parameter, :template_template_parameter, :function_template, :class_template, :class_template_partial_specialization, :namespace_alias, :using_directive, :using_declaration, :type_alias_decl, :obj_c_synthesize_decl, :obj_c_dynamic_decl, :x_access_specifier, :first_ref, :obj_c_super_class_ref, :obj_c_protocol_ref, :obj_c_class_ref, :type_ref, :x_base_specifier, :template_ref, :namespace_ref, :member_ref, :label_ref, :overloaded_decl_ref, :first_invalid, :invalid_file, :no_decl_found, :not_implemented, :invalid_code, :first_expr, :unexposed_expr, :decl_ref_expr, :member_ref_expr, :call_expr, :obj_c_message_expr, :block_expr, :integer_literal, :floating_literal, :imaginary_literal, :string_literal, :character_literal, :paren_expr, :unary_operator, :array_subscript_expr, :binary_operator, :compound_assign_operator, :conditional_operator, :c_style_cast_expr, :compound_literal_expr, :init_list_expr, :addr_label_expr, :stmt_expr, :generic_selection_expr, :gnu_null_expr, :x_static_cast_expr, :x_dynamic_cast_expr, :x_reinterpret_cast_expr, :x_const_cast_expr, :x_functional_cast_expr, :x_typeid_expr, :x_bool_literal_expr, :x_null_ptr_literal_expr, :x_this_expr, :x_throw_expr, :x_new_expr, :x_delete_expr, :unary_expr, :obj_c_string_literal, :obj_c_encode_expr, :obj_c_selector_expr, :obj_c_protocol_expr, :obj_c_bridged_cast_expr, :pack_expansion_expr, :size_of_pack_expr, :first_stmt, :unexposed_stmt, :label_stmt, :compound_stmt, :case_stmt, :default_stmt, :if_stmt, :switch_stmt, :while_stmt, :do_stmt, :for_stmt, :goto_stmt, :indirect_goto_stmt, :continue_stmt, :break_stmt, :return_stmt, :asm_stmt, :obj_c_at_try_stmt, :obj_c_at_catch_stmt, :obj_c_at_finally_stmt, :obj_c_at_throw_stmt, :obj_c_at_synchronized_stmt, :obj_c_autorelease_pool_stmt, :obj_c_for_collection_stmt, :x_catch_stmt, :x_try_stmt, :x_for_range_stmt, :seh_try_stmt, :seh_except_stmt, :seh_finally_stmt, :null_stmt, :decl_stmt, :translation_unit, :first_attr, :unexposed_attr, :ib_action_attr, :ib_outlet_attr, :ib_outlet_collection_attr, :x_final_attr, :x_override_attr, :annotate_attr, :preprocessing_directive, :macro_definition, :macro_expansion, :inclusion_directive]
|
1476
1565
|
end
|
@@ -1622,6 +1711,31 @@ module Clang
|
|
1622
1711
|
:inclusion_directive, 503
|
1623
1712
|
]
|
1624
1713
|
|
1714
|
+
# A cursor representing some element in the abstract syntax tree for
|
1715
|
+
# a translation unit.
|
1716
|
+
#
|
1717
|
+
# The cursor abstraction unifies the different kinds of entities in a
|
1718
|
+
# program--declaration, statements, expressions, references to declarations,
|
1719
|
+
# etc.--under a single "cursor" abstraction with a common set of operations.
|
1720
|
+
# Common operation for a cursor include: getting the physical location in
|
1721
|
+
# a source file where the cursor points, getting the name associated with a
|
1722
|
+
# cursor, and retrieving cursors for any child nodes of a particular cursor.
|
1723
|
+
#
|
1724
|
+
# Cursors can be produced in two specific ways.
|
1725
|
+
# clang_getTranslationUnitCursor() produces a cursor for a translation unit,
|
1726
|
+
# from which one can use clang_visitChildren() to explore the rest of the
|
1727
|
+
# translation unit. clang_getCursor() maps from a physical source location
|
1728
|
+
# to the entity that resides at that location, allowing one to map from the
|
1729
|
+
# source code into the AST.
|
1730
|
+
#
|
1731
|
+
# = Fields:
|
1732
|
+
# :kind ::
|
1733
|
+
# (Symbol from cursor_kind_enum)
|
1734
|
+
# :xdata ::
|
1735
|
+
# (Integer)
|
1736
|
+
# :data ::
|
1737
|
+
# (Array<FFI::Pointer(*Void)>)
|
1738
|
+
#
|
1625
1739
|
class Cursor < FFI::Struct
|
1626
1740
|
layout :kind, :cursor_kind,
|
1627
1741
|
:xdata, :int,
|
@@ -1641,7 +1755,7 @@ module Clang
|
|
1641
1755
|
# various declarations within the given translation unit.
|
1642
1756
|
#
|
1643
1757
|
# @method get_translation_unit_cursor(translation_unit)
|
1644
|
-
# @param [FFI::Pointer
|
1758
|
+
# @param [FFI::Pointer(TranslationUnit)] translation_unit
|
1645
1759
|
# @return [Cursor]
|
1646
1760
|
# @scope class
|
1647
1761
|
attach_function :get_translation_unit_cursor, :clang_getTranslationUnitCursor, [:pointer], Cursor.by_value
|
@@ -1681,8 +1795,8 @@ module Clang
|
|
1681
1795
|
|
1682
1796
|
# Determine whether the given cursor kind represents a declaration.
|
1683
1797
|
#
|
1684
|
-
# @method is_declaration(
|
1685
|
-
# @param [Symbol from cursor_kind_enum]
|
1798
|
+
# @method is_declaration(cursor_kind)
|
1799
|
+
# @param [Symbol from cursor_kind_enum] cursor_kind
|
1686
1800
|
# @return [Integer]
|
1687
1801
|
# @scope class
|
1688
1802
|
attach_function :is_declaration, :clang_isDeclaration, [:cursor_kind], :uint
|
@@ -1694,32 +1808,32 @@ module Clang
|
|
1694
1808
|
# other cursors. Use clang_getCursorReferenced() to determine whether a
|
1695
1809
|
# particular cursor refers to another entity.
|
1696
1810
|
#
|
1697
|
-
# @method is_reference(
|
1698
|
-
# @param [Symbol from cursor_kind_enum]
|
1811
|
+
# @method is_reference(cursor_kind)
|
1812
|
+
# @param [Symbol from cursor_kind_enum] cursor_kind
|
1699
1813
|
# @return [Integer]
|
1700
1814
|
# @scope class
|
1701
1815
|
attach_function :is_reference, :clang_isReference, [:cursor_kind], :uint
|
1702
1816
|
|
1703
1817
|
# Determine whether the given cursor kind represents an expression.
|
1704
1818
|
#
|
1705
|
-
# @method is_expression(
|
1706
|
-
# @param [Symbol from cursor_kind_enum]
|
1819
|
+
# @method is_expression(cursor_kind)
|
1820
|
+
# @param [Symbol from cursor_kind_enum] cursor_kind
|
1707
1821
|
# @return [Integer]
|
1708
1822
|
# @scope class
|
1709
1823
|
attach_function :is_expression, :clang_isExpression, [:cursor_kind], :uint
|
1710
1824
|
|
1711
1825
|
# Determine whether the given cursor kind represents a statement.
|
1712
1826
|
#
|
1713
|
-
# @method is_statement(
|
1714
|
-
# @param [Symbol from cursor_kind_enum]
|
1827
|
+
# @method is_statement(cursor_kind)
|
1828
|
+
# @param [Symbol from cursor_kind_enum] cursor_kind
|
1715
1829
|
# @return [Integer]
|
1716
1830
|
# @scope class
|
1717
1831
|
attach_function :is_statement, :clang_isStatement, [:cursor_kind], :uint
|
1718
1832
|
|
1719
1833
|
# Determine whether the given cursor kind represents an attribute.
|
1720
1834
|
#
|
1721
|
-
# @method is_attribute(
|
1722
|
-
# @param [Symbol from cursor_kind_enum]
|
1835
|
+
# @method is_attribute(cursor_kind)
|
1836
|
+
# @param [Symbol from cursor_kind_enum] cursor_kind
|
1723
1837
|
# @return [Integer]
|
1724
1838
|
# @scope class
|
1725
1839
|
attach_function :is_attribute, :clang_isAttribute, [:cursor_kind], :uint
|
@@ -1727,8 +1841,8 @@ module Clang
|
|
1727
1841
|
# Determine whether the given cursor kind represents an invalid
|
1728
1842
|
# cursor.
|
1729
1843
|
#
|
1730
|
-
# @method is_invalid(
|
1731
|
-
# @param [Symbol from cursor_kind_enum]
|
1844
|
+
# @method is_invalid(cursor_kind)
|
1845
|
+
# @param [Symbol from cursor_kind_enum] cursor_kind
|
1732
1846
|
# @return [Integer]
|
1733
1847
|
# @scope class
|
1734
1848
|
attach_function :is_invalid, :clang_isInvalid, [:cursor_kind], :uint
|
@@ -1736,8 +1850,8 @@ module Clang
|
|
1736
1850
|
# Determine whether the given cursor kind represents a translation
|
1737
1851
|
# unit.
|
1738
1852
|
#
|
1739
|
-
# @method is_translation_unit(
|
1740
|
-
# @param [Symbol from cursor_kind_enum]
|
1853
|
+
# @method is_translation_unit(cursor_kind)
|
1854
|
+
# @param [Symbol from cursor_kind_enum] cursor_kind
|
1741
1855
|
# @return [Integer]
|
1742
1856
|
# @scope class
|
1743
1857
|
attach_function :is_translation_unit, :clang_isTranslationUnit, [:cursor_kind], :uint
|
@@ -1745,8 +1859,8 @@ module Clang
|
|
1745
1859
|
# Determine whether the given cursor represents a preprocessing
|
1746
1860
|
# element, such as a preprocessor directive or macro instantiation.
|
1747
1861
|
#
|
1748
|
-
# @method is_preprocessing(
|
1749
|
-
# @param [Symbol from cursor_kind_enum]
|
1862
|
+
# @method is_preprocessing(cursor_kind)
|
1863
|
+
# @param [Symbol from cursor_kind_enum] cursor_kind
|
1750
1864
|
# @return [Integer]
|
1751
1865
|
# @scope class
|
1752
1866
|
attach_function :is_preprocessing, :clang_isPreprocessing, [:cursor_kind], :uint
|
@@ -1754,8 +1868,8 @@ module Clang
|
|
1754
1868
|
# Determine whether the given cursor represents a currently
|
1755
1869
|
# unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
|
1756
1870
|
#
|
1757
|
-
# @method is_unexposed(
|
1758
|
-
# @param [Symbol from cursor_kind_enum]
|
1871
|
+
# @method is_unexposed(cursor_kind)
|
1872
|
+
# @param [Symbol from cursor_kind_enum] cursor_kind
|
1759
1873
|
# @return [Integer]
|
1760
1874
|
# @scope class
|
1761
1875
|
attach_function :is_unexposed, :clang_isUnexposed, [:cursor_kind], :uint
|
@@ -1763,21 +1877,21 @@ module Clang
|
|
1763
1877
|
# Describe the linkage of the entity referred to by a cursor.
|
1764
1878
|
#
|
1765
1879
|
# === Options:
|
1766
|
-
# :invalid::
|
1880
|
+
# :invalid ::
|
1767
1881
|
# This value indicates that no linkage information is available
|
1768
1882
|
# for a provided CXCursor.
|
1769
|
-
# :no_linkage::
|
1883
|
+
# :no_linkage ::
|
1770
1884
|
# This is the linkage for variables, parameters, and so on that
|
1771
1885
|
# have automatic storage. This covers normal (non-extern) local variables.
|
1772
|
-
# :internal::
|
1886
|
+
# :internal ::
|
1773
1887
|
# This is the linkage for static variables and static functions.
|
1774
|
-
# :unique_external::
|
1888
|
+
# :unique_external ::
|
1775
1889
|
# This is the linkage for entities with external linkage that live
|
1776
1890
|
# in C++ anonymous namespaces.
|
1777
|
-
# :external::
|
1891
|
+
# :external ::
|
1778
1892
|
# This is the linkage for entities with true, external linkage.
|
1779
1893
|
#
|
1780
|
-
# @return [Array
|
1894
|
+
# @return [Array<Symbol>]
|
1781
1895
|
def self.linkage_kind_enum
|
1782
1896
|
[:invalid, :no_linkage, :internal, :unique_external, :external]
|
1783
1897
|
end
|
@@ -1808,16 +1922,16 @@ module Clang
|
|
1808
1922
|
# Describe the "language" of the entity referred to by a cursor.
|
1809
1923
|
#
|
1810
1924
|
# === Options:
|
1811
|
-
# :invalid::
|
1925
|
+
# :invalid ::
|
1812
1926
|
#
|
1813
|
-
# :c::
|
1927
|
+
# :c ::
|
1814
1928
|
#
|
1815
|
-
# :obj_c::
|
1929
|
+
# :obj_c ::
|
1816
1930
|
#
|
1817
|
-
# :c_plus_plus::
|
1931
|
+
# :c_plus_plus ::
|
1818
1932
|
#
|
1819
1933
|
#
|
1820
|
-
# @return [Array
|
1934
|
+
# @return [Array<Symbol>]
|
1821
1935
|
def self.language_kind_enum
|
1822
1936
|
[:invalid, :c, :obj_c, :c_plus_plus]
|
1823
1937
|
end
|
@@ -1840,21 +1954,28 @@ module Clang
|
|
1840
1954
|
#
|
1841
1955
|
# @method cursor_get_translation_unit(cursor)
|
1842
1956
|
# @param [Cursor] cursor
|
1843
|
-
# @return [FFI::Pointer
|
1957
|
+
# @return [FFI::Pointer(TranslationUnit)]
|
1844
1958
|
# @scope class
|
1845
1959
|
attach_function :cursor_get_translation_unit, :clang_Cursor_getTranslationUnit, [Cursor.by_value], :pointer
|
1846
1960
|
|
1961
|
+
# A fast container representing a set of CXCursors.
|
1962
|
+
#
|
1963
|
+
# = Fields:
|
1964
|
+
#
|
1965
|
+
class CursorSetImpl < FFI::Struct
|
1966
|
+
end
|
1967
|
+
|
1847
1968
|
# Creates an empty CXCursorSet.
|
1848
1969
|
#
|
1849
1970
|
# @method create_cx_cursor_set()
|
1850
|
-
# @return [FFI::Pointer
|
1971
|
+
# @return [FFI::Pointer(CursorSet)]
|
1851
1972
|
# @scope class
|
1852
1973
|
attach_function :create_cx_cursor_set, :clang_createCXCursorSet, [], :pointer
|
1853
1974
|
|
1854
1975
|
# Disposes a CXCursorSet and releases its associated memory.
|
1855
1976
|
#
|
1856
1977
|
# @method dispose_cx_cursor_set(cset)
|
1857
|
-
# @param [FFI::Pointer
|
1978
|
+
# @param [FFI::Pointer(CursorSet)] cset
|
1858
1979
|
# @return [nil]
|
1859
1980
|
# @scope class
|
1860
1981
|
attach_function :dispose_cx_cursor_set, :clang_disposeCXCursorSet, [:pointer], :void
|
@@ -1862,7 +1983,7 @@ module Clang
|
|
1862
1983
|
# Queries a CXCursorSet to see if it contains a specific CXCursor.
|
1863
1984
|
#
|
1864
1985
|
# @method cx_cursor_set_contains(cset, cursor)
|
1865
|
-
# @param [FFI::Pointer
|
1986
|
+
# @param [FFI::Pointer(CursorSet)] cset
|
1866
1987
|
# @param [Cursor] cursor
|
1867
1988
|
# @return [Integer] non-zero if the set contains the specified cursor.
|
1868
1989
|
# @scope class
|
@@ -1871,7 +1992,7 @@ module Clang
|
|
1871
1992
|
# Inserts a CXCursor into a CXCursorSet.
|
1872
1993
|
#
|
1873
1994
|
# @method cx_cursor_set_insert(cset, cursor)
|
1874
|
-
# @param [FFI::Pointer
|
1995
|
+
# @param [FFI::Pointer(CursorSet)] cset
|
1875
1996
|
# @param [Cursor] cursor
|
1876
1997
|
# @return [Integer] zero if the CXCursor was already in the set, and non-zero otherwise.
|
1877
1998
|
# @scope class
|
@@ -1985,12 +2106,12 @@ module Clang
|
|
1985
2106
|
# @param [Cursor] cursor A cursor representing an Objective-C or C++
|
1986
2107
|
# method. This routine will compute the set of methods that this
|
1987
2108
|
# method overrides.
|
1988
|
-
# @param [FFI::Pointer
|
2109
|
+
# @param [FFI::Pointer(**Cursor)] overridden A pointer whose pointee will be replaced with a
|
1989
2110
|
# pointer to an array of cursors, representing the set of overridden
|
1990
2111
|
# methods. If there are no overridden methods, the pointee will be
|
1991
2112
|
# set to NULL. The pointee must be freed via a call to
|
1992
2113
|
# \c clang_disposeOverriddenCursors().
|
1993
|
-
# @param [FFI::Pointer
|
2114
|
+
# @param [FFI::Pointer(*UInt)] num_overridden A pointer to the number of overridden
|
1994
2115
|
# functions, will be set to the number of overridden functions in the
|
1995
2116
|
# array pointed to by \p overridden.
|
1996
2117
|
# @return [nil]
|
@@ -2001,7 +2122,7 @@ module Clang
|
|
2001
2122
|
# clang_getOverriddenCursors().
|
2002
2123
|
#
|
2003
2124
|
# @method dispose_overridden_cursors(overridden)
|
2004
|
-
# @param [FFI::Pointer
|
2125
|
+
# @param [FFI::Pointer(*Cursor)] overridden
|
2005
2126
|
# @return [nil]
|
2006
2127
|
# @scope class
|
2007
2128
|
attach_function :dispose_overridden_cursors, :clang_disposeOverriddenCursors, [:pointer], :void
|
@@ -2011,7 +2132,7 @@ module Clang
|
|
2011
2132
|
#
|
2012
2133
|
# @method get_included_file(cursor)
|
2013
2134
|
# @param [Cursor] cursor
|
2014
|
-
# @return [FFI::Pointer
|
2135
|
+
# @return [FFI::Pointer(File)]
|
2015
2136
|
# @scope class
|
2016
2137
|
attach_function :get_included_file, :clang_getIncludedFile, [Cursor.by_value], :pointer
|
2017
2138
|
|
@@ -2027,7 +2148,7 @@ module Clang
|
|
2027
2148
|
# will return a cursor referring to the "+" expression.
|
2028
2149
|
#
|
2029
2150
|
# @method get_cursor(translation_unit, source_location)
|
2030
|
-
# @param [FFI::Pointer
|
2151
|
+
# @param [FFI::Pointer(TranslationUnit)] translation_unit
|
2031
2152
|
# @param [SourceLocation] source_location
|
2032
2153
|
# @return [Cursor] a cursor representing the entity at the given source location, or
|
2033
2154
|
# a NULL cursor if no such entity can be found.
|
@@ -2068,95 +2189,95 @@ module Clang
|
|
2068
2189
|
# Describes the kind of type
|
2069
2190
|
#
|
2070
2191
|
# === Options:
|
2071
|
-
# :invalid::
|
2192
|
+
# :invalid ::
|
2072
2193
|
# Reprents an invalid type (e.g., where no type is available).
|
2073
|
-
# :unexposed::
|
2194
|
+
# :unexposed ::
|
2074
2195
|
# A type whose specific kind is not exposed via this
|
2075
2196
|
# interface.
|
2076
|
-
# :void::
|
2197
|
+
# :void ::
|
2077
2198
|
# Builtin types
|
2078
|
-
# :bool::
|
2199
|
+
# :bool ::
|
2079
2200
|
#
|
2080
|
-
# :char_u::
|
2201
|
+
# :char_u ::
|
2081
2202
|
#
|
2082
|
-
# :u_char::
|
2203
|
+
# :u_char ::
|
2083
2204
|
#
|
2084
|
-
# :char16::
|
2205
|
+
# :char16 ::
|
2085
2206
|
#
|
2086
|
-
# :char32::
|
2207
|
+
# :char32 ::
|
2087
2208
|
#
|
2088
|
-
# :u_short::
|
2209
|
+
# :u_short ::
|
2089
2210
|
#
|
2090
|
-
# :u_int::
|
2211
|
+
# :u_int ::
|
2091
2212
|
#
|
2092
|
-
# :u_long::
|
2213
|
+
# :u_long ::
|
2093
2214
|
#
|
2094
|
-
# :u_long_long::
|
2215
|
+
# :u_long_long ::
|
2095
2216
|
#
|
2096
|
-
# :u_int128::
|
2217
|
+
# :u_int128 ::
|
2097
2218
|
#
|
2098
|
-
# :char_s::
|
2219
|
+
# :char_s ::
|
2099
2220
|
#
|
2100
|
-
# :s_char::
|
2221
|
+
# :s_char ::
|
2101
2222
|
#
|
2102
|
-
# :w_char::
|
2223
|
+
# :w_char ::
|
2103
2224
|
#
|
2104
|
-
# :short::
|
2225
|
+
# :short ::
|
2105
2226
|
#
|
2106
|
-
# :int::
|
2227
|
+
# :int ::
|
2107
2228
|
#
|
2108
|
-
# :long::
|
2229
|
+
# :long ::
|
2109
2230
|
#
|
2110
|
-
# :long_long::
|
2231
|
+
# :long_long ::
|
2111
2232
|
#
|
2112
|
-
# :int128::
|
2233
|
+
# :int128 ::
|
2113
2234
|
#
|
2114
|
-
# :float::
|
2235
|
+
# :float ::
|
2115
2236
|
#
|
2116
|
-
# :double::
|
2237
|
+
# :double ::
|
2117
2238
|
#
|
2118
|
-
# :long_double::
|
2239
|
+
# :long_double ::
|
2119
2240
|
#
|
2120
|
-
# :null_ptr::
|
2241
|
+
# :null_ptr ::
|
2121
2242
|
#
|
2122
|
-
# :overload::
|
2243
|
+
# :overload ::
|
2123
2244
|
#
|
2124
|
-
# :dependent::
|
2245
|
+
# :dependent ::
|
2125
2246
|
#
|
2126
|
-
# :obj_c_id::
|
2247
|
+
# :obj_c_id ::
|
2127
2248
|
#
|
2128
|
-
# :obj_c_class::
|
2249
|
+
# :obj_c_class ::
|
2129
2250
|
#
|
2130
|
-
# :obj_c_sel::
|
2251
|
+
# :obj_c_sel ::
|
2131
2252
|
#
|
2132
|
-
# :complex::
|
2253
|
+
# :complex ::
|
2133
2254
|
#
|
2134
|
-
# :pointer::
|
2255
|
+
# :pointer ::
|
2135
2256
|
#
|
2136
|
-
# :block_pointer::
|
2257
|
+
# :block_pointer ::
|
2137
2258
|
#
|
2138
|
-
# :l_value_reference::
|
2259
|
+
# :l_value_reference ::
|
2139
2260
|
#
|
2140
|
-
# :r_value_reference::
|
2261
|
+
# :r_value_reference ::
|
2141
2262
|
#
|
2142
|
-
# :record::
|
2263
|
+
# :record ::
|
2143
2264
|
#
|
2144
|
-
# :enum::
|
2265
|
+
# :enum ::
|
2145
2266
|
#
|
2146
|
-
# :typedef::
|
2267
|
+
# :typedef ::
|
2147
2268
|
#
|
2148
|
-
# :obj_c_interface::
|
2269
|
+
# :obj_c_interface ::
|
2149
2270
|
#
|
2150
|
-
# :obj_c_object_pointer::
|
2271
|
+
# :obj_c_object_pointer ::
|
2151
2272
|
#
|
2152
|
-
# :function_no_proto::
|
2273
|
+
# :function_no_proto ::
|
2153
2274
|
#
|
2154
|
-
# :function_proto::
|
2275
|
+
# :function_proto ::
|
2155
2276
|
#
|
2156
|
-
# :constant_array::
|
2277
|
+
# :constant_array ::
|
2157
2278
|
#
|
2158
2279
|
#
|
2159
|
-
# @return [Array
|
2280
|
+
# @return [Array<Symbol>]
|
2160
2281
|
def self.type_kind_enum
|
2161
2282
|
[:invalid, :unexposed, :void, :bool, :char_u, :u_char, :char16, :char32, :u_short, :u_int, :u_long, :u_long_long, :u_int128, :char_s, :s_char, :w_char, :short, :int, :long, :long_long, :int128, :float, :double, :long_double, :null_ptr, :overload, :dependent, :obj_c_id, :obj_c_class, :obj_c_sel, :complex, :pointer, :block_pointer, :l_value_reference, :r_value_reference, :record, :enum, :typedef, :obj_c_interface, :obj_c_object_pointer, :function_no_proto, :function_proto, :constant_array]
|
2162
2283
|
end
|
@@ -2206,6 +2327,14 @@ module Clang
|
|
2206
2327
|
:constant_array, 112
|
2207
2328
|
]
|
2208
2329
|
|
2330
|
+
# The type of an element in the abstract syntax tree.
|
2331
|
+
#
|
2332
|
+
# = Fields:
|
2333
|
+
# :kind ::
|
2334
|
+
# (Symbol from type_kind_enum)
|
2335
|
+
# :data ::
|
2336
|
+
# (Array<FFI::Pointer(*Void)>)
|
2337
|
+
#
|
2209
2338
|
class Type < FFI::Struct
|
2210
2339
|
layout :kind, :type_kind,
|
2211
2340
|
:data, [:pointer, 2]
|
@@ -2360,16 +2489,16 @@ module Clang
|
|
2360
2489
|
# cursor with kind CX_CXXBaseSpecifier.
|
2361
2490
|
#
|
2362
2491
|
# === Options:
|
2363
|
-
# :x_invalid_access_specifier::
|
2492
|
+
# :x_invalid_access_specifier ::
|
2364
2493
|
#
|
2365
|
-
# :x_public::
|
2494
|
+
# :x_public ::
|
2366
2495
|
#
|
2367
|
-
# :x_protected::
|
2496
|
+
# :x_protected ::
|
2368
2497
|
#
|
2369
|
-
# :x_private::
|
2498
|
+
# :x_private ::
|
2370
2499
|
#
|
2371
2500
|
#
|
2372
|
-
# @return [Array
|
2501
|
+
# @return [Array<Symbol>]
|
2373
2502
|
def self.cxx_access_specifier_enum
|
2374
2503
|
[:x_invalid_access_specifier, :x_public, :x_protected, :x_private]
|
2375
2504
|
end
|
@@ -2430,16 +2559,16 @@ module Clang
|
|
2430
2559
|
# \c CXCursorVisitor to indicate how clang_visitChildren() proceed.
|
2431
2560
|
#
|
2432
2561
|
# === Options:
|
2433
|
-
# :break::
|
2562
|
+
# :break ::
|
2434
2563
|
# Terminates the cursor traversal.
|
2435
|
-
# :continue::
|
2564
|
+
# :continue ::
|
2436
2565
|
# Continues the cursor traversal with the next sibling of
|
2437
2566
|
# the cursor just visited, without visiting its children.
|
2438
|
-
# :recurse::
|
2567
|
+
# :recurse ::
|
2439
2568
|
# Recursively traverse the children of this cursor, using
|
2440
2569
|
# the same visitor and client data.
|
2441
2570
|
#
|
2442
|
-
# @return [Array
|
2571
|
+
# @return [Array<Symbol>]
|
2443
2572
|
def self.child_visit_result_enum
|
2444
2573
|
[:break, :continue, :recurse]
|
2445
2574
|
end
|
@@ -2449,6 +2578,25 @@ module Clang
|
|
2449
2578
|
:recurse
|
2450
2579
|
]
|
2451
2580
|
|
2581
|
+
# <em>This is no real method. This entry is only for documentation of the callback.</em>
|
2582
|
+
#
|
2583
|
+
# Visitor invoked for each cursor found by a traversal.
|
2584
|
+
#
|
2585
|
+
# This visitor function will be invoked for each cursor found by
|
2586
|
+
# clang_visitCursorChildren(). Its first argument is the cursor being
|
2587
|
+
# visited, its second argument is the parent visitor for that cursor,
|
2588
|
+
# and its third argument is the client data provided to
|
2589
|
+
# clang_visitCursorChildren().
|
2590
|
+
#
|
2591
|
+
# The visitor should return one of the \c CXChildVisitResult values
|
2592
|
+
# to direct clang_visitCursorChildren().
|
2593
|
+
#
|
2594
|
+
# @method cursor_visitor_callback(cursor, parent, client_data)
|
2595
|
+
# @param [Cursor] cursor
|
2596
|
+
# @param [Cursor] parent
|
2597
|
+
# @param [FFI::Pointer(ClientData)] client_data
|
2598
|
+
# @return [Symbol from child_visit_result_enum]
|
2599
|
+
# @scope class
|
2452
2600
|
callback :cursor_visitor, [Cursor.by_value, Cursor.by_value, :pointer], :child_visit_result
|
2453
2601
|
|
2454
2602
|
# Visit the children of a particular cursor.
|
@@ -2463,9 +2611,9 @@ module Clang
|
|
2463
2611
|
# @param [Cursor] parent the cursor whose child may be visited. All kinds of
|
2464
2612
|
# cursors can be visited, including invalid cursors (which, by
|
2465
2613
|
# definition, have no children).
|
2466
|
-
# @param [
|
2614
|
+
# @param [Proc(cursor_visitor_callback)] visitor the visitor function that will be invoked for each
|
2467
2615
|
# child of \p parent.
|
2468
|
-
# @param [FFI::Pointer
|
2616
|
+
# @param [FFI::Pointer(ClientData)] client_data pointer data supplied by the client, which will
|
2469
2617
|
# be passed to the visitor each time it is invoked.
|
2470
2618
|
# @return [Integer] a non-zero value if the traversal was terminated
|
2471
2619
|
# prematurely by the visitor returning \c CXChildVisit_Break.
|
@@ -2732,14 +2880,16 @@ module Clang
|
|
2732
2880
|
# @scope class
|
2733
2881
|
attach_function :get_cursor_reference_name_range, :clang_getCursorReferenceNameRange, [Cursor.by_value, :uint, :uint], SourceRange.by_value
|
2734
2882
|
|
2883
|
+
# (Not documented)
|
2884
|
+
#
|
2735
2885
|
# === Options:
|
2736
|
-
# :want_qualifier::
|
2886
|
+
# :want_qualifier ::
|
2737
2887
|
# Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the
|
2738
2888
|
# range.
|
2739
|
-
# :want_template_args::
|
2889
|
+
# :want_template_args ::
|
2740
2890
|
# Include the explicit template arguments, e.g. <int> in x.f<int>, in
|
2741
2891
|
# the range.
|
2742
|
-
# :want_single_piece::
|
2892
|
+
# :want_single_piece ::
|
2743
2893
|
# If the name is non-contiguous, return the full spanning range.
|
2744
2894
|
#
|
2745
2895
|
# Non-contiguous names occur in Objective-C when a selector with two or more
|
@@ -2749,7 +2899,7 @@ module Clang
|
|
2749
2899
|
# return some_vector(1); // C++
|
2750
2900
|
# \endcode
|
2751
2901
|
#
|
2752
|
-
# @return [Array
|
2902
|
+
# @return [Array<Symbol>]
|
2753
2903
|
def self.name_ref_flags_enum
|
2754
2904
|
[:want_qualifier, :want_template_args, :want_single_piece]
|
2755
2905
|
end
|
@@ -2762,18 +2912,18 @@ module Clang
|
|
2762
2912
|
# Describes a kind of token.
|
2763
2913
|
#
|
2764
2914
|
# === Options:
|
2765
|
-
# :punctuation::
|
2915
|
+
# :punctuation ::
|
2766
2916
|
# A token that contains some kind of punctuation.
|
2767
|
-
# :keyword::
|
2917
|
+
# :keyword ::
|
2768
2918
|
# A language keyword.
|
2769
|
-
# :identifier::
|
2919
|
+
# :identifier ::
|
2770
2920
|
# An identifier (that is not a keyword).
|
2771
|
-
# :literal::
|
2921
|
+
# :literal ::
|
2772
2922
|
# A numeric, string, or character literal.
|
2773
|
-
# :comment::
|
2923
|
+
# :comment ::
|
2774
2924
|
# A comment.
|
2775
2925
|
#
|
2776
|
-
# @return [Array
|
2926
|
+
# @return [Array<Symbol>]
|
2777
2927
|
def self.token_kind_enum
|
2778
2928
|
[:punctuation, :keyword, :identifier, :literal, :comment]
|
2779
2929
|
end
|
@@ -2785,6 +2935,14 @@ module Clang
|
|
2785
2935
|
:comment
|
2786
2936
|
]
|
2787
2937
|
|
2938
|
+
# Describes a single preprocessing token.
|
2939
|
+
#
|
2940
|
+
# = Fields:
|
2941
|
+
# :int_data ::
|
2942
|
+
# (Array<Integer>)
|
2943
|
+
# :ptr_data ::
|
2944
|
+
# (FFI::Pointer(*Void))
|
2945
|
+
#
|
2788
2946
|
class Token < FFI::Struct
|
2789
2947
|
layout :int_data, [:uint, 4],
|
2790
2948
|
:ptr_data, :pointer
|
@@ -2804,7 +2962,7 @@ module Clang
|
|
2804
2962
|
# the text of an identifier or keyword.
|
2805
2963
|
#
|
2806
2964
|
# @method get_token_spelling(translation_unit, token)
|
2807
|
-
# @param [FFI::Pointer
|
2965
|
+
# @param [FFI::Pointer(TranslationUnit)] translation_unit
|
2808
2966
|
# @param [Token] token
|
2809
2967
|
# @return [String]
|
2810
2968
|
# @scope class
|
@@ -2813,7 +2971,7 @@ module Clang
|
|
2813
2971
|
# Retrieve the source location of the given token.
|
2814
2972
|
#
|
2815
2973
|
# @method get_token_location(translation_unit, token)
|
2816
|
-
# @param [FFI::Pointer
|
2974
|
+
# @param [FFI::Pointer(TranslationUnit)] translation_unit
|
2817
2975
|
# @param [Token] token
|
2818
2976
|
# @return [SourceLocation]
|
2819
2977
|
# @scope class
|
@@ -2822,7 +2980,7 @@ module Clang
|
|
2822
2980
|
# Retrieve a source range that covers the given token.
|
2823
2981
|
#
|
2824
2982
|
# @method get_token_extent(translation_unit, token)
|
2825
|
-
# @param [FFI::Pointer
|
2983
|
+
# @param [FFI::Pointer(TranslationUnit)] translation_unit
|
2826
2984
|
# @param [Token] token
|
2827
2985
|
# @return [SourceRange]
|
2828
2986
|
# @scope class
|
@@ -2832,13 +2990,13 @@ module Clang
|
|
2832
2990
|
# lexical tokens.
|
2833
2991
|
#
|
2834
2992
|
# @method tokenize(tu, range, tokens, num_tokens)
|
2835
|
-
# @param [FFI::Pointer
|
2993
|
+
# @param [FFI::Pointer(TranslationUnit)] tu the translation unit whose text is being tokenized.
|
2836
2994
|
# @param [SourceRange] range the source range in which text should be tokenized. All of the
|
2837
2995
|
# tokens produced by tokenization will fall within this source range,
|
2838
|
-
# @param [FFI::Pointer
|
2996
|
+
# @param [FFI::Pointer(**Token)] tokens this pointer will be set to point to the array of tokens
|
2839
2997
|
# that occur within the given source range. The returned pointer must be
|
2840
2998
|
# freed with clang_disposeTokens() before the translation unit is destroyed.
|
2841
|
-
# @param [FFI::Pointer
|
2999
|
+
# @param [FFI::Pointer(*UInt)] num_tokens will be set to the number of tokens in the \c *Tokens
|
2842
3000
|
# array.
|
2843
3001
|
# @return [nil]
|
2844
3002
|
# @scope class
|
@@ -2865,10 +3023,10 @@ module Clang
|
|
2865
3023
|
# not provided as an annotation.
|
2866
3024
|
#
|
2867
3025
|
# @method annotate_tokens(tu, tokens, num_tokens, cursors)
|
2868
|
-
# @param [FFI::Pointer
|
2869
|
-
# @param [FFI::Pointer
|
3026
|
+
# @param [FFI::Pointer(TranslationUnit)] tu the translation unit that owns the given tokens.
|
3027
|
+
# @param [FFI::Pointer(*Token)] tokens the set of tokens to annotate.
|
2870
3028
|
# @param [Integer] num_tokens the number of tokens in \p Tokens.
|
2871
|
-
# @param [FFI::Pointer
|
3029
|
+
# @param [FFI::Pointer(*Cursor)] cursors an array of \p NumTokens cursors, whose contents will be
|
2872
3030
|
# replaced with the cursors corresponding to each token.
|
2873
3031
|
# @return [nil]
|
2874
3032
|
# @scope class
|
@@ -2877,8 +3035,8 @@ module Clang
|
|
2877
3035
|
# Free the given set of tokens.
|
2878
3036
|
#
|
2879
3037
|
# @method dispose_tokens(tu, tokens, num_tokens)
|
2880
|
-
# @param [FFI::Pointer
|
2881
|
-
# @param [FFI::Pointer
|
3038
|
+
# @param [FFI::Pointer(TranslationUnit)] tu
|
3039
|
+
# @param [FFI::Pointer(*Token)] tokens
|
2882
3040
|
# @param [Integer] num_tokens
|
2883
3041
|
# @return [nil]
|
2884
3042
|
# @scope class
|
@@ -2892,31 +3050,53 @@ module Clang
|
|
2892
3050
|
# @scope class
|
2893
3051
|
attach_function :get_cursor_kind_spelling, :clang_getCursorKindSpelling, [:cursor_kind], String.by_value
|
2894
3052
|
|
3053
|
+
# (Not documented)
|
3054
|
+
#
|
2895
3055
|
# @method get_definition_spelling_and_extent(cursor, start_buf, end_buf, start_line, start_column, end_line, end_column)
|
2896
3056
|
# @param [Cursor] cursor
|
2897
|
-
# @param [FFI::Pointer
|
2898
|
-
# @param [FFI::Pointer
|
2899
|
-
# @param [FFI::Pointer
|
2900
|
-
# @param [FFI::Pointer
|
2901
|
-
# @param [FFI::Pointer
|
2902
|
-
# @param [FFI::Pointer
|
3057
|
+
# @param [FFI::Pointer(**Char_S)] start_buf
|
3058
|
+
# @param [FFI::Pointer(**Char_S)] end_buf
|
3059
|
+
# @param [FFI::Pointer(*UInt)] start_line
|
3060
|
+
# @param [FFI::Pointer(*UInt)] start_column
|
3061
|
+
# @param [FFI::Pointer(*UInt)] end_line
|
3062
|
+
# @param [FFI::Pointer(*UInt)] end_column
|
2903
3063
|
# @return [nil]
|
2904
3064
|
# @scope class
|
2905
3065
|
attach_function :get_definition_spelling_and_extent, :clang_getDefinitionSpellingAndExtent, [Cursor.by_value, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer], :void
|
2906
3066
|
|
3067
|
+
# (Not documented)
|
3068
|
+
#
|
2907
3069
|
# @method enable_stack_traces()
|
2908
3070
|
# @return [nil]
|
2909
3071
|
# @scope class
|
2910
3072
|
attach_function :enable_stack_traces, :clang_enableStackTraces, [], :void
|
2911
3073
|
|
3074
|
+
# (Not documented)
|
3075
|
+
#
|
2912
3076
|
# @method execute_on_thread(fn, user_data, stack_size)
|
2913
|
-
# @param [FFI::Pointer
|
2914
|
-
# @param [FFI::Pointer
|
3077
|
+
# @param [FFI::Pointer(*)] fn
|
3078
|
+
# @param [FFI::Pointer(*Void)] user_data
|
2915
3079
|
# @param [Integer] stack_size
|
2916
3080
|
# @return [nil]
|
2917
3081
|
# @scope class
|
2918
3082
|
attach_function :execute_on_thread, :clang_executeOnThread, [:pointer, :pointer, :uint], :void
|
2919
3083
|
|
3084
|
+
# A single result of code completion.
|
3085
|
+
#
|
3086
|
+
# = Fields:
|
3087
|
+
# :cursor_kind ::
|
3088
|
+
# (Symbol from cursor_kind_enum) The kind of entity that this completion refers to.
|
3089
|
+
#
|
3090
|
+
# The cursor kind will be a macro, keyword, or a declaration (one of the
|
3091
|
+
# *Decl cursor kinds), describing the entity that the completion is
|
3092
|
+
# referring to.
|
3093
|
+
#
|
3094
|
+
# \todo In the future, we would like to provide a full cursor, to allow
|
3095
|
+
# the client to extract additional information from declaration.
|
3096
|
+
# :completion_string ::
|
3097
|
+
# (FFI::Pointer(CompletionString)) The code-completion string that describes how to insert this
|
3098
|
+
# code-completion result into the editing buffer.
|
3099
|
+
#
|
2920
3100
|
class CompletionResult < FFI::Struct
|
2921
3101
|
layout :cursor_kind, :cursor_kind,
|
2922
3102
|
:completion_string, :pointer
|
@@ -2929,7 +3109,7 @@ module Clang
|
|
2929
3109
|
# should be interpreted by the client or is another completion string.
|
2930
3110
|
#
|
2931
3111
|
# === Options:
|
2932
|
-
# :optional::
|
3112
|
+
# :optional ::
|
2933
3113
|
# A code-completion string that describes "optional" text that
|
2934
3114
|
# could be a part of the template (but is not required).
|
2935
3115
|
#
|
@@ -2961,7 +3141,7 @@ module Clang
|
|
2961
3141
|
# function "f" would only include the first parameter ("int x").
|
2962
3142
|
# - Fully expand all optional chunks, in which case the template for the
|
2963
3143
|
# function "f" would have all of the parameters.
|
2964
|
-
# :typed_text::
|
3144
|
+
# :typed_text ::
|
2965
3145
|
# Text that a user would be expected to type to get this
|
2966
3146
|
# code-completion result.
|
2967
3147
|
#
|
@@ -2970,13 +3150,13 @@ module Clang
|
|
2970
3150
|
# declaration that could be used at the current code point. Clients are
|
2971
3151
|
# expected to filter the code-completion results based on the text in this
|
2972
3152
|
# chunk.
|
2973
|
-
# :text::
|
3153
|
+
# :text ::
|
2974
3154
|
# Text that should be inserted as part of a code-completion result.
|
2975
3155
|
#
|
2976
3156
|
# A "text" chunk represents text that is part of the template to be
|
2977
3157
|
# inserted into user code should this particular code-completion result
|
2978
3158
|
# be selected.
|
2979
|
-
# :placeholder::
|
3159
|
+
# :placeholder ::
|
2980
3160
|
# Placeholder text that should be replaced by the user.
|
2981
3161
|
#
|
2982
3162
|
# A "placeholder" chunk marks a place where the user should insert text
|
@@ -2985,7 +3165,7 @@ module Clang
|
|
2985
3165
|
# user should provide arguments for each of those parameters. The actual
|
2986
3166
|
# text in a placeholder is a suggestion for the text to display before
|
2987
3167
|
# the user replaces the placeholder with real code.
|
2988
|
-
# :informative::
|
3168
|
+
# :informative ::
|
2989
3169
|
# Informative text that should be displayed but never inserted as
|
2990
3170
|
# part of the template.
|
2991
3171
|
#
|
@@ -2993,7 +3173,7 @@ module Clang
|
|
2993
3173
|
# help the user decide whether a particular code-completion result is the
|
2994
3174
|
# right option, but which is not part of the actual template to be inserted
|
2995
3175
|
# by code completion.
|
2996
|
-
# :current_parameter::
|
3176
|
+
# :current_parameter ::
|
2997
3177
|
# Text that describes the current parameter when code-completion is
|
2998
3178
|
# referring to function call, message send, or template specialization.
|
2999
3179
|
#
|
@@ -3011,45 +3191,45 @@ module Clang
|
|
3011
3191
|
# parameter. After typing further, to \c add(17, (where the code-completion
|
3012
3192
|
# point is after the ","), the code-completion string will contain a
|
3013
3193
|
# "current paremeter" chunk to "int y".
|
3014
|
-
# :left_paren::
|
3194
|
+
# :left_paren ::
|
3015
3195
|
# A left parenthesis ('('), used to initiate a function call or
|
3016
3196
|
# signal the beginning of a function parameter list.
|
3017
|
-
# :right_paren::
|
3197
|
+
# :right_paren ::
|
3018
3198
|
# A right parenthesis (')'), used to finish a function call or
|
3019
3199
|
# signal the end of a function parameter list.
|
3020
|
-
# :left_bracket::
|
3200
|
+
# :left_bracket ::
|
3021
3201
|
# A left bracket ('(').
|
3022
|
-
# :right_bracket::
|
3202
|
+
# :right_bracket ::
|
3023
3203
|
# A right bracket (')').
|
3024
|
-
# :left_brace::
|
3204
|
+
# :left_brace ::
|
3025
3205
|
# A left brace ('{').
|
3026
|
-
# :right_brace::
|
3206
|
+
# :right_brace ::
|
3027
3207
|
# A right brace ('}').
|
3028
|
-
# :left_angle::
|
3208
|
+
# :left_angle ::
|
3029
3209
|
# A left angle bracket ('<').
|
3030
|
-
# :right_angle::
|
3210
|
+
# :right_angle ::
|
3031
3211
|
# A right angle bracket ('>').
|
3032
|
-
# :comma::
|
3212
|
+
# :comma ::
|
3033
3213
|
# A comma separator (',').
|
3034
|
-
# :result_type::
|
3214
|
+
# :result_type ::
|
3035
3215
|
# Text that specifies the result type of a given result.
|
3036
3216
|
#
|
3037
3217
|
# This special kind of informative chunk is not meant to be inserted into
|
3038
3218
|
# the text buffer. Rather, it is meant to illustrate the type that an
|
3039
3219
|
# expression using the given completion string would have.
|
3040
|
-
# :colon::
|
3220
|
+
# :colon ::
|
3041
3221
|
# A colon (':').
|
3042
|
-
# :semi_colon::
|
3222
|
+
# :semi_colon ::
|
3043
3223
|
# A semicolon (';').
|
3044
|
-
# :equal::
|
3224
|
+
# :equal ::
|
3045
3225
|
# An '=' sign.
|
3046
|
-
# :horizontal_space::
|
3226
|
+
# :horizontal_space ::
|
3047
3227
|
# Horizontal space (' ').
|
3048
|
-
# :vertical_space::
|
3228
|
+
# :vertical_space ::
|
3049
3229
|
# Vertical space ('\n'), after which it is generally a good idea to
|
3050
3230
|
# perform indentation.
|
3051
3231
|
#
|
3052
|
-
# @return [Array
|
3232
|
+
# @return [Array<Symbol>]
|
3053
3233
|
def self.completion_chunk_kind_enum
|
3054
3234
|
[:optional, :typed_text, :text, :placeholder, :informative, :current_parameter, :left_paren, :right_paren, :left_bracket, :right_bracket, :left_brace, :right_brace, :left_angle, :right_angle, :comma, :result_type, :colon, :semi_colon, :equal, :horizontal_space, :vertical_space]
|
3055
3235
|
end
|
@@ -3080,7 +3260,7 @@ module Clang
|
|
3080
3260
|
# Determine the kind of a particular chunk within a completion string.
|
3081
3261
|
#
|
3082
3262
|
# @method get_completion_chunk_kind(completion_string, chunk_number)
|
3083
|
-
# @param [FFI::Pointer
|
3263
|
+
# @param [FFI::Pointer(CompletionString)] completion_string the completion string to query.
|
3084
3264
|
# @param [Integer] chunk_number the 0-based index of the chunk in the completion string.
|
3085
3265
|
# @return [Symbol from completion_chunk_kind_enum] the kind of the chunk at the index \c chunk_number.
|
3086
3266
|
# @scope class
|
@@ -3090,7 +3270,7 @@ module Clang
|
|
3090
3270
|
# completion string.
|
3091
3271
|
#
|
3092
3272
|
# @method get_completion_chunk_text(completion_string, chunk_number)
|
3093
|
-
# @param [FFI::Pointer
|
3273
|
+
# @param [FFI::Pointer(CompletionString)] completion_string the completion string to query.
|
3094
3274
|
# @param [Integer] chunk_number the 0-based index of the chunk in the completion string.
|
3095
3275
|
# @return [String] the text associated with the chunk at index \c chunk_number.
|
3096
3276
|
# @scope class
|
@@ -3100,9 +3280,9 @@ module Clang
|
|
3100
3280
|
# within a completion string.
|
3101
3281
|
#
|
3102
3282
|
# @method get_completion_chunk_completion_string(completion_string, chunk_number)
|
3103
|
-
# @param [FFI::Pointer
|
3283
|
+
# @param [FFI::Pointer(CompletionString)] completion_string the completion string to query.
|
3104
3284
|
# @param [Integer] chunk_number the 0-based index of the chunk in the completion string.
|
3105
|
-
# @return [FFI::Pointer
|
3285
|
+
# @return [FFI::Pointer(CompletionString)] the completion string associated with the chunk at index
|
3106
3286
|
# \c chunk_number.
|
3107
3287
|
# @scope class
|
3108
3288
|
attach_function :get_completion_chunk_completion_string, :clang_getCompletionChunkCompletionString, [:pointer, :uint], :pointer
|
@@ -3110,7 +3290,7 @@ module Clang
|
|
3110
3290
|
# Retrieve the number of chunks in the given code-completion string.
|
3111
3291
|
#
|
3112
3292
|
# @method get_num_completion_chunks(completion_string)
|
3113
|
-
# @param [FFI::Pointer
|
3293
|
+
# @param [FFI::Pointer(CompletionString)] completion_string
|
3114
3294
|
# @return [Integer]
|
3115
3295
|
# @scope class
|
3116
3296
|
attach_function :get_num_completion_chunks, :clang_getNumCompletionChunks, [:pointer], :uint
|
@@ -3122,7 +3302,7 @@ module Clang
|
|
3122
3302
|
# priority is selected by various internal heuristics.
|
3123
3303
|
#
|
3124
3304
|
# @method get_completion_priority(completion_string)
|
3125
|
-
# @param [FFI::Pointer
|
3305
|
+
# @param [FFI::Pointer(CompletionString)] completion_string The completion string to query.
|
3126
3306
|
# @return [Integer] The priority of this completion string. Smaller values indicate
|
3127
3307
|
# higher-priority (more likely) completions.
|
3128
3308
|
# @scope class
|
@@ -3132,7 +3312,7 @@ module Clang
|
|
3132
3312
|
# string refers to.
|
3133
3313
|
#
|
3134
3314
|
# @method get_completion_availability(completion_string)
|
3135
|
-
# @param [FFI::Pointer
|
3315
|
+
# @param [FFI::Pointer(CompletionString)] completion_string The completion string to query.
|
3136
3316
|
# @return [Symbol from availability_kind_enum] The availability of the completion string.
|
3137
3317
|
# @scope class
|
3138
3318
|
attach_function :get_completion_availability, :clang_getCompletionAvailability, [:pointer], :availability_kind
|
@@ -3141,7 +3321,7 @@ module Clang
|
|
3141
3321
|
# completion string.
|
3142
3322
|
#
|
3143
3323
|
# @method get_completion_num_annotations(completion_string)
|
3144
|
-
# @param [FFI::Pointer
|
3324
|
+
# @param [FFI::Pointer(CompletionString)] completion_string the completion string to query.
|
3145
3325
|
# @return [Integer] the number of annotations associated with the given completion
|
3146
3326
|
# string.
|
3147
3327
|
# @scope class
|
@@ -3150,7 +3330,7 @@ module Clang
|
|
3150
3330
|
# Retrieve the annotation associated with the given completion string.
|
3151
3331
|
#
|
3152
3332
|
# @method get_completion_annotation(completion_string, annotation_number)
|
3153
|
-
# @param [FFI::Pointer
|
3333
|
+
# @param [FFI::Pointer(CompletionString)] completion_string the completion string to query.
|
3154
3334
|
# @param [Integer] annotation_number the 0-based index of the annotation of the
|
3155
3335
|
# completion string.
|
3156
3336
|
# @return [String] annotation string associated with the completion at index
|
@@ -3163,11 +3343,24 @@ module Clang
|
|
3163
3343
|
#
|
3164
3344
|
# @method get_cursor_completion_string(cursor)
|
3165
3345
|
# @param [Cursor] cursor The cursor to query.
|
3166
|
-
# @return [FFI::Pointer
|
3346
|
+
# @return [FFI::Pointer(CompletionString)] A non-context-sensitive completion string for declaration and macro
|
3167
3347
|
# definition cursors, or NULL for other kinds of cursors.
|
3168
3348
|
# @scope class
|
3169
3349
|
attach_function :get_cursor_completion_string, :clang_getCursorCompletionString, [Cursor.by_value], :pointer
|
3170
3350
|
|
3351
|
+
# Contains the results of code-completion.
|
3352
|
+
#
|
3353
|
+
# This data structure contains the results of code completion, as
|
3354
|
+
# produced by \c clang_codeCompleteAt(). Its contents must be freed by
|
3355
|
+
# \c clang_disposeCodeCompleteResults.
|
3356
|
+
#
|
3357
|
+
# = Fields:
|
3358
|
+
# :results ::
|
3359
|
+
# (FFI::Pointer(*CompletionResult)) The code-completion results.
|
3360
|
+
# :num_results ::
|
3361
|
+
# (Integer) The number of code-completion results stored in the
|
3362
|
+
# \c Results array.
|
3363
|
+
#
|
3171
3364
|
class CodeCompleteResults < FFI::Struct
|
3172
3365
|
layout :results, :pointer,
|
3173
3366
|
:num_results, :uint
|
@@ -3180,14 +3373,14 @@ module Clang
|
|
3180
3373
|
# provide multiple options to \c clang_codeCompleteAt().
|
3181
3374
|
#
|
3182
3375
|
# === Options:
|
3183
|
-
# :include_macros::
|
3376
|
+
# :include_macros ::
|
3184
3377
|
# Whether to include macros within the set of code
|
3185
3378
|
# completions returned.
|
3186
|
-
# :include_code_patterns::
|
3379
|
+
# :include_code_patterns ::
|
3187
3380
|
# Whether to include code patterns for language constructs
|
3188
3381
|
# within the set of code completions, e.g., for loops.
|
3189
3382
|
#
|
3190
|
-
# @return [Array
|
3383
|
+
# @return [Array<Symbol>]
|
3191
3384
|
def self.code_complete_flags_enum
|
3192
3385
|
[:include_macros, :include_code_patterns]
|
3193
3386
|
end
|
@@ -3202,11 +3395,11 @@ module Clang
|
|
3202
3395
|
# contexts are occurring simultaneously.
|
3203
3396
|
#
|
3204
3397
|
# === Options:
|
3205
|
-
# :completion_context_unexposed::
|
3398
|
+
# :completion_context_unexposed ::
|
3206
3399
|
# The context for completions is unexposed, as only Clang results
|
3207
3400
|
# should be included. (This is equivalent to having no context bits set.)
|
3208
3401
|
#
|
3209
|
-
# @return [Array
|
3402
|
+
# @return [Array<Symbol>]
|
3210
3403
|
def self.completion_context_enum
|
3211
3404
|
[:completion_context_unexposed]
|
3212
3405
|
end
|
@@ -3253,7 +3446,7 @@ module Clang
|
|
3253
3446
|
# have a lower latency.
|
3254
3447
|
#
|
3255
3448
|
# @method code_complete_at(tu, complete_filename, complete_line, complete_column, unsaved_files, num_unsaved_files, options)
|
3256
|
-
# @param [FFI::Pointer
|
3449
|
+
# @param [FFI::Pointer(TranslationUnit)] tu The translation unit in which code-completion should
|
3257
3450
|
# occur. The source files for this translation unit need not be
|
3258
3451
|
# completely up-to-date (and the contents of those source files may
|
3259
3452
|
# be overridden via \p unsaved_files). Cursors referring into the
|
@@ -3265,7 +3458,7 @@ module Clang
|
|
3265
3458
|
# @param [Integer] complete_column The column at which code-completion should occur.
|
3266
3459
|
# Note that the column should point just after the syntactic construct that
|
3267
3460
|
# initiated code completion, and not in the middle of a lexical token.
|
3268
|
-
# @param [FFI::Pointer
|
3461
|
+
# @param [FFI::Pointer(*UnsavedFile)] unsaved_files the Tiles that have not yet been saved to disk
|
3269
3462
|
# but may be required for parsing or code completion, including the
|
3270
3463
|
# contents of those files. The contents and name of these files (as
|
3271
3464
|
# specified by CXUnsavedFile) are copied when necessary, so the
|
@@ -3278,7 +3471,7 @@ module Clang
|
|
3278
3471
|
# CXCodeComplete_Flags enumeration. The
|
3279
3472
|
# \c clang_defaultCodeCompleteOptions() function returns a default set
|
3280
3473
|
# of code-completion options.
|
3281
|
-
# @return [FFI::Pointer
|
3474
|
+
# @return [FFI::Pointer(*CodeCompleteResults)] If successful, a new \c CXCodeCompleteResults structure
|
3282
3475
|
# containing code-completion results, which should eventually be
|
3283
3476
|
# freed with \c clang_disposeCodeCompleteResults(). If code
|
3284
3477
|
# completion fails, returns NULL.
|
@@ -3289,7 +3482,7 @@ module Clang
|
|
3289
3482
|
# order.
|
3290
3483
|
#
|
3291
3484
|
# @method sort_code_completion_results(results, num_results)
|
3292
|
-
# @param [FFI::Pointer
|
3485
|
+
# @param [FFI::Pointer(*CompletionResult)] results The set of results to sort.
|
3293
3486
|
# @param [Integer] num_results The number of results in \p Results.
|
3294
3487
|
# @return [nil]
|
3295
3488
|
# @scope class
|
@@ -3298,7 +3491,7 @@ module Clang
|
|
3298
3491
|
# Free the given set of code-completion results.
|
3299
3492
|
#
|
3300
3493
|
# @method dispose_code_complete_results(results)
|
3301
|
-
# @param [FFI::Pointer
|
3494
|
+
# @param [FFI::Pointer(*CodeCompleteResults)] results
|
3302
3495
|
# @return [nil]
|
3303
3496
|
# @scope class
|
3304
3497
|
attach_function :dispose_code_complete_results, :clang_disposeCodeCompleteResults, [:pointer], :void
|
@@ -3307,7 +3500,7 @@ module Clang
|
|
3307
3500
|
# location where code completion was performed.
|
3308
3501
|
#
|
3309
3502
|
# @method code_complete_get_num_diagnostics(results)
|
3310
|
-
# @param [FFI::Pointer
|
3503
|
+
# @param [FFI::Pointer(*CodeCompleteResults)] results
|
3311
3504
|
# @return [Integer]
|
3312
3505
|
# @scope class
|
3313
3506
|
attach_function :code_complete_get_num_diagnostics, :clang_codeCompleteGetNumDiagnostics, [:pointer], :uint
|
@@ -3318,9 +3511,9 @@ module Clang
|
|
3318
3511
|
# the code completion results to query.
|
3319
3512
|
#
|
3320
3513
|
# @method code_complete_get_diagnostic(results, index)
|
3321
|
-
# @param [FFI::Pointer
|
3514
|
+
# @param [FFI::Pointer(*CodeCompleteResults)] results
|
3322
3515
|
# @param [Integer] index the zero-based diagnostic number to retrieve.
|
3323
|
-
# @return [FFI::Pointer
|
3516
|
+
# @return [FFI::Pointer(Diagnostic)] the requested diagnostic. This diagnostic must be freed
|
3324
3517
|
# via a call to \c clang_disposeDiagnostic().
|
3325
3518
|
# @scope class
|
3326
3519
|
attach_function :code_complete_get_diagnostic, :clang_codeCompleteGetDiagnostic, [:pointer, :uint], :pointer
|
@@ -3329,7 +3522,7 @@ module Clang
|
|
3329
3522
|
# the given code completion.
|
3330
3523
|
#
|
3331
3524
|
# @method code_complete_get_contexts(results)
|
3332
|
-
# @param [FFI::Pointer
|
3525
|
+
# @param [FFI::Pointer(*CodeCompleteResults)] results the code completion results to query
|
3333
3526
|
# @return [Integer] the kinds of completions that are appropriate for use
|
3334
3527
|
# along with the given code completion results.
|
3335
3528
|
# @scope class
|
@@ -3342,8 +3535,8 @@ module Clang
|
|
3342
3535
|
# CXCursor_InvalidCode.
|
3343
3536
|
#
|
3344
3537
|
# @method code_complete_get_container_kind(results, is_incomplete)
|
3345
|
-
# @param [FFI::Pointer
|
3346
|
-
# @param [FFI::Pointer
|
3538
|
+
# @param [FFI::Pointer(*CodeCompleteResults)] results the code completion results to query
|
3539
|
+
# @param [FFI::Pointer(*UInt)] is_incomplete on return, this value will be false if Clang has complete
|
3347
3540
|
# information about the container. If Clang does not have complete
|
3348
3541
|
# information, this value will be true.
|
3349
3542
|
# @return [Symbol from cursor_kind_enum] the container kind, or CXCursor_InvalidCode if there is not a
|
@@ -3356,7 +3549,7 @@ module Clang
|
|
3356
3549
|
# function will return the empty string.
|
3357
3550
|
#
|
3358
3551
|
# @method code_complete_get_container_usr(results)
|
3359
|
-
# @param [FFI::Pointer
|
3552
|
+
# @param [FFI::Pointer(*CodeCompleteResults)] results the code completion results to query
|
3360
3553
|
# @return [String] the USR for the container
|
3361
3554
|
# @scope class
|
3362
3555
|
attach_function :code_complete_get_container_usr, :clang_codeCompleteGetContainerUSR, [:pointer], String.by_value
|
@@ -3367,7 +3560,7 @@ module Clang
|
|
3367
3560
|
# CXCompletionContext_ObjCClassMessage.
|
3368
3561
|
#
|
3369
3562
|
# @method code_complete_get_obj_c_selector(results)
|
3370
|
-
# @param [FFI::Pointer
|
3563
|
+
# @param [FFI::Pointer(*CodeCompleteResults)] results the code completion results to query
|
3371
3564
|
# @return [String] the selector (or partial selector) that has been entered thus far
|
3372
3565
|
# for an Objective-C message send.
|
3373
3566
|
# @scope class
|
@@ -3393,6 +3586,24 @@ module Clang
|
|
3393
3586
|
# @scope class
|
3394
3587
|
attach_function :toggle_crash_recovery, :clang_toggleCrashRecovery, [:uint], :void
|
3395
3588
|
|
3589
|
+
# <em>This is no real method. This entry is only for documentation of the callback.</em>
|
3590
|
+
#
|
3591
|
+
# Visitor invoked for each file in a translation unit
|
3592
|
+
# (used with clang_getInclusions()).
|
3593
|
+
#
|
3594
|
+
# This visitor function will be invoked by clang_getInclusions() for each
|
3595
|
+
# file included (either at the top-level or by #include directives) within
|
3596
|
+
# a translation unit. The first argument is the file being included, and
|
3597
|
+
# the second and third arguments provide the inclusion stack. The
|
3598
|
+
# array is sorted in order of immediate inclusion. For example,
|
3599
|
+
# the first element refers to the location that included 'included_file'.
|
3600
|
+
#
|
3601
|
+
# @method inclusion_visitor_callback(inclusion_stack, include_len, client_data)
|
3602
|
+
# @param [FFI::Pointer(*SourceLocation)] inclusion_stack
|
3603
|
+
# @param [Integer] include_len
|
3604
|
+
# @param [FFI::Pointer(ClientData)] client_data
|
3605
|
+
# @return [FFI::Pointer(File)]
|
3606
|
+
# @scope class
|
3396
3607
|
callback :inclusion_visitor, [:pointer, :uint, :pointer], :pointer
|
3397
3608
|
|
3398
3609
|
# Visit the set of preprocessor inclusions in a translation unit.
|
@@ -3401,9 +3612,9 @@ module Clang
|
|
3401
3612
|
# is inspecting the inclusions in the PCH file itself).
|
3402
3613
|
#
|
3403
3614
|
# @method get_inclusions(tu, visitor, client_data)
|
3404
|
-
# @param [FFI::Pointer
|
3405
|
-
# @param [
|
3406
|
-
# @param [FFI::Pointer
|
3615
|
+
# @param [FFI::Pointer(TranslationUnit)] tu
|
3616
|
+
# @param [Proc(inclusion_visitor_callback)] visitor
|
3617
|
+
# @param [FFI::Pointer(ClientData)] client_data
|
3407
3618
|
# @return [nil]
|
3408
3619
|
# @scope class
|
3409
3620
|
attach_function :get_inclusions, :clang_getInclusions, [:pointer, :inclusion_visitor, :pointer], :void
|
@@ -3412,7 +3623,7 @@ module Clang
|
|
3412
3623
|
#
|
3413
3624
|
# @method get_remappings(path)
|
3414
3625
|
# @param [String] path the path that contains metadata about remappings.
|
3415
|
-
# @return [FFI::Pointer
|
3626
|
+
# @return [FFI::Pointer(Remapping)] the requested remapping. This remapping must be freed
|
3416
3627
|
# via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
|
3417
3628
|
# @scope class
|
3418
3629
|
attach_function :get_remappings, :clang_getRemappings, [:string], :pointer
|
@@ -3420,7 +3631,7 @@ module Clang
|
|
3420
3631
|
# Determine the number of remappings.
|
3421
3632
|
#
|
3422
3633
|
# @method remap_get_num_files(remapping)
|
3423
|
-
# @param [FFI::Pointer
|
3634
|
+
# @param [FFI::Pointer(Remapping)] remapping
|
3424
3635
|
# @return [Integer]
|
3425
3636
|
# @scope class
|
3426
3637
|
attach_function :remap_get_num_files, :clang_remap_getNumFiles, [:pointer], :uint
|
@@ -3428,10 +3639,10 @@ module Clang
|
|
3428
3639
|
# Get the original and the associated filename from the remapping.
|
3429
3640
|
#
|
3430
3641
|
# @method remap_get_filenames(remapping, index, original, transformed)
|
3431
|
-
# @param [FFI::Pointer
|
3642
|
+
# @param [FFI::Pointer(Remapping)] remapping
|
3432
3643
|
# @param [Integer] index
|
3433
|
-
# @param [FFI::Pointer
|
3434
|
-
# @param [FFI::Pointer
|
3644
|
+
# @param [FFI::Pointer(*String)] original If non-NULL, will be set to the original filename.
|
3645
|
+
# @param [FFI::Pointer(*String)] transformed If non-NULL, will be set to the filename that the original
|
3435
3646
|
# is associated with.
|
3436
3647
|
# @return [nil]
|
3437
3648
|
# @scope class
|
@@ -3440,7 +3651,7 @@ module Clang
|
|
3440
3651
|
# Dispose the remapping.
|
3441
3652
|
#
|
3442
3653
|
# @method remap_dispose(remapping)
|
3443
|
-
# @param [FFI::Pointer
|
3654
|
+
# @param [FFI::Pointer(Remapping)] remapping
|
3444
3655
|
# @return [nil]
|
3445
3656
|
# @scope class
|
3446
3657
|
attach_function :remap_dispose, :clang_remap_dispose, [:pointer], :void
|
@@ -3450,12 +3661,12 @@ module Clang
|
|
3450
3661
|
# @{
|
3451
3662
|
#
|
3452
3663
|
# === Options:
|
3453
|
-
# :break::
|
3664
|
+
# :break ::
|
3454
3665
|
#
|
3455
|
-
# :continue::
|
3666
|
+
# :continue ::
|
3456
3667
|
#
|
3457
3668
|
#
|
3458
|
-
# @return [Array
|
3669
|
+
# @return [Array<Symbol>]
|
3459
3670
|
def self.visitor_result_enum
|
3460
3671
|
[:break, :continue]
|
3461
3672
|
end
|
@@ -3464,6 +3675,16 @@ module Clang
|
|
3464
3675
|
:continue
|
3465
3676
|
]
|
3466
3677
|
|
3678
|
+
# \defgroup CINDEX_HIGH Higher level API functions
|
3679
|
+
#
|
3680
|
+
# @{
|
3681
|
+
#
|
3682
|
+
# = Fields:
|
3683
|
+
# :context ::
|
3684
|
+
# (FFI::Pointer(*Void))
|
3685
|
+
# :visit ::
|
3686
|
+
# (FFI::Pointer(*))
|
3687
|
+
#
|
3467
3688
|
class CursorAndRangeVisitor < FFI::Struct
|
3468
3689
|
layout :context, :pointer,
|
3469
3690
|
:visit, :pointer
|
@@ -3473,7 +3694,7 @@ module Clang
|
|
3473
3694
|
#
|
3474
3695
|
# @method find_references_in_file(cursor, file, visitor)
|
3475
3696
|
# @param [Cursor] cursor pointing to a declaration or a reference of one.
|
3476
|
-
# @param [FFI::Pointer
|
3697
|
+
# @param [FFI::Pointer(File)] file to search for references.
|
3477
3698
|
# @param [CursorAndRangeVisitor] visitor callback that will receive pairs of CXCursor/CXSourceRange for
|
3478
3699
|
# each reference found.
|
3479
3700
|
# The CXSourceRange will point inside the file; if the reference is inside
|