rbind 0.0.26 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rbind/core/hooks.rb +57 -0
- data/lib/rbind/core/rcast_operation.rb +14 -0
- data/lib/rbind/core/rclass.rb +93 -10
- data/lib/rbind/core/rnamespace.rb +20 -2
- data/lib/rbind/core.rb +2 -1
- data/lib/rbind/default_parser.rb +43 -26
- data/lib/rbind/generator_c.rb +60 -57
- data/lib/rbind/generator_extern.rb +7 -3
- data/lib/rbind/generator_ruby.rb +1 -1
- data/lib/rbind/logger.rb +2 -1
- data/lib/rbind/rbind.rb +23 -53
- data/lib/rbind/templates/c/CMakeLists.txt +8 -21
- data/lib/rbind/templates/c/cmake/FindRuby.cmake +15 -8
- data/lib/rbind/templates/c/operations.cc +1 -1
- data/lib/rbind/templates/c/operations.h +6 -3
- data/lib/rbind/templates/c/type_wrapper.h +1 -1
- data/lib/rbind/templates/c/types.h +9 -0
- data/lib/rbind/templates/ruby/rbind.rb +8 -2
- data/lib/rbind/tools/hdr_parser.py +43 -32
- data/manifest.xml +0 -2
- data/rbind.gemspec +2 -3
- metadata +9 -27
- data/lib/rbind/clang/clang.rb +0 -3719
- data/lib/rbind/clang/clang_types.rb +0 -338
- data/lib/rbind/clang_parser.rb +0 -523
- data/lib/rbind/templates/c/cmake/FindGem.cmake +0 -155
- data/lib/rbind/templates/c/find_gem.txt +0 -3
- data/lib/rbind/templates/c/rbind.pc.in +0 -11
data/lib/rbind/clang/clang.rb
DELETED
@@ -1,3719 +0,0 @@
|
|
1
|
-
require 'ffi'
|
2
|
-
require 'rbind/clang/clang_types'
|
3
|
-
|
4
|
-
module::Clang
|
5
|
-
module Rbind
|
6
|
-
extend FFI::Library
|
7
|
-
clang_names = ['clang']
|
8
|
-
|
9
|
-
clang_names = Dir.glob("/usr/lib/libclang*")
|
10
|
-
clang_names.flatten!
|
11
|
-
|
12
|
-
%w{3.4 3.3 3.2}.each do |llvm_version|
|
13
|
-
clang_names << File.join("/", "usr", "lib", "llvm-#{llvm_version}", "lib", "libclang.so")
|
14
|
-
end
|
15
|
-
begin
|
16
|
-
actual_clang_name = clang_names.find do |name|
|
17
|
-
begin
|
18
|
-
ffi_lib name
|
19
|
-
true
|
20
|
-
rescue LoadError
|
21
|
-
false
|
22
|
-
end
|
23
|
-
end
|
24
|
-
if !actual_clang_name
|
25
|
-
raise LoadError, "cannot load the clang library, tried: #{clang_names.join(", ")}"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# Provides the contents of a file that has not yet been saved to disk.
|
30
|
-
#
|
31
|
-
# Each CXUnsavedFile instance provides the name of a file on the
|
32
|
-
# system along with the current contents of that file that have not
|
33
|
-
# yet been saved to disk.
|
34
|
-
#
|
35
|
-
# = Fields:
|
36
|
-
# :filename ::
|
37
|
-
# (String) The file whose contents have not yet been saved.
|
38
|
-
#
|
39
|
-
# This file must already exist in the file system.
|
40
|
-
# :contents ::
|
41
|
-
# (String) A buffer containing the unsaved contents of this file.
|
42
|
-
# :length ::
|
43
|
-
# (Integer) The length of the unsaved contents of this buffer.
|
44
|
-
class UnsavedFile < FFI::Struct
|
45
|
-
layout :filename, :string,
|
46
|
-
:contents, :string,
|
47
|
-
:length, :ulong
|
48
|
-
end
|
49
|
-
|
50
|
-
# Describes the availability of a particular entity, which indicates
|
51
|
-
# whether the use of this entity will result in a warning or error due to
|
52
|
-
# it being deprecated or unavailable.
|
53
|
-
#
|
54
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:availability_kind).</em>
|
55
|
-
#
|
56
|
-
# === Options:
|
57
|
-
# :available ::
|
58
|
-
# The entity is available.
|
59
|
-
# :deprecated ::
|
60
|
-
# The entity is available, but has been deprecated (and its use is
|
61
|
-
# not recommended).
|
62
|
-
# :not_available ::
|
63
|
-
# The entity is not available; any use of it will be an error.
|
64
|
-
# :not_accessible ::
|
65
|
-
# The entity is available, but not accessible; any use of it will be
|
66
|
-
# an error.
|
67
|
-
#
|
68
|
-
# @method _enum_availability_kind_
|
69
|
-
# @return [Symbol]
|
70
|
-
# @scope class
|
71
|
-
enum :availability_kind, [
|
72
|
-
:available,
|
73
|
-
:deprecated,
|
74
|
-
:not_available,
|
75
|
-
:not_accessible
|
76
|
-
]
|
77
|
-
|
78
|
-
# A character string.
|
79
|
-
#
|
80
|
-
# The \c CXString type is used to return strings from the interface when
|
81
|
-
# the ownership of that string might different from one call to the next.
|
82
|
-
# Use \c clang_getCString() to retrieve the string data and, once finished
|
83
|
-
# with the string data, call \c clang_disposeString() to free the string.
|
84
|
-
#
|
85
|
-
# = Fields:
|
86
|
-
# :data ::
|
87
|
-
# (FFI::Pointer(*Void))
|
88
|
-
# :private_flags ::
|
89
|
-
# (Integer)
|
90
|
-
class String < FFI::Struct
|
91
|
-
layout :data, :pointer,
|
92
|
-
:private_flags, :uint
|
93
|
-
end
|
94
|
-
|
95
|
-
# Retrieve the character data associated with the given string.
|
96
|
-
#
|
97
|
-
# @method get_c_string(string)
|
98
|
-
# @param [String] string
|
99
|
-
# @return [String]
|
100
|
-
# @scope class
|
101
|
-
attach_function :get_c_string, :clang_getCString, [String.by_value], :string
|
102
|
-
|
103
|
-
# Free the given string,
|
104
|
-
#
|
105
|
-
# @method dispose_string(string)
|
106
|
-
# @param [String] string
|
107
|
-
# @return [nil]
|
108
|
-
# @scope class
|
109
|
-
attach_function :dispose_string, :clang_disposeString, [String.by_value], :void
|
110
|
-
|
111
|
-
# clang_createIndex() provides a shared context for creating
|
112
|
-
# translation units. It provides two options:
|
113
|
-
#
|
114
|
-
# - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
|
115
|
-
# declarations (when loading any new translation units). A "local" declaration
|
116
|
-
# is one that belongs in the translation unit itself and not in a precompiled
|
117
|
-
# header that was used by the translation unit. If zero, all declarations
|
118
|
-
# will be enumerated.
|
119
|
-
#
|
120
|
-
# Here is an example:
|
121
|
-
#
|
122
|
-
# // excludeDeclsFromPCH = 1, displayDiagnostics=1
|
123
|
-
# Idx = clang_createIndex(1, 1);
|
124
|
-
#
|
125
|
-
# // IndexTest.pch was produced with the following command:
|
126
|
-
# // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
|
127
|
-
# TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
|
128
|
-
#
|
129
|
-
# // This will load all the symbols from 'IndexTest.pch'
|
130
|
-
# clang_visitChildren(clang_getTranslationUnitCursor(TU),
|
131
|
-
# TranslationUnitVisitor, 0);
|
132
|
-
# clang_disposeTranslationUnit(TU);
|
133
|
-
#
|
134
|
-
# // This will load all the symbols from 'IndexTest.c', excluding symbols
|
135
|
-
# // from 'IndexTest.pch'.
|
136
|
-
# char *args() = { "-Xclang", "-include-pch=IndexTest.pch" };
|
137
|
-
# TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args,
|
138
|
-
# 0, 0);
|
139
|
-
# clang_visitChildren(clang_getTranslationUnitCursor(TU),
|
140
|
-
# TranslationUnitVisitor, 0);
|
141
|
-
# clang_disposeTranslationUnit(TU);
|
142
|
-
#
|
143
|
-
# This process of creating the 'pch', loading it separately, and using it (via
|
144
|
-
# -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
|
145
|
-
# (which gives the indexer the same performance benefit as the compiler).
|
146
|
-
#
|
147
|
-
# @method create_index(exclude_declarations_from_pch, display_diagnostics)
|
148
|
-
# @param [Integer] exclude_declarations_from_pch
|
149
|
-
# @param [Integer] display_diagnostics
|
150
|
-
# @return [FFI::Pointer(Index)]
|
151
|
-
# @scope class
|
152
|
-
attach_function :create_index, :clang_createIndex, [:int, :int], :pointer
|
153
|
-
|
154
|
-
# Destroy the given index.
|
155
|
-
#
|
156
|
-
# The index must not be destroyed until all of the translation units created
|
157
|
-
# within that index have been destroyed.
|
158
|
-
#
|
159
|
-
# @method dispose_index(index)
|
160
|
-
# @param [FFI::Pointer(Index)] index
|
161
|
-
# @return [nil]
|
162
|
-
# @scope class
|
163
|
-
attach_function :dispose_index, :clang_disposeIndex, [:pointer], :void
|
164
|
-
|
165
|
-
# Retrieve the complete file and path name of the given file.
|
166
|
-
#
|
167
|
-
# @method get_file_name(s_file)
|
168
|
-
# @param [FFI::Pointer(File)] s_file
|
169
|
-
# @return [String]
|
170
|
-
# @scope class
|
171
|
-
attach_function :get_file_name, :clang_getFileName, [:pointer], String.by_value
|
172
|
-
|
173
|
-
# Retrieve the last modification time of the given file.
|
174
|
-
#
|
175
|
-
# @method get_file_time(s_file)
|
176
|
-
# @param [FFI::Pointer(File)] s_file
|
177
|
-
# @return [Integer]
|
178
|
-
# @scope class
|
179
|
-
attach_function :get_file_time, :clang_getFileTime, [:pointer], :long
|
180
|
-
|
181
|
-
# Determine whether the given header is guarded against
|
182
|
-
# multiple inclusions, either with the conventional
|
183
|
-
# #ifndef/#define/#endif macro guards or with #pragma once.
|
184
|
-
#
|
185
|
-
# @method is_file_multiple_include_guarded(tu, file)
|
186
|
-
# @param [TranslationUnitImpl] tu
|
187
|
-
# @param [FFI::Pointer(File)] file
|
188
|
-
# @return [Integer]
|
189
|
-
# @scope class
|
190
|
-
attach_function :is_file_multiple_include_guarded, :clang_isFileMultipleIncludeGuarded, [TranslationUnitImpl, :pointer], :uint
|
191
|
-
|
192
|
-
# Retrieve a file handle within the given translation unit.
|
193
|
-
#
|
194
|
-
# @method get_file(tu, file_name)
|
195
|
-
# @param [TranslationUnitImpl] tu the translation unit
|
196
|
-
# @param [String] file_name the name of the file.
|
197
|
-
# @return [FFI::Pointer(File)] the file handle for the named file in the translation unit \p tu,
|
198
|
-
# or a NULL file handle if the file was not a part of this translation unit.
|
199
|
-
# @scope class
|
200
|
-
attach_function :get_file, :clang_getFile, [TranslationUnitImpl, :string], :pointer
|
201
|
-
|
202
|
-
# Identifies a specific source location within a translation
|
203
|
-
# unit.
|
204
|
-
#
|
205
|
-
# Use clang_getExpansionLocation() or clang_getSpellingLocation()
|
206
|
-
# to map a source location to a particular file, line, and column.
|
207
|
-
#
|
208
|
-
# = Fields:
|
209
|
-
# :ptr_data ::
|
210
|
-
# (Array<FFI::Pointer(*Void)>)
|
211
|
-
# :int_data ::
|
212
|
-
# (Integer)
|
213
|
-
class SourceLocation < FFI::Struct
|
214
|
-
layout :ptr_data, [:pointer, 2],
|
215
|
-
:int_data, :uint
|
216
|
-
end
|
217
|
-
|
218
|
-
# Identifies a half-open character range in the source code.
|
219
|
-
#
|
220
|
-
# Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the
|
221
|
-
# starting and end locations from a source range, respectively.
|
222
|
-
#
|
223
|
-
# = Fields:
|
224
|
-
# :ptr_data ::
|
225
|
-
# (Array<FFI::Pointer(*Void)>)
|
226
|
-
# :begin_int_data ::
|
227
|
-
# (Integer)
|
228
|
-
# :end_int_data ::
|
229
|
-
# (Integer)
|
230
|
-
class SourceRange < FFI::Struct
|
231
|
-
layout :ptr_data, [:pointer, 2],
|
232
|
-
:begin_int_data, :uint,
|
233
|
-
:end_int_data, :uint
|
234
|
-
end
|
235
|
-
|
236
|
-
# Retrieve a NULL (invalid) source location.
|
237
|
-
#
|
238
|
-
# @method get_null_location()
|
239
|
-
# @return [SourceLocation]
|
240
|
-
# @scope class
|
241
|
-
attach_function :get_null_location, :clang_getNullLocation, [], SourceLocation.by_value
|
242
|
-
|
243
|
-
# Determine whether two source locations, which must refer into
|
244
|
-
# the same translation unit, refer to exactly the same point in the source
|
245
|
-
# code.
|
246
|
-
#
|
247
|
-
# @method equal_locations(loc1, loc2)
|
248
|
-
# @param [SourceLocation] loc1
|
249
|
-
# @param [SourceLocation] loc2
|
250
|
-
# @return [Integer] non-zero if the source locations refer to the same location, zero
|
251
|
-
# if they refer to different locations.
|
252
|
-
# @scope class
|
253
|
-
attach_function :equal_locations, :clang_equalLocations, [SourceLocation.by_value, SourceLocation.by_value], :uint
|
254
|
-
|
255
|
-
# Retrieves the source location associated with a given file/line/column
|
256
|
-
# in a particular translation unit.
|
257
|
-
#
|
258
|
-
# @method get_location(tu, file, line, column)
|
259
|
-
# @param [TranslationUnitImpl] tu
|
260
|
-
# @param [FFI::Pointer(File)] file
|
261
|
-
# @param [Integer] line
|
262
|
-
# @param [Integer] column
|
263
|
-
# @return [SourceLocation]
|
264
|
-
# @scope class
|
265
|
-
attach_function :get_location, :clang_getLocation, [TranslationUnitImpl, :pointer, :uint, :uint], SourceLocation.by_value
|
266
|
-
|
267
|
-
# Retrieves the source location associated with a given character offset
|
268
|
-
# in a particular translation unit.
|
269
|
-
#
|
270
|
-
# @method get_location_for_offset(tu, file, offset)
|
271
|
-
# @param [TranslationUnitImpl] tu
|
272
|
-
# @param [FFI::Pointer(File)] file
|
273
|
-
# @param [Integer] offset
|
274
|
-
# @return [SourceLocation]
|
275
|
-
# @scope class
|
276
|
-
attach_function :get_location_for_offset, :clang_getLocationForOffset, [TranslationUnitImpl, :pointer, :uint], SourceLocation.by_value
|
277
|
-
|
278
|
-
# Retrieve a NULL (invalid) source range.
|
279
|
-
#
|
280
|
-
# @method get_null_range()
|
281
|
-
# @return [SourceRange]
|
282
|
-
# @scope class
|
283
|
-
attach_function :get_null_range, :clang_getNullRange, [], SourceRange.by_value
|
284
|
-
|
285
|
-
# Retrieve a source range given the beginning and ending source
|
286
|
-
# locations.
|
287
|
-
#
|
288
|
-
# @method get_range(begin, end)
|
289
|
-
# @param [SourceLocation] begin
|
290
|
-
# @param [SourceLocation] end
|
291
|
-
# @return [SourceRange]
|
292
|
-
# @scope class
|
293
|
-
attach_function :get_range, :clang_getRange, [SourceLocation.by_value, SourceLocation.by_value], SourceRange.by_value
|
294
|
-
|
295
|
-
# Determine whether two ranges are equivalent.
|
296
|
-
#
|
297
|
-
# @method equal_ranges(range1, range2)
|
298
|
-
# @param [SourceRange] range1
|
299
|
-
# @param [SourceRange] range2
|
300
|
-
# @return [Integer] non-zero if the ranges are the same, zero if they differ.
|
301
|
-
# @scope class
|
302
|
-
attach_function :equal_ranges, :clang_equalRanges, [SourceRange.by_value, SourceRange.by_value], :uint
|
303
|
-
|
304
|
-
# Returns non-zero if \arg range is null.
|
305
|
-
#
|
306
|
-
# @method range_is_null(range)
|
307
|
-
# @param [SourceRange] range
|
308
|
-
# @return [Integer]
|
309
|
-
# @scope class
|
310
|
-
attach_function :range_is_null, :clang_Range_isNull, [SourceRange.by_value], :int
|
311
|
-
|
312
|
-
# Retrieve the file, line, column, and offset represented by
|
313
|
-
# the given source location, as specified in a # line directive.
|
314
|
-
#
|
315
|
-
# Example: given the following source code in a file somefile.c
|
316
|
-
#
|
317
|
-
# #123 "dummy.c" 1
|
318
|
-
#
|
319
|
-
# static int func(void)
|
320
|
-
# {
|
321
|
-
# return 0;
|
322
|
-
# }
|
323
|
-
#
|
324
|
-
# the location information returned by this function would be
|
325
|
-
#
|
326
|
-
# File: dummy.c Line: 124 Column: 12
|
327
|
-
#
|
328
|
-
# whereas clang_getExpansionLocation would have returned
|
329
|
-
#
|
330
|
-
# File: somefile.c Line: 3 Column: 12
|
331
|
-
#
|
332
|
-
# @method get_presumed_location(location, filename, line, column)
|
333
|
-
# @param [SourceLocation] location the location within a source file that will be decomposed
|
334
|
-
# into its parts.
|
335
|
-
# @param [String] filename (out) if non-NULL, will be set to the filename of the
|
336
|
-
# source location. Note that filenames returned will be for "virtual" files,
|
337
|
-
# which don't necessarily exist on the machine running clang - e.g. when
|
338
|
-
# parsing preprocessed output obtained from a different environment. If
|
339
|
-
# a non-NULL value is passed in, remember to dispose of the returned value
|
340
|
-
# using \c clang_disposeString() once you've finished with it. For an invalid
|
341
|
-
# source location, an empty string is returned.
|
342
|
-
# @param [FFI::Pointer(*UInt)] line (out) if non-NULL, will be set to the line number of the
|
343
|
-
# source location. For an invalid source location, zero is returned.
|
344
|
-
# @param [FFI::Pointer(*UInt)] column (out) if non-NULL, will be set to the column number of the
|
345
|
-
# source location. For an invalid source location, zero is returned.
|
346
|
-
# @return [nil]
|
347
|
-
# @scope class
|
348
|
-
attach_function :get_presumed_location, :clang_getPresumedLocation, [SourceLocation.by_value, String, :pointer, :pointer], :void
|
349
|
-
|
350
|
-
# Legacy API to retrieve the file, line, column, and offset represented
|
351
|
-
# by the given source location.
|
352
|
-
#
|
353
|
-
# This interface has been replaced by the newer interface
|
354
|
-
# \see clang_getExpansionLocation(). See that interface's documentation for
|
355
|
-
# details.
|
356
|
-
#
|
357
|
-
# @method get_instantiation_location(location, file, line, column, offset)
|
358
|
-
# @param [SourceLocation] location
|
359
|
-
# @param [FFI::Pointer(*File)] file
|
360
|
-
# @param [FFI::Pointer(*UInt)] line
|
361
|
-
# @param [FFI::Pointer(*UInt)] column
|
362
|
-
# @param [FFI::Pointer(*UInt)] offset
|
363
|
-
# @return [nil]
|
364
|
-
# @scope class
|
365
|
-
attach_function :get_instantiation_location, :clang_getInstantiationLocation, [SourceLocation.by_value, :pointer, :pointer, :pointer, :pointer], :void
|
366
|
-
|
367
|
-
# Retrieve the file, line, column, and offset represented by
|
368
|
-
# the given source location.
|
369
|
-
#
|
370
|
-
# If the location refers into a macro instantiation, return where the
|
371
|
-
# location was originally spelled in the source file.
|
372
|
-
#
|
373
|
-
# @method get_spelling_location(location, file, line, column, offset)
|
374
|
-
# @param [SourceLocation] location the location within a source file that will be decomposed
|
375
|
-
# into its parts.
|
376
|
-
# @param [FFI::Pointer(*File)] file (out) if non-NULL, will be set to the file to which the given
|
377
|
-
# source location points.
|
378
|
-
# @param [FFI::Pointer(*UInt)] line (out) if non-NULL, will be set to the line to which the given
|
379
|
-
# source location points.
|
380
|
-
# @param [FFI::Pointer(*UInt)] column (out) if non-NULL, will be set to the column to which the given
|
381
|
-
# source location points.
|
382
|
-
# @param [FFI::Pointer(*UInt)] offset (out) if non-NULL, will be set to the offset into the
|
383
|
-
# buffer to which the given source location points.
|
384
|
-
# @return [nil]
|
385
|
-
# @scope class
|
386
|
-
attach_function :get_spelling_location, :clang_getSpellingLocation, [SourceLocation.by_value, :pointer, :pointer, :pointer, :pointer], :void
|
387
|
-
|
388
|
-
# Retrieve a source location representing the first character within a
|
389
|
-
# source range.
|
390
|
-
#
|
391
|
-
# @method get_range_start(range)
|
392
|
-
# @param [SourceRange] range
|
393
|
-
# @return [SourceLocation]
|
394
|
-
# @scope class
|
395
|
-
attach_function :get_range_start, :clang_getRangeStart, [SourceRange.by_value], SourceLocation.by_value
|
396
|
-
|
397
|
-
# Retrieve a source location representing the last character within a
|
398
|
-
# source range.
|
399
|
-
#
|
400
|
-
# @method get_range_end(range)
|
401
|
-
# @param [SourceRange] range
|
402
|
-
# @return [SourceLocation]
|
403
|
-
# @scope class
|
404
|
-
attach_function :get_range_end, :clang_getRangeEnd, [SourceRange.by_value], SourceLocation.by_value
|
405
|
-
|
406
|
-
# Describes the severity of a particular diagnostic.
|
407
|
-
#
|
408
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:diagnostic_severity).</em>
|
409
|
-
#
|
410
|
-
# === Options:
|
411
|
-
# :ignored ::
|
412
|
-
# A diagnostic that has been suppressed, e.g., by a command-line
|
413
|
-
# option.
|
414
|
-
# :note ::
|
415
|
-
# This diagnostic is a note that should be attached to the
|
416
|
-
# previous (non-note) diagnostic.
|
417
|
-
# :warning ::
|
418
|
-
# This diagnostic indicates suspicious code that may not be
|
419
|
-
# wrong.
|
420
|
-
# :error ::
|
421
|
-
# This diagnostic indicates that the code is ill-formed.
|
422
|
-
# :fatal ::
|
423
|
-
# This diagnostic indicates that the code is ill-formed such
|
424
|
-
# that future parser recovery is unlikely to produce useful
|
425
|
-
# results.
|
426
|
-
#
|
427
|
-
# @method _enum_diagnostic_severity_
|
428
|
-
# @return [Symbol]
|
429
|
-
# @scope class
|
430
|
-
enum :diagnostic_severity, [
|
431
|
-
:ignored, 0,
|
432
|
-
:note, 1,
|
433
|
-
:warning, 2,
|
434
|
-
:error, 3,
|
435
|
-
:fatal, 4
|
436
|
-
]
|
437
|
-
|
438
|
-
# Determine the number of diagnostics produced for the given
|
439
|
-
# translation unit.
|
440
|
-
#
|
441
|
-
# @method get_num_diagnostics(unit)
|
442
|
-
# @param [TranslationUnitImpl] unit
|
443
|
-
# @return [Integer]
|
444
|
-
# @scope class
|
445
|
-
attach_function :get_num_diagnostics, :clang_getNumDiagnostics, [TranslationUnitImpl], :uint
|
446
|
-
|
447
|
-
# Retrieve a diagnostic associated with the given translation unit.
|
448
|
-
#
|
449
|
-
# @method get_diagnostic(unit, index)
|
450
|
-
# @param [TranslationUnitImpl] unit the translation unit to query.
|
451
|
-
# @param [Integer] index the zero-based diagnostic number to retrieve.
|
452
|
-
# @return [FFI::Pointer(Diagnostic)] the requested diagnostic. This diagnostic must be freed
|
453
|
-
# via a call to \c clang_disposeDiagnostic().
|
454
|
-
# @scope class
|
455
|
-
attach_function :get_diagnostic, :clang_getDiagnostic, [TranslationUnitImpl, :uint], :pointer
|
456
|
-
|
457
|
-
# Destroy a diagnostic.
|
458
|
-
#
|
459
|
-
# @method dispose_diagnostic(diagnostic)
|
460
|
-
# @param [FFI::Pointer(Diagnostic)] diagnostic
|
461
|
-
# @return [nil]
|
462
|
-
# @scope class
|
463
|
-
attach_function :dispose_diagnostic, :clang_disposeDiagnostic, [:pointer], :void
|
464
|
-
|
465
|
-
# Options to control the display of diagnostics.
|
466
|
-
#
|
467
|
-
# The values in this enum are meant to be combined to customize the
|
468
|
-
# behavior of \c clang_displayDiagnostic().
|
469
|
-
#
|
470
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:diagnostic_display_options).</em>
|
471
|
-
#
|
472
|
-
# === Options:
|
473
|
-
# :display_source_location ::
|
474
|
-
# Display the source-location information where the
|
475
|
-
# diagnostic was located.
|
476
|
-
#
|
477
|
-
# When set, diagnostics will be prefixed by the file, line, and
|
478
|
-
# (optionally) column to which the diagnostic refers. For example,
|
479
|
-
#
|
480
|
-
# \code
|
481
|
-
# test.c:28: warning: extra tokens at end of #endif directive
|
482
|
-
# \endcode
|
483
|
-
#
|
484
|
-
# This option corresponds to the clang flag \c -fshow-source-location.
|
485
|
-
# :display_column ::
|
486
|
-
# If displaying the source-location information of the
|
487
|
-
# diagnostic, also include the column number.
|
488
|
-
#
|
489
|
-
# This option corresponds to the clang flag \c -fshow-column.
|
490
|
-
# :display_source_ranges ::
|
491
|
-
# If displaying the source-location information of the
|
492
|
-
# diagnostic, also include information about source ranges in a
|
493
|
-
# machine-parsable format.
|
494
|
-
#
|
495
|
-
# This option corresponds to the clang flag
|
496
|
-
# \c -fdiagnostics-print-source-range-info.
|
497
|
-
# :display_option ::
|
498
|
-
# Display the option name associated with this diagnostic, if any.
|
499
|
-
#
|
500
|
-
# The option name displayed (e.g., -Wconversion) will be placed in brackets
|
501
|
-
# after the diagnostic text. This option corresponds to the clang flag
|
502
|
-
# \c -fdiagnostics-show-option.
|
503
|
-
# :display_category_id ::
|
504
|
-
# Display the category number associated with this diagnostic, if any.
|
505
|
-
#
|
506
|
-
# The category number is displayed within brackets after the diagnostic text.
|
507
|
-
# This option corresponds to the clang flag
|
508
|
-
# \c -fdiagnostics-show-category=id.
|
509
|
-
# :display_category_name ::
|
510
|
-
# Display the category name associated with this diagnostic, if any.
|
511
|
-
#
|
512
|
-
# The category name is displayed within brackets after the diagnostic text.
|
513
|
-
# This option corresponds to the clang flag
|
514
|
-
# \c -fdiagnostics-show-category=name.
|
515
|
-
#
|
516
|
-
# @method _enum_diagnostic_display_options_
|
517
|
-
# @return [Symbol]
|
518
|
-
# @scope class
|
519
|
-
enum :diagnostic_display_options, [
|
520
|
-
:display_source_location, 0x01,
|
521
|
-
:display_column, 0x02,
|
522
|
-
:display_source_ranges, 0x04,
|
523
|
-
:display_option, 0x08,
|
524
|
-
:display_category_id, 0x10,
|
525
|
-
:display_category_name, 0x20
|
526
|
-
]
|
527
|
-
|
528
|
-
# Format the given diagnostic in a manner that is suitable for display.
|
529
|
-
#
|
530
|
-
# This routine will format the given diagnostic to a string, rendering
|
531
|
-
# the diagnostic according to the various options given. The
|
532
|
-
# \c clang_defaultDiagnosticDisplayOptions() function returns the set of
|
533
|
-
# options that most closely mimics the behavior of the clang compiler.
|
534
|
-
#
|
535
|
-
# @method format_diagnostic(diagnostic, options)
|
536
|
-
# @param [FFI::Pointer(Diagnostic)] diagnostic The diagnostic to print.
|
537
|
-
# @param [Integer] options A set of options that control the diagnostic display,
|
538
|
-
# created by combining \c CXDiagnosticDisplayOptions values.
|
539
|
-
# @return [String] A new string containing for formatted diagnostic.
|
540
|
-
# @scope class
|
541
|
-
attach_function :format_diagnostic, :clang_formatDiagnostic, [:pointer, :uint], String.by_value
|
542
|
-
|
543
|
-
# Retrieve the set of display options most similar to the
|
544
|
-
# default behavior of the clang compiler.
|
545
|
-
#
|
546
|
-
# @method default_diagnostic_display_options()
|
547
|
-
# @return [Integer] A set of display options suitable for use with \c
|
548
|
-
# clang_displayDiagnostic().
|
549
|
-
# @scope class
|
550
|
-
attach_function :default_diagnostic_display_options, :clang_defaultDiagnosticDisplayOptions, [], :uint
|
551
|
-
|
552
|
-
# Determine the severity of the given diagnostic.
|
553
|
-
#
|
554
|
-
# @method get_diagnostic_severity(diagnostic)
|
555
|
-
# @param [FFI::Pointer(Diagnostic)] diagnostic
|
556
|
-
# @return [Symbol from _enum_diagnostic_severity_]
|
557
|
-
# @scope class
|
558
|
-
attach_function :get_diagnostic_severity, :clang_getDiagnosticSeverity, [:pointer], :diagnostic_severity
|
559
|
-
|
560
|
-
# Retrieve the source location of the given diagnostic.
|
561
|
-
#
|
562
|
-
# This location is where Clang would print the caret ('^') when
|
563
|
-
# displaying the diagnostic on the command line.
|
564
|
-
#
|
565
|
-
# @method get_diagnostic_location(diagnostic)
|
566
|
-
# @param [FFI::Pointer(Diagnostic)] diagnostic
|
567
|
-
# @return [SourceLocation]
|
568
|
-
# @scope class
|
569
|
-
attach_function :get_diagnostic_location, :clang_getDiagnosticLocation, [:pointer], SourceLocation.by_value
|
570
|
-
|
571
|
-
# Retrieve the text of the given diagnostic.
|
572
|
-
#
|
573
|
-
# @method get_diagnostic_spelling(diagnostic)
|
574
|
-
# @param [FFI::Pointer(Diagnostic)] diagnostic
|
575
|
-
# @return [String]
|
576
|
-
# @scope class
|
577
|
-
attach_function :get_diagnostic_spelling, :clang_getDiagnosticSpelling, [:pointer], String.by_value
|
578
|
-
|
579
|
-
# Retrieve the name of the command-line option that enabled this
|
580
|
-
# diagnostic.
|
581
|
-
#
|
582
|
-
# @method get_diagnostic_option(diag, disable)
|
583
|
-
# @param [FFI::Pointer(Diagnostic)] diag The diagnostic to be queried.
|
584
|
-
# @param [String] disable If non-NULL, will be set to the option that disables this
|
585
|
-
# diagnostic (if any).
|
586
|
-
# @return [String] A string that contains the command-line option used to enable this
|
587
|
-
# warning, such as "-Wconversion" or "-pedantic".
|
588
|
-
# @scope class
|
589
|
-
attach_function :get_diagnostic_option, :clang_getDiagnosticOption, [:pointer, String], String.by_value
|
590
|
-
|
591
|
-
# Retrieve the category number for this diagnostic.
|
592
|
-
#
|
593
|
-
# Diagnostics can be categorized into groups along with other, related
|
594
|
-
# diagnostics (e.g., diagnostics under the same warning flag). This routine
|
595
|
-
# retrieves the category number for the given diagnostic.
|
596
|
-
#
|
597
|
-
# @method get_diagnostic_category(diagnostic)
|
598
|
-
# @param [FFI::Pointer(Diagnostic)] diagnostic
|
599
|
-
# @return [Integer] The number of the category that contains this diagnostic, or zero
|
600
|
-
# if this diagnostic is uncategorized.
|
601
|
-
# @scope class
|
602
|
-
attach_function :get_diagnostic_category, :clang_getDiagnosticCategory, [:pointer], :uint
|
603
|
-
|
604
|
-
# Retrieve the name of a particular diagnostic category.
|
605
|
-
#
|
606
|
-
# @method get_diagnostic_category_name(category)
|
607
|
-
# @param [Integer] category A diagnostic category number, as returned by
|
608
|
-
# \c clang_getDiagnosticCategory().
|
609
|
-
# @return [String] The name of the given diagnostic category.
|
610
|
-
# @scope class
|
611
|
-
attach_function :get_diagnostic_category_name, :clang_getDiagnosticCategoryName, [:uint], String.by_value
|
612
|
-
|
613
|
-
# Determine the number of source ranges associated with the given
|
614
|
-
# diagnostic.
|
615
|
-
#
|
616
|
-
# @method get_diagnostic_num_ranges(diagnostic)
|
617
|
-
# @param [FFI::Pointer(Diagnostic)] diagnostic
|
618
|
-
# @return [Integer]
|
619
|
-
# @scope class
|
620
|
-
attach_function :get_diagnostic_num_ranges, :clang_getDiagnosticNumRanges, [:pointer], :uint
|
621
|
-
|
622
|
-
# Retrieve a source range associated with the diagnostic.
|
623
|
-
#
|
624
|
-
# A diagnostic's source ranges highlight important elements in the source
|
625
|
-
# code. On the command line, Clang displays source ranges by
|
626
|
-
# underlining them with '~' characters.
|
627
|
-
#
|
628
|
-
# @method get_diagnostic_range(diagnostic, range)
|
629
|
-
# @param [FFI::Pointer(Diagnostic)] diagnostic the diagnostic whose range is being extracted.
|
630
|
-
# @param [Integer] range the zero-based index specifying which range to
|
631
|
-
# @return [SourceRange] the requested source range.
|
632
|
-
# @scope class
|
633
|
-
attach_function :get_diagnostic_range, :clang_getDiagnosticRange, [:pointer, :uint], SourceRange.by_value
|
634
|
-
|
635
|
-
# Determine the number of fix-it hints associated with the
|
636
|
-
# given diagnostic.
|
637
|
-
#
|
638
|
-
# @method get_diagnostic_num_fix_its(diagnostic)
|
639
|
-
# @param [FFI::Pointer(Diagnostic)] diagnostic
|
640
|
-
# @return [Integer]
|
641
|
-
# @scope class
|
642
|
-
attach_function :get_diagnostic_num_fix_its, :clang_getDiagnosticNumFixIts, [:pointer], :uint
|
643
|
-
|
644
|
-
# Retrieve the replacement information for a given fix-it.
|
645
|
-
#
|
646
|
-
# Fix-its are described in terms of a source range whose contents
|
647
|
-
# should be replaced by a string. This approach generalizes over
|
648
|
-
# three kinds of operations: removal of source code (the range covers
|
649
|
-
# the code to be removed and the replacement string is empty),
|
650
|
-
# replacement of source code (the range covers the code to be
|
651
|
-
# replaced and the replacement string provides the new code), and
|
652
|
-
# insertion (both the start and end of the range point at the
|
653
|
-
# insertion location, and the replacement string provides the text to
|
654
|
-
# insert).
|
655
|
-
#
|
656
|
-
# @method get_diagnostic_fix_it(diagnostic, fix_it, replacement_range)
|
657
|
-
# @param [FFI::Pointer(Diagnostic)] diagnostic The diagnostic whose fix-its are being queried.
|
658
|
-
# @param [Integer] fix_it The zero-based index of the fix-it.
|
659
|
-
# @param [SourceRange] replacement_range The source range whose contents will be
|
660
|
-
# replaced with the returned replacement string. Note that source
|
661
|
-
# ranges are half-open ranges (a, b), so the source code should be
|
662
|
-
# replaced from a and up to (but not including) b.
|
663
|
-
# @return [String] A string containing text that should be replace the source
|
664
|
-
# code indicated by the \c ReplacementRange.
|
665
|
-
# @scope class
|
666
|
-
attach_function :get_diagnostic_fix_it, :clang_getDiagnosticFixIt, [:pointer, :uint, SourceRange], String.by_value
|
667
|
-
|
668
|
-
# Get the original translation unit source file name.
|
669
|
-
#
|
670
|
-
# @method get_translation_unit_spelling(ct_unit)
|
671
|
-
# @param [TranslationUnitImpl] ct_unit
|
672
|
-
# @return [String]
|
673
|
-
# @scope class
|
674
|
-
attach_function :get_translation_unit_spelling, :clang_getTranslationUnitSpelling, [TranslationUnitImpl], String.by_value
|
675
|
-
|
676
|
-
# Return the CXTranslationUnit for a given source file and the provided
|
677
|
-
# command line arguments one would pass to the compiler.
|
678
|
-
#
|
679
|
-
# Note: The 'source_filename' argument is optional. If the caller provides a
|
680
|
-
# NULL pointer, the name of the source file is expected to reside in the
|
681
|
-
# specified command line arguments.
|
682
|
-
#
|
683
|
-
# Note: When encountered in 'clang_command_line_args', the following options
|
684
|
-
# are ignored:
|
685
|
-
#
|
686
|
-
# '-c'
|
687
|
-
# '-emit-ast'
|
688
|
-
# '-fsyntax-only'
|
689
|
-
# '-o <output file>' (both '-o' and '<output file>' are ignored)
|
690
|
-
#
|
691
|
-
# @method create_translation_unit_from_source_file(c_idx, source_filename, num_clang_command_line_args, command_line_args, num_unsaved_files, unsaved_files)
|
692
|
-
# @param [FFI::Pointer(Index)] c_idx The index object with which the translation unit will be
|
693
|
-
# associated.
|
694
|
-
# @param [String] source_filename - The name of the source file to load, or NULL if the
|
695
|
-
# source file is included in \p clang_command_line_args.
|
696
|
-
# @param [Integer] num_clang_command_line_args The number of command-line arguments in
|
697
|
-
# \p clang_command_line_args.
|
698
|
-
# @param [FFI::Pointer(**Char_S)] command_line_args The command-line arguments that would be
|
699
|
-
# passed to the \c clang executable if it were being invoked out-of-process.
|
700
|
-
# These command-line options will be parsed and will affect how the translation
|
701
|
-
# unit is parsed. Note that the following options are ignored: '-c',
|
702
|
-
# '-emit-ast', '-fsyntex-only' (which is the default), and '-o <output file>'.
|
703
|
-
# @param [Integer] num_unsaved_files the number of unsaved file entries in \p
|
704
|
-
# unsaved_files.
|
705
|
-
# @param [UnsavedFile] unsaved_files the files that have not yet been saved to disk
|
706
|
-
# but may be required for code completion, including the contents of
|
707
|
-
# those files. The contents and name of these files (as specified by
|
708
|
-
# CXUnsavedFile) are copied when necessary, so the client only needs to
|
709
|
-
# guarantee their validity until the call to this function returns.
|
710
|
-
# @return [TranslationUnitImpl]
|
711
|
-
# @scope class
|
712
|
-
attach_function :create_translation_unit_from_source_file, :clang_createTranslationUnitFromSourceFile, [:pointer, :string, :int, :pointer, :uint, UnsavedFile], TranslationUnitImpl
|
713
|
-
|
714
|
-
# Create a translation unit from an AST file (-emit-ast).
|
715
|
-
#
|
716
|
-
# @method create_translation_unit(index, ast_filename)
|
717
|
-
# @param [FFI::Pointer(Index)] index
|
718
|
-
# @param [String] ast_filename
|
719
|
-
# @return [TranslationUnitImpl]
|
720
|
-
# @scope class
|
721
|
-
attach_function :create_translation_unit, :clang_createTranslationUnit, [:pointer, :string], TranslationUnitImpl
|
722
|
-
|
723
|
-
# Flags that control the creation of translation units.
|
724
|
-
#
|
725
|
-
# The enumerators in this enumeration type are meant to be bitwise
|
726
|
-
# ORed together to specify which options should be used when
|
727
|
-
# constructing the translation unit.
|
728
|
-
#
|
729
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:translation_unit_flags).</em>
|
730
|
-
#
|
731
|
-
# === Options:
|
732
|
-
# :none ::
|
733
|
-
# Used to indicate that no special translation-unit options are
|
734
|
-
# needed.
|
735
|
-
# :detailed_preprocessing_record ::
|
736
|
-
# Used to indicate that the parser should construct a "detailed"
|
737
|
-
# preprocessing record, including all macro definitions and instantiations.
|
738
|
-
#
|
739
|
-
# Constructing a detailed preprocessing record requires more memory
|
740
|
-
# and time to parse, since the information contained in the record
|
741
|
-
# is usually not retained. However, it can be useful for
|
742
|
-
# applications that require more detailed information about the
|
743
|
-
# behavior of the preprocessor.
|
744
|
-
# :incomplete ::
|
745
|
-
# Used to indicate that the translation unit is incomplete.
|
746
|
-
#
|
747
|
-
# When a translation unit is considered "incomplete", semantic
|
748
|
-
# analysis that is typically performed at the end of the
|
749
|
-
# translation unit will be suppressed. For example, this suppresses
|
750
|
-
# the completion of tentative declarations in C and of
|
751
|
-
# instantiation of implicitly-instantiation function templates in
|
752
|
-
# C++. This option is typically used when parsing a header with the
|
753
|
-
# intent of producing a precompiled header.
|
754
|
-
# :precompiled_preamble ::
|
755
|
-
# Used to indicate that the translation unit should be built with an
|
756
|
-
# implicit precompiled header for the preamble.
|
757
|
-
#
|
758
|
-
# An implicit precompiled header is used as an optimization when a
|
759
|
-
# particular translation unit is likely to be reparsed many times
|
760
|
-
# when the sources aren't changing that often. In this case, an
|
761
|
-
# implicit precompiled header will be built containing all of the
|
762
|
-
# initial includes at the top of the main file (what we refer to as
|
763
|
-
# the "preamble" of the file). In subsequent parses, if the
|
764
|
-
# preamble or the files in it have not changed, \c
|
765
|
-
# clang_reparseTranslationUnit() will re-use the implicit
|
766
|
-
# precompiled header to improve parsing performance.
|
767
|
-
# :cache_completion_results ::
|
768
|
-
# Used to indicate that the translation unit should cache some
|
769
|
-
# code-completion results with each reparse of the source file.
|
770
|
-
#
|
771
|
-
# Caching of code-completion results is a performance optimization that
|
772
|
-
# introduces some overhead to reparsing but improves the performance of
|
773
|
-
# code-completion operations.
|
774
|
-
# :x_precompiled_preamble ::
|
775
|
-
# DEPRECATED: Enable precompiled preambles in C++.
|
776
|
-
#
|
777
|
-
# Note: this is a *temporary* option that is available only while
|
778
|
-
# we are testing C++ precompiled preamble support. It is deprecated.
|
779
|
-
# :x_chained_pch ::
|
780
|
-
# DEPRECATED: Enabled chained precompiled preambles in C++.
|
781
|
-
#
|
782
|
-
# Note: this is a *temporary* option that is available only while
|
783
|
-
# we are testing C++ precompiled preamble support. It is deprecated.
|
784
|
-
# :nested_macro_expansions ::
|
785
|
-
# Used to indicate that the "detailed" preprocessing record,
|
786
|
-
# if requested, should also contain nested macro expansions.
|
787
|
-
#
|
788
|
-
# Nested macro expansions (i.e., macro expansions that occur
|
789
|
-
# inside another macro expansion) can, in some code bases, require
|
790
|
-
# a large amount of storage to due preprocessor metaprogramming. Moreover,
|
791
|
-
# its fairly rare that this information is useful for libclang clients.
|
792
|
-
#
|
793
|
-
# @method _enum_translation_unit_flags_
|
794
|
-
# @return [Symbol]
|
795
|
-
# @scope class
|
796
|
-
enum :translation_unit_flags, [
|
797
|
-
:none, 0x0,
|
798
|
-
:detailed_preprocessing_record, 0x01,
|
799
|
-
:incomplete, 0x02,
|
800
|
-
:precompiled_preamble, 0x04,
|
801
|
-
:cache_completion_results, 0x08,
|
802
|
-
:x_precompiled_preamble, 0x10,
|
803
|
-
:x_chained_pch, 0x20,
|
804
|
-
:nested_macro_expansions, 0x40
|
805
|
-
]
|
806
|
-
|
807
|
-
# Returns the set of flags that is suitable for parsing a translation
|
808
|
-
# unit that is being edited.
|
809
|
-
#
|
810
|
-
# The set of flags returned provide options for \c clang_parseTranslationUnit()
|
811
|
-
# to indicate that the translation unit is likely to be reparsed many times,
|
812
|
-
# either explicitly (via \c clang_reparseTranslationUnit()) or implicitly
|
813
|
-
# (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag
|
814
|
-
# set contains an unspecified set of optimizations (e.g., the precompiled
|
815
|
-
# preamble) geared toward improving the performance of these routines. The
|
816
|
-
# set of optimizations enabled may change from one version to the next.
|
817
|
-
#
|
818
|
-
# @method default_editing_translation_unit_options()
|
819
|
-
# @return [Integer]
|
820
|
-
# @scope class
|
821
|
-
attach_function :default_editing_translation_unit_options, :clang_defaultEditingTranslationUnitOptions, [], :uint
|
822
|
-
|
823
|
-
# Parse the given source file and the translation unit corresponding
|
824
|
-
# to that file.
|
825
|
-
#
|
826
|
-
# This routine is the main entry point for the Clang C API, providing the
|
827
|
-
# ability to parse a source file into a translation unit that can then be
|
828
|
-
# queried by other functions in the API. This routine accepts a set of
|
829
|
-
# command-line arguments so that the compilation can be configured in the same
|
830
|
-
# way that the compiler is configured on the command line.
|
831
|
-
#
|
832
|
-
# @method parse_translation_unit(c_idx, source_filename, command_line_args, num_command_line_args, unsaved_files, num_unsaved_files, options)
|
833
|
-
# @param [FFI::Pointer(Index)] c_idx The index object with which the translation unit will be
|
834
|
-
# associated.
|
835
|
-
# @param [String] source_filename The name of the source file to load, or NULL if the
|
836
|
-
# source file is included in \p command_line_args.
|
837
|
-
# @param [FFI::Pointer(**Char_S)] command_line_args The command-line arguments that would be
|
838
|
-
# passed to the \c clang executable if it were being invoked out-of-process.
|
839
|
-
# These command-line options will be parsed and will affect how the translation
|
840
|
-
# unit is parsed. Note that the following options are ignored: '-c',
|
841
|
-
# '-emit-ast', '-fsyntex-only' (which is the default), and '-o <output file>'.
|
842
|
-
# @param [Integer] num_command_line_args The number of command-line arguments in
|
843
|
-
# \p command_line_args.
|
844
|
-
# @param [UnsavedFile] unsaved_files the files that have not yet been saved to disk
|
845
|
-
# but may be required for parsing, including the contents of
|
846
|
-
# those files. The contents and name of these files (as specified by
|
847
|
-
# CXUnsavedFile) are copied when necessary, so the client only needs to
|
848
|
-
# guarantee their validity until the call to this function returns.
|
849
|
-
# @param [Integer] num_unsaved_files the number of unsaved file entries in \p
|
850
|
-
# unsaved_files.
|
851
|
-
# @param [Integer] options A bitmask of options that affects how the translation unit
|
852
|
-
# is managed but not its compilation. This should be a bitwise OR of the
|
853
|
-
# CXTranslationUnit_XXX flags.
|
854
|
-
# @return [TranslationUnitImpl] A new translation unit describing the parsed code and containing
|
855
|
-
# any diagnostics produced by the compiler. If there is a failure from which
|
856
|
-
# the compiler cannot recover, returns NULL.
|
857
|
-
# @scope class
|
858
|
-
attach_function :parse_translation_unit, :clang_parseTranslationUnit, [:pointer, :string, :pointer, :int, UnsavedFile, :uint, :uint], TranslationUnitImpl
|
859
|
-
|
860
|
-
# Flags that control how translation units are saved.
|
861
|
-
#
|
862
|
-
# The enumerators in this enumeration type are meant to be bitwise
|
863
|
-
# ORed together to specify which options should be used when
|
864
|
-
# saving the translation unit.
|
865
|
-
#
|
866
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:save_translation_unit_flags).</em>
|
867
|
-
#
|
868
|
-
# === Options:
|
869
|
-
# :save_translation_unit_none ::
|
870
|
-
# Used to indicate that no special saving options are needed.
|
871
|
-
#
|
872
|
-
# @method _enum_save_translation_unit_flags_
|
873
|
-
# @return [Symbol]
|
874
|
-
# @scope class
|
875
|
-
enum :save_translation_unit_flags, [
|
876
|
-
:save_translation_unit_none, 0x0
|
877
|
-
]
|
878
|
-
|
879
|
-
# Returns the set of flags that is suitable for saving a translation
|
880
|
-
# unit.
|
881
|
-
#
|
882
|
-
# The set of flags returned provide options for
|
883
|
-
# \c clang_saveTranslationUnit() by default. The returned flag
|
884
|
-
# set contains an unspecified set of options that save translation units with
|
885
|
-
# the most commonly-requested data.
|
886
|
-
#
|
887
|
-
# @method default_save_options(tu)
|
888
|
-
# @param [TranslationUnitImpl] tu
|
889
|
-
# @return [Integer]
|
890
|
-
# @scope class
|
891
|
-
attach_function :default_save_options, :clang_defaultSaveOptions, [TranslationUnitImpl], :uint
|
892
|
-
|
893
|
-
# Describes the kind of error that occurred (if any) in a call to
|
894
|
-
# \c clang_saveTranslationUnit().
|
895
|
-
#
|
896
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:save_error).</em>
|
897
|
-
#
|
898
|
-
# === Options:
|
899
|
-
# :none ::
|
900
|
-
# Indicates that no error occurred while saving a translation unit.
|
901
|
-
# :unknown ::
|
902
|
-
# Indicates that an unknown error occurred while attempting to save
|
903
|
-
# the file.
|
904
|
-
#
|
905
|
-
# This error typically indicates that file I/O failed when attempting to
|
906
|
-
# write the file.
|
907
|
-
# :translation_errors ::
|
908
|
-
# Indicates that errors during translation prevented this attempt
|
909
|
-
# to save the translation unit.
|
910
|
-
#
|
911
|
-
# Errors that prevent the translation unit from being saved can be
|
912
|
-
# extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic().
|
913
|
-
# :invalid_tu ::
|
914
|
-
# Indicates that the translation unit to be saved was somehow
|
915
|
-
# invalid (e.g., NULL).
|
916
|
-
#
|
917
|
-
# @method _enum_save_error_
|
918
|
-
# @return [Symbol]
|
919
|
-
# @scope class
|
920
|
-
enum :save_error, [
|
921
|
-
:none, 0,
|
922
|
-
:unknown, 1,
|
923
|
-
:translation_errors, 2,
|
924
|
-
:invalid_tu, 3
|
925
|
-
]
|
926
|
-
|
927
|
-
# Saves a translation unit into a serialized representation of
|
928
|
-
# that translation unit on disk.
|
929
|
-
#
|
930
|
-
# Any translation unit that was parsed without error can be saved
|
931
|
-
# into a file. The translation unit can then be deserialized into a
|
932
|
-
# new \c CXTranslationUnit with \c clang_createTranslationUnit() or,
|
933
|
-
# if it is an incomplete translation unit that corresponds to a
|
934
|
-
# header, used as a precompiled header when parsing other translation
|
935
|
-
# units.
|
936
|
-
#
|
937
|
-
# @method save_translation_unit(tu, file_name, options)
|
938
|
-
# @param [TranslationUnitImpl] tu The translation unit to save.
|
939
|
-
# @param [String] file_name The file to which the translation unit will be saved.
|
940
|
-
# @param [Integer] options A bitmask of options that affects how the translation unit
|
941
|
-
# is saved. This should be a bitwise OR of the
|
942
|
-
# CXSaveTranslationUnit_XXX flags.
|
943
|
-
# @return [Integer] A value that will match one of the enumerators of the CXSaveError
|
944
|
-
# enumeration. Zero (CXSaveError_None) indicates that the translation unit was
|
945
|
-
# saved successfully, while a non-zero value indicates that a problem occurred.
|
946
|
-
# @scope class
|
947
|
-
attach_function :save_translation_unit, :clang_saveTranslationUnit, [TranslationUnitImpl, :string, :uint], :int
|
948
|
-
|
949
|
-
# Destroy the specified CXTranslationUnit object.
|
950
|
-
#
|
951
|
-
# @method dispose_translation_unit(translation_unit_impl)
|
952
|
-
# @param [TranslationUnitImpl] translation_unit_impl
|
953
|
-
# @return [nil]
|
954
|
-
# @scope class
|
955
|
-
attach_function :dispose_translation_unit, :clang_disposeTranslationUnit, [TranslationUnitImplStruct], :void
|
956
|
-
|
957
|
-
# Flags that control the reparsing of translation units.
|
958
|
-
#
|
959
|
-
# The enumerators in this enumeration type are meant to be bitwise
|
960
|
-
# ORed together to specify which options should be used when
|
961
|
-
# reparsing the translation unit.
|
962
|
-
#
|
963
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:reparse_flags).</em>
|
964
|
-
#
|
965
|
-
# === Options:
|
966
|
-
# :reparse_none ::
|
967
|
-
# Used to indicate that no special reparsing options are needed.
|
968
|
-
#
|
969
|
-
# @method _enum_reparse_flags_
|
970
|
-
# @return [Symbol]
|
971
|
-
# @scope class
|
972
|
-
enum :reparse_flags, [
|
973
|
-
:reparse_none, 0x0
|
974
|
-
]
|
975
|
-
|
976
|
-
# Returns the set of flags that is suitable for reparsing a translation
|
977
|
-
# unit.
|
978
|
-
#
|
979
|
-
# The set of flags returned provide options for
|
980
|
-
# \c clang_reparseTranslationUnit() by default. The returned flag
|
981
|
-
# set contains an unspecified set of optimizations geared toward common uses
|
982
|
-
# of reparsing. The set of optimizations enabled may change from one version
|
983
|
-
# to the next.
|
984
|
-
#
|
985
|
-
# @method default_reparse_options(tu)
|
986
|
-
# @param [TranslationUnitImpl] tu
|
987
|
-
# @return [Integer]
|
988
|
-
# @scope class
|
989
|
-
attach_function :default_reparse_options, :clang_defaultReparseOptions, [TranslationUnitImpl], :uint
|
990
|
-
|
991
|
-
# Reparse the source files that produced this translation unit.
|
992
|
-
#
|
993
|
-
# This routine can be used to re-parse the source files that originally
|
994
|
-
# created the given translation unit, for example because those source files
|
995
|
-
# have changed (either on disk or as passed via \p unsaved_files). The
|
996
|
-
# source code will be reparsed with the same command-line options as it
|
997
|
-
# was originally parsed.
|
998
|
-
#
|
999
|
-
# Reparsing a translation unit invalidates all cursors and source locations
|
1000
|
-
# that refer into that translation unit. This makes reparsing a translation
|
1001
|
-
# unit semantically equivalent to destroying the translation unit and then
|
1002
|
-
# creating a new translation unit with the same command-line arguments.
|
1003
|
-
# However, it may be more efficient to reparse a translation
|
1004
|
-
# unit using this routine.
|
1005
|
-
#
|
1006
|
-
# @method reparse_translation_unit(tu, num_unsaved_files, unsaved_files, options)
|
1007
|
-
# @param [TranslationUnitImpl] tu The translation unit whose contents will be re-parsed. The
|
1008
|
-
# translation unit must originally have been built with
|
1009
|
-
# \c clang_createTranslationUnitFromSourceFile().
|
1010
|
-
# @param [Integer] num_unsaved_files The number of unsaved file entries in \p
|
1011
|
-
# unsaved_files.
|
1012
|
-
# @param [UnsavedFile] unsaved_files The files that have not yet been saved to disk
|
1013
|
-
# but may be required for parsing, including the contents of
|
1014
|
-
# those files. The contents and name of these files (as specified by
|
1015
|
-
# CXUnsavedFile) are copied when necessary, so the client only needs to
|
1016
|
-
# guarantee their validity until the call to this function returns.
|
1017
|
-
# @param [Integer] options A bitset of options composed of the flags in CXReparse_Flags.
|
1018
|
-
# The function \c clang_defaultReparseOptions() produces a default set of
|
1019
|
-
# options recommended for most uses, based on the translation unit.
|
1020
|
-
# @return [Integer] 0 if the sources could be reparsed. A non-zero value will be
|
1021
|
-
# returned if reparsing was impossible, such that the translation unit is
|
1022
|
-
# invalid. In such cases, the only valid call for \p TU is
|
1023
|
-
# \c clang_disposeTranslationUnit(TU).
|
1024
|
-
# @scope class
|
1025
|
-
attach_function :reparse_translation_unit, :clang_reparseTranslationUnit, [TranslationUnitImpl, :uint, UnsavedFile, :uint], :int
|
1026
|
-
|
1027
|
-
# Categorizes how memory is being used by a translation unit.
|
1028
|
-
#
|
1029
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:tu_resource_usage_kind).</em>
|
1030
|
-
#
|
1031
|
-
# === Options:
|
1032
|
-
# :ast ::
|
1033
|
-
#
|
1034
|
-
# :identifiers ::
|
1035
|
-
#
|
1036
|
-
# :selectors ::
|
1037
|
-
#
|
1038
|
-
# :global_completion_results ::
|
1039
|
-
#
|
1040
|
-
# :source_manager_content_cache ::
|
1041
|
-
#
|
1042
|
-
# :ast_side_tables ::
|
1043
|
-
#
|
1044
|
-
# :source_manager_membuffer_malloc ::
|
1045
|
-
#
|
1046
|
-
# :source_manager_membuffer_m_map ::
|
1047
|
-
#
|
1048
|
-
# :external_ast_source_membuffer_malloc ::
|
1049
|
-
#
|
1050
|
-
# :external_ast_source_membuffer_m_map ::
|
1051
|
-
#
|
1052
|
-
# :preprocessor ::
|
1053
|
-
#
|
1054
|
-
# :preprocessing_record ::
|
1055
|
-
#
|
1056
|
-
# :source_manager_data_structures ::
|
1057
|
-
#
|
1058
|
-
# :preprocessor_header_search ::
|
1059
|
-
#
|
1060
|
-
#
|
1061
|
-
# @method _enum_tu_resource_usage_kind_
|
1062
|
-
# @return [Symbol]
|
1063
|
-
# @scope class
|
1064
|
-
enum :tu_resource_usage_kind, [
|
1065
|
-
:ast, 1,
|
1066
|
-
:identifiers, 2,
|
1067
|
-
:selectors, 3,
|
1068
|
-
:global_completion_results, 4,
|
1069
|
-
:source_manager_content_cache, 5,
|
1070
|
-
:ast_side_tables, 6,
|
1071
|
-
:source_manager_membuffer_malloc, 7,
|
1072
|
-
:source_manager_membuffer_m_map, 8,
|
1073
|
-
:external_ast_source_membuffer_malloc, 9,
|
1074
|
-
:external_ast_source_membuffer_m_map, 10,
|
1075
|
-
:preprocessor, 11,
|
1076
|
-
:preprocessing_record, 12,
|
1077
|
-
:source_manager_data_structures, 13,
|
1078
|
-
:preprocessor_header_search, 14
|
1079
|
-
]
|
1080
|
-
|
1081
|
-
# Returns the human-readable null-terminated C string that represents
|
1082
|
-
# the name of the memory category. This string should never be freed.
|
1083
|
-
#
|
1084
|
-
# @method get_tu_resource_usage_name(kind)
|
1085
|
-
# @param [Symbol from _enum_tu_resource_usage_kind_] kind
|
1086
|
-
# @return [String]
|
1087
|
-
# @scope class
|
1088
|
-
attach_function :get_tu_resource_usage_name, :clang_getTUResourceUsageName, [:tu_resource_usage_kind], :string
|
1089
|
-
|
1090
|
-
# (Not documented)
|
1091
|
-
#
|
1092
|
-
# = Fields:
|
1093
|
-
# :kind ::
|
1094
|
-
# (Symbol from _enum_tu_resource_usage_kind_) The memory usage category.
|
1095
|
-
# :amount ::
|
1096
|
-
# (Integer) Amount of resources used.
|
1097
|
-
# The units will depend on the resource kind.
|
1098
|
-
class TUResourceUsageEntry < FFI::Struct
|
1099
|
-
layout :kind, :tu_resource_usage_kind,
|
1100
|
-
:amount, :ulong
|
1101
|
-
end
|
1102
|
-
|
1103
|
-
# The memory usage of a CXTranslationUnit, broken into categories.
|
1104
|
-
#
|
1105
|
-
# = Fields:
|
1106
|
-
# :data ::
|
1107
|
-
# (FFI::Pointer(*Void)) Private data member, used for queries.
|
1108
|
-
# :num_entries ::
|
1109
|
-
# (Integer) The number of entries in the 'entries' array.
|
1110
|
-
# :entries ::
|
1111
|
-
# (TUResourceUsageEntry) An array of key-value pairs, representing the breakdown of memory
|
1112
|
-
# usage.
|
1113
|
-
class TUResourceUsage < FFI::Struct
|
1114
|
-
layout :data, :pointer,
|
1115
|
-
:num_entries, :uint,
|
1116
|
-
:entries, TUResourceUsageEntry
|
1117
|
-
end
|
1118
|
-
|
1119
|
-
# Return the memory usage of a translation unit. This object
|
1120
|
-
# should be released with clang_disposeCXTUResourceUsage().
|
1121
|
-
#
|
1122
|
-
# @method get_cxtu_resource_usage(tu)
|
1123
|
-
# @param [TranslationUnitImpl] tu
|
1124
|
-
# @return [TUResourceUsage]
|
1125
|
-
# @scope class
|
1126
|
-
attach_function :get_cxtu_resource_usage, :clang_getCXTUResourceUsage, [TranslationUnitImpl], TUResourceUsage.by_value
|
1127
|
-
|
1128
|
-
# (Not documented)
|
1129
|
-
#
|
1130
|
-
# @method dispose_cxtu_resource_usage(usage)
|
1131
|
-
# @param [TUResourceUsage] usage
|
1132
|
-
# @return [nil]
|
1133
|
-
# @scope class
|
1134
|
-
attach_function :dispose_cxtu_resource_usage, :clang_disposeCXTUResourceUsage, [TUResourceUsage.by_value], :void
|
1135
|
-
|
1136
|
-
# Describes the kind of entity that a cursor refers to.
|
1137
|
-
#
|
1138
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:cursor_kind).</em>
|
1139
|
-
#
|
1140
|
-
# === Options:
|
1141
|
-
# :unexposed_decl ::
|
1142
|
-
# A declaration whose specific kind is not exposed via this
|
1143
|
-
# interface.
|
1144
|
-
#
|
1145
|
-
# Unexposed declarations have the same operations as any other kind
|
1146
|
-
# of declaration; one can extract their location information,
|
1147
|
-
# spelling, find their definitions, etc. However, the specific kind
|
1148
|
-
# of the declaration is not reported.
|
1149
|
-
# :struct_decl ::
|
1150
|
-
# A C or C++ struct.
|
1151
|
-
# :union_decl ::
|
1152
|
-
# A C or C++ union.
|
1153
|
-
# :class_decl ::
|
1154
|
-
# A C++ class.
|
1155
|
-
# :enum_decl ::
|
1156
|
-
# An enumeration.
|
1157
|
-
# :field_decl ::
|
1158
|
-
# A field (in C) or non-static data member (in C++) in a
|
1159
|
-
# struct, union, or C++ class.
|
1160
|
-
# :enum_constant_decl ::
|
1161
|
-
# An enumerator constant.
|
1162
|
-
# :function_decl ::
|
1163
|
-
# A function.
|
1164
|
-
# :var_decl ::
|
1165
|
-
# A variable.
|
1166
|
-
# :parm_decl ::
|
1167
|
-
# A function or method parameter.
|
1168
|
-
# :obj_c_interface_decl ::
|
1169
|
-
# An Objective-C @interface.
|
1170
|
-
# :obj_c_category_decl ::
|
1171
|
-
# An Objective-C @interface for a category.
|
1172
|
-
# :obj_c_protocol_decl ::
|
1173
|
-
# An Objective-C @protocol declaration.
|
1174
|
-
# :obj_c_property_decl ::
|
1175
|
-
# An Objective-C @property declaration.
|
1176
|
-
# :obj_c_ivar_decl ::
|
1177
|
-
# An Objective-C instance variable.
|
1178
|
-
# :obj_c_instance_method_decl ::
|
1179
|
-
# An Objective-C instance method.
|
1180
|
-
# :obj_c_class_method_decl ::
|
1181
|
-
# An Objective-C class method.
|
1182
|
-
# :obj_c_implementation_decl ::
|
1183
|
-
# An Objective-C @implementation.
|
1184
|
-
# :obj_c_category_impl_decl ::
|
1185
|
-
# An Objective-C @implementation for a category.
|
1186
|
-
# :typedef_decl ::
|
1187
|
-
# A typedef
|
1188
|
-
# :x_method ::
|
1189
|
-
# A C++ class method.
|
1190
|
-
# :namespace ::
|
1191
|
-
# A C++ namespace.
|
1192
|
-
# :linkage_spec ::
|
1193
|
-
# A linkage specification, e.g. 'extern "C"'.
|
1194
|
-
# :constructor ::
|
1195
|
-
# A C++ constructor.
|
1196
|
-
# :destructor ::
|
1197
|
-
# A C++ destructor.
|
1198
|
-
# :conversion_function ::
|
1199
|
-
# A C++ conversion function.
|
1200
|
-
# :template_type_parameter ::
|
1201
|
-
# A C++ template type parameter.
|
1202
|
-
# :non_type_template_parameter ::
|
1203
|
-
# A C++ non-type template parameter.
|
1204
|
-
# :template_template_parameter ::
|
1205
|
-
# A C++ template template parameter.
|
1206
|
-
# :function_template ::
|
1207
|
-
# A C++ function template.
|
1208
|
-
# :class_template ::
|
1209
|
-
# A C++ class template.
|
1210
|
-
# :class_template_partial_specialization ::
|
1211
|
-
# A C++ class template partial specialization.
|
1212
|
-
# :namespace_alias ::
|
1213
|
-
# A C++ namespace alias declaration.
|
1214
|
-
# :using_directive ::
|
1215
|
-
# A C++ using directive.
|
1216
|
-
# :using_declaration ::
|
1217
|
-
# A C++ using declaration.
|
1218
|
-
# :type_alias_decl ::
|
1219
|
-
# A C++ alias declaration
|
1220
|
-
# :obj_c_synthesize_decl ::
|
1221
|
-
# An Objective-C @synthesize definition.
|
1222
|
-
# :obj_c_dynamic_decl ::
|
1223
|
-
# An Objective-C @dynamic definition.
|
1224
|
-
# :x_access_specifier ::
|
1225
|
-
# An access specifier.
|
1226
|
-
# :first_ref ::
|
1227
|
-
# References
|
1228
|
-
# :obj_c_super_class_ref ::
|
1229
|
-
# Decl references
|
1230
|
-
# :obj_c_protocol_ref ::
|
1231
|
-
#
|
1232
|
-
# :obj_c_class_ref ::
|
1233
|
-
#
|
1234
|
-
# :type_ref ::
|
1235
|
-
# A reference to a type declaration.
|
1236
|
-
#
|
1237
|
-
# A type reference occurs anywhere where a type is named but not
|
1238
|
-
# declared. For example, given:
|
1239
|
-
#
|
1240
|
-
# \code
|
1241
|
-
# typedef unsigned size_type;
|
1242
|
-
# size_type size;
|
1243
|
-
# \endcode
|
1244
|
-
#
|
1245
|
-
# The typedef is a declaration of size_type (CXCursor_TypedefDecl),
|
1246
|
-
# while the type of the variable "size" is referenced. The cursor
|
1247
|
-
# referenced by the type of size is the typedef for size_type.
|
1248
|
-
# :x_base_specifier ::
|
1249
|
-
#
|
1250
|
-
# :template_ref ::
|
1251
|
-
# A reference to a class template, function template, template
|
1252
|
-
# template parameter, or class template partial specialization.
|
1253
|
-
# :namespace_ref ::
|
1254
|
-
# A reference to a namespace or namespace alias.
|
1255
|
-
# :member_ref ::
|
1256
|
-
# A reference to a member of a struct, union, or class that occurs in
|
1257
|
-
# some non-expression context, e.g., a designated initializer.
|
1258
|
-
# :label_ref ::
|
1259
|
-
# A reference to a labeled statement.
|
1260
|
-
#
|
1261
|
-
# This cursor kind is used to describe the jump to "start_over" in the
|
1262
|
-
# goto statement in the following example:
|
1263
|
-
#
|
1264
|
-
# \code
|
1265
|
-
# start_over:
|
1266
|
-
# ++counter;
|
1267
|
-
#
|
1268
|
-
# goto start_over;
|
1269
|
-
# \endcode
|
1270
|
-
#
|
1271
|
-
# A label reference cursor refers to a label statement.
|
1272
|
-
# :overloaded_decl_ref ::
|
1273
|
-
# A reference to a set of overloaded functions or function templates
|
1274
|
-
# that has not yet been resolved to a specific function or function template.
|
1275
|
-
#
|
1276
|
-
# An overloaded declaration reference cursor occurs in C++ templates where
|
1277
|
-
# a dependent name refers to a function. For example:
|
1278
|
-
#
|
1279
|
-
# \code
|
1280
|
-
# template<typename T> void swap(T&, T&);
|
1281
|
-
#
|
1282
|
-
# struct X { ... };
|
1283
|
-
# void swap(X&, X&);
|
1284
|
-
#
|
1285
|
-
# template<typename T>
|
1286
|
-
# void reverse(T* first, T* last) {
|
1287
|
-
# while (first < last - 1) {
|
1288
|
-
# swap(*first, *--last);
|
1289
|
-
# ++first;
|
1290
|
-
# }
|
1291
|
-
# }
|
1292
|
-
#
|
1293
|
-
# struct Y { };
|
1294
|
-
# void swap(Y&, Y&);
|
1295
|
-
# \endcode
|
1296
|
-
#
|
1297
|
-
# Here, the identifier "swap" is associated with an overloaded declaration
|
1298
|
-
# reference. In the template definition, "swap" refers to either of the two
|
1299
|
-
# "swap" functions declared above, so both results will be available. At
|
1300
|
-
# instantiation time, "swap" may also refer to other functions found via
|
1301
|
-
# argument-dependent lookup (e.g., the "swap" function at the end of the
|
1302
|
-
# example).
|
1303
|
-
#
|
1304
|
-
# The functions \c clang_getNumOverloadedDecls() and
|
1305
|
-
# \c clang_getOverloadedDecl() can be used to retrieve the definitions
|
1306
|
-
# referenced by this cursor.
|
1307
|
-
# :first_invalid ::
|
1308
|
-
# Error conditions
|
1309
|
-
# :invalid_file ::
|
1310
|
-
#
|
1311
|
-
# :no_decl_found ::
|
1312
|
-
#
|
1313
|
-
# :not_implemented ::
|
1314
|
-
#
|
1315
|
-
# :invalid_code ::
|
1316
|
-
#
|
1317
|
-
# :first_expr ::
|
1318
|
-
# Expressions
|
1319
|
-
# :unexposed_expr ::
|
1320
|
-
# An expression whose specific kind is not exposed via this
|
1321
|
-
# interface.
|
1322
|
-
#
|
1323
|
-
# Unexposed expressions have the same operations as any other kind
|
1324
|
-
# of expression; one can extract their location information,
|
1325
|
-
# spelling, children, etc. However, the specific kind of the
|
1326
|
-
# expression is not reported.
|
1327
|
-
# :decl_ref_expr ::
|
1328
|
-
# An expression that refers to some value declaration, such
|
1329
|
-
# as a function, varible, or enumerator.
|
1330
|
-
# :member_ref_expr ::
|
1331
|
-
# An expression that refers to a member of a struct, union,
|
1332
|
-
# class, Objective-C class, etc.
|
1333
|
-
# :call_expr ::
|
1334
|
-
# An expression that calls a function.
|
1335
|
-
# :obj_c_message_expr ::
|
1336
|
-
# An expression that sends a message to an Objective-C
|
1337
|
-
# object or class.
|
1338
|
-
# :block_expr ::
|
1339
|
-
# An expression that represents a block literal.
|
1340
|
-
# :integer_literal ::
|
1341
|
-
# An integer literal.
|
1342
|
-
# :floating_literal ::
|
1343
|
-
# A floating point number literal.
|
1344
|
-
# :imaginary_literal ::
|
1345
|
-
# An imaginary number literal.
|
1346
|
-
# :string_literal ::
|
1347
|
-
# A string literal.
|
1348
|
-
# :character_literal ::
|
1349
|
-
# A character literal.
|
1350
|
-
# :paren_expr ::
|
1351
|
-
# A parenthesized expression, e.g. "(1)".
|
1352
|
-
#
|
1353
|
-
# This AST node is only formed if full location information is requested.
|
1354
|
-
# :unary_operator ::
|
1355
|
-
# This represents the unary-expression's (except sizeof and
|
1356
|
-
# alignof).
|
1357
|
-
# :array_subscript_expr ::
|
1358
|
-
# (C99 6.5.2.1) Array Subscripting.
|
1359
|
-
# :binary_operator ::
|
1360
|
-
# A builtin binary operation expression such as "x + y" or
|
1361
|
-
# "x <= y".
|
1362
|
-
# :compound_assign_operator ::
|
1363
|
-
# Compound assignment such as "+=".
|
1364
|
-
# :conditional_operator ::
|
1365
|
-
# The ?: ternary operator.
|
1366
|
-
# :c_style_cast_expr ::
|
1367
|
-
# An explicit cast in C (C99 6.5.4) or a C-style cast in C++
|
1368
|
-
# (C++ (expr.cast)), which uses the syntax (Type)expr.
|
1369
|
-
#
|
1370
|
-
# For example: (int)f.
|
1371
|
-
# :compound_literal_expr ::
|
1372
|
-
# (C99 6.5.2.5)
|
1373
|
-
# :init_list_expr ::
|
1374
|
-
# Describes an C or C++ initializer list.
|
1375
|
-
# :addr_label_expr ::
|
1376
|
-
# The GNU address of label extension, representing &&label.
|
1377
|
-
# :stmt_expr ::
|
1378
|
-
# This is the GNU Statement Expression extension: ({int X=4; X;})
|
1379
|
-
# :generic_selection_expr ::
|
1380
|
-
# Represents a C1X generic selection.
|
1381
|
-
# :gnu_null_expr ::
|
1382
|
-
# Implements the GNU __null extension, which is a name for a null
|
1383
|
-
# pointer constant that has integral type (e.g., int or long) and is the same
|
1384
|
-
# size and alignment as a pointer.
|
1385
|
-
#
|
1386
|
-
# The __null extension is typically only used by system headers, which define
|
1387
|
-
# NULL as __null in C++ rather than using 0 (which is an integer that may not
|
1388
|
-
# match the size of a pointer).
|
1389
|
-
# :x_static_cast_expr ::
|
1390
|
-
# C++'s static_cast<> expression.
|
1391
|
-
# :x_dynamic_cast_expr ::
|
1392
|
-
# C++'s dynamic_cast<> expression.
|
1393
|
-
# :x_reinterpret_cast_expr ::
|
1394
|
-
# C++'s reinterpret_cast<> expression.
|
1395
|
-
# :x_const_cast_expr ::
|
1396
|
-
# C++'s const_cast<> expression.
|
1397
|
-
# :x_functional_cast_expr ::
|
1398
|
-
# Represents an explicit C++ type conversion that uses "functional"
|
1399
|
-
# notion (C++ (expr.type.conv)).
|
1400
|
-
#
|
1401
|
-
# Example:
|
1402
|
-
# \code
|
1403
|
-
# x = int(0.5);
|
1404
|
-
# \endcode
|
1405
|
-
# :x_typeid_expr ::
|
1406
|
-
# A C++ typeid expression (C++ (expr.typeid)).
|
1407
|
-
# :x_bool_literal_expr ::
|
1408
|
-
# (C++ 2.13.5) C++ Boolean Literal.
|
1409
|
-
# :x_null_ptr_literal_expr ::
|
1410
|
-
# (C++0x 2.14.7) C++ Pointer Literal.
|
1411
|
-
# :x_this_expr ::
|
1412
|
-
# Represents the "this" expression in C++
|
1413
|
-
# :x_throw_expr ::
|
1414
|
-
# (C++ 15) C++ Throw Expression.
|
1415
|
-
#
|
1416
|
-
# This handles 'throw' and 'throw' assignment-expression. When
|
1417
|
-
# assignment-expression isn't present, Op will be null.
|
1418
|
-
# :x_new_expr ::
|
1419
|
-
# A new expression for memory allocation and constructor calls, e.g:
|
1420
|
-
# "new CXXNewExpr(foo)".
|
1421
|
-
# :x_delete_expr ::
|
1422
|
-
# A delete expression for memory deallocation and destructor calls,
|
1423
|
-
# e.g. "delete() pArray".
|
1424
|
-
# :unary_expr ::
|
1425
|
-
# A unary expression.
|
1426
|
-
# :obj_c_string_literal ::
|
1427
|
-
# ObjCStringLiteral, used for Objective-C string literals i.e. "foo".
|
1428
|
-
# :obj_c_encode_expr ::
|
1429
|
-
# ObjCEncodeExpr, used for in Objective-C.
|
1430
|
-
# :obj_c_selector_expr ::
|
1431
|
-
# ObjCSelectorExpr used for in Objective-C.
|
1432
|
-
# :obj_c_protocol_expr ::
|
1433
|
-
# Objective-C's protocol expression.
|
1434
|
-
# :obj_c_bridged_cast_expr ::
|
1435
|
-
# An Objective-C "bridged" cast expression, which casts between
|
1436
|
-
# Objective-C pointers and C pointers, transferring ownership in the process.
|
1437
|
-
#
|
1438
|
-
# \code
|
1439
|
-
# NSString *str = (__bridge_transfer NSString *)CFCreateString();
|
1440
|
-
# \endcode
|
1441
|
-
# :pack_expansion_expr ::
|
1442
|
-
# Represents a C++0x pack expansion that produces a sequence of
|
1443
|
-
# expressions.
|
1444
|
-
#
|
1445
|
-
# A pack expansion expression contains a pattern (which itself is an
|
1446
|
-
# expression) followed by an ellipsis. For example:
|
1447
|
-
#
|
1448
|
-
# \code
|
1449
|
-
# template<typename F, typename ...Types>
|
1450
|
-
# void forward(F f, Types &&...args) {
|
1451
|
-
# f(static_cast<Types&&>(args)...);
|
1452
|
-
# }
|
1453
|
-
# \endcode
|
1454
|
-
# :size_of_pack_expr ::
|
1455
|
-
# Represents an expression that computes the length of a parameter
|
1456
|
-
# pack.
|
1457
|
-
#
|
1458
|
-
# \code
|
1459
|
-
# template<typename ...Types>
|
1460
|
-
# struct count {
|
1461
|
-
# static const unsigned value = sizeof...(Types);
|
1462
|
-
# };
|
1463
|
-
# \endcode
|
1464
|
-
# :first_stmt ::
|
1465
|
-
# Statements
|
1466
|
-
# :unexposed_stmt ::
|
1467
|
-
# A statement whose specific kind is not exposed via this
|
1468
|
-
# interface.
|
1469
|
-
#
|
1470
|
-
# Unexposed statements have the same operations as any other kind of
|
1471
|
-
# statement; one can extract their location information, spelling,
|
1472
|
-
# children, etc. However, the specific kind of the statement is not
|
1473
|
-
# reported.
|
1474
|
-
# :label_stmt ::
|
1475
|
-
# A labelled statement in a function.
|
1476
|
-
#
|
1477
|
-
# This cursor kind is used to describe the "start_over:" label statement in
|
1478
|
-
# the following example:
|
1479
|
-
#
|
1480
|
-
# \code
|
1481
|
-
# start_over:
|
1482
|
-
# ++counter;
|
1483
|
-
# \endcode
|
1484
|
-
# :compound_stmt ::
|
1485
|
-
# A group of statements like { stmt stmt }.
|
1486
|
-
#
|
1487
|
-
# This cursor kind is used to describe compound statements, e.g. function
|
1488
|
-
# bodies.
|
1489
|
-
# :case_stmt ::
|
1490
|
-
# A case statment.
|
1491
|
-
# :default_stmt ::
|
1492
|
-
# A default statement.
|
1493
|
-
# :if_stmt ::
|
1494
|
-
# An if statement
|
1495
|
-
# :switch_stmt ::
|
1496
|
-
# A switch statement.
|
1497
|
-
# :while_stmt ::
|
1498
|
-
# A while statement.
|
1499
|
-
# :do_stmt ::
|
1500
|
-
# A do statement.
|
1501
|
-
# :for_stmt ::
|
1502
|
-
# A for statement.
|
1503
|
-
# :goto_stmt ::
|
1504
|
-
# A goto statement.
|
1505
|
-
# :indirect_goto_stmt ::
|
1506
|
-
# An indirect goto statement.
|
1507
|
-
# :continue_stmt ::
|
1508
|
-
# A continue statement.
|
1509
|
-
# :break_stmt ::
|
1510
|
-
# A break statement.
|
1511
|
-
# :return_stmt ::
|
1512
|
-
# A return statement.
|
1513
|
-
# :asm_stmt ::
|
1514
|
-
# A GNU inline assembly statement extension.
|
1515
|
-
# :obj_c_at_try_stmt ::
|
1516
|
-
# Objective-C's overall @try-@catc-@finall statement.
|
1517
|
-
# :obj_c_at_catch_stmt ::
|
1518
|
-
# Objective-C's @catch statement.
|
1519
|
-
# :obj_c_at_finally_stmt ::
|
1520
|
-
# Objective-C's @finally statement.
|
1521
|
-
# :obj_c_at_throw_stmt ::
|
1522
|
-
# Objective-C's @throw statement.
|
1523
|
-
# :obj_c_at_synchronized_stmt ::
|
1524
|
-
# Objective-C's @synchronized statement.
|
1525
|
-
# :obj_c_autorelease_pool_stmt ::
|
1526
|
-
# Objective-C's autorelease pool statement.
|
1527
|
-
# :obj_c_for_collection_stmt ::
|
1528
|
-
# Objective-C's collection statement.
|
1529
|
-
# :x_catch_stmt ::
|
1530
|
-
# C++'s catch statement.
|
1531
|
-
# :x_try_stmt ::
|
1532
|
-
# C++'s try statement.
|
1533
|
-
# :x_for_range_stmt ::
|
1534
|
-
# C++'s for (* : *) statement.
|
1535
|
-
# :seh_try_stmt ::
|
1536
|
-
# Windows Structured Exception Handling's try statement.
|
1537
|
-
# :seh_except_stmt ::
|
1538
|
-
# Windows Structured Exception Handling's except statement.
|
1539
|
-
# :seh_finally_stmt ::
|
1540
|
-
# Windows Structured Exception Handling's finally statement.
|
1541
|
-
# :null_stmt ::
|
1542
|
-
# The null satement ";": C99 6.8.3p3.
|
1543
|
-
#
|
1544
|
-
# This cursor kind is used to describe the null statement.
|
1545
|
-
# :decl_stmt ::
|
1546
|
-
# Adaptor class for mixing declarations with statements and
|
1547
|
-
# expressions.
|
1548
|
-
# :translation_unit ::
|
1549
|
-
# Cursor that represents the translation unit itself.
|
1550
|
-
#
|
1551
|
-
# The translation unit cursor exists primarily to act as the root
|
1552
|
-
# cursor for traversing the contents of a translation unit.
|
1553
|
-
# :first_attr ::
|
1554
|
-
# Attributes
|
1555
|
-
# :unexposed_attr ::
|
1556
|
-
# An attribute whose specific kind is not exposed via this
|
1557
|
-
# interface.
|
1558
|
-
# :ib_action_attr ::
|
1559
|
-
#
|
1560
|
-
# :ib_outlet_attr ::
|
1561
|
-
#
|
1562
|
-
# :ib_outlet_collection_attr ::
|
1563
|
-
#
|
1564
|
-
# :x_final_attr ::
|
1565
|
-
#
|
1566
|
-
# :x_override_attr ::
|
1567
|
-
#
|
1568
|
-
# :annotate_attr ::
|
1569
|
-
#
|
1570
|
-
# :preprocessing_directive ::
|
1571
|
-
# Preprocessing
|
1572
|
-
# :macro_definition ::
|
1573
|
-
#
|
1574
|
-
# :macro_expansion ::
|
1575
|
-
#
|
1576
|
-
# :inclusion_directive ::
|
1577
|
-
#
|
1578
|
-
#
|
1579
|
-
# @method _enum_cursor_kind_
|
1580
|
-
# @return [Symbol]
|
1581
|
-
# @scope class
|
1582
|
-
enum :cursor_kind, [
|
1583
|
-
:unexposed_decl, 1,
|
1584
|
-
:struct_decl, 2,
|
1585
|
-
:union_decl, 3,
|
1586
|
-
:class_decl, 4,
|
1587
|
-
:enum_decl, 5,
|
1588
|
-
:field_decl, 6,
|
1589
|
-
:enum_constant_decl, 7,
|
1590
|
-
:function_decl, 8,
|
1591
|
-
:var_decl, 9,
|
1592
|
-
:parm_decl, 10,
|
1593
|
-
:obj_c_interface_decl, 11,
|
1594
|
-
:obj_c_category_decl, 12,
|
1595
|
-
:obj_c_protocol_decl, 13,
|
1596
|
-
:obj_c_property_decl, 14,
|
1597
|
-
:obj_c_ivar_decl, 15,
|
1598
|
-
:obj_c_instance_method_decl, 16,
|
1599
|
-
:obj_c_class_method_decl, 17,
|
1600
|
-
:obj_c_implementation_decl, 18,
|
1601
|
-
:obj_c_category_impl_decl, 19,
|
1602
|
-
:typedef_decl, 20,
|
1603
|
-
:x_method, 21,
|
1604
|
-
:namespace, 22,
|
1605
|
-
:linkage_spec, 23,
|
1606
|
-
:constructor, 24,
|
1607
|
-
:destructor, 25,
|
1608
|
-
:conversion_function, 26,
|
1609
|
-
:template_type_parameter, 27,
|
1610
|
-
:non_type_template_parameter, 28,
|
1611
|
-
:template_template_parameter, 29,
|
1612
|
-
:function_template, 30,
|
1613
|
-
:class_template, 31,
|
1614
|
-
:class_template_partial_specialization, 32,
|
1615
|
-
:namespace_alias, 33,
|
1616
|
-
:using_directive, 34,
|
1617
|
-
:using_declaration, 35,
|
1618
|
-
:type_alias_decl, 36,
|
1619
|
-
:obj_c_synthesize_decl, 37,
|
1620
|
-
:obj_c_dynamic_decl, 38,
|
1621
|
-
:x_access_specifier, 39,
|
1622
|
-
:first_ref, 40,
|
1623
|
-
:obj_c_super_class_ref, 40,
|
1624
|
-
:obj_c_protocol_ref, 41,
|
1625
|
-
:obj_c_class_ref, 42,
|
1626
|
-
:type_ref, 43,
|
1627
|
-
:x_base_specifier, 44,
|
1628
|
-
:template_ref, 45,
|
1629
|
-
:namespace_ref, 46,
|
1630
|
-
:member_ref, 47,
|
1631
|
-
:label_ref, 48,
|
1632
|
-
:overloaded_decl_ref, 49,
|
1633
|
-
:first_invalid, 70,
|
1634
|
-
:invalid_file, 70,
|
1635
|
-
:no_decl_found, 71,
|
1636
|
-
:not_implemented, 72,
|
1637
|
-
:invalid_code, 73,
|
1638
|
-
:first_expr, 100,
|
1639
|
-
:unexposed_expr, 100,
|
1640
|
-
:decl_ref_expr, 101,
|
1641
|
-
:member_ref_expr, 102,
|
1642
|
-
:call_expr, 103,
|
1643
|
-
:obj_c_message_expr, 104,
|
1644
|
-
:block_expr, 105,
|
1645
|
-
:integer_literal, 106,
|
1646
|
-
:floating_literal, 107,
|
1647
|
-
:imaginary_literal, 108,
|
1648
|
-
:string_literal, 109,
|
1649
|
-
:character_literal, 110,
|
1650
|
-
:paren_expr, 111,
|
1651
|
-
:unary_operator, 112,
|
1652
|
-
:array_subscript_expr, 113,
|
1653
|
-
:binary_operator, 114,
|
1654
|
-
:compound_assign_operator, 115,
|
1655
|
-
:conditional_operator, 116,
|
1656
|
-
:c_style_cast_expr, 117,
|
1657
|
-
:compound_literal_expr, 118,
|
1658
|
-
:init_list_expr, 119,
|
1659
|
-
:addr_label_expr, 120,
|
1660
|
-
:stmt_expr, 121,
|
1661
|
-
:generic_selection_expr, 122,
|
1662
|
-
:gnu_null_expr, 123,
|
1663
|
-
:x_static_cast_expr, 124,
|
1664
|
-
:x_dynamic_cast_expr, 125,
|
1665
|
-
:x_reinterpret_cast_expr, 126,
|
1666
|
-
:x_const_cast_expr, 127,
|
1667
|
-
:x_functional_cast_expr, 128,
|
1668
|
-
:x_typeid_expr, 129,
|
1669
|
-
:x_bool_literal_expr, 130,
|
1670
|
-
:x_null_ptr_literal_expr, 131,
|
1671
|
-
:x_this_expr, 132,
|
1672
|
-
:x_throw_expr, 133,
|
1673
|
-
:x_new_expr, 134,
|
1674
|
-
:x_delete_expr, 135,
|
1675
|
-
:unary_expr, 136,
|
1676
|
-
:obj_c_string_literal, 137,
|
1677
|
-
:obj_c_encode_expr, 138,
|
1678
|
-
:obj_c_selector_expr, 139,
|
1679
|
-
:obj_c_protocol_expr, 140,
|
1680
|
-
:obj_c_bridged_cast_expr, 141,
|
1681
|
-
:pack_expansion_expr, 142,
|
1682
|
-
:size_of_pack_expr, 143,
|
1683
|
-
:first_stmt, 200,
|
1684
|
-
:unexposed_stmt, 200,
|
1685
|
-
:label_stmt, 201,
|
1686
|
-
:compound_stmt, 202,
|
1687
|
-
:case_stmt, 203,
|
1688
|
-
:default_stmt, 204,
|
1689
|
-
:if_stmt, 205,
|
1690
|
-
:switch_stmt, 206,
|
1691
|
-
:while_stmt, 207,
|
1692
|
-
:do_stmt, 208,
|
1693
|
-
:for_stmt, 209,
|
1694
|
-
:goto_stmt, 210,
|
1695
|
-
:indirect_goto_stmt, 211,
|
1696
|
-
:continue_stmt, 212,
|
1697
|
-
:break_stmt, 213,
|
1698
|
-
:return_stmt, 214,
|
1699
|
-
:asm_stmt, 215,
|
1700
|
-
:obj_c_at_try_stmt, 216,
|
1701
|
-
:obj_c_at_catch_stmt, 217,
|
1702
|
-
:obj_c_at_finally_stmt, 218,
|
1703
|
-
:obj_c_at_throw_stmt, 219,
|
1704
|
-
:obj_c_at_synchronized_stmt, 220,
|
1705
|
-
:obj_c_autorelease_pool_stmt, 221,
|
1706
|
-
:obj_c_for_collection_stmt, 222,
|
1707
|
-
:x_catch_stmt, 223,
|
1708
|
-
:x_try_stmt, 224,
|
1709
|
-
:x_for_range_stmt, 225,
|
1710
|
-
:seh_try_stmt, 226,
|
1711
|
-
:seh_except_stmt, 227,
|
1712
|
-
:seh_finally_stmt, 228,
|
1713
|
-
:null_stmt, 230,
|
1714
|
-
:decl_stmt, 231,
|
1715
|
-
:translation_unit, 300,
|
1716
|
-
:first_attr, 400,
|
1717
|
-
:unexposed_attr, 400,
|
1718
|
-
:ib_action_attr, 401,
|
1719
|
-
:ib_outlet_attr, 402,
|
1720
|
-
:ib_outlet_collection_attr, 403,
|
1721
|
-
:x_final_attr, 404,
|
1722
|
-
:x_override_attr, 405,
|
1723
|
-
:annotate_attr, 406,
|
1724
|
-
:preprocessing_directive, 500,
|
1725
|
-
:macro_definition, 501,
|
1726
|
-
:macro_expansion, 502,
|
1727
|
-
:inclusion_directive, 503
|
1728
|
-
]
|
1729
|
-
|
1730
|
-
# A cursor representing some element in the abstract syntax tree for
|
1731
|
-
# a translation unit.
|
1732
|
-
#
|
1733
|
-
# The cursor abstraction unifies the different kinds of entities in a
|
1734
|
-
# program--declaration, statements, expressions, references to declarations,
|
1735
|
-
# etc.--under a single "cursor" abstraction with a common set of operations.
|
1736
|
-
# Common operation for a cursor include: getting the physical location in
|
1737
|
-
# a source file where the cursor points, getting the name associated with a
|
1738
|
-
# cursor, and retrieving cursors for any child nodes of a particular cursor.
|
1739
|
-
#
|
1740
|
-
# Cursors can be produced in two specific ways.
|
1741
|
-
# clang_getTranslationUnitCursor() produces a cursor for a translation unit,
|
1742
|
-
# from which one can use clang_visitChildren() to explore the rest of the
|
1743
|
-
# translation unit. clang_getCursor() maps from a physical source location
|
1744
|
-
# to the entity that resides at that location, allowing one to map from the
|
1745
|
-
# source code into the AST.
|
1746
|
-
#
|
1747
|
-
# = Fields:
|
1748
|
-
# :kind ::
|
1749
|
-
# (Symbol from _enum_cursor_kind_)
|
1750
|
-
# :xdata ::
|
1751
|
-
# (Integer)
|
1752
|
-
# :data ::
|
1753
|
-
# (Array<FFI::Pointer(*Void)>)
|
1754
|
-
class Cursor < FFI::Struct
|
1755
|
-
layout :kind, :cursor_kind,
|
1756
|
-
:xdata, :int,
|
1757
|
-
:data, [:pointer, 3]
|
1758
|
-
end
|
1759
|
-
|
1760
|
-
# Retrieve the NULL cursor, which represents no entity.
|
1761
|
-
#
|
1762
|
-
# @method get_null_cursor()
|
1763
|
-
# @return [Cursor]
|
1764
|
-
# @scope class
|
1765
|
-
attach_function :get_null_cursor, :clang_getNullCursor, [], Cursor.by_value
|
1766
|
-
|
1767
|
-
# Retrieve the cursor that represents the given translation unit.
|
1768
|
-
#
|
1769
|
-
# The translation unit cursor can be used to start traversing the
|
1770
|
-
# various declarations within the given translation unit.
|
1771
|
-
#
|
1772
|
-
# @method get_translation_unit_cursor(translation_unit_impl)
|
1773
|
-
# @param [TranslationUnitImpl] translation_unit_impl
|
1774
|
-
# @return [Cursor]
|
1775
|
-
# @scope class
|
1776
|
-
attach_function :get_translation_unit_cursor, :clang_getTranslationUnitCursor, [TranslationUnitImpl], Cursor.by_value
|
1777
|
-
|
1778
|
-
# Determine whether two cursors are equivalent.
|
1779
|
-
#
|
1780
|
-
# @method equal_cursors(cursor, cursor)
|
1781
|
-
# @param [Cursor] cursor
|
1782
|
-
# @param [Cursor] cursor
|
1783
|
-
# @return [Integer]
|
1784
|
-
# @scope class
|
1785
|
-
attach_function :equal_cursors, :clang_equalCursors, [Cursor.by_value, Cursor.by_value], :uint
|
1786
|
-
|
1787
|
-
# Returns non-zero if \arg cursor is null.
|
1788
|
-
#
|
1789
|
-
# @method cursor_is_null(cursor)
|
1790
|
-
# @param [Cursor] cursor
|
1791
|
-
# @return [Integer]
|
1792
|
-
# @scope class
|
1793
|
-
attach_function :cursor_is_null, :clang_Cursor_isNull, [Cursor.by_value], :int
|
1794
|
-
|
1795
|
-
# Compute a hash value for the given cursor.
|
1796
|
-
#
|
1797
|
-
# @method hash_cursor(cursor)
|
1798
|
-
# @param [Cursor] cursor
|
1799
|
-
# @return [Integer]
|
1800
|
-
# @scope class
|
1801
|
-
attach_function :hash_cursor, :clang_hashCursor, [Cursor.by_value], :uint
|
1802
|
-
|
1803
|
-
# Retrieve the kind of the given cursor.
|
1804
|
-
#
|
1805
|
-
# @method get_cursor_kind(cursor)
|
1806
|
-
# @param [Cursor] cursor
|
1807
|
-
# @return [Symbol from _enum_cursor_kind_]
|
1808
|
-
# @scope class
|
1809
|
-
attach_function :get_cursor_kind, :clang_getCursorKind, [Cursor.by_value], :cursor_kind
|
1810
|
-
|
1811
|
-
# Determine whether the given cursor kind represents a declaration.
|
1812
|
-
#
|
1813
|
-
# @method is_declaration(cursor_kind)
|
1814
|
-
# @param [Symbol from _enum_cursor_kind_] cursor_kind
|
1815
|
-
# @return [Integer]
|
1816
|
-
# @scope class
|
1817
|
-
attach_function :is_declaration, :clang_isDeclaration, [:cursor_kind], :uint
|
1818
|
-
|
1819
|
-
# Determine whether the given cursor kind represents a simple
|
1820
|
-
# reference.
|
1821
|
-
#
|
1822
|
-
# Note that other kinds of cursors (such as expressions) can also refer to
|
1823
|
-
# other cursors. Use clang_getCursorReferenced() to determine whether a
|
1824
|
-
# particular cursor refers to another entity.
|
1825
|
-
#
|
1826
|
-
# @method is_reference(cursor_kind)
|
1827
|
-
# @param [Symbol from _enum_cursor_kind_] cursor_kind
|
1828
|
-
# @return [Integer]
|
1829
|
-
# @scope class
|
1830
|
-
attach_function :is_reference, :clang_isReference, [:cursor_kind], :uint
|
1831
|
-
|
1832
|
-
# Determine whether the given cursor kind represents an expression.
|
1833
|
-
#
|
1834
|
-
# @method is_expression(cursor_kind)
|
1835
|
-
# @param [Symbol from _enum_cursor_kind_] cursor_kind
|
1836
|
-
# @return [Integer]
|
1837
|
-
# @scope class
|
1838
|
-
attach_function :is_expression, :clang_isExpression, [:cursor_kind], :uint
|
1839
|
-
|
1840
|
-
# Determine whether the given cursor kind represents a statement.
|
1841
|
-
#
|
1842
|
-
# @method is_statement(cursor_kind)
|
1843
|
-
# @param [Symbol from _enum_cursor_kind_] cursor_kind
|
1844
|
-
# @return [Integer]
|
1845
|
-
# @scope class
|
1846
|
-
attach_function :is_statement, :clang_isStatement, [:cursor_kind], :uint
|
1847
|
-
|
1848
|
-
# Determine whether the given cursor kind represents an attribute.
|
1849
|
-
#
|
1850
|
-
# @method is_attribute(cursor_kind)
|
1851
|
-
# @param [Symbol from _enum_cursor_kind_] cursor_kind
|
1852
|
-
# @return [Integer]
|
1853
|
-
# @scope class
|
1854
|
-
attach_function :is_attribute, :clang_isAttribute, [:cursor_kind], :uint
|
1855
|
-
|
1856
|
-
# Determine whether the given cursor kind represents an invalid
|
1857
|
-
# cursor.
|
1858
|
-
#
|
1859
|
-
# @method is_invalid(cursor_kind)
|
1860
|
-
# @param [Symbol from _enum_cursor_kind_] cursor_kind
|
1861
|
-
# @return [Integer]
|
1862
|
-
# @scope class
|
1863
|
-
attach_function :is_invalid, :clang_isInvalid, [:cursor_kind], :uint
|
1864
|
-
|
1865
|
-
# Determine whether the given cursor kind represents a translation
|
1866
|
-
# unit.
|
1867
|
-
#
|
1868
|
-
# @method is_translation_unit(cursor_kind)
|
1869
|
-
# @param [Symbol from _enum_cursor_kind_] cursor_kind
|
1870
|
-
# @return [Integer]
|
1871
|
-
# @scope class
|
1872
|
-
attach_function :is_translation_unit, :clang_isTranslationUnit, [:cursor_kind], :uint
|
1873
|
-
|
1874
|
-
# Determine whether the given cursor represents a preprocessing
|
1875
|
-
# element, such as a preprocessor directive or macro instantiation.
|
1876
|
-
#
|
1877
|
-
# @method is_preprocessing(cursor_kind)
|
1878
|
-
# @param [Symbol from _enum_cursor_kind_] cursor_kind
|
1879
|
-
# @return [Integer]
|
1880
|
-
# @scope class
|
1881
|
-
attach_function :is_preprocessing, :clang_isPreprocessing, [:cursor_kind], :uint
|
1882
|
-
|
1883
|
-
# Determine whether the given cursor represents a currently
|
1884
|
-
# unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
|
1885
|
-
#
|
1886
|
-
# @method is_unexposed(cursor_kind)
|
1887
|
-
# @param [Symbol from _enum_cursor_kind_] cursor_kind
|
1888
|
-
# @return [Integer]
|
1889
|
-
# @scope class
|
1890
|
-
attach_function :is_unexposed, :clang_isUnexposed, [:cursor_kind], :uint
|
1891
|
-
|
1892
|
-
# Describe the linkage of the entity referred to by a cursor.
|
1893
|
-
#
|
1894
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:linkage_kind).</em>
|
1895
|
-
#
|
1896
|
-
# === Options:
|
1897
|
-
# :invalid ::
|
1898
|
-
# This value indicates that no linkage information is available
|
1899
|
-
# for a provided CXCursor.
|
1900
|
-
# :no_linkage ::
|
1901
|
-
# This is the linkage for variables, parameters, and so on that
|
1902
|
-
# have automatic storage. This covers normal (non-extern) local variables.
|
1903
|
-
# :internal ::
|
1904
|
-
# This is the linkage for static variables and static functions.
|
1905
|
-
# :unique_external ::
|
1906
|
-
# This is the linkage for entities with external linkage that live
|
1907
|
-
# in C++ anonymous namespaces.
|
1908
|
-
# :external ::
|
1909
|
-
# This is the linkage for entities with true, external linkage.
|
1910
|
-
#
|
1911
|
-
# @method _enum_linkage_kind_
|
1912
|
-
# @return [Symbol]
|
1913
|
-
# @scope class
|
1914
|
-
enum :linkage_kind, [
|
1915
|
-
:invalid,
|
1916
|
-
:no_linkage,
|
1917
|
-
:internal,
|
1918
|
-
:unique_external,
|
1919
|
-
:external
|
1920
|
-
]
|
1921
|
-
|
1922
|
-
# Determine the linkage of the entity referred to by a given cursor.
|
1923
|
-
#
|
1924
|
-
# @method get_cursor_linkage(cursor)
|
1925
|
-
# @param [Cursor] cursor
|
1926
|
-
# @return [Symbol from _enum_linkage_kind_]
|
1927
|
-
# @scope class
|
1928
|
-
attach_function :get_cursor_linkage, :clang_getCursorLinkage, [Cursor.by_value], :linkage_kind
|
1929
|
-
|
1930
|
-
# Determine the availability of the entity that this cursor refers to.
|
1931
|
-
#
|
1932
|
-
# @method get_cursor_availability(cursor)
|
1933
|
-
# @param [Cursor] cursor The cursor to query.
|
1934
|
-
# @return [Symbol from _enum_availability_kind_] The availability of the cursor.
|
1935
|
-
# @scope class
|
1936
|
-
attach_function :get_cursor_availability, :clang_getCursorAvailability, [Cursor.by_value], :availability_kind
|
1937
|
-
|
1938
|
-
# Describe the "language" of the entity referred to by a cursor.
|
1939
|
-
#
|
1940
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:language_kind).</em>
|
1941
|
-
#
|
1942
|
-
# === Options:
|
1943
|
-
# :invalid ::
|
1944
|
-
#
|
1945
|
-
# :c ::
|
1946
|
-
#
|
1947
|
-
# :obj_c ::
|
1948
|
-
#
|
1949
|
-
# :c_plus_plus ::
|
1950
|
-
#
|
1951
|
-
#
|
1952
|
-
# @method _enum_language_kind_
|
1953
|
-
# @return [Symbol]
|
1954
|
-
# @scope class
|
1955
|
-
enum :language_kind, [
|
1956
|
-
:invalid, 0,
|
1957
|
-
:c,
|
1958
|
-
:obj_c,
|
1959
|
-
:c_plus_plus
|
1960
|
-
]
|
1961
|
-
|
1962
|
-
# Determine the "language" of the entity referred to by a given cursor.
|
1963
|
-
#
|
1964
|
-
# @method get_cursor_language(cursor)
|
1965
|
-
# @param [Cursor] cursor
|
1966
|
-
# @return [Symbol from _enum_language_kind_]
|
1967
|
-
# @scope class
|
1968
|
-
attach_function :get_cursor_language, :clang_getCursorLanguage, [Cursor.by_value], :language_kind
|
1969
|
-
|
1970
|
-
# Returns the translation unit that a cursor originated from.
|
1971
|
-
#
|
1972
|
-
# @method cursor_get_translation_unit(cursor)
|
1973
|
-
# @param [Cursor] cursor
|
1974
|
-
# @return [TranslationUnitImpl]
|
1975
|
-
# @scope class
|
1976
|
-
attach_function :cursor_get_translation_unit, :clang_Cursor_getTranslationUnit, [Cursor.by_value], TranslationUnitImpl
|
1977
|
-
|
1978
|
-
# A fast container representing a set of CXCursors.
|
1979
|
-
class CursorSetImpl < FFI::Struct
|
1980
|
-
layout :dummy, :char
|
1981
|
-
end
|
1982
|
-
|
1983
|
-
# Creates an empty CXCursorSet.
|
1984
|
-
#
|
1985
|
-
# @method create_cx_cursor_set()
|
1986
|
-
# @return [CursorSetImpl]
|
1987
|
-
# @scope class
|
1988
|
-
attach_function :create_cx_cursor_set, :clang_createCXCursorSet, [], CursorSetImpl
|
1989
|
-
|
1990
|
-
# Disposes a CXCursorSet and releases its associated memory.
|
1991
|
-
#
|
1992
|
-
# @method dispose_cx_cursor_set(cset)
|
1993
|
-
# @param [CursorSetImpl] cset
|
1994
|
-
# @return [nil]
|
1995
|
-
# @scope class
|
1996
|
-
attach_function :dispose_cx_cursor_set, :clang_disposeCXCursorSet, [CursorSetImpl], :void
|
1997
|
-
|
1998
|
-
# Queries a CXCursorSet to see if it contains a specific CXCursor.
|
1999
|
-
#
|
2000
|
-
# @method cx_cursor_set_contains(cset, cursor)
|
2001
|
-
# @param [CursorSetImpl] cset
|
2002
|
-
# @param [Cursor] cursor
|
2003
|
-
# @return [Integer] non-zero if the set contains the specified cursor.
|
2004
|
-
# @scope class
|
2005
|
-
attach_function :cx_cursor_set_contains, :clang_CXCursorSet_contains, [CursorSetImpl, Cursor.by_value], :uint
|
2006
|
-
|
2007
|
-
# Inserts a CXCursor into a CXCursorSet.
|
2008
|
-
#
|
2009
|
-
# @method cx_cursor_set_insert(cset, cursor)
|
2010
|
-
# @param [CursorSetImpl] cset
|
2011
|
-
# @param [Cursor] cursor
|
2012
|
-
# @return [Integer] zero if the CXCursor was already in the set, and non-zero otherwise.
|
2013
|
-
# @scope class
|
2014
|
-
attach_function :cx_cursor_set_insert, :clang_CXCursorSet_insert, [CursorSetImpl, Cursor.by_value], :uint
|
2015
|
-
|
2016
|
-
# Determine the semantic parent of the given cursor.
|
2017
|
-
#
|
2018
|
-
# The semantic parent of a cursor is the cursor that semantically contains
|
2019
|
-
# the given \p cursor. For many declarations, the lexical and semantic parents
|
2020
|
-
# are equivalent (the lexical parent is returned by
|
2021
|
-
# \c clang_getCursorLexicalParent()). They diverge when declarations or
|
2022
|
-
# definitions are provided out-of-line. For example:
|
2023
|
-
#
|
2024
|
-
# \code
|
2025
|
-
# class C {
|
2026
|
-
# void f();
|
2027
|
-
# };
|
2028
|
-
#
|
2029
|
-
# void C::f() { }
|
2030
|
-
# \endcode
|
2031
|
-
#
|
2032
|
-
# In the out-of-line definition of \c C::f, the semantic parent is the
|
2033
|
-
# the class \c C, of which this function is a member. The lexical parent is
|
2034
|
-
# the place where the declaration actually occurs in the source code; in this
|
2035
|
-
# case, the definition occurs in the translation unit. In general, the
|
2036
|
-
# lexical parent for a given entity can change without affecting the semantics
|
2037
|
-
# of the program, and the lexical parent of different declarations of the
|
2038
|
-
# same entity may be different. Changing the semantic parent of a declaration,
|
2039
|
-
# on the other hand, can have a major impact on semantics, and redeclarations
|
2040
|
-
# of a particular entity should all have the same semantic context.
|
2041
|
-
#
|
2042
|
-
# In the example above, both declarations of \c C::f have \c C as their
|
2043
|
-
# semantic context, while the lexical context of the first \c C::f is \c C
|
2044
|
-
# and the lexical context of the second \c C::f is the translation unit.
|
2045
|
-
#
|
2046
|
-
# For global declarations, the semantic parent is the translation unit.
|
2047
|
-
#
|
2048
|
-
# @method get_cursor_semantic_parent(cursor)
|
2049
|
-
# @param [Cursor] cursor
|
2050
|
-
# @return [Cursor]
|
2051
|
-
# @scope class
|
2052
|
-
attach_function :get_cursor_semantic_parent, :clang_getCursorSemanticParent, [Cursor.by_value], Cursor.by_value
|
2053
|
-
|
2054
|
-
# Determine the lexical parent of the given cursor.
|
2055
|
-
#
|
2056
|
-
# The lexical parent of a cursor is the cursor in which the given \p cursor
|
2057
|
-
# was actually written. For many declarations, the lexical and semantic parents
|
2058
|
-
# are equivalent (the semantic parent is returned by
|
2059
|
-
# \c clang_getCursorSemanticParent()). They diverge when declarations or
|
2060
|
-
# definitions are provided out-of-line. For example:
|
2061
|
-
#
|
2062
|
-
# \code
|
2063
|
-
# class C {
|
2064
|
-
# void f();
|
2065
|
-
# };
|
2066
|
-
#
|
2067
|
-
# void C::f() { }
|
2068
|
-
# \endcode
|
2069
|
-
#
|
2070
|
-
# In the out-of-line definition of \c C::f, the semantic parent is the
|
2071
|
-
# the class \c C, of which this function is a member. The lexical parent is
|
2072
|
-
# the place where the declaration actually occurs in the source code; in this
|
2073
|
-
# case, the definition occurs in the translation unit. In general, the
|
2074
|
-
# lexical parent for a given entity can change without affecting the semantics
|
2075
|
-
# of the program, and the lexical parent of different declarations of the
|
2076
|
-
# same entity may be different. Changing the semantic parent of a declaration,
|
2077
|
-
# on the other hand, can have a major impact on semantics, and redeclarations
|
2078
|
-
# of a particular entity should all have the same semantic context.
|
2079
|
-
#
|
2080
|
-
# In the example above, both declarations of \c C::f have \c C as their
|
2081
|
-
# semantic context, while the lexical context of the first \c C::f is \c C
|
2082
|
-
# and the lexical context of the second \c C::f is the translation unit.
|
2083
|
-
#
|
2084
|
-
# For declarations written in the global scope, the lexical parent is
|
2085
|
-
# the translation unit.
|
2086
|
-
#
|
2087
|
-
# @method get_cursor_lexical_parent(cursor)
|
2088
|
-
# @param [Cursor] cursor
|
2089
|
-
# @return [Cursor]
|
2090
|
-
# @scope class
|
2091
|
-
attach_function :get_cursor_lexical_parent, :clang_getCursorLexicalParent, [Cursor.by_value], Cursor.by_value
|
2092
|
-
|
2093
|
-
# Determine the set of methods that are overridden by the given
|
2094
|
-
# method.
|
2095
|
-
#
|
2096
|
-
# In both Objective-C and C++, a method (aka virtual member function,
|
2097
|
-
# in C++) can override a virtual method in a base class. For
|
2098
|
-
# Objective-C, a method is said to override any method in the class's
|
2099
|
-
# interface (if we're coming from an implementation), its protocols,
|
2100
|
-
# or its categories, that has the same selector and is of the same
|
2101
|
-
# kind (class or instance). If no such method exists, the search
|
2102
|
-
# continues to the class's superclass, its protocols, and its
|
2103
|
-
# categories, and so on.
|
2104
|
-
#
|
2105
|
-
# For C++, a virtual member function overrides any virtual member
|
2106
|
-
# function with the same signature that occurs in its base
|
2107
|
-
# classes. With multiple inheritance, a virtual member function can
|
2108
|
-
# override several virtual member functions coming from different
|
2109
|
-
# base classes.
|
2110
|
-
#
|
2111
|
-
# In all cases, this function determines the immediate overridden
|
2112
|
-
# method, rather than all of the overridden methods. For example, if
|
2113
|
-
# a method is originally declared in a class A, then overridden in B
|
2114
|
-
# (which in inherits from A) and also in C (which inherited from B),
|
2115
|
-
# then the only overridden method returned from this function when
|
2116
|
-
# invoked on C's method will be B's method. The client may then
|
2117
|
-
# invoke this function again, given the previously-found overridden
|
2118
|
-
# methods, to map out the complete method-override set.
|
2119
|
-
#
|
2120
|
-
# @method get_overridden_cursors(cursor, overridden, num_overridden)
|
2121
|
-
# @param [Cursor] cursor A cursor representing an Objective-C or C++
|
2122
|
-
# method. This routine will compute the set of methods that this
|
2123
|
-
# method overrides.
|
2124
|
-
# @param [FFI::Pointer(**Cursor)] overridden A pointer whose pointee will be replaced with a
|
2125
|
-
# pointer to an array of cursors, representing the set of overridden
|
2126
|
-
# methods. If there are no overridden methods, the pointee will be
|
2127
|
-
# set to NULL. The pointee must be freed via a call to
|
2128
|
-
# \c clang_disposeOverriddenCursors().
|
2129
|
-
# @param [FFI::Pointer(*UInt)] num_overridden A pointer to the number of overridden
|
2130
|
-
# functions, will be set to the number of overridden functions in the
|
2131
|
-
# array pointed to by \p overridden.
|
2132
|
-
# @return [nil]
|
2133
|
-
# @scope class
|
2134
|
-
attach_function :get_overridden_cursors, :clang_getOverriddenCursors, [Cursor.by_value, :pointer, :pointer], :void
|
2135
|
-
|
2136
|
-
# Free the set of overridden cursors returned by \c
|
2137
|
-
# clang_getOverriddenCursors().
|
2138
|
-
#
|
2139
|
-
# @method dispose_overridden_cursors(overridden)
|
2140
|
-
# @param [Cursor] overridden
|
2141
|
-
# @return [nil]
|
2142
|
-
# @scope class
|
2143
|
-
attach_function :dispose_overridden_cursors, :clang_disposeOverriddenCursors, [Cursor], :void
|
2144
|
-
|
2145
|
-
# Retrieve the file that is included by the given inclusion directive
|
2146
|
-
# cursor.
|
2147
|
-
#
|
2148
|
-
# @method get_included_file(cursor)
|
2149
|
-
# @param [Cursor] cursor
|
2150
|
-
# @return [FFI::Pointer(File)]
|
2151
|
-
# @scope class
|
2152
|
-
attach_function :get_included_file, :clang_getIncludedFile, [Cursor.by_value], :pointer
|
2153
|
-
|
2154
|
-
# Map a source location to the cursor that describes the entity at that
|
2155
|
-
# location in the source code.
|
2156
|
-
#
|
2157
|
-
# clang_getCursor() maps an arbitrary source location within a translation
|
2158
|
-
# unit down to the most specific cursor that describes the entity at that
|
2159
|
-
# location. For example, given an expression \c x + y, invoking
|
2160
|
-
# clang_getCursor() with a source location pointing to "x" will return the
|
2161
|
-
# cursor for "x"; similarly for "y". If the cursor points anywhere between
|
2162
|
-
# "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor()
|
2163
|
-
# will return a cursor referring to the "+" expression.
|
2164
|
-
#
|
2165
|
-
# @method get_cursor(translation_unit_impl, source_location)
|
2166
|
-
# @param [TranslationUnitImpl] translation_unit_impl
|
2167
|
-
# @param [SourceLocation] source_location
|
2168
|
-
# @return [Cursor] a cursor representing the entity at the given source location, or
|
2169
|
-
# a NULL cursor if no such entity can be found.
|
2170
|
-
# @scope class
|
2171
|
-
attach_function :get_cursor, :clang_getCursor, [TranslationUnitImpl, SourceLocation.by_value], Cursor.by_value
|
2172
|
-
|
2173
|
-
# Retrieve the physical location of the source constructor referenced
|
2174
|
-
# by the given cursor.
|
2175
|
-
#
|
2176
|
-
# The location of a declaration is typically the location of the name of that
|
2177
|
-
# declaration, where the name of that declaration would occur if it is
|
2178
|
-
# unnamed, or some keyword that introduces that particular declaration.
|
2179
|
-
# The location of a reference is where that reference occurs within the
|
2180
|
-
# source code.
|
2181
|
-
#
|
2182
|
-
# @method get_cursor_location(cursor)
|
2183
|
-
# @param [Cursor] cursor
|
2184
|
-
# @return [SourceLocation]
|
2185
|
-
# @scope class
|
2186
|
-
attach_function :get_cursor_location, :clang_getCursorLocation, [Cursor.by_value], SourceLocation.by_value
|
2187
|
-
|
2188
|
-
# Retrieve the physical extent of the source construct referenced by
|
2189
|
-
# the given cursor.
|
2190
|
-
#
|
2191
|
-
# The extent of a cursor starts with the file/line/column pointing at the
|
2192
|
-
# first character within the source construct that the cursor refers to and
|
2193
|
-
# ends with the last character withinin that source construct. For a
|
2194
|
-
# declaration, the extent covers the declaration itself. For a reference,
|
2195
|
-
# the extent covers the location of the reference (e.g., where the referenced
|
2196
|
-
# entity was actually used).
|
2197
|
-
#
|
2198
|
-
# @method get_cursor_extent(cursor)
|
2199
|
-
# @param [Cursor] cursor
|
2200
|
-
# @return [SourceRange]
|
2201
|
-
# @scope class
|
2202
|
-
attach_function :get_cursor_extent, :clang_getCursorExtent, [Cursor.by_value], SourceRange.by_value
|
2203
|
-
|
2204
|
-
# Describes the kind of type
|
2205
|
-
#
|
2206
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:type_kind).</em>
|
2207
|
-
#
|
2208
|
-
# === Options:
|
2209
|
-
# :invalid ::
|
2210
|
-
# Reprents an invalid type (e.g., where no type is available).
|
2211
|
-
# :unexposed ::
|
2212
|
-
# A type whose specific kind is not exposed via this
|
2213
|
-
# interface.
|
2214
|
-
# :void ::
|
2215
|
-
# Builtin types
|
2216
|
-
# :bool ::
|
2217
|
-
#
|
2218
|
-
# :char_u ::
|
2219
|
-
#
|
2220
|
-
# :u_char ::
|
2221
|
-
#
|
2222
|
-
# :char16 ::
|
2223
|
-
#
|
2224
|
-
# :char32 ::
|
2225
|
-
#
|
2226
|
-
# :u_short ::
|
2227
|
-
#
|
2228
|
-
# :u_int ::
|
2229
|
-
#
|
2230
|
-
# :u_long ::
|
2231
|
-
#
|
2232
|
-
# :u_long_long ::
|
2233
|
-
#
|
2234
|
-
# :u_int128 ::
|
2235
|
-
#
|
2236
|
-
# :char_s ::
|
2237
|
-
#
|
2238
|
-
# :s_char ::
|
2239
|
-
#
|
2240
|
-
# :w_char ::
|
2241
|
-
#
|
2242
|
-
# :short ::
|
2243
|
-
#
|
2244
|
-
# :int ::
|
2245
|
-
#
|
2246
|
-
# :long ::
|
2247
|
-
#
|
2248
|
-
# :long_long ::
|
2249
|
-
#
|
2250
|
-
# :int128 ::
|
2251
|
-
#
|
2252
|
-
# :float ::
|
2253
|
-
#
|
2254
|
-
# :double ::
|
2255
|
-
#
|
2256
|
-
# :long_double ::
|
2257
|
-
#
|
2258
|
-
# :null_ptr ::
|
2259
|
-
#
|
2260
|
-
# :overload ::
|
2261
|
-
#
|
2262
|
-
# :dependent ::
|
2263
|
-
#
|
2264
|
-
# :obj_c_id ::
|
2265
|
-
#
|
2266
|
-
# :obj_c_class ::
|
2267
|
-
#
|
2268
|
-
# :obj_c_sel ::
|
2269
|
-
#
|
2270
|
-
# :complex ::
|
2271
|
-
#
|
2272
|
-
# :pointer ::
|
2273
|
-
#
|
2274
|
-
# :block_pointer ::
|
2275
|
-
#
|
2276
|
-
# :l_value_reference ::
|
2277
|
-
#
|
2278
|
-
# :r_value_reference ::
|
2279
|
-
#
|
2280
|
-
# :record ::
|
2281
|
-
#
|
2282
|
-
# :enum ::
|
2283
|
-
#
|
2284
|
-
# :typedef ::
|
2285
|
-
#
|
2286
|
-
# :obj_c_interface ::
|
2287
|
-
#
|
2288
|
-
# :obj_c_object_pointer ::
|
2289
|
-
#
|
2290
|
-
# :function_no_proto ::
|
2291
|
-
#
|
2292
|
-
# :function_proto ::
|
2293
|
-
#
|
2294
|
-
# :constant_array ::
|
2295
|
-
#
|
2296
|
-
#
|
2297
|
-
# @method _enum_type_kind_
|
2298
|
-
# @return [Symbol]
|
2299
|
-
# @scope class
|
2300
|
-
enum :type_kind, [
|
2301
|
-
:invalid, 0,
|
2302
|
-
:unexposed, 1,
|
2303
|
-
:void, 2,
|
2304
|
-
:bool, 3,
|
2305
|
-
:char_u, 4,
|
2306
|
-
:u_char, 5,
|
2307
|
-
:char16, 6,
|
2308
|
-
:char32, 7,
|
2309
|
-
:u_short, 8,
|
2310
|
-
:u_int, 9,
|
2311
|
-
:u_long, 10,
|
2312
|
-
:u_long_long, 11,
|
2313
|
-
:u_int128, 12,
|
2314
|
-
:char_s, 13,
|
2315
|
-
:s_char, 14,
|
2316
|
-
:w_char, 15,
|
2317
|
-
:short, 16,
|
2318
|
-
:int, 17,
|
2319
|
-
:long, 18,
|
2320
|
-
:long_long, 19,
|
2321
|
-
:int128, 20,
|
2322
|
-
:float, 21,
|
2323
|
-
:double, 22,
|
2324
|
-
:long_double, 23,
|
2325
|
-
:null_ptr, 24,
|
2326
|
-
:overload, 25,
|
2327
|
-
:dependent, 26,
|
2328
|
-
:obj_c_id, 27,
|
2329
|
-
:obj_c_class, 28,
|
2330
|
-
:obj_c_sel, 29,
|
2331
|
-
:complex, 100,
|
2332
|
-
:pointer, 101,
|
2333
|
-
:block_pointer, 102,
|
2334
|
-
:l_value_reference, 103,
|
2335
|
-
:r_value_reference, 104,
|
2336
|
-
:record, 105,
|
2337
|
-
:enum, 106,
|
2338
|
-
:typedef, 107,
|
2339
|
-
:obj_c_interface, 108,
|
2340
|
-
:obj_c_object_pointer, 109,
|
2341
|
-
:function_no_proto, 110,
|
2342
|
-
:function_proto, 111,
|
2343
|
-
:constant_array, 112
|
2344
|
-
]
|
2345
|
-
|
2346
|
-
# The type of an element in the abstract syntax tree.
|
2347
|
-
#
|
2348
|
-
# = Fields:
|
2349
|
-
# :kind ::
|
2350
|
-
# (Symbol from _enum_type_kind_)
|
2351
|
-
# :data ::
|
2352
|
-
# (Array<FFI::Pointer(*Void)>)
|
2353
|
-
class Type < FFI::Struct
|
2354
|
-
layout :kind, :type_kind,
|
2355
|
-
:data, [:pointer, 2]
|
2356
|
-
end
|
2357
|
-
|
2358
|
-
# Retrieve the type of a CXCursor (if any).
|
2359
|
-
#
|
2360
|
-
# @method get_cursor_type(c)
|
2361
|
-
# @param [Cursor] c
|
2362
|
-
# @return [Type]
|
2363
|
-
# @scope class
|
2364
|
-
attach_function :get_cursor_type, :clang_getCursorType, [Cursor.by_value], Type.by_value
|
2365
|
-
|
2366
|
-
# Determine whether two CXTypes represent the same type.
|
2367
|
-
#
|
2368
|
-
# @method equal_types(a, b)
|
2369
|
-
# @param [Type] a
|
2370
|
-
# @param [Type] b
|
2371
|
-
# @return [Integer] non-zero if the CXTypes represent the same type and
|
2372
|
-
# zero otherwise.
|
2373
|
-
# @scope class
|
2374
|
-
attach_function :equal_types, :clang_equalTypes, [Type.by_value, Type.by_value], :uint
|
2375
|
-
|
2376
|
-
# Return the canonical type for a CXType.
|
2377
|
-
#
|
2378
|
-
# Clang's type system explicitly models typedefs and all the ways
|
2379
|
-
# a specific type can be represented. The canonical type is the underlying
|
2380
|
-
# type with all the "sugar" removed. For example, if 'T' is a typedef
|
2381
|
-
# for 'int', the canonical type for 'T' would be 'int'.
|
2382
|
-
#
|
2383
|
-
# @method get_canonical_type(t)
|
2384
|
-
# @param [Type] t
|
2385
|
-
# @return [Type]
|
2386
|
-
# @scope class
|
2387
|
-
attach_function :get_canonical_type, :clang_getCanonicalType, [Type.by_value], Type.by_value
|
2388
|
-
|
2389
|
-
# Determine whether a CXType has the "const" qualifier set,
|
2390
|
-
# without looking through typedefs that may have added "const" at a different level.
|
2391
|
-
#
|
2392
|
-
# @method is_const_qualified_type(t)
|
2393
|
-
# @param [Type] t
|
2394
|
-
# @return [Integer]
|
2395
|
-
# @scope class
|
2396
|
-
attach_function :is_const_qualified_type, :clang_isConstQualifiedType, [Type.by_value], :uint
|
2397
|
-
|
2398
|
-
# Determine whether a CXType has the "volatile" qualifier set,
|
2399
|
-
# without looking through typedefs that may have added "volatile" at a different level.
|
2400
|
-
#
|
2401
|
-
# @method is_volatile_qualified_type(t)
|
2402
|
-
# @param [Type] t
|
2403
|
-
# @return [Integer]
|
2404
|
-
# @scope class
|
2405
|
-
attach_function :is_volatile_qualified_type, :clang_isVolatileQualifiedType, [Type.by_value], :uint
|
2406
|
-
|
2407
|
-
# Determine whether a CXType has the "restrict" qualifier set,
|
2408
|
-
# without looking through typedefs that may have added "restrict" at a different level.
|
2409
|
-
#
|
2410
|
-
# @method is_restrict_qualified_type(t)
|
2411
|
-
# @param [Type] t
|
2412
|
-
# @return [Integer]
|
2413
|
-
# @scope class
|
2414
|
-
attach_function :is_restrict_qualified_type, :clang_isRestrictQualifiedType, [Type.by_value], :uint
|
2415
|
-
|
2416
|
-
# For pointer types, returns the type of the pointee.
|
2417
|
-
#
|
2418
|
-
# @method get_pointee_type(t)
|
2419
|
-
# @param [Type] t
|
2420
|
-
# @return [Type]
|
2421
|
-
# @scope class
|
2422
|
-
attach_function :get_pointee_type, :clang_getPointeeType, [Type.by_value], Type.by_value
|
2423
|
-
|
2424
|
-
# Return the cursor for the declaration of the given type.
|
2425
|
-
#
|
2426
|
-
# @method get_type_declaration(t)
|
2427
|
-
# @param [Type] t
|
2428
|
-
# @return [Cursor]
|
2429
|
-
# @scope class
|
2430
|
-
attach_function :get_type_declaration, :clang_getTypeDeclaration, [Type.by_value], Cursor.by_value
|
2431
|
-
|
2432
|
-
# Returns the Objective-C type encoding for the specified declaration.
|
2433
|
-
#
|
2434
|
-
# @method get_decl_obj_c_type_encoding(c)
|
2435
|
-
# @param [Cursor] c
|
2436
|
-
# @return [String]
|
2437
|
-
# @scope class
|
2438
|
-
attach_function :get_decl_obj_c_type_encoding, :clang_getDeclObjCTypeEncoding, [Cursor.by_value], String.by_value
|
2439
|
-
|
2440
|
-
# Retrieve the spelling of a given CXTypeKind.
|
2441
|
-
#
|
2442
|
-
# @method get_type_kind_spelling(k)
|
2443
|
-
# @param [Symbol from _enum_type_kind_] k
|
2444
|
-
# @return [String]
|
2445
|
-
# @scope class
|
2446
|
-
attach_function :get_type_kind_spelling, :clang_getTypeKindSpelling, [:type_kind], String.by_value
|
2447
|
-
|
2448
|
-
# Retrieve the result type associated with a function type.
|
2449
|
-
#
|
2450
|
-
# @method get_result_type(t)
|
2451
|
-
# @param [Type] t
|
2452
|
-
# @return [Type]
|
2453
|
-
# @scope class
|
2454
|
-
attach_function :get_result_type, :clang_getResultType, [Type.by_value], Type.by_value
|
2455
|
-
|
2456
|
-
# Retrieve the result type associated with a given cursor. This only
|
2457
|
-
# returns a valid type of the cursor refers to a function or method.
|
2458
|
-
#
|
2459
|
-
# @method get_cursor_result_type(c)
|
2460
|
-
# @param [Cursor] c
|
2461
|
-
# @return [Type]
|
2462
|
-
# @scope class
|
2463
|
-
attach_function :get_cursor_result_type, :clang_getCursorResultType, [Cursor.by_value], Type.by_value
|
2464
|
-
|
2465
|
-
# Return 1 if the CXType is a POD (plain old data) type, and 0
|
2466
|
-
# otherwise.
|
2467
|
-
#
|
2468
|
-
# @method is_pod_type(t)
|
2469
|
-
# @param [Type] t
|
2470
|
-
# @return [Integer]
|
2471
|
-
# @scope class
|
2472
|
-
attach_function :is_pod_type, :clang_isPODType, [Type.by_value], :uint
|
2473
|
-
|
2474
|
-
# Return the element type of an array type.
|
2475
|
-
#
|
2476
|
-
# If a non-array type is passed in, an invalid type is returned.
|
2477
|
-
#
|
2478
|
-
# @method get_array_element_type(t)
|
2479
|
-
# @param [Type] t
|
2480
|
-
# @return [Type]
|
2481
|
-
# @scope class
|
2482
|
-
attach_function :get_array_element_type, :clang_getArrayElementType, [Type.by_value], Type.by_value
|
2483
|
-
|
2484
|
-
# Return the the array size of a constant array.
|
2485
|
-
#
|
2486
|
-
# If a non-array type is passed in, -1 is returned.
|
2487
|
-
#
|
2488
|
-
# @method get_array_size(t)
|
2489
|
-
# @param [Type] t
|
2490
|
-
# @return [Integer]
|
2491
|
-
# @scope class
|
2492
|
-
attach_function :get_array_size, :clang_getArraySize, [Type.by_value], :long_long
|
2493
|
-
|
2494
|
-
# Returns 1 if the base class specified by the cursor with kind
|
2495
|
-
# CX_CXXBaseSpecifier is virtual.
|
2496
|
-
#
|
2497
|
-
# @method is_virtual_base(cursor)
|
2498
|
-
# @param [Cursor] cursor
|
2499
|
-
# @return [Integer]
|
2500
|
-
# @scope class
|
2501
|
-
attach_function :is_virtual_base, :clang_isVirtualBase, [Cursor.by_value], :uint
|
2502
|
-
|
2503
|
-
# Represents the C++ access control level to a base class for a
|
2504
|
-
# cursor with kind CX_CXXBaseSpecifier.
|
2505
|
-
#
|
2506
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:cxx_access_specifier).</em>
|
2507
|
-
#
|
2508
|
-
# === Options:
|
2509
|
-
# :x_invalid_access_specifier ::
|
2510
|
-
#
|
2511
|
-
# :x_public ::
|
2512
|
-
#
|
2513
|
-
# :x_protected ::
|
2514
|
-
#
|
2515
|
-
# :x_private ::
|
2516
|
-
#
|
2517
|
-
#
|
2518
|
-
# @method _enum_cxx_access_specifier_
|
2519
|
-
# @return [Symbol]
|
2520
|
-
# @scope class
|
2521
|
-
enum :cxx_access_specifier, [
|
2522
|
-
:x_invalid_access_specifier,
|
2523
|
-
:x_public,
|
2524
|
-
:x_protected,
|
2525
|
-
:x_private
|
2526
|
-
]
|
2527
|
-
|
2528
|
-
# Returns the access control level for the C++ base specifier
|
2529
|
-
# represented by a cursor with kind CXCursor_CXXBaseSpecifier or
|
2530
|
-
# CXCursor_AccessSpecifier.
|
2531
|
-
#
|
2532
|
-
# @method get_cxx_access_specifier(cursor)
|
2533
|
-
# @param [Cursor] cursor
|
2534
|
-
# @return [Symbol from _enum_cxx_access_specifier_]
|
2535
|
-
# @scope class
|
2536
|
-
attach_function :get_cxx_access_specifier, :clang_getCXXAccessSpecifier, [Cursor.by_value], :cxx_access_specifier
|
2537
|
-
|
2538
|
-
# Determine the number of overloaded declarations referenced by a
|
2539
|
-
# \c CXCursor_OverloadedDeclRef cursor.
|
2540
|
-
#
|
2541
|
-
# @method get_num_overloaded_decls(cursor)
|
2542
|
-
# @param [Cursor] cursor The cursor whose overloaded declarations are being queried.
|
2543
|
-
# @return [Integer] The number of overloaded declarations referenced by \c cursor. If it
|
2544
|
-
# is not a \c CXCursor_OverloadedDeclRef cursor, returns 0.
|
2545
|
-
# @scope class
|
2546
|
-
attach_function :get_num_overloaded_decls, :clang_getNumOverloadedDecls, [Cursor.by_value], :uint
|
2547
|
-
|
2548
|
-
# Retrieve a cursor for one of the overloaded declarations referenced
|
2549
|
-
# by a \c CXCursor_OverloadedDeclRef cursor.
|
2550
|
-
#
|
2551
|
-
# @method get_overloaded_decl(cursor, index)
|
2552
|
-
# @param [Cursor] cursor The cursor whose overloaded declarations are being queried.
|
2553
|
-
# @param [Integer] index The zero-based index into the set of overloaded declarations in
|
2554
|
-
# the cursor.
|
2555
|
-
# @return [Cursor] A cursor representing the declaration referenced by the given
|
2556
|
-
# \c cursor at the specified \c index. If the cursor does not have an
|
2557
|
-
# associated set of overloaded declarations, or if the index is out of bounds,
|
2558
|
-
# returns \c clang_getNullCursor();
|
2559
|
-
# @scope class
|
2560
|
-
attach_function :get_overloaded_decl, :clang_getOverloadedDecl, [Cursor.by_value, :uint], Cursor.by_value
|
2561
|
-
|
2562
|
-
# For cursors representing an iboutletcollection attribute,
|
2563
|
-
# this function returns the collection element type.
|
2564
|
-
#
|
2565
|
-
# @method get_ib_outlet_collection_type(cursor)
|
2566
|
-
# @param [Cursor] cursor
|
2567
|
-
# @return [Type]
|
2568
|
-
# @scope class
|
2569
|
-
attach_function :get_ib_outlet_collection_type, :clang_getIBOutletCollectionType, [Cursor.by_value], Type.by_value
|
2570
|
-
|
2571
|
-
# Describes how the traversal of the children of a particular
|
2572
|
-
# cursor should proceed after visiting a particular child cursor.
|
2573
|
-
#
|
2574
|
-
# A value of this enumeration type should be returned by each
|
2575
|
-
# \c CXCursorVisitor to indicate how clang_visitChildren() proceed.
|
2576
|
-
#
|
2577
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:child_visit_result).</em>
|
2578
|
-
#
|
2579
|
-
# === Options:
|
2580
|
-
# :break ::
|
2581
|
-
# Terminates the cursor traversal.
|
2582
|
-
# :continue ::
|
2583
|
-
# Continues the cursor traversal with the next sibling of
|
2584
|
-
# the cursor just visited, without visiting its children.
|
2585
|
-
# :recurse ::
|
2586
|
-
# Recursively traverse the children of this cursor, using
|
2587
|
-
# the same visitor and client data.
|
2588
|
-
#
|
2589
|
-
# @method _enum_child_visit_result_
|
2590
|
-
# @return [Symbol]
|
2591
|
-
# @scope class
|
2592
|
-
enum :child_visit_result, [
|
2593
|
-
:break,
|
2594
|
-
:continue,
|
2595
|
-
:recurse
|
2596
|
-
]
|
2597
|
-
|
2598
|
-
# Visitor invoked for each cursor found by a traversal.
|
2599
|
-
#
|
2600
|
-
# This visitor function will be invoked for each cursor found by
|
2601
|
-
# clang_visitCursorChildren(). Its first argument is the cursor being
|
2602
|
-
# visited, its second argument is the parent visitor for that cursor,
|
2603
|
-
# and its third argument is the client data provided to
|
2604
|
-
# clang_visitCursorChildren().
|
2605
|
-
#
|
2606
|
-
# The visitor should return one of the \c CXChildVisitResult values
|
2607
|
-
# to direct clang_visitCursorChildren().
|
2608
|
-
#
|
2609
|
-
# <em>This entry is only for documentation and no real method.</em>
|
2610
|
-
#
|
2611
|
-
# @method _callback_cursor_visitor_(cursor, parent, client_data)
|
2612
|
-
# @param [Cursor] cursor
|
2613
|
-
# @param [Cursor] parent
|
2614
|
-
# @param [FFI::Pointer(ClientData)] client_data
|
2615
|
-
# @return [Symbol from _enum_child_visit_result_]
|
2616
|
-
# @scope class
|
2617
|
-
callback :cursor_visitor, [Cursor.by_value, Cursor.by_value, :pointer], :child_visit_result
|
2618
|
-
|
2619
|
-
# Visit the children of a particular cursor.
|
2620
|
-
#
|
2621
|
-
# This function visits all the direct children of the given cursor,
|
2622
|
-
# invoking the given \p visitor function with the cursors of each
|
2623
|
-
# visited child. The traversal may be recursive, if the visitor returns
|
2624
|
-
# \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if
|
2625
|
-
# the visitor returns \c CXChildVisit_Break.
|
2626
|
-
#
|
2627
|
-
# @method visit_children(parent, visitor, client_data)
|
2628
|
-
# @param [Cursor] parent the cursor whose child may be visited. All kinds of
|
2629
|
-
# cursors can be visited, including invalid cursors (which, by
|
2630
|
-
# definition, have no children).
|
2631
|
-
# @param [Proc(_callback_cursor_visitor_)] visitor the visitor function that will be invoked for each
|
2632
|
-
# child of \p parent.
|
2633
|
-
# @param [FFI::Pointer(ClientData)] client_data pointer data supplied by the client, which will
|
2634
|
-
# be passed to the visitor each time it is invoked.
|
2635
|
-
# @return [Integer] a non-zero value if the traversal was terminated
|
2636
|
-
# prematurely by the visitor returning \c CXChildVisit_Break.
|
2637
|
-
# @scope class
|
2638
|
-
attach_function :visit_children, :clang_visitChildren, [Cursor.by_value, :cursor_visitor, :pointer], :uint
|
2639
|
-
|
2640
|
-
# Retrieve a Unified Symbol Resolution (USR) for the entity referenced
|
2641
|
-
# by the given cursor.
|
2642
|
-
#
|
2643
|
-
# A Unified Symbol Resolution (USR) is a string that identifies a particular
|
2644
|
-
# entity (function, class, variable, etc.) within a program. USRs can be
|
2645
|
-
# compared across translation units to determine, e.g., when references in
|
2646
|
-
# one translation refer to an entity defined in another translation unit.
|
2647
|
-
#
|
2648
|
-
# @method get_cursor_usr(cursor)
|
2649
|
-
# @param [Cursor] cursor
|
2650
|
-
# @return [String]
|
2651
|
-
# @scope class
|
2652
|
-
attach_function :get_cursor_usr, :clang_getCursorUSR, [Cursor.by_value], String.by_value
|
2653
|
-
|
2654
|
-
# Construct a USR for a specified Objective-C class.
|
2655
|
-
#
|
2656
|
-
# @method construct_usr_obj_c_class(class_name)
|
2657
|
-
# @param [String] class_name
|
2658
|
-
# @return [String]
|
2659
|
-
# @scope class
|
2660
|
-
attach_function :construct_usr_obj_c_class, :clang_constructUSR_ObjCClass, [:string], String.by_value
|
2661
|
-
|
2662
|
-
# Construct a USR for a specified Objective-C category.
|
2663
|
-
#
|
2664
|
-
# @method construct_usr_obj_c_category(class_name, category_name)
|
2665
|
-
# @param [String] class_name
|
2666
|
-
# @param [String] category_name
|
2667
|
-
# @return [String]
|
2668
|
-
# @scope class
|
2669
|
-
attach_function :construct_usr_obj_c_category, :clang_constructUSR_ObjCCategory, [:string, :string], String.by_value
|
2670
|
-
|
2671
|
-
# Construct a USR for a specified Objective-C protocol.
|
2672
|
-
#
|
2673
|
-
# @method construct_usr_obj_c_protocol(protocol_name)
|
2674
|
-
# @param [String] protocol_name
|
2675
|
-
# @return [String]
|
2676
|
-
# @scope class
|
2677
|
-
attach_function :construct_usr_obj_c_protocol, :clang_constructUSR_ObjCProtocol, [:string], String.by_value
|
2678
|
-
|
2679
|
-
# Construct a USR for a specified Objective-C instance variable and
|
2680
|
-
# the USR for its containing class.
|
2681
|
-
#
|
2682
|
-
# @method construct_usr_obj_c_ivar(name, class_usr)
|
2683
|
-
# @param [String] name
|
2684
|
-
# @param [String] class_usr
|
2685
|
-
# @return [String]
|
2686
|
-
# @scope class
|
2687
|
-
attach_function :construct_usr_obj_c_ivar, :clang_constructUSR_ObjCIvar, [:string, String.by_value], String.by_value
|
2688
|
-
|
2689
|
-
# Construct a USR for a specified Objective-C method and
|
2690
|
-
# the USR for its containing class.
|
2691
|
-
#
|
2692
|
-
# @method construct_usr_obj_c_method(name, is_instance_method, class_usr)
|
2693
|
-
# @param [String] name
|
2694
|
-
# @param [Integer] is_instance_method
|
2695
|
-
# @param [String] class_usr
|
2696
|
-
# @return [String]
|
2697
|
-
# @scope class
|
2698
|
-
attach_function :construct_usr_obj_c_method, :clang_constructUSR_ObjCMethod, [:string, :uint, String.by_value], String.by_value
|
2699
|
-
|
2700
|
-
# Construct a USR for a specified Objective-C property and the USR
|
2701
|
-
# for its containing class.
|
2702
|
-
#
|
2703
|
-
# @method construct_usr_obj_c_property(property, class_usr)
|
2704
|
-
# @param [String] property
|
2705
|
-
# @param [String] class_usr
|
2706
|
-
# @return [String]
|
2707
|
-
# @scope class
|
2708
|
-
attach_function :construct_usr_obj_c_property, :clang_constructUSR_ObjCProperty, [:string, String.by_value], String.by_value
|
2709
|
-
|
2710
|
-
# Retrieve a name for the entity referenced by this cursor.
|
2711
|
-
#
|
2712
|
-
# @method get_cursor_spelling(cursor)
|
2713
|
-
# @param [Cursor] cursor
|
2714
|
-
# @return [String]
|
2715
|
-
# @scope class
|
2716
|
-
attach_function :get_cursor_spelling, :clang_getCursorSpelling, [Cursor.by_value], String.by_value
|
2717
|
-
|
2718
|
-
# Retrieve the display name for the entity referenced by this cursor.
|
2719
|
-
#
|
2720
|
-
# The display name contains extra information that helps identify the cursor,
|
2721
|
-
# such as the parameters of a function or template or the arguments of a
|
2722
|
-
# class template specialization.
|
2723
|
-
#
|
2724
|
-
# @method get_cursor_display_name(cursor)
|
2725
|
-
# @param [Cursor] cursor
|
2726
|
-
# @return [String]
|
2727
|
-
# @scope class
|
2728
|
-
attach_function :get_cursor_display_name, :clang_getCursorDisplayName, [Cursor.by_value], String.by_value
|
2729
|
-
|
2730
|
-
# For a cursor that is a reference, retrieve a cursor representing the
|
2731
|
-
# entity that it references.
|
2732
|
-
#
|
2733
|
-
# Reference cursors refer to other entities in the AST. For example, an
|
2734
|
-
# Objective-C superclass reference cursor refers to an Objective-C class.
|
2735
|
-
# This function produces the cursor for the Objective-C class from the
|
2736
|
-
# cursor for the superclass reference. If the input cursor is a declaration or
|
2737
|
-
# definition, it returns that declaration or definition unchanged.
|
2738
|
-
# Otherwise, returns the NULL cursor.
|
2739
|
-
#
|
2740
|
-
# @method get_cursor_referenced(cursor)
|
2741
|
-
# @param [Cursor] cursor
|
2742
|
-
# @return [Cursor]
|
2743
|
-
# @scope class
|
2744
|
-
attach_function :get_cursor_referenced, :clang_getCursorReferenced, [Cursor.by_value], Cursor.by_value
|
2745
|
-
|
2746
|
-
# For a cursor that is either a reference to or a declaration
|
2747
|
-
# of some entity, retrieve a cursor that describes the definition of
|
2748
|
-
# that entity.
|
2749
|
-
#
|
2750
|
-
# Some entities can be declared multiple times within a translation
|
2751
|
-
# unit, but only one of those declarations can also be a
|
2752
|
-
# definition. For example, given:
|
2753
|
-
#
|
2754
|
-
# \code
|
2755
|
-
# int f(int, int);
|
2756
|
-
# int g(int x, int y) { return f(x, y); }
|
2757
|
-
# int f(int a, int b) { return a + b; }
|
2758
|
-
# int f(int, int);
|
2759
|
-
# \endcode
|
2760
|
-
#
|
2761
|
-
# there are three declarations of the function "f", but only the
|
2762
|
-
# second one is a definition. The clang_getCursorDefinition()
|
2763
|
-
# function will take any cursor pointing to a declaration of "f"
|
2764
|
-
# (the first or fourth lines of the example) or a cursor referenced
|
2765
|
-
# that uses "f" (the call to "f' inside "g") and will return a
|
2766
|
-
# declaration cursor pointing to the definition (the second "f"
|
2767
|
-
# declaration).
|
2768
|
-
#
|
2769
|
-
# If given a cursor for which there is no corresponding definition,
|
2770
|
-
# e.g., because there is no definition of that entity within this
|
2771
|
-
# translation unit, returns a NULL cursor.
|
2772
|
-
#
|
2773
|
-
# @method get_cursor_definition(cursor)
|
2774
|
-
# @param [Cursor] cursor
|
2775
|
-
# @return [Cursor]
|
2776
|
-
# @scope class
|
2777
|
-
attach_function :get_cursor_definition, :clang_getCursorDefinition, [Cursor.by_value], Cursor.by_value
|
2778
|
-
|
2779
|
-
# Determine whether the declaration pointed to by this cursor
|
2780
|
-
# is also a definition of that entity.
|
2781
|
-
#
|
2782
|
-
# @method is_cursor_definition(cursor)
|
2783
|
-
# @param [Cursor] cursor
|
2784
|
-
# @return [Integer]
|
2785
|
-
# @scope class
|
2786
|
-
attach_function :is_cursor_definition, :clang_isCursorDefinition, [Cursor.by_value], :uint
|
2787
|
-
|
2788
|
-
# Retrieve the canonical cursor corresponding to the given cursor.
|
2789
|
-
#
|
2790
|
-
# In the C family of languages, many kinds of entities can be declared several
|
2791
|
-
# times within a single translation unit. For example, a structure type can
|
2792
|
-
# be forward-declared (possibly multiple times) and later defined:
|
2793
|
-
#
|
2794
|
-
# \code
|
2795
|
-
# struct X;
|
2796
|
-
# struct X;
|
2797
|
-
# struct X {
|
2798
|
-
# int member;
|
2799
|
-
# };
|
2800
|
-
# \endcode
|
2801
|
-
#
|
2802
|
-
# The declarations and the definition of \c X are represented by three
|
2803
|
-
# different cursors, all of which are declarations of the same underlying
|
2804
|
-
# entity. One of these cursor is considered the "canonical" cursor, which
|
2805
|
-
# is effectively the representative for the underlying entity. One can
|
2806
|
-
# determine if two cursors are declarations of the same underlying entity by
|
2807
|
-
# comparing their canonical cursors.
|
2808
|
-
#
|
2809
|
-
# @method get_canonical_cursor(cursor)
|
2810
|
-
# @param [Cursor] cursor
|
2811
|
-
# @return [Cursor] The canonical cursor for the entity referred to by the given cursor.
|
2812
|
-
# @scope class
|
2813
|
-
attach_function :get_canonical_cursor, :clang_getCanonicalCursor, [Cursor.by_value], Cursor.by_value
|
2814
|
-
|
2815
|
-
# Determine if a C++ member function or member function template is
|
2816
|
-
# declared 'static'.
|
2817
|
-
#
|
2818
|
-
# @method cxx_method_is_static(c)
|
2819
|
-
# @param [Cursor] c
|
2820
|
-
# @return [Integer]
|
2821
|
-
# @scope class
|
2822
|
-
attach_function :cxx_method_is_static, :clang_CXXMethod_isStatic, [Cursor.by_value], :uint
|
2823
|
-
|
2824
|
-
# Determine if a C++ member function or member function template is
|
2825
|
-
# explicitly declared 'virtual' or if it overrides a virtual method from
|
2826
|
-
# one of the base classes.
|
2827
|
-
#
|
2828
|
-
# @method cxx_method_is_virtual(c)
|
2829
|
-
# @param [Cursor] c
|
2830
|
-
# @return [Integer]
|
2831
|
-
# @scope class
|
2832
|
-
attach_function :cxx_method_is_virtual, :clang_CXXMethod_isVirtual, [Cursor.by_value], :uint
|
2833
|
-
|
2834
|
-
# Given a cursor that represents a template, determine
|
2835
|
-
# the cursor kind of the specializations would be generated by instantiating
|
2836
|
-
# the template.
|
2837
|
-
#
|
2838
|
-
# This routine can be used to determine what flavor of function template,
|
2839
|
-
# class template, or class template partial specialization is stored in the
|
2840
|
-
# cursor. For example, it can describe whether a class template cursor is
|
2841
|
-
# declared with "struct", "class" or "union".
|
2842
|
-
#
|
2843
|
-
# @method get_template_cursor_kind(c)
|
2844
|
-
# @param [Cursor] c The cursor to query. This cursor should represent a template
|
2845
|
-
# declaration.
|
2846
|
-
# @return [Symbol from _enum_cursor_kind_] The cursor kind of the specializations that would be generated
|
2847
|
-
# by instantiating the template \p C. If \p C is not a template, returns
|
2848
|
-
# \c CXCursor_NoDeclFound.
|
2849
|
-
# @scope class
|
2850
|
-
attach_function :get_template_cursor_kind, :clang_getTemplateCursorKind, [Cursor.by_value], :cursor_kind
|
2851
|
-
|
2852
|
-
# Given a cursor that may represent a specialization or instantiation
|
2853
|
-
# of a template, retrieve the cursor that represents the template that it
|
2854
|
-
# specializes or from which it was instantiated.
|
2855
|
-
#
|
2856
|
-
# This routine determines the template involved both for explicit
|
2857
|
-
# specializations of templates and for implicit instantiations of the template,
|
2858
|
-
# both of which are referred to as "specializations". For a class template
|
2859
|
-
# specialization (e.g., \c std::vector<bool>), this routine will return
|
2860
|
-
# either the primary template (\c std::vector) or, if the specialization was
|
2861
|
-
# instantiated from a class template partial specialization, the class template
|
2862
|
-
# partial specialization. For a class template partial specialization and a
|
2863
|
-
# function template specialization (including instantiations), this
|
2864
|
-
# this routine will return the specialized template.
|
2865
|
-
#
|
2866
|
-
# For members of a class template (e.g., member functions, member classes, or
|
2867
|
-
# static data members), returns the specialized or instantiated member.
|
2868
|
-
# Although not strictly "templates" in the C++ language, members of class
|
2869
|
-
# templates have the same notions of specializations and instantiations that
|
2870
|
-
# templates do, so this routine treats them similarly.
|
2871
|
-
#
|
2872
|
-
# @method get_specialized_cursor_template(c)
|
2873
|
-
# @param [Cursor] c A cursor that may be a specialization of a template or a member
|
2874
|
-
# of a template.
|
2875
|
-
# @return [Cursor] If the given cursor is a specialization or instantiation of a
|
2876
|
-
# template or a member thereof, the template or member that it specializes or
|
2877
|
-
# from which it was instantiated. Otherwise, returns a NULL cursor.
|
2878
|
-
# @scope class
|
2879
|
-
attach_function :get_specialized_cursor_template, :clang_getSpecializedCursorTemplate, [Cursor.by_value], Cursor.by_value
|
2880
|
-
|
2881
|
-
# Given a cursor that references something else, return the source range
|
2882
|
-
# covering that reference.
|
2883
|
-
#
|
2884
|
-
# @method get_cursor_reference_name_range(c, name_flags, piece_index)
|
2885
|
-
# @param [Cursor] c A cursor pointing to a member reference, a declaration reference, or
|
2886
|
-
# an operator call.
|
2887
|
-
# @param [Integer] name_flags A bitset with three independent flags:
|
2888
|
-
# CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and
|
2889
|
-
# CXNameRange_WantSinglePiece.
|
2890
|
-
# @param [Integer] piece_index For contiguous names or when passing the flag
|
2891
|
-
# CXNameRange_WantSinglePiece, only one piece with index 0 is
|
2892
|
-
# available. When the CXNameRange_WantSinglePiece flag is not passed for a
|
2893
|
-
# non-contiguous names, this index can be used to retreive the individual
|
2894
|
-
# pieces of the name. See also CXNameRange_WantSinglePiece.
|
2895
|
-
# @return [SourceRange] The piece of the name pointed to by the given cursor. If there is no
|
2896
|
-
# name, or if the PieceIndex is out-of-range, a null-cursor will be returned.
|
2897
|
-
# @scope class
|
2898
|
-
attach_function :get_cursor_reference_name_range, :clang_getCursorReferenceNameRange, [Cursor.by_value, :uint, :uint], SourceRange.by_value
|
2899
|
-
|
2900
|
-
# (Not documented)
|
2901
|
-
#
|
2902
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:name_ref_flags).</em>
|
2903
|
-
#
|
2904
|
-
# === Options:
|
2905
|
-
# :want_qualifier ::
|
2906
|
-
# Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the
|
2907
|
-
# range.
|
2908
|
-
# :want_template_args ::
|
2909
|
-
# Include the explicit template arguments, e.g. <int> in x.f<int>, in
|
2910
|
-
# the range.
|
2911
|
-
# :want_single_piece ::
|
2912
|
-
# If the name is non-contiguous, return the full spanning range.
|
2913
|
-
#
|
2914
|
-
# Non-contiguous names occur in Objective-C when a selector with two or more
|
2915
|
-
# parameters is used, or in C++ when using an operator:
|
2916
|
-
# \code
|
2917
|
-
# (object doSomething:here withValue:there); // ObjC
|
2918
|
-
# return some_vector(1); // C++
|
2919
|
-
# \endcode
|
2920
|
-
#
|
2921
|
-
# @method _enum_name_ref_flags_
|
2922
|
-
# @return [Symbol]
|
2923
|
-
# @scope class
|
2924
|
-
enum :name_ref_flags, [
|
2925
|
-
:want_qualifier, 0x1,
|
2926
|
-
:want_template_args, 0x2,
|
2927
|
-
:want_single_piece, 0x4
|
2928
|
-
]
|
2929
|
-
|
2930
|
-
# Describes a kind of token.
|
2931
|
-
#
|
2932
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:token_kind).</em>
|
2933
|
-
#
|
2934
|
-
# === Options:
|
2935
|
-
# :punctuation ::
|
2936
|
-
# A token that contains some kind of punctuation.
|
2937
|
-
# :keyword ::
|
2938
|
-
# A language keyword.
|
2939
|
-
# :identifier ::
|
2940
|
-
# An identifier (that is not a keyword).
|
2941
|
-
# :literal ::
|
2942
|
-
# A numeric, string, or character literal.
|
2943
|
-
# :comment ::
|
2944
|
-
# A comment.
|
2945
|
-
#
|
2946
|
-
# @method _enum_token_kind_
|
2947
|
-
# @return [Symbol]
|
2948
|
-
# @scope class
|
2949
|
-
enum :token_kind, [
|
2950
|
-
:punctuation,
|
2951
|
-
:keyword,
|
2952
|
-
:identifier,
|
2953
|
-
:literal,
|
2954
|
-
:comment
|
2955
|
-
]
|
2956
|
-
|
2957
|
-
class Token < FFI::Struct
|
2958
|
-
layout :int_data, [:uint, 4],
|
2959
|
-
:ptr_data, :pointer
|
2960
|
-
end
|
2961
|
-
|
2962
|
-
# Determine the kind of the given token.
|
2963
|
-
#
|
2964
|
-
# @method get_token_kind(token)
|
2965
|
-
# @param [Token] token
|
2966
|
-
# @return [Symbol from _enum_token_kind_]
|
2967
|
-
# @scope class
|
2968
|
-
attach_function :get_token_kind, :clang_getTokenKind, [Token.by_value], :token_kind
|
2969
|
-
|
2970
|
-
# Determine the spelling of the given token.
|
2971
|
-
#
|
2972
|
-
# The spelling of a token is the textual representation of that token, e.g.,
|
2973
|
-
# the text of an identifier or keyword.
|
2974
|
-
#
|
2975
|
-
# @method get_token_spelling(translation_unit_impl, token)
|
2976
|
-
# @param [TranslationUnitImpl] translation_unit_impl
|
2977
|
-
# @param [Token] token
|
2978
|
-
# @return [String]
|
2979
|
-
# @scope class
|
2980
|
-
attach_function :get_token_spelling, :clang_getTokenSpelling, [TranslationUnitImpl, Token.by_value], String.by_value
|
2981
|
-
|
2982
|
-
# Retrieve the source location of the given token.
|
2983
|
-
#
|
2984
|
-
# @method get_token_location(translation_unit_impl, token)
|
2985
|
-
# @param [TranslationUnitImpl] translation_unit_impl
|
2986
|
-
# @param [Token] token
|
2987
|
-
# @return [SourceLocation]
|
2988
|
-
# @scope class
|
2989
|
-
attach_function :get_token_location, :clang_getTokenLocation, [TranslationUnitImpl, Token.by_value], SourceLocation.by_value
|
2990
|
-
|
2991
|
-
# Retrieve a source range that covers the given token.
|
2992
|
-
#
|
2993
|
-
# @method get_token_extent(translation_unit_impl, token)
|
2994
|
-
# @param [TranslationUnitImpl] translation_unit_impl
|
2995
|
-
# @param [Token] token
|
2996
|
-
# @return [SourceRange]
|
2997
|
-
# @scope class
|
2998
|
-
attach_function :get_token_extent, :clang_getTokenExtent, [TranslationUnitImpl, Token.by_value], SourceRange.by_value
|
2999
|
-
|
3000
|
-
# Tokenize the source code described by the given range into raw
|
3001
|
-
# lexical tokens.
|
3002
|
-
#
|
3003
|
-
# @method tokenize(tu, range, tokens, num_tokens)
|
3004
|
-
# @param [TranslationUnitImpl] tu the translation unit whose text is being tokenized.
|
3005
|
-
# @param [SourceRange] range the source range in which text should be tokenized. All of the
|
3006
|
-
# tokens produced by tokenization will fall within this source range,
|
3007
|
-
# @param [FFI::Pointer(**Token)] tokens this pointer will be set to point to the array of tokens
|
3008
|
-
# that occur within the given source range. The returned pointer must be
|
3009
|
-
# freed with clang_disposeTokens() before the translation unit is destroyed.
|
3010
|
-
# @param [FFI::Pointer(*UInt)] num_tokens will be set to the number of tokens in the \c *Tokens
|
3011
|
-
# array.
|
3012
|
-
# @return [nil]
|
3013
|
-
# @scope class
|
3014
|
-
attach_function :tokenize, :clang_tokenize, [TranslationUnitImpl, SourceRange.by_value, :pointer, :pointer], :void
|
3015
|
-
|
3016
|
-
# Annotate the given set of tokens by providing cursors for each token
|
3017
|
-
# that can be mapped to a specific entity within the abstract syntax tree.
|
3018
|
-
#
|
3019
|
-
# This token-annotation routine is equivalent to invoking
|
3020
|
-
# clang_getCursor() for the source locations of each of the
|
3021
|
-
# tokens. The cursors provided are filtered, so that only those
|
3022
|
-
# cursors that have a direct correspondence to the token are
|
3023
|
-
# accepted. For example, given a function call \c f(x),
|
3024
|
-
# clang_getCursor() would provide the following cursors:
|
3025
|
-
#
|
3026
|
-
# * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'.
|
3027
|
-
# * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'.
|
3028
|
-
# * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'.
|
3029
|
-
#
|
3030
|
-
# Only the first and last of these cursors will occur within the
|
3031
|
-
# annotate, since the tokens "f" and "x' directly refer to a function
|
3032
|
-
# and a variable, respectively, but the parentheses are just a small
|
3033
|
-
# part of the full syntax of the function call expression, which is
|
3034
|
-
# not provided as an annotation.
|
3035
|
-
#
|
3036
|
-
# @method annotate_tokens(tu, tokens, num_tokens, cursors)
|
3037
|
-
# @param [TranslationUnitImpl] tu the translation unit that owns the given tokens.
|
3038
|
-
# @param [Token] tokens the set of tokens to annotate.
|
3039
|
-
# @param [Integer] num_tokens the number of tokens in \p Tokens.
|
3040
|
-
# @param [Cursor] cursors an array of \p NumTokens cursors, whose contents will be
|
3041
|
-
# replaced with the cursors corresponding to each token.
|
3042
|
-
# @return [nil]
|
3043
|
-
# @scope class
|
3044
|
-
attach_function :annotate_tokens, :clang_annotateTokens, [TranslationUnitImpl, Token, :uint, Cursor], :void
|
3045
|
-
|
3046
|
-
# Free the given set of tokens.
|
3047
|
-
#
|
3048
|
-
# @method dispose_tokens(tu, tokens, num_tokens)
|
3049
|
-
# @param [TranslationUnitImpl] tu
|
3050
|
-
# @param [Token] tokens
|
3051
|
-
# @param [Integer] num_tokens
|
3052
|
-
# @return [nil]
|
3053
|
-
# @scope class
|
3054
|
-
attach_function :dispose_tokens, :clang_disposeTokens, [TranslationUnitImpl, Token, :uint], :void
|
3055
|
-
|
3056
|
-
# for debug/testing
|
3057
|
-
#
|
3058
|
-
# @method get_cursor_kind_spelling(kind)
|
3059
|
-
# @param [Symbol from _enum_cursor_kind_] kind
|
3060
|
-
# @return [String]
|
3061
|
-
# @scope class
|
3062
|
-
attach_function :get_cursor_kind_spelling, :clang_getCursorKindSpelling, [:cursor_kind], String.by_value
|
3063
|
-
|
3064
|
-
# (Not documented)
|
3065
|
-
#
|
3066
|
-
# @method get_definition_spelling_and_extent(cursor, start_buf, end_buf, start_line, start_column, end_line, end_column)
|
3067
|
-
# @param [Cursor] cursor
|
3068
|
-
# @param [FFI::Pointer(**Char_S)] start_buf
|
3069
|
-
# @param [FFI::Pointer(**Char_S)] end_buf
|
3070
|
-
# @param [FFI::Pointer(*UInt)] start_line
|
3071
|
-
# @param [FFI::Pointer(*UInt)] start_column
|
3072
|
-
# @param [FFI::Pointer(*UInt)] end_line
|
3073
|
-
# @param [FFI::Pointer(*UInt)] end_column
|
3074
|
-
# @return [nil]
|
3075
|
-
# @scope class
|
3076
|
-
attach_function :get_definition_spelling_and_extent, :clang_getDefinitionSpellingAndExtent, [Cursor.by_value, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer], :void
|
3077
|
-
|
3078
|
-
# (Not documented)
|
3079
|
-
#
|
3080
|
-
# @method enable_stack_traces()
|
3081
|
-
# @return [nil]
|
3082
|
-
# @scope class
|
3083
|
-
attach_function :enable_stack_traces, :clang_enableStackTraces, [], :void
|
3084
|
-
|
3085
|
-
# (Not documented)
|
3086
|
-
#
|
3087
|
-
# @method execute_on_thread(fn, user_data, stack_size)
|
3088
|
-
# @param [FFI::Pointer(*)] fn
|
3089
|
-
# @param [FFI::Pointer(*Void)] user_data
|
3090
|
-
# @param [Integer] stack_size
|
3091
|
-
# @return [nil]
|
3092
|
-
# @scope class
|
3093
|
-
attach_function :execute_on_thread, :clang_executeOnThread, [:pointer, :pointer, :uint], :void
|
3094
|
-
|
3095
|
-
# A single result of code completion.
|
3096
|
-
#
|
3097
|
-
# = Fields:
|
3098
|
-
# :cursor_kind ::
|
3099
|
-
# (Symbol from _enum_cursor_kind_) The kind of entity that this completion refers to.
|
3100
|
-
#
|
3101
|
-
# The cursor kind will be a macro, keyword, or a declaration (one of the
|
3102
|
-
# *Decl cursor kinds), describing the entity that the completion is
|
3103
|
-
# referring to.
|
3104
|
-
#
|
3105
|
-
# \todo In the future, we would like to provide a full cursor, to allow
|
3106
|
-
# the client to extract additional information from declaration.
|
3107
|
-
# :completion_string ::
|
3108
|
-
# (FFI::Pointer(CompletionString)) The code-completion string that describes how to insert this
|
3109
|
-
# code-completion result into the editing buffer.
|
3110
|
-
class CompletionResult < FFI::Struct
|
3111
|
-
layout :cursor_kind, :cursor_kind,
|
3112
|
-
:completion_string, :pointer
|
3113
|
-
end
|
3114
|
-
|
3115
|
-
# Describes a single piece of text within a code-completion string.
|
3116
|
-
#
|
3117
|
-
# Each "chunk" within a code-completion string (\c CXCompletionString) is
|
3118
|
-
# either a piece of text with a specific "kind" that describes how that text
|
3119
|
-
# should be interpreted by the client or is another completion string.
|
3120
|
-
#
|
3121
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:completion_chunk_kind).</em>
|
3122
|
-
#
|
3123
|
-
# === Options:
|
3124
|
-
# :optional ::
|
3125
|
-
# A code-completion string that describes "optional" text that
|
3126
|
-
# could be a part of the template (but is not required).
|
3127
|
-
#
|
3128
|
-
# The Optional chunk is the only kind of chunk that has a code-completion
|
3129
|
-
# string for its representation, which is accessible via
|
3130
|
-
# \c clang_getCompletionChunkCompletionString(). The code-completion string
|
3131
|
-
# describes an additional part of the template that is completely optional.
|
3132
|
-
# For example, optional chunks can be used to describe the placeholders for
|
3133
|
-
# arguments that match up with defaulted function parameters, e.g. given:
|
3134
|
-
#
|
3135
|
-
# \code
|
3136
|
-
# void f(int x, float y = 3.14, double z = 2.71828);
|
3137
|
-
# \endcode
|
3138
|
-
#
|
3139
|
-
# The code-completion string for this function would contain:
|
3140
|
-
# - a TypedText chunk for "f".
|
3141
|
-
# - a LeftParen chunk for "(".
|
3142
|
-
# - a Placeholder chunk for "int x"
|
3143
|
-
# - an Optional chunk containing the remaining defaulted arguments, e.g.,
|
3144
|
-
# - a Comma chunk for ","
|
3145
|
-
# - a Placeholder chunk for "float y"
|
3146
|
-
# - an Optional chunk containing the last defaulted argument:
|
3147
|
-
# - a Comma chunk for ","
|
3148
|
-
# - a Placeholder chunk for "double z"
|
3149
|
-
# - a RightParen chunk for ")"
|
3150
|
-
#
|
3151
|
-
# There are many ways to handle Optional chunks. Two simple approaches are:
|
3152
|
-
# - Completely ignore optional chunks, in which case the template for the
|
3153
|
-
# function "f" would only include the first parameter ("int x").
|
3154
|
-
# - Fully expand all optional chunks, in which case the template for the
|
3155
|
-
# function "f" would have all of the parameters.
|
3156
|
-
# :typed_text ::
|
3157
|
-
# Text that a user would be expected to type to get this
|
3158
|
-
# code-completion result.
|
3159
|
-
#
|
3160
|
-
# There will be exactly one "typed text" chunk in a semantic string, which
|
3161
|
-
# will typically provide the spelling of a keyword or the name of a
|
3162
|
-
# declaration that could be used at the current code point. Clients are
|
3163
|
-
# expected to filter the code-completion results based on the text in this
|
3164
|
-
# chunk.
|
3165
|
-
# :text ::
|
3166
|
-
# Text that should be inserted as part of a code-completion result.
|
3167
|
-
#
|
3168
|
-
# A "text" chunk represents text that is part of the template to be
|
3169
|
-
# inserted into user code should this particular code-completion result
|
3170
|
-
# be selected.
|
3171
|
-
# :placeholder ::
|
3172
|
-
# Placeholder text that should be replaced by the user.
|
3173
|
-
#
|
3174
|
-
# A "placeholder" chunk marks a place where the user should insert text
|
3175
|
-
# into the code-completion template. For example, placeholders might mark
|
3176
|
-
# the function parameters for a function declaration, to indicate that the
|
3177
|
-
# user should provide arguments for each of those parameters. The actual
|
3178
|
-
# text in a placeholder is a suggestion for the text to display before
|
3179
|
-
# the user replaces the placeholder with real code.
|
3180
|
-
# :informative ::
|
3181
|
-
# Informative text that should be displayed but never inserted as
|
3182
|
-
# part of the template.
|
3183
|
-
#
|
3184
|
-
# An "informative" chunk contains annotations that can be displayed to
|
3185
|
-
# help the user decide whether a particular code-completion result is the
|
3186
|
-
# right option, but which is not part of the actual template to be inserted
|
3187
|
-
# by code completion.
|
3188
|
-
# :current_parameter ::
|
3189
|
-
# Text that describes the current parameter when code-completion is
|
3190
|
-
# referring to function call, message send, or template specialization.
|
3191
|
-
#
|
3192
|
-
# A "current parameter" chunk occurs when code-completion is providing
|
3193
|
-
# information about a parameter corresponding to the argument at the
|
3194
|
-
# code-completion point. For example, given a function
|
3195
|
-
#
|
3196
|
-
# \code
|
3197
|
-
# int add(int x, int y);
|
3198
|
-
# \endcode
|
3199
|
-
#
|
3200
|
-
# and the source code \c add(, where the code-completion point is after the
|
3201
|
-
# "(", the code-completion string will contain a "current parameter" chunk
|
3202
|
-
# for "int x", indicating that the current argument will initialize that
|
3203
|
-
# parameter. After typing further, to \c add(17, (where the code-completion
|
3204
|
-
# point is after the ","), the code-completion string will contain a
|
3205
|
-
# "current paremeter" chunk to "int y".
|
3206
|
-
# :left_paren ::
|
3207
|
-
# A left parenthesis ('('), used to initiate a function call or
|
3208
|
-
# signal the beginning of a function parameter list.
|
3209
|
-
# :right_paren ::
|
3210
|
-
# A right parenthesis (')'), used to finish a function call or
|
3211
|
-
# signal the end of a function parameter list.
|
3212
|
-
# :left_bracket ::
|
3213
|
-
# A left bracket ('(').
|
3214
|
-
# :right_bracket ::
|
3215
|
-
# A right bracket (')').
|
3216
|
-
# :left_brace ::
|
3217
|
-
# A left brace ('{').
|
3218
|
-
# :right_brace ::
|
3219
|
-
# A right brace ('}').
|
3220
|
-
# :left_angle ::
|
3221
|
-
# A left angle bracket ('<').
|
3222
|
-
# :right_angle ::
|
3223
|
-
# A right angle bracket ('>').
|
3224
|
-
# :comma ::
|
3225
|
-
# A comma separator (',').
|
3226
|
-
# :result_type ::
|
3227
|
-
# Text that specifies the result type of a given result.
|
3228
|
-
#
|
3229
|
-
# This special kind of informative chunk is not meant to be inserted into
|
3230
|
-
# the text buffer. Rather, it is meant to illustrate the type that an
|
3231
|
-
# expression using the given completion string would have.
|
3232
|
-
# :colon ::
|
3233
|
-
# A colon (':').
|
3234
|
-
# :semi_colon ::
|
3235
|
-
# A semicolon (';').
|
3236
|
-
# :equal ::
|
3237
|
-
# An '=' sign.
|
3238
|
-
# :horizontal_space ::
|
3239
|
-
# Horizontal space (' ').
|
3240
|
-
# :vertical_space ::
|
3241
|
-
# Vertical space ('\n'), after which it is generally a good idea to
|
3242
|
-
# perform indentation.
|
3243
|
-
#
|
3244
|
-
# @method _enum_completion_chunk_kind_
|
3245
|
-
# @return [Symbol]
|
3246
|
-
# @scope class
|
3247
|
-
enum :completion_chunk_kind, [
|
3248
|
-
:optional,
|
3249
|
-
:typed_text,
|
3250
|
-
:text,
|
3251
|
-
:placeholder,
|
3252
|
-
:informative,
|
3253
|
-
:current_parameter,
|
3254
|
-
:left_paren,
|
3255
|
-
:right_paren,
|
3256
|
-
:left_bracket,
|
3257
|
-
:right_bracket,
|
3258
|
-
:left_brace,
|
3259
|
-
:right_brace,
|
3260
|
-
:left_angle,
|
3261
|
-
:right_angle,
|
3262
|
-
:comma,
|
3263
|
-
:result_type,
|
3264
|
-
:colon,
|
3265
|
-
:semi_colon,
|
3266
|
-
:equal,
|
3267
|
-
:horizontal_space,
|
3268
|
-
:vertical_space
|
3269
|
-
]
|
3270
|
-
|
3271
|
-
# Determine the kind of a particular chunk within a completion string.
|
3272
|
-
#
|
3273
|
-
# @method get_completion_chunk_kind(completion_string, chunk_number)
|
3274
|
-
# @param [FFI::Pointer(CompletionString)] completion_string the completion string to query.
|
3275
|
-
# @param [Integer] chunk_number the 0-based index of the chunk in the completion string.
|
3276
|
-
# @return [Symbol from _enum_completion_chunk_kind_] the kind of the chunk at the index \c chunk_number.
|
3277
|
-
# @scope class
|
3278
|
-
attach_function :get_completion_chunk_kind, :clang_getCompletionChunkKind, [:pointer, :uint], :completion_chunk_kind
|
3279
|
-
|
3280
|
-
# Retrieve the text associated with a particular chunk within a
|
3281
|
-
# completion string.
|
3282
|
-
#
|
3283
|
-
# @method get_completion_chunk_text(completion_string, chunk_number)
|
3284
|
-
# @param [FFI::Pointer(CompletionString)] completion_string the completion string to query.
|
3285
|
-
# @param [Integer] chunk_number the 0-based index of the chunk in the completion string.
|
3286
|
-
# @return [String] the text associated with the chunk at index \c chunk_number.
|
3287
|
-
# @scope class
|
3288
|
-
attach_function :get_completion_chunk_text, :clang_getCompletionChunkText, [:pointer, :uint], String.by_value
|
3289
|
-
|
3290
|
-
# Retrieve the completion string associated with a particular chunk
|
3291
|
-
# within a completion string.
|
3292
|
-
#
|
3293
|
-
# @method get_completion_chunk_completion_string(completion_string, chunk_number)
|
3294
|
-
# @param [FFI::Pointer(CompletionString)] completion_string the completion string to query.
|
3295
|
-
# @param [Integer] chunk_number the 0-based index of the chunk in the completion string.
|
3296
|
-
# @return [FFI::Pointer(CompletionString)] the completion string associated with the chunk at index
|
3297
|
-
# \c chunk_number.
|
3298
|
-
# @scope class
|
3299
|
-
attach_function :get_completion_chunk_completion_string, :clang_getCompletionChunkCompletionString, [:pointer, :uint], :pointer
|
3300
|
-
|
3301
|
-
# Retrieve the number of chunks in the given code-completion string.
|
3302
|
-
#
|
3303
|
-
# @method get_num_completion_chunks(completion_string)
|
3304
|
-
# @param [FFI::Pointer(CompletionString)] completion_string
|
3305
|
-
# @return [Integer]
|
3306
|
-
# @scope class
|
3307
|
-
attach_function :get_num_completion_chunks, :clang_getNumCompletionChunks, [:pointer], :uint
|
3308
|
-
|
3309
|
-
# Determine the priority of this code completion.
|
3310
|
-
#
|
3311
|
-
# The priority of a code completion indicates how likely it is that this
|
3312
|
-
# particular completion is the completion that the user will select. The
|
3313
|
-
# priority is selected by various internal heuristics.
|
3314
|
-
#
|
3315
|
-
# @method get_completion_priority(completion_string)
|
3316
|
-
# @param [FFI::Pointer(CompletionString)] completion_string The completion string to query.
|
3317
|
-
# @return [Integer] The priority of this completion string. Smaller values indicate
|
3318
|
-
# higher-priority (more likely) completions.
|
3319
|
-
# @scope class
|
3320
|
-
attach_function :get_completion_priority, :clang_getCompletionPriority, [:pointer], :uint
|
3321
|
-
|
3322
|
-
# Determine the availability of the entity that this code-completion
|
3323
|
-
# string refers to.
|
3324
|
-
#
|
3325
|
-
# @method get_completion_availability(completion_string)
|
3326
|
-
# @param [FFI::Pointer(CompletionString)] completion_string The completion string to query.
|
3327
|
-
# @return [Symbol from _enum_availability_kind_] The availability of the completion string.
|
3328
|
-
# @scope class
|
3329
|
-
attach_function :get_completion_availability, :clang_getCompletionAvailability, [:pointer], :availability_kind
|
3330
|
-
|
3331
|
-
# Retrieve the number of annotations associated with the given
|
3332
|
-
# completion string.
|
3333
|
-
#
|
3334
|
-
# @method get_completion_num_annotations(completion_string)
|
3335
|
-
# @param [FFI::Pointer(CompletionString)] completion_string the completion string to query.
|
3336
|
-
# @return [Integer] the number of annotations associated with the given completion
|
3337
|
-
# string.
|
3338
|
-
# @scope class
|
3339
|
-
attach_function :get_completion_num_annotations, :clang_getCompletionNumAnnotations, [:pointer], :uint
|
3340
|
-
|
3341
|
-
# Retrieve the annotation associated with the given completion string.
|
3342
|
-
#
|
3343
|
-
# @method get_completion_annotation(completion_string, annotation_number)
|
3344
|
-
# @param [FFI::Pointer(CompletionString)] completion_string the completion string to query.
|
3345
|
-
# @param [Integer] annotation_number the 0-based index of the annotation of the
|
3346
|
-
# completion string.
|
3347
|
-
# @return [String] annotation string associated with the completion at index
|
3348
|
-
# \c annotation_number, or a NULL string if that annotation is not available.
|
3349
|
-
# @scope class
|
3350
|
-
attach_function :get_completion_annotation, :clang_getCompletionAnnotation, [:pointer, :uint], String.by_value
|
3351
|
-
|
3352
|
-
# Retrieve a completion string for an arbitrary declaration or macro
|
3353
|
-
# definition cursor.
|
3354
|
-
#
|
3355
|
-
# @method get_cursor_completion_string(cursor)
|
3356
|
-
# @param [Cursor] cursor The cursor to query.
|
3357
|
-
# @return [FFI::Pointer(CompletionString)] A non-context-sensitive completion string for declaration and macro
|
3358
|
-
# definition cursors, or NULL for other kinds of cursors.
|
3359
|
-
# @scope class
|
3360
|
-
attach_function :get_cursor_completion_string, :clang_getCursorCompletionString, [Cursor.by_value], :pointer
|
3361
|
-
|
3362
|
-
# Contains the results of code-completion.
|
3363
|
-
#
|
3364
|
-
# This data structure contains the results of code completion, as
|
3365
|
-
# produced by \c clang_codeCompleteAt(). Its contents must be freed by
|
3366
|
-
# \c clang_disposeCodeCompleteResults.
|
3367
|
-
#
|
3368
|
-
# = Fields:
|
3369
|
-
# :results ::
|
3370
|
-
# (CompletionResult) The code-completion results.
|
3371
|
-
# :num_results ::
|
3372
|
-
# (Integer) The number of code-completion results stored in the
|
3373
|
-
# \c Results array.
|
3374
|
-
class CodeCompleteResults < FFI::Struct
|
3375
|
-
layout :results, CompletionResult,
|
3376
|
-
:num_results, :uint
|
3377
|
-
end
|
3378
|
-
|
3379
|
-
# Flags that can be passed to \c clang_codeCompleteAt() to
|
3380
|
-
# modify its behavior.
|
3381
|
-
#
|
3382
|
-
# The enumerators in this enumeration can be bitwise-OR'd together to
|
3383
|
-
# provide multiple options to \c clang_codeCompleteAt().
|
3384
|
-
#
|
3385
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:code_complete_flags).</em>
|
3386
|
-
#
|
3387
|
-
# === Options:
|
3388
|
-
# :include_macros ::
|
3389
|
-
# Whether to include macros within the set of code
|
3390
|
-
# completions returned.
|
3391
|
-
# :include_code_patterns ::
|
3392
|
-
# Whether to include code patterns for language constructs
|
3393
|
-
# within the set of code completions, e.g., for loops.
|
3394
|
-
#
|
3395
|
-
# @method _enum_code_complete_flags_
|
3396
|
-
# @return [Symbol]
|
3397
|
-
# @scope class
|
3398
|
-
enum :code_complete_flags, [
|
3399
|
-
:include_macros, 0x01,
|
3400
|
-
:include_code_patterns, 0x02
|
3401
|
-
]
|
3402
|
-
|
3403
|
-
# Bits that represent the context under which completion is occurring.
|
3404
|
-
#
|
3405
|
-
# The enumerators in this enumeration may be bitwise-OR'd together if multiple
|
3406
|
-
# contexts are occurring simultaneously.
|
3407
|
-
#
|
3408
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:completion_context).</em>
|
3409
|
-
#
|
3410
|
-
# === Options:
|
3411
|
-
# :completion_context_unexposed ::
|
3412
|
-
# The context for completions is unexposed, as only Clang results
|
3413
|
-
# should be included. (This is equivalent to having no context bits set.)
|
3414
|
-
#
|
3415
|
-
# @method _enum_completion_context_
|
3416
|
-
# @return [Symbol]
|
3417
|
-
# @scope class
|
3418
|
-
enum :completion_context, [
|
3419
|
-
:completion_context_unexposed, 0
|
3420
|
-
]
|
3421
|
-
|
3422
|
-
# Returns a default set of code-completion options that can be
|
3423
|
-
# passed to\c clang_codeCompleteAt().
|
3424
|
-
#
|
3425
|
-
# @method default_code_complete_options()
|
3426
|
-
# @return [Integer]
|
3427
|
-
# @scope class
|
3428
|
-
attach_function :default_code_complete_options, :clang_defaultCodeCompleteOptions, [], :uint
|
3429
|
-
|
3430
|
-
# Perform code completion at a given location in a translation unit.
|
3431
|
-
#
|
3432
|
-
# This function performs code completion at a particular file, line, and
|
3433
|
-
# column within source code, providing results that suggest potential
|
3434
|
-
# code snippets based on the context of the completion. The basic model
|
3435
|
-
# for code completion is that Clang will parse a complete source file,
|
3436
|
-
# performing syntax checking up to the location where code-completion has
|
3437
|
-
# been requested. At that point, a special code-completion token is passed
|
3438
|
-
# to the parser, which recognizes this token and determines, based on the
|
3439
|
-
# current location in the C/Objective-C/C++ grammar and the state of
|
3440
|
-
# semantic analysis, what completions to provide. These completions are
|
3441
|
-
# returned via a new \c CXCodeCompleteResults structure.
|
3442
|
-
#
|
3443
|
-
# Code completion itself is meant to be triggered by the client when the
|
3444
|
-
# user types punctuation characters or whitespace, at which point the
|
3445
|
-
# code-completion location will coincide with the cursor. For example, if \c p
|
3446
|
-
# is a pointer, code-completion might be triggered after the "-" and then
|
3447
|
-
# after the ">" in \c p->. When the code-completion location is afer the ">",
|
3448
|
-
# the completion results will provide, e.g., the members of the struct that
|
3449
|
-
# "p" points to. The client is responsible for placing the cursor at the
|
3450
|
-
# beginning of the token currently being typed, then filtering the results
|
3451
|
-
# based on the contents of the token. For example, when code-completing for
|
3452
|
-
# the expression \c p->get, the client should provide the location just after
|
3453
|
-
# the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the
|
3454
|
-
# client can filter the results based on the current token text ("get"), only
|
3455
|
-
# showing those results that start with "get". The intent of this interface
|
3456
|
-
# is to separate the relatively high-latency acquisition of code-completion
|
3457
|
-
# results from the filtering of results on a per-character basis, which must
|
3458
|
-
# have a lower latency.
|
3459
|
-
#
|
3460
|
-
# @method code_complete_at(tu, complete_filename, complete_line, complete_column, unsaved_files, num_unsaved_files, options)
|
3461
|
-
# @param [TranslationUnitImpl] tu The translation unit in which code-completion should
|
3462
|
-
# occur. The source files for this translation unit need not be
|
3463
|
-
# completely up-to-date (and the contents of those source files may
|
3464
|
-
# be overridden via \p unsaved_files). Cursors referring into the
|
3465
|
-
# translation unit may be invalidated by this invocation.
|
3466
|
-
# @param [String] complete_filename The name of the source file where code
|
3467
|
-
# completion should be performed. This filename may be any file
|
3468
|
-
# included in the translation unit.
|
3469
|
-
# @param [Integer] complete_line The line at which code-completion should occur.
|
3470
|
-
# @param [Integer] complete_column The column at which code-completion should occur.
|
3471
|
-
# Note that the column should point just after the syntactic construct that
|
3472
|
-
# initiated code completion, and not in the middle of a lexical token.
|
3473
|
-
# @param [UnsavedFile] unsaved_files the Tiles that have not yet been saved to disk
|
3474
|
-
# but may be required for parsing or code completion, including the
|
3475
|
-
# contents of those files. The contents and name of these files (as
|
3476
|
-
# specified by CXUnsavedFile) are copied when necessary, so the
|
3477
|
-
# client only needs to guarantee their validity until the call to
|
3478
|
-
# this function returns.
|
3479
|
-
# @param [Integer] num_unsaved_files The number of unsaved file entries in \p
|
3480
|
-
# unsaved_files.
|
3481
|
-
# @param [Integer] options Extra options that control the behavior of code
|
3482
|
-
# completion, expressed as a bitwise OR of the enumerators of the
|
3483
|
-
# CXCodeComplete_Flags enumeration. The
|
3484
|
-
# \c clang_defaultCodeCompleteOptions() function returns a default set
|
3485
|
-
# of code-completion options.
|
3486
|
-
# @return [CodeCompleteResults] If successful, a new \c CXCodeCompleteResults structure
|
3487
|
-
# containing code-completion results, which should eventually be
|
3488
|
-
# freed with \c clang_disposeCodeCompleteResults(). If code
|
3489
|
-
# completion fails, returns NULL.
|
3490
|
-
# @scope class
|
3491
|
-
attach_function :code_complete_at, :clang_codeCompleteAt, [TranslationUnitImpl, :string, :uint, :uint, UnsavedFile, :uint, :uint], CodeCompleteResults
|
3492
|
-
|
3493
|
-
# Sort the code-completion results in case-insensitive alphabetical
|
3494
|
-
# order.
|
3495
|
-
#
|
3496
|
-
# @method sort_code_completion_results(results, num_results)
|
3497
|
-
# @param [CompletionResult] results The set of results to sort.
|
3498
|
-
# @param [Integer] num_results The number of results in \p Results.
|
3499
|
-
# @return [nil]
|
3500
|
-
# @scope class
|
3501
|
-
attach_function :sort_code_completion_results, :clang_sortCodeCompletionResults, [CompletionResult, :uint], :void
|
3502
|
-
|
3503
|
-
# Free the given set of code-completion results.
|
3504
|
-
#
|
3505
|
-
# @method dispose_code_complete_results(results)
|
3506
|
-
# @param [CodeCompleteResults] results
|
3507
|
-
# @return [nil]
|
3508
|
-
# @scope class
|
3509
|
-
attach_function :dispose_code_complete_results, :clang_disposeCodeCompleteResults, [CodeCompleteResults], :void
|
3510
|
-
|
3511
|
-
# Determine the number of diagnostics produced prior to the
|
3512
|
-
# location where code completion was performed.
|
3513
|
-
#
|
3514
|
-
# @method code_complete_get_num_diagnostics(results)
|
3515
|
-
# @param [CodeCompleteResults] results
|
3516
|
-
# @return [Integer]
|
3517
|
-
# @scope class
|
3518
|
-
attach_function :code_complete_get_num_diagnostics, :clang_codeCompleteGetNumDiagnostics, [CodeCompleteResults], :uint
|
3519
|
-
|
3520
|
-
# Retrieve a diagnostic associated with the given code completion.
|
3521
|
-
#
|
3522
|
-
# Result:
|
3523
|
-
# the code completion results to query.
|
3524
|
-
#
|
3525
|
-
# @method code_complete_get_diagnostic(results, index)
|
3526
|
-
# @param [CodeCompleteResults] results
|
3527
|
-
# @param [Integer] index the zero-based diagnostic number to retrieve.
|
3528
|
-
# @return [FFI::Pointer(Diagnostic)] the requested diagnostic. This diagnostic must be freed
|
3529
|
-
# via a call to \c clang_disposeDiagnostic().
|
3530
|
-
# @scope class
|
3531
|
-
attach_function :code_complete_get_diagnostic, :clang_codeCompleteGetDiagnostic, [CodeCompleteResults, :uint], :pointer
|
3532
|
-
|
3533
|
-
# Determines what compeltions are appropriate for the context
|
3534
|
-
# the given code completion.
|
3535
|
-
#
|
3536
|
-
# @method code_complete_get_contexts(results)
|
3537
|
-
# @param [CodeCompleteResults] results the code completion results to query
|
3538
|
-
# @return [Integer] the kinds of completions that are appropriate for use
|
3539
|
-
# along with the given code completion results.
|
3540
|
-
# @scope class
|
3541
|
-
attach_function :code_complete_get_contexts, :clang_codeCompleteGetContexts, [CodeCompleteResults], :ulong_long
|
3542
|
-
|
3543
|
-
# Returns the cursor kind for the container for the current code
|
3544
|
-
# completion context. The container is only guaranteed to be set for
|
3545
|
-
# contexts where a container exists (i.e. member accesses or Objective-C
|
3546
|
-
# message sends); if there is not a container, this function will return
|
3547
|
-
# CXCursor_InvalidCode.
|
3548
|
-
#
|
3549
|
-
# @method code_complete_get_container_kind(results, is_incomplete)
|
3550
|
-
# @param [CodeCompleteResults] results the code completion results to query
|
3551
|
-
# @param [FFI::Pointer(*UInt)] is_incomplete on return, this value will be false if Clang has complete
|
3552
|
-
# information about the container. If Clang does not have complete
|
3553
|
-
# information, this value will be true.
|
3554
|
-
# @return [Symbol from _enum_cursor_kind_] the container kind, or CXCursor_InvalidCode if there is not a
|
3555
|
-
# container
|
3556
|
-
# @scope class
|
3557
|
-
attach_function :code_complete_get_container_kind, :clang_codeCompleteGetContainerKind, [CodeCompleteResults, :pointer], :cursor_kind
|
3558
|
-
|
3559
|
-
# Returns the USR for the container for the current code completion
|
3560
|
-
# context. If there is not a container for the current context, this
|
3561
|
-
# function will return the empty string.
|
3562
|
-
#
|
3563
|
-
# @method code_complete_get_container_usr(results)
|
3564
|
-
# @param [CodeCompleteResults] results the code completion results to query
|
3565
|
-
# @return [String] the USR for the container
|
3566
|
-
# @scope class
|
3567
|
-
attach_function :code_complete_get_container_usr, :clang_codeCompleteGetContainerUSR, [CodeCompleteResults], String.by_value
|
3568
|
-
|
3569
|
-
# Returns the currently-entered selector for an Objective-C message
|
3570
|
-
# send, formatted like "initWithFoo:bar:". Only guaranteed to return a
|
3571
|
-
# non-empty string for CXCompletionContext_ObjCInstanceMessage and
|
3572
|
-
# CXCompletionContext_ObjCClassMessage.
|
3573
|
-
#
|
3574
|
-
# @method code_complete_get_obj_c_selector(results)
|
3575
|
-
# @param [CodeCompleteResults] results the code completion results to query
|
3576
|
-
# @return [String] the selector (or partial selector) that has been entered thus far
|
3577
|
-
# for an Objective-C message send.
|
3578
|
-
# @scope class
|
3579
|
-
attach_function :code_complete_get_obj_c_selector, :clang_codeCompleteGetObjCSelector, [CodeCompleteResults], String.by_value
|
3580
|
-
|
3581
|
-
# Return a version string, suitable for showing to a user, but not
|
3582
|
-
# intended to be parsed (the format is not guaranteed to be stable).
|
3583
|
-
#
|
3584
|
-
# @method get_clang_version()
|
3585
|
-
# @return [String]
|
3586
|
-
# @scope class
|
3587
|
-
attach_function :get_clang_version, :clang_getClangVersion, [], String.by_value
|
3588
|
-
|
3589
|
-
# Enable/disable crash recovery.
|
3590
|
-
#
|
3591
|
-
# Flag:
|
3592
|
-
# to indicate if crash recovery is enabled. A non-zero value
|
3593
|
-
# enables crash recovery, while 0 disables it.
|
3594
|
-
#
|
3595
|
-
# @method toggle_crash_recovery(is_enabled)
|
3596
|
-
# @param [Integer] is_enabled
|
3597
|
-
# @return [nil]
|
3598
|
-
# @scope class
|
3599
|
-
attach_function :toggle_crash_recovery, :clang_toggleCrashRecovery, [:uint], :void
|
3600
|
-
|
3601
|
-
# Visitor invoked for each file in a translation unit
|
3602
|
-
# (used with clang_getInclusions()).
|
3603
|
-
#
|
3604
|
-
# This visitor function will be invoked by clang_getInclusions() for each
|
3605
|
-
# file included (either at the top-level or by #include directives) within
|
3606
|
-
# a translation unit. The first argument is the file being included, and
|
3607
|
-
# the second and third arguments provide the inclusion stack. The
|
3608
|
-
# array is sorted in order of immediate inclusion. For example,
|
3609
|
-
# the first element refers to the location that included 'included_file'.
|
3610
|
-
#
|
3611
|
-
# <em>This entry is only for documentation and no real method.</em>
|
3612
|
-
#
|
3613
|
-
# @method _callback_inclusion_visitor_(inclusion_stack, include_len, client_data)
|
3614
|
-
# @param [SourceLocation] inclusion_stack
|
3615
|
-
# @param [Integer] include_len
|
3616
|
-
# @param [FFI::Pointer(ClientData)] client_data
|
3617
|
-
# @return [FFI::Pointer(File)]
|
3618
|
-
# @scope class
|
3619
|
-
callback :inclusion_visitor, [SourceLocation, :uint, :pointer], :pointer
|
3620
|
-
|
3621
|
-
# Visit the set of preprocessor inclusions in a translation unit.
|
3622
|
-
# The visitor function is called with the provided data for every included
|
3623
|
-
# file. This does not include headers included by the PCH file (unless one
|
3624
|
-
# is inspecting the inclusions in the PCH file itself).
|
3625
|
-
#
|
3626
|
-
# @method get_inclusions(tu, visitor, client_data)
|
3627
|
-
# @param [TranslationUnitImpl] tu
|
3628
|
-
# @param [Proc(_callback_inclusion_visitor_)] visitor
|
3629
|
-
# @param [FFI::Pointer(ClientData)] client_data
|
3630
|
-
# @return [nil]
|
3631
|
-
# @scope class
|
3632
|
-
attach_function :get_inclusions, :clang_getInclusions, [TranslationUnitImpl, :inclusion_visitor, :pointer], :void
|
3633
|
-
|
3634
|
-
# Retrieve a remapping.
|
3635
|
-
#
|
3636
|
-
# @method get_remappings(path)
|
3637
|
-
# @param [String] path the path that contains metadata about remappings.
|
3638
|
-
# @return [FFI::Pointer(Remapping)] the requested remapping. This remapping must be freed
|
3639
|
-
# via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
|
3640
|
-
# @scope class
|
3641
|
-
attach_function :get_remappings, :clang_getRemappings, [:string], :pointer
|
3642
|
-
|
3643
|
-
# Determine the number of remappings.
|
3644
|
-
#
|
3645
|
-
# @method remap_get_num_files(remapping)
|
3646
|
-
# @param [FFI::Pointer(Remapping)] remapping
|
3647
|
-
# @return [Integer]
|
3648
|
-
# @scope class
|
3649
|
-
attach_function :remap_get_num_files, :clang_remap_getNumFiles, [:pointer], :uint
|
3650
|
-
|
3651
|
-
# Get the original and the associated filename from the remapping.
|
3652
|
-
#
|
3653
|
-
# @method remap_get_filenames(remapping, index, original, transformed)
|
3654
|
-
# @param [FFI::Pointer(Remapping)] remapping
|
3655
|
-
# @param [Integer] index
|
3656
|
-
# @param [String] original If non-NULL, will be set to the original filename.
|
3657
|
-
# @param [String] transformed If non-NULL, will be set to the filename that the original
|
3658
|
-
# is associated with.
|
3659
|
-
# @return [nil]
|
3660
|
-
# @scope class
|
3661
|
-
attach_function :remap_get_filenames, :clang_remap_getFilenames, [:pointer, :uint, String, String], :void
|
3662
|
-
|
3663
|
-
# Dispose the remapping.
|
3664
|
-
#
|
3665
|
-
# @method remap_dispose(remapping)
|
3666
|
-
# @param [FFI::Pointer(Remapping)] remapping
|
3667
|
-
# @return [nil]
|
3668
|
-
# @scope class
|
3669
|
-
attach_function :remap_dispose, :clang_remap_dispose, [:pointer], :void
|
3670
|
-
|
3671
|
-
# \defgroup CINDEX_HIGH Higher level API functions
|
3672
|
-
#
|
3673
|
-
# @{
|
3674
|
-
#
|
3675
|
-
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:visitor_result).</em>
|
3676
|
-
#
|
3677
|
-
# === Options:
|
3678
|
-
# :break ::
|
3679
|
-
#
|
3680
|
-
# :continue ::
|
3681
|
-
#
|
3682
|
-
#
|
3683
|
-
# @method _enum_visitor_result_
|
3684
|
-
# @return [Symbol]
|
3685
|
-
# @scope class
|
3686
|
-
enum :visitor_result, [
|
3687
|
-
:break,
|
3688
|
-
:continue
|
3689
|
-
]
|
3690
|
-
|
3691
|
-
# \defgroup CINDEX_HIGH Higher level API functions
|
3692
|
-
#
|
3693
|
-
# @{
|
3694
|
-
#
|
3695
|
-
# = Fields:
|
3696
|
-
# :context ::
|
3697
|
-
# (FFI::Pointer(*Void))
|
3698
|
-
# :visit ::
|
3699
|
-
# (FFI::Pointer(*))
|
3700
|
-
class CursorAndRangeVisitor < FFI::Struct
|
3701
|
-
layout :context, :pointer,
|
3702
|
-
:visit, :pointer
|
3703
|
-
end
|
3704
|
-
|
3705
|
-
# Find references of a declaration in a specific file.
|
3706
|
-
#
|
3707
|
-
# @method find_references_in_file(cursor, file, visitor)
|
3708
|
-
# @param [Cursor] cursor pointing to a declaration or a reference of one.
|
3709
|
-
# @param [FFI::Pointer(File)] file to search for references.
|
3710
|
-
# @param [CursorAndRangeVisitor] visitor callback that will receive pairs of CXCursor/CXSourceRange for
|
3711
|
-
# each reference found.
|
3712
|
-
# The CXSourceRange will point inside the file; if the reference is inside
|
3713
|
-
# a macro (and not a macro argument) the CXSourceRange will be invalid.
|
3714
|
-
# @return [nil]
|
3715
|
-
# @scope class
|
3716
|
-
attach_function :find_references_in_file, :clang_findReferencesInFile, [Cursor.by_value, :pointer, CursorAndRangeVisitor.by_value], :void
|
3717
|
-
|
3718
|
-
end
|
3719
|
-
end
|