ffi_gen 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,80 @@ require 'ffi'
4
4
 
5
5
  module FFIGen::Clang
6
6
  extend FFI::Library
7
- ffi_lib 'clang'
7
+ ffi_lib ["libclang-3.5.so.1", "libclang.so.1", "clang"]
8
+
9
+ def self.attach_function(name, *_)
10
+ begin; super; rescue FFI::NotFoundError => e
11
+ (class << self; self; end).class_eval { define_method(name) { |*_| raise e } }
12
+ end
13
+ end
14
+
15
+ CINDEX_VERSION_MAJOR = 0
16
+
17
+ CINDEX_VERSION_MINOR = 27
18
+
19
+ def cindex_version_stringize(major, minor)
20
+ cindex_version_stringize(major, minor)
21
+ end
22
+
23
+ # (Not documented)
24
+ #
25
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:error_code).</em>
26
+ #
27
+ # === Options:
28
+ # :success ::
29
+ # No error.
30
+ # :failure ::
31
+ # A generic error code, no further details are available.
32
+ #
33
+ # Errors of this kind can get their own specific error codes in future
34
+ # libclang versions.
35
+ # :crashed ::
36
+ # libclang crashed while performing the requested operation.
37
+ # :invalid_arguments ::
38
+ # The function detected that the arguments violate the function
39
+ # contract.
40
+ # :ast_read_error ::
41
+ # An AST deserialization error has occurred.
42
+ #
43
+ # @method _enum_error_code_
44
+ # @return [Symbol]
45
+ # @scope class
46
+ enum :error_code, [
47
+ :success, 0,
48
+ :failure, 1,
49
+ :crashed, 2,
50
+ :invalid_arguments, 3,
51
+ :ast_read_error, 4
52
+ ]
53
+
54
+ # (Not documented)
55
+ #
56
+ # = Fields:
57
+ # :data ::
58
+ # (FFI::Pointer(*Void))
59
+ # :private_flags ::
60
+ # (Integer)
61
+ class String < FFI::Struct
62
+ layout :data, :pointer,
63
+ :private_flags, :uint
64
+ end
65
+
66
+ # Retrieve the character data associated with the given string.
67
+ #
68
+ # @method get_c_string(string)
69
+ # @param [String] string
70
+ # @return [String]
71
+ # @scope class
72
+ attach_function :get_c_string, :clang_getCString, [String.by_value], :string
73
+
74
+ # Free the given string.
75
+ #
76
+ # @method dispose_string(string)
77
+ # @param [String] string
78
+ # @return [nil]
79
+ # @scope class
80
+ attach_function :dispose_string, :clang_disposeString, [String.by_value], :void
8
81
 
9
82
  # A single translation unit, which resides in an index.
10
83
  class TranslationUnitImpl < FFI::Struct
@@ -54,47 +127,35 @@ module FFIGen::Clang
54
127
  # @return [Symbol]
55
128
  # @scope class
56
129
  enum :availability_kind, [
57
- :available,
58
- :deprecated,
59
- :not_available,
60
- :not_accessible
130
+ :available, 0,
131
+ :deprecated, 1,
132
+ :not_available, 2,
133
+ :not_accessible, 3
61
134
  ]
62
135
 
63
- # A character string.
64
- #
65
- # The \c CXString type is used to return strings from the interface when
66
- # the ownership of that string might different from one call to the next.
67
- # Use \c clang_getCString() to retrieve the string data and, once finished
68
- # with the string data, call \c clang_disposeString() to free the string.
136
+ # Describes a version number of the form major.minor.subminor.
69
137
  #
70
138
  # = Fields:
71
- # :data ::
72
- # (FFI::Pointer(*Void))
73
- # :private_flags ::
74
- # (Integer)
75
- class String < FFI::Struct
76
- layout :data, :pointer,
77
- :private_flags, :uint
139
+ # :major ::
140
+ # (Integer) The major version number, e.g., the '10' in '10.7.3'. A negative
141
+ # value indicates that there is no version number at all.
142
+ # :minor ::
143
+ # (Integer) The minor version number, e.g., the '7' in '10.7.3'. This value
144
+ # will be negative if no minor version number was provided, e.g., for
145
+ # version '10'.
146
+ # :subminor ::
147
+ # (Integer) The subminor version number, e.g., the '3' in '10.7.3'. This value
148
+ # will be negative if no minor or subminor version number was provided,
149
+ # e.g., in version '10' or '10.7'.
150
+ class Version < FFI::Struct
151
+ layout :major, :int,
152
+ :minor, :int,
153
+ :subminor, :int
78
154
  end
79
155
 
80
- # Retrieve the character data associated with the given string.
81
- #
82
- # @method get_c_string(string)
83
- # @param [String] string
84
- # @return [String]
85
- # @scope class
86
- attach_function :get_c_string, :clang_getCString, [String.by_value], :string
87
-
88
- # Free the given string,
156
+ # Provides a shared context for creating translation units.
89
157
  #
90
- # @method dispose_string(string)
91
- # @param [String] string
92
- # @return [nil]
93
- # @scope class
94
- attach_function :dispose_string, :clang_disposeString, [String.by_value], :void
95
-
96
- # clang_createIndex() provides a shared context for creating
97
- # translation units. It provides two options:
158
+ # It provides two options:
98
159
  #
99
160
  # - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
100
161
  # declarations (when loading any new translation units). A "local" declaration
@@ -104,6 +165,7 @@ module FFIGen::Clang
104
165
  #
105
166
  # Here is an example:
106
167
  #
168
+ # \code
107
169
  # // excludeDeclsFromPCH = 1, displayDiagnostics=1
108
170
  # Idx = clang_createIndex(1, 1);
109
171
  #
@@ -124,6 +186,7 @@ module FFIGen::Clang
124
186
  # clang_visitChildren(clang_getTranslationUnitCursor(TU),
125
187
  # TranslationUnitVisitor, 0);
126
188
  # clang_disposeTranslationUnit(TU);
189
+ # \endcode
127
190
  #
128
191
  # This process of creating the 'pch', loading it separately, and using it (via
129
192
  # -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
@@ -147,6 +210,61 @@ module FFIGen::Clang
147
210
  # @scope class
148
211
  attach_function :dispose_index, :clang_disposeIndex, [:pointer], :void
149
212
 
213
+ # (Not documented)
214
+ #
215
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:global_opt_flags).</em>
216
+ #
217
+ # === Options:
218
+ # :none ::
219
+ # Used to indicate that no special CXIndex options are needed.
220
+ # :thread_background_priority_for_indexing ::
221
+ # Used to indicate that threads that libclang creates for indexing
222
+ # purposes should use background priority.
223
+ #
224
+ # Affects #clang_indexSourceFile, #clang_indexTranslationUnit,
225
+ # #clang_parseTranslationUnit, #clang_saveTranslationUnit.
226
+ # :thread_background_priority_for_editing ::
227
+ # Used to indicate that threads that libclang creates for editing
228
+ # purposes should use background priority.
229
+ #
230
+ # Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt,
231
+ # #clang_annotateTokens
232
+ #
233
+ # @method _enum_global_opt_flags_
234
+ # @return [Symbol]
235
+ # @scope class
236
+ enum :global_opt_flags, [
237
+ :none, 0,
238
+ :thread_background_priority_for_indexing, 1,
239
+ :thread_background_priority_for_editing, 2
240
+ ]
241
+
242
+ # Sets general options associated with a CXIndex.
243
+ #
244
+ # For example:
245
+ # \code
246
+ # CXIndex idx = ...;
247
+ # clang_CXIndex_setGlobalOptions(idx,
248
+ # clang_CXIndex_getGlobalOptions(idx) |
249
+ # CXGlobalOpt_ThreadBackgroundPriorityForIndexing);
250
+ # \endcode
251
+ #
252
+ # @method cx_index_set_global_options(index, options)
253
+ # @param [FFI::Pointer(Index)] index
254
+ # @param [Integer] options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags.
255
+ # @return [nil]
256
+ # @scope class
257
+ attach_function :cx_index_set_global_options, :clang_CXIndex_setGlobalOptions, [:pointer, :uint], :void
258
+
259
+ # Gets the general options associated with a CXIndex.
260
+ #
261
+ # @method cx_index_get_global_options(index)
262
+ # @param [FFI::Pointer(Index)] index
263
+ # @return [Integer] A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that
264
+ # are associated with the given CXIndex object.
265
+ # @scope class
266
+ attach_function :cx_index_get_global_options, :clang_CXIndex_getGlobalOptions, [:pointer], :uint
267
+
150
268
  # Retrieve the complete file and path name of the given file.
151
269
  #
152
270
  # @method get_file_name(s_file)
@@ -163,9 +281,29 @@ module FFIGen::Clang
163
281
  # @scope class
164
282
  attach_function :get_file_time, :clang_getFileTime, [:pointer], :long
165
283
 
284
+ # Uniquely identifies a CXFile, that refers to the same underlying file,
285
+ # across an indexing session.
286
+ #
287
+ # = Fields:
288
+ # :data ::
289
+ # (Array<Integer>)
290
+ class FileUniqueID < FFI::Struct
291
+ layout :data, [:ulong_long, 3]
292
+ end
293
+
294
+ # Retrieve the unique ID for the given \c file.
295
+ #
296
+ # @method get_file_unique_id(file, out_id)
297
+ # @param [FFI::Pointer(File)] file the file to get the ID for.
298
+ # @param [FileUniqueID] out_id stores the returned CXFileUniqueID.
299
+ # @return [Integer] If there was a failure getting the unique ID, returns non-zero,
300
+ # otherwise returns 0.
301
+ # @scope class
302
+ attach_function :get_file_unique_id, :clang_getFileUniqueID, [:pointer, FileUniqueID], :int
303
+
166
304
  # Determine whether the given header is guarded against
167
305
  # multiple inclusions, either with the conventional
168
- # #ifndef/#define/#endif macro guards or with #pragma once.
306
+ # \#ifndef/\#define/\#endif macro guards or with \#pragma once.
169
307
  #
170
308
  # @method is_file_multiple_include_guarded(tu, file)
171
309
  # @param [TranslationUnitImpl] tu
@@ -260,6 +398,23 @@ module FFIGen::Clang
260
398
  # @scope class
261
399
  attach_function :get_location_for_offset, :clang_getLocationForOffset, [TranslationUnitImpl, :pointer, :uint], SourceLocation.by_value
262
400
 
401
+ # Returns non-zero if the given source location is in a system header.
402
+ #
403
+ # @method location_is_in_system_header(location)
404
+ # @param [SourceLocation] location
405
+ # @return [Integer]
406
+ # @scope class
407
+ attach_function :location_is_in_system_header, :clang_Location_isInSystemHeader, [SourceLocation.by_value], :int
408
+
409
+ # Returns non-zero if the given source location is in the main file of
410
+ # the corresponding translation unit.
411
+ #
412
+ # @method location_is_from_main_file(location)
413
+ # @param [SourceLocation] location
414
+ # @return [Integer]
415
+ # @scope class
416
+ attach_function :location_is_from_main_file, :clang_Location_isFromMainFile, [SourceLocation.by_value], :int
417
+
263
418
  # Retrieve a NULL (invalid) source range.
264
419
  #
265
420
  # @method get_null_range()
@@ -270,9 +425,9 @@ module FFIGen::Clang
270
425
  # Retrieve a source range given the beginning and ending source
271
426
  # locations.
272
427
  #
273
- # @method get_range(begin, end)
274
- # @param [SourceLocation] begin
275
- # @param [SourceLocation] end
428
+ # @method get_range(begin_, end_)
429
+ # @param [SourceLocation] begin_
430
+ # @param [SourceLocation] end_
276
431
  # @return [SourceRange]
277
432
  # @scope class
278
433
  attach_function :get_range, :clang_getRange, [SourceLocation.by_value, SourceLocation.by_value], SourceRange.by_value
@@ -286,7 +441,7 @@ module FFIGen::Clang
286
441
  # @scope class
287
442
  attach_function :equal_ranges, :clang_equalRanges, [SourceRange.by_value, SourceRange.by_value], :uint
288
443
 
289
- # Returns non-zero if \arg range is null.
444
+ # Returns non-zero if \p range is null.
290
445
  #
291
446
  # @method range_is_null(range)
292
447
  # @param [SourceRange] range
@@ -294,17 +449,40 @@ module FFIGen::Clang
294
449
  # @scope class
295
450
  attach_function :range_is_null, :clang_Range_isNull, [SourceRange.by_value], :int
296
451
 
452
+ # Retrieve the file, line, column, and offset represented by
453
+ # the given source location.
454
+ #
455
+ # If the location refers into a macro expansion, retrieves the
456
+ # location of the macro expansion.
457
+ #
458
+ # @method get_expansion_location(location, file, line, column, offset)
459
+ # @param [SourceLocation] location the location within a source file that will be decomposed
460
+ # into its parts.
461
+ # @param [FFI::Pointer(*File)] file (out) if non-NULL, will be set to the file to which the given
462
+ # source location points.
463
+ # @param [FFI::Pointer(*UInt)] line (out) if non-NULL, will be set to the line to which the given
464
+ # source location points.
465
+ # @param [FFI::Pointer(*UInt)] column (out) if non-NULL, will be set to the column to which the given
466
+ # source location points.
467
+ # @param [FFI::Pointer(*UInt)] offset (out) if non-NULL, will be set to the offset into the
468
+ # buffer to which the given source location points.
469
+ # @return [nil]
470
+ # @scope class
471
+ attach_function :get_expansion_location, :clang_getExpansionLocation, [SourceLocation.by_value, :pointer, :pointer, :pointer, :pointer], :void
472
+
297
473
  # Retrieve the file, line, column, and offset represented by
298
474
  # the given source location, as specified in a # line directive.
299
475
  #
300
476
  # Example: given the following source code in a file somefile.c
301
477
  #
478
+ # \code
302
479
  # #123 "dummy.c" 1
303
480
  #
304
481
  # static int func(void)
305
482
  # {
306
483
  # return 0;
307
484
  # }
485
+ # \endcode
308
486
  #
309
487
  # the location information returned by this function would be
310
488
  #
@@ -336,7 +514,7 @@ module FFIGen::Clang
336
514
  # by the given source location.
337
515
  #
338
516
  # This interface has been replaced by the newer interface
339
- # \see clang_getExpansionLocation(). See that interface's documentation for
517
+ # #clang_getExpansionLocation(). See that interface's documentation for
340
518
  # details.
341
519
  #
342
520
  # @method get_instantiation_location(location, file, line, column, offset)
@@ -370,6 +548,28 @@ module FFIGen::Clang
370
548
  # @scope class
371
549
  attach_function :get_spelling_location, :clang_getSpellingLocation, [SourceLocation.by_value, :pointer, :pointer, :pointer, :pointer], :void
372
550
 
551
+ # Retrieve the file, line, column, and offset represented by
552
+ # the given source location.
553
+ #
554
+ # If the location refers into a macro expansion, return where the macro was
555
+ # expanded or where the macro argument was written, if the location points at
556
+ # a macro argument.
557
+ #
558
+ # @method get_file_location(location, file, line, column, offset)
559
+ # @param [SourceLocation] location the location within a source file that will be decomposed
560
+ # into its parts.
561
+ # @param [FFI::Pointer(*File)] file (out) if non-NULL, will be set to the file to which the given
562
+ # source location points.
563
+ # @param [FFI::Pointer(*UInt)] line (out) if non-NULL, will be set to the line to which the given
564
+ # source location points.
565
+ # @param [FFI::Pointer(*UInt)] column (out) if non-NULL, will be set to the column to which the given
566
+ # source location points.
567
+ # @param [FFI::Pointer(*UInt)] offset (out) if non-NULL, will be set to the offset into the
568
+ # buffer to which the given source location points.
569
+ # @return [nil]
570
+ # @scope class
571
+ attach_function :get_file_location, :clang_getFileLocation, [SourceLocation.by_value, :pointer, :pointer, :pointer, :pointer], :void
572
+
373
573
  # Retrieve a source location representing the first character within a
374
574
  # source range.
375
575
  #
@@ -388,6 +588,38 @@ module FFIGen::Clang
388
588
  # @scope class
389
589
  attach_function :get_range_end, :clang_getRangeEnd, [SourceRange.by_value], SourceLocation.by_value
390
590
 
591
+ # Identifies an array of ranges.
592
+ #
593
+ # = Fields:
594
+ # :count ::
595
+ # (Integer) The number of ranges in the \c ranges array.
596
+ # :ranges ::
597
+ # (SourceRange) An array of \c CXSourceRanges.
598
+ class SourceRangeList < FFI::Struct
599
+ layout :count, :uint,
600
+ :ranges, SourceRange
601
+ end
602
+
603
+ # Retrieve all ranges that were skipped by the preprocessor.
604
+ #
605
+ # The preprocessor will skip lines when they are surrounded by an
606
+ # if/ifdef/ifndef directive whose condition does not evaluate to true.
607
+ #
608
+ # @method get_skipped_ranges(tu, file)
609
+ # @param [TranslationUnitImpl] tu
610
+ # @param [FFI::Pointer(File)] file
611
+ # @return [SourceRangeList]
612
+ # @scope class
613
+ attach_function :get_skipped_ranges, :clang_getSkippedRanges, [TranslationUnitImpl, :pointer], SourceRangeList
614
+
615
+ # Destroy the given \c CXSourceRangeList.
616
+ #
617
+ # @method dispose_source_range_list(ranges)
618
+ # @param [SourceRangeList] ranges
619
+ # @return [nil]
620
+ # @scope class
621
+ attach_function :dispose_source_range_list, :clang_disposeSourceRangeList, [SourceRangeList], :void
622
+
391
623
  # Describes the severity of a particular diagnostic.
392
624
  #
393
625
  # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:diagnostic_severity).</em>
@@ -420,6 +652,85 @@ module FFIGen::Clang
420
652
  :fatal, 4
421
653
  ]
422
654
 
655
+ # Determine the number of diagnostics in a CXDiagnosticSet.
656
+ #
657
+ # @method get_num_diagnostics_in_set(diags)
658
+ # @param [FFI::Pointer(DiagnosticSet)] diags
659
+ # @return [Integer]
660
+ # @scope class
661
+ attach_function :get_num_diagnostics_in_set, :clang_getNumDiagnosticsInSet, [:pointer], :uint
662
+
663
+ # Retrieve a diagnostic associated with the given CXDiagnosticSet.
664
+ #
665
+ # @method get_diagnostic_in_set(diags, index)
666
+ # @param [FFI::Pointer(DiagnosticSet)] diags the CXDiagnosticSet to query.
667
+ # @param [Integer] index the zero-based diagnostic number to retrieve.
668
+ # @return [FFI::Pointer(Diagnostic)] the requested diagnostic. This diagnostic must be freed
669
+ # via a call to \c clang_disposeDiagnostic().
670
+ # @scope class
671
+ attach_function :get_diagnostic_in_set, :clang_getDiagnosticInSet, [:pointer, :uint], :pointer
672
+
673
+ # Describes the kind of error that occurred (if any) in a call to
674
+ # \c clang_loadDiagnostics.
675
+ #
676
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:load_diag_error).</em>
677
+ #
678
+ # === Options:
679
+ # :none ::
680
+ # Indicates that no error occurred.
681
+ # :unknown ::
682
+ # Indicates that an unknown error occurred while attempting to
683
+ # deserialize diagnostics.
684
+ # :cannot_load ::
685
+ # Indicates that the file containing the serialized diagnostics
686
+ # could not be opened.
687
+ # :invalid_file ::
688
+ # Indicates that the serialized diagnostics file is invalid or
689
+ # corrupt.
690
+ #
691
+ # @method _enum_load_diag_error_
692
+ # @return [Symbol]
693
+ # @scope class
694
+ enum :load_diag_error, [
695
+ :none, 0,
696
+ :unknown, 1,
697
+ :cannot_load, 2,
698
+ :invalid_file, 3
699
+ ]
700
+
701
+ # Deserialize a set of diagnostics from a Clang diagnostics bitcode
702
+ # file.
703
+ #
704
+ # @method load_diagnostics(file, error, error_string)
705
+ # @param [String] file The name of the file to deserialize.
706
+ # @param [FFI::Pointer(*LoadDiagError)] error A pointer to a enum value recording if there was a problem
707
+ # deserializing the diagnostics.
708
+ # @param [String] error_string A pointer to a CXString for recording the error string
709
+ # if the file was not successfully loaded.
710
+ # @return [FFI::Pointer(DiagnosticSet)] A loaded CXDiagnosticSet if successful, and NULL otherwise. These
711
+ # diagnostics should be released using clang_disposeDiagnosticSet().
712
+ # @scope class
713
+ attach_function :load_diagnostics, :clang_loadDiagnostics, [:string, :pointer, String], :pointer
714
+
715
+ # Release a CXDiagnosticSet and all of its contained diagnostics.
716
+ #
717
+ # @method dispose_diagnostic_set(diags)
718
+ # @param [FFI::Pointer(DiagnosticSet)] diags
719
+ # @return [nil]
720
+ # @scope class
721
+ attach_function :dispose_diagnostic_set, :clang_disposeDiagnosticSet, [:pointer], :void
722
+
723
+ # Retrieve the child diagnostics of a CXDiagnostic.
724
+ #
725
+ # This CXDiagnosticSet does not need to be released by
726
+ # clang_disposeDiagnosticSet.
727
+ #
728
+ # @method get_child_diagnostics(d)
729
+ # @param [FFI::Pointer(Diagnostic)] d
730
+ # @return [FFI::Pointer(DiagnosticSet)]
731
+ # @scope class
732
+ attach_function :get_child_diagnostics, :clang_getChildDiagnostics, [:pointer], :pointer
733
+
423
734
  # Determine the number of diagnostics produced for the given
424
735
  # translation unit.
425
736
  #
@@ -439,6 +750,15 @@ module FFIGen::Clang
439
750
  # @scope class
440
751
  attach_function :get_diagnostic, :clang_getDiagnostic, [TranslationUnitImpl, :uint], :pointer
441
752
 
753
+ # Retrieve the complete set of diagnostics associated with a
754
+ # translation unit.
755
+ #
756
+ # @method get_diagnostic_set_from_tu(unit)
757
+ # @param [TranslationUnitImpl] unit the translation unit to query.
758
+ # @return [FFI::Pointer(DiagnosticSet)]
759
+ # @scope class
760
+ attach_function :get_diagnostic_set_from_tu, :clang_getDiagnosticSetFromTU, [TranslationUnitImpl], :pointer
761
+
442
762
  # Destroy a diagnostic.
443
763
  #
444
764
  # @method dispose_diagnostic(diagnostic)
@@ -450,12 +770,12 @@ module FFIGen::Clang
450
770
  # Options to control the display of diagnostics.
451
771
  #
452
772
  # The values in this enum are meant to be combined to customize the
453
- # behavior of \c clang_displayDiagnostic().
773
+ # behavior of \c clang_formatDiagnostic().
454
774
  #
455
775
  # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:diagnostic_display_options).</em>
456
776
  #
457
777
  # === Options:
458
- # :display_source_location ::
778
+ # :source_location ::
459
779
  # Display the source-location information where the
460
780
  # diagnostic was located.
461
781
  #
@@ -467,31 +787,31 @@ module FFIGen::Clang
467
787
  # \endcode
468
788
  #
469
789
  # This option corresponds to the clang flag \c -fshow-source-location.
470
- # :display_column ::
790
+ # :column ::
471
791
  # If displaying the source-location information of the
472
792
  # diagnostic, also include the column number.
473
793
  #
474
794
  # This option corresponds to the clang flag \c -fshow-column.
475
- # :display_source_ranges ::
795
+ # :source_ranges ::
476
796
  # If displaying the source-location information of the
477
797
  # diagnostic, also include information about source ranges in a
478
798
  # machine-parsable format.
479
799
  #
480
800
  # This option corresponds to the clang flag
481
801
  # \c -fdiagnostics-print-source-range-info.
482
- # :display_option ::
802
+ # :option ::
483
803
  # Display the option name associated with this diagnostic, if any.
484
804
  #
485
805
  # The option name displayed (e.g., -Wconversion) will be placed in brackets
486
806
  # after the diagnostic text. This option corresponds to the clang flag
487
807
  # \c -fdiagnostics-show-option.
488
- # :display_category_id ::
808
+ # :category_id ::
489
809
  # Display the category number associated with this diagnostic, if any.
490
810
  #
491
811
  # The category number is displayed within brackets after the diagnostic text.
492
812
  # This option corresponds to the clang flag
493
813
  # \c -fdiagnostics-show-category=id.
494
- # :display_category_name ::
814
+ # :category_name ::
495
815
  # Display the category name associated with this diagnostic, if any.
496
816
  #
497
817
  # The category name is displayed within brackets after the diagnostic text.
@@ -502,12 +822,12 @@ module FFIGen::Clang
502
822
  # @return [Symbol]
503
823
  # @scope class
504
824
  enum :diagnostic_display_options, [
505
- :display_source_location, 0x01,
506
- :display_column, 0x02,
507
- :display_source_ranges, 0x04,
508
- :display_option, 0x08,
509
- :display_category_id, 0x10,
510
- :display_category_name, 0x20
825
+ :source_location, 1,
826
+ :column, 2,
827
+ :source_ranges, 4,
828
+ :option, 8,
829
+ :category_id, 16,
830
+ :category_name, 32
511
831
  ]
512
832
 
513
833
  # Format the given diagnostic in a manner that is suitable for display.
@@ -530,7 +850,7 @@ module FFIGen::Clang
530
850
  #
531
851
  # @method default_diagnostic_display_options()
532
852
  # @return [Integer] A set of display options suitable for use with \c
533
- # clang_displayDiagnostic().
853
+ # clang_formatDiagnostic().
534
854
  # @scope class
535
855
  attach_function :default_diagnostic_display_options, :clang_defaultDiagnosticDisplayOptions, [], :uint
536
856
 
@@ -586,7 +906,9 @@ module FFIGen::Clang
586
906
  # @scope class
587
907
  attach_function :get_diagnostic_category, :clang_getDiagnosticCategory, [:pointer], :uint
588
908
 
589
- # Retrieve the name of a particular diagnostic category.
909
+ # Retrieve the name of a particular diagnostic category. This
910
+ # is now deprecated. Use clang_getDiagnosticCategoryText()
911
+ # instead.
590
912
  #
591
913
  # @method get_diagnostic_category_name(category)
592
914
  # @param [Integer] category A diagnostic category number, as returned by
@@ -595,6 +917,14 @@ module FFIGen::Clang
595
917
  # @scope class
596
918
  attach_function :get_diagnostic_category_name, :clang_getDiagnosticCategoryName, [:uint], String.by_value
597
919
 
920
+ # Retrieve the diagnostic category text for a given diagnostic.
921
+ #
922
+ # @method get_diagnostic_category_text(diagnostic)
923
+ # @param [FFI::Pointer(Diagnostic)] diagnostic
924
+ # @return [String] The text of the given diagnostic category.
925
+ # @scope class
926
+ attach_function :get_diagnostic_category_text, :clang_getDiagnosticCategoryText, [:pointer], String.by_value
927
+
598
928
  # Determine the number of source ranges associated with the given
599
929
  # diagnostic.
600
930
  #
@@ -671,20 +1001,20 @@ module FFIGen::Clang
671
1001
  # '-c'
672
1002
  # '-emit-ast'
673
1003
  # '-fsyntax-only'
674
- # '-o <output file>' (both '-o' and '<output file>' are ignored)
1004
+ # '-o \<output file>' (both '-o' and '\<output file>' are ignored)
675
1005
  #
676
1006
  # @method create_translation_unit_from_source_file(c_idx, source_filename, num_clang_command_line_args, command_line_args, num_unsaved_files, unsaved_files)
677
1007
  # @param [FFI::Pointer(Index)] c_idx The index object with which the translation unit will be
678
1008
  # associated.
679
- # @param [String] source_filename - The name of the source file to load, or NULL if the
1009
+ # @param [String] source_filename The name of the source file to load, or NULL if the
680
1010
  # source file is included in \p clang_command_line_args.
681
1011
  # @param [Integer] num_clang_command_line_args The number of command-line arguments in
682
1012
  # \p clang_command_line_args.
683
- # @param [FFI::Pointer(**Char_S)] command_line_args The command-line arguments that would be
1013
+ # @param [FFI::Pointer(**CharS)] command_line_args The command-line arguments that would be
684
1014
  # passed to the \c clang executable if it were being invoked out-of-process.
685
1015
  # These command-line options will be parsed and will affect how the translation
686
1016
  # unit is parsed. Note that the following options are ignored: '-c',
687
- # '-emit-ast', '-fsyntex-only' (which is the default), and '-o <output file>'.
1017
+ # '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'.
688
1018
  # @param [Integer] num_unsaved_files the number of unsaved file entries in \p
689
1019
  # unsaved_files.
690
1020
  # @param [UnsavedFile] unsaved_files the files that have not yet been saved to disk
@@ -696,15 +1026,31 @@ module FFIGen::Clang
696
1026
  # @scope class
697
1027
  attach_function :create_translation_unit_from_source_file, :clang_createTranslationUnitFromSourceFile, [:pointer, :string, :int, :pointer, :uint, UnsavedFile], TranslationUnitImpl
698
1028
 
699
- # Create a translation unit from an AST file (-emit-ast).
1029
+ # Same as \c clang_createTranslationUnit2, but returns
1030
+ # the \c CXTranslationUnit instead of an error code. In case of an error this
1031
+ # routine returns a \c NULL \c CXTranslationUnit, without further detailed
1032
+ # error codes.
700
1033
  #
701
- # @method create_translation_unit(index, ast_filename)
702
- # @param [FFI::Pointer(Index)] index
1034
+ # @method create_translation_unit(c_idx, ast_filename)
1035
+ # @param [FFI::Pointer(Index)] c_idx
703
1036
  # @param [String] ast_filename
704
1037
  # @return [TranslationUnitImpl]
705
1038
  # @scope class
706
1039
  attach_function :create_translation_unit, :clang_createTranslationUnit, [:pointer, :string], TranslationUnitImpl
707
1040
 
1041
+ # Create a translation unit from an AST file (\c -emit-ast).
1042
+ #
1043
+ # \param(out) out_TU A non-NULL pointer to store the created
1044
+ # \c CXTranslationUnit.
1045
+ #
1046
+ # @method create_translation_unit2(c_idx, ast_filename, out_tu)
1047
+ # @param [FFI::Pointer(Index)] c_idx
1048
+ # @param [String] ast_filename
1049
+ # @param [FFI::Pointer(*TranslationUnit)] out_tu
1050
+ # @return [Symbol from _enum_error_code_] Zero on success, otherwise returns an error code.
1051
+ # @scope class
1052
+ attach_function :create_translation_unit2, :clang_createTranslationUnit2, [:pointer, :string, :pointer], :error_code
1053
+
708
1054
  # Flags that control the creation of translation units.
709
1055
  #
710
1056
  # The enumerators in this enumeration type are meant to be bitwise
@@ -756,37 +1102,41 @@ module FFIGen::Clang
756
1102
  # Caching of code-completion results is a performance optimization that
757
1103
  # introduces some overhead to reparsing but improves the performance of
758
1104
  # code-completion operations.
759
- # :x_precompiled_preamble ::
760
- # DEPRECATED: Enable precompiled preambles in C++.
1105
+ # :for_serialization ::
1106
+ # Used to indicate that the translation unit will be serialized with
1107
+ # \c clang_saveTranslationUnit.
761
1108
  #
762
- # Note: this is a *temporary* option that is available only while
763
- # we are testing C++ precompiled preamble support. It is deprecated.
764
- # :x_chained_pch ::
1109
+ # This option is typically used when parsing a header with the intent of
1110
+ # producing a precompiled header.
1111
+ # :cxx_chained_pch ::
765
1112
  # DEPRECATED: Enabled chained precompiled preambles in C++.
766
1113
  #
767
1114
  # Note: this is a *temporary* option that is available only while
768
1115
  # we are testing C++ precompiled preamble support. It is deprecated.
769
- # :nested_macro_expansions ::
770
- # Used to indicate that the "detailed" preprocessing record,
771
- # if requested, should also contain nested macro expansions.
1116
+ # :skip_function_bodies ::
1117
+ # Used to indicate that function/method bodies should be skipped while
1118
+ # parsing.
772
1119
  #
773
- # Nested macro expansions (i.e., macro expansions that occur
774
- # inside another macro expansion) can, in some code bases, require
775
- # a large amount of storage to due preprocessor metaprogramming. Moreover,
776
- # its fairly rare that this information is useful for libclang clients.
1120
+ # This option can be used to search for declarations/definitions while
1121
+ # ignoring the usages.
1122
+ # :include_brief_comments_in_code_completion ::
1123
+ # Used to indicate that brief documentation comments should be
1124
+ # included into the set of code completions returned from this translation
1125
+ # unit.
777
1126
  #
778
1127
  # @method _enum_translation_unit_flags_
779
1128
  # @return [Symbol]
780
1129
  # @scope class
781
1130
  enum :translation_unit_flags, [
782
- :none, 0x0,
783
- :detailed_preprocessing_record, 0x01,
784
- :incomplete, 0x02,
785
- :precompiled_preamble, 0x04,
786
- :cache_completion_results, 0x08,
787
- :x_precompiled_preamble, 0x10,
788
- :x_chained_pch, 0x20,
789
- :nested_macro_expansions, 0x40
1131
+ :none, 0,
1132
+ :detailed_preprocessing_record, 1,
1133
+ :incomplete, 2,
1134
+ :precompiled_preamble, 4,
1135
+ :cache_completion_results, 8,
1136
+ :for_serialization, 16,
1137
+ :cxx_chained_pch, 32,
1138
+ :skip_function_bodies, 64,
1139
+ :include_brief_comments_in_code_completion, 128
790
1140
  ]
791
1141
 
792
1142
  # Returns the set of flags that is suitable for parsing a translation
@@ -805,6 +1155,23 @@ module FFIGen::Clang
805
1155
  # @scope class
806
1156
  attach_function :default_editing_translation_unit_options, :clang_defaultEditingTranslationUnitOptions, [], :uint
807
1157
 
1158
+ # Same as \c clang_parseTranslationUnit2, but returns
1159
+ # the \c CXTranslationUnit instead of an error code. In case of an error this
1160
+ # routine returns a \c NULL \c CXTranslationUnit, without further detailed
1161
+ # error codes.
1162
+ #
1163
+ # @method parse_translation_unit(c_idx, source_filename, command_line_args, num_command_line_args, unsaved_files, num_unsaved_files, options)
1164
+ # @param [FFI::Pointer(Index)] c_idx
1165
+ # @param [String] source_filename
1166
+ # @param [FFI::Pointer(**CharS)] command_line_args
1167
+ # @param [Integer] num_command_line_args
1168
+ # @param [UnsavedFile] unsaved_files
1169
+ # @param [Integer] num_unsaved_files
1170
+ # @param [Integer] options
1171
+ # @return [TranslationUnitImpl]
1172
+ # @scope class
1173
+ attach_function :parse_translation_unit, :clang_parseTranslationUnit, [:pointer, :string, :pointer, :int, UnsavedFile, :uint, :uint], TranslationUnitImpl
1174
+
808
1175
  # Parse the given source file and the translation unit corresponding
809
1176
  # to that file.
810
1177
  #
@@ -814,18 +1181,18 @@ module FFIGen::Clang
814
1181
  # command-line arguments so that the compilation can be configured in the same
815
1182
  # way that the compiler is configured on the command line.
816
1183
  #
817
- # @method parse_translation_unit(c_idx, source_filename, command_line_args, num_command_line_args, unsaved_files, num_unsaved_files, options)
1184
+ # @method parse_translation_unit2(c_idx, source_filename, command_line_args, num_command_line_args, unsaved_files, num_unsaved_files, options, out_tu)
818
1185
  # @param [FFI::Pointer(Index)] c_idx The index object with which the translation unit will be
819
1186
  # associated.
820
1187
  # @param [String] source_filename The name of the source file to load, or NULL if the
821
- # source file is included in \p command_line_args.
822
- # @param [FFI::Pointer(**Char_S)] command_line_args The command-line arguments that would be
1188
+ # source file is included in \c command_line_args.
1189
+ # @param [FFI::Pointer(**CharS)] command_line_args The command-line arguments that would be
823
1190
  # passed to the \c clang executable if it were being invoked out-of-process.
824
1191
  # These command-line options will be parsed and will affect how the translation
825
1192
  # unit is parsed. Note that the following options are ignored: '-c',
826
- # '-emit-ast', '-fsyntex-only' (which is the default), and '-o <output file>'.
1193
+ # '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'.
827
1194
  # @param [Integer] num_command_line_args The number of command-line arguments in
828
- # \p command_line_args.
1195
+ # \c command_line_args.
829
1196
  # @param [UnsavedFile] unsaved_files the files that have not yet been saved to disk
830
1197
  # but may be required for parsing, including the contents of
831
1198
  # those files. The contents and name of these files (as specified by
@@ -836,11 +1203,14 @@ module FFIGen::Clang
836
1203
  # @param [Integer] options A bitmask of options that affects how the translation unit
837
1204
  # is managed but not its compilation. This should be a bitwise OR of the
838
1205
  # CXTranslationUnit_XXX flags.
839
- # @return [TranslationUnitImpl] A new translation unit describing the parsed code and containing
840
- # any diagnostics produced by the compiler. If there is a failure from which
841
- # the compiler cannot recover, returns NULL.
1206
+ #
1207
+ # \param(out) out_TU A non-NULL pointer to store the created
1208
+ # \c CXTranslationUnit, describing the parsed code and containing any
1209
+ # diagnostics produced by the compiler.
1210
+ # @param [FFI::Pointer(*TranslationUnit)] out_tu
1211
+ # @return [Symbol from _enum_error_code_] Zero on success, otherwise returns an error code.
842
1212
  # @scope class
843
- attach_function :parse_translation_unit, :clang_parseTranslationUnit, [:pointer, :string, :pointer, :int, UnsavedFile, :uint, :uint], TranslationUnitImpl
1213
+ attach_function :parse_translation_unit2, :clang_parseTranslationUnit2, [:pointer, :string, :pointer, :int, UnsavedFile, :uint, :uint, :pointer], :error_code
844
1214
 
845
1215
  # Flags that control how translation units are saved.
846
1216
  #
@@ -858,7 +1228,7 @@ module FFIGen::Clang
858
1228
  # @return [Symbol]
859
1229
  # @scope class
860
1230
  enum :save_translation_unit_flags, [
861
- :save_translation_unit_none, 0x0
1231
+ :save_translation_unit_none, 0
862
1232
  ]
863
1233
 
864
1234
  # Returns the set of flags that is suitable for saving a translation
@@ -955,7 +1325,7 @@ module FFIGen::Clang
955
1325
  # @return [Symbol]
956
1326
  # @scope class
957
1327
  enum :reparse_flags, [
958
- :reparse_none, 0x0
1328
+ :reparse_none, 0
959
1329
  ]
960
1330
 
961
1331
  # Returns the set of flags that is suitable for reparsing a translation
@@ -1002,10 +1372,11 @@ module FFIGen::Clang
1002
1372
  # @param [Integer] options A bitset of options composed of the flags in CXReparse_Flags.
1003
1373
  # The function \c clang_defaultReparseOptions() produces a default set of
1004
1374
  # options recommended for most uses, based on the translation unit.
1005
- # @return [Integer] 0 if the sources could be reparsed. A non-zero value will be
1375
+ # @return [Integer] 0 if the sources could be reparsed. A non-zero error code will be
1006
1376
  # returned if reparsing was impossible, such that the translation unit is
1007
- # invalid. In such cases, the only valid call for \p TU is
1008
- # \c clang_disposeTranslationUnit(TU).
1377
+ # invalid. In such cases, the only valid call for \c TU is
1378
+ # \c clang_disposeTranslationUnit(TU). The error codes returned by this
1379
+ # routine are described by the \c CXErrorCode enum.
1009
1380
  # @scope class
1010
1381
  attach_function :reparse_translation_unit, :clang_reparseTranslationUnit, [TranslationUnitImpl, :uint, UnsavedFile, :uint], :int
1011
1382
 
@@ -1151,13 +1522,13 @@ module FFIGen::Clang
1151
1522
  # :parm_decl ::
1152
1523
  # A function or method parameter.
1153
1524
  # :obj_c_interface_decl ::
1154
- # An Objective-C @interface.
1525
+ # An Objective-C \@interface.
1155
1526
  # :obj_c_category_decl ::
1156
- # An Objective-C @interface for a category.
1527
+ # An Objective-C \@interface for a category.
1157
1528
  # :obj_c_protocol_decl ::
1158
- # An Objective-C @protocol declaration.
1529
+ # An Objective-C \@protocol declaration.
1159
1530
  # :obj_c_property_decl ::
1160
- # An Objective-C @property declaration.
1531
+ # An Objective-C \@property declaration.
1161
1532
  # :obj_c_ivar_decl ::
1162
1533
  # An Objective-C instance variable.
1163
1534
  # :obj_c_instance_method_decl ::
@@ -1165,12 +1536,12 @@ module FFIGen::Clang
1165
1536
  # :obj_c_class_method_decl ::
1166
1537
  # An Objective-C class method.
1167
1538
  # :obj_c_implementation_decl ::
1168
- # An Objective-C @implementation.
1539
+ # An Objective-C \@implementation.
1169
1540
  # :obj_c_category_impl_decl ::
1170
- # An Objective-C @implementation for a category.
1541
+ # An Objective-C \@implementation for a category.
1171
1542
  # :typedef_decl ::
1172
1543
  # A typedef
1173
- # :x_method ::
1544
+ # :cxx_method ::
1174
1545
  # A C++ class method.
1175
1546
  # :namespace ::
1176
1547
  # A C++ namespace.
@@ -1203,10 +1574,10 @@ module FFIGen::Clang
1203
1574
  # :type_alias_decl ::
1204
1575
  # A C++ alias declaration
1205
1576
  # :obj_c_synthesize_decl ::
1206
- # An Objective-C @synthesize definition.
1577
+ # An Objective-C \@synthesize definition.
1207
1578
  # :obj_c_dynamic_decl ::
1208
- # An Objective-C @dynamic definition.
1209
- # :x_access_specifier ::
1579
+ # An Objective-C \@dynamic definition.
1580
+ # :cxx_access_specifier ::
1210
1581
  # An access specifier.
1211
1582
  # :first_ref ::
1212
1583
  # References
@@ -1230,7 +1601,7 @@ module FFIGen::Clang
1230
1601
  # The typedef is a declaration of size_type (CXCursor_TypedefDecl),
1231
1602
  # while the type of the variable "size" is referenced. The cursor
1232
1603
  # referenced by the type of size is the typedef for size_type.
1233
- # :x_base_specifier ::
1604
+ # :cxx_base_specifier ::
1234
1605
  #
1235
1606
  # :template_ref ::
1236
1607
  # A reference to a class template, function template, template
@@ -1289,6 +1660,9 @@ module FFIGen::Clang
1289
1660
  # The functions \c clang_getNumOverloadedDecls() and
1290
1661
  # \c clang_getOverloadedDecl() can be used to retrieve the definitions
1291
1662
  # referenced by this cursor.
1663
+ # :variable_ref ::
1664
+ # A reference to a variable that occurs in some non-expression
1665
+ # context, e.g., a C++ lambda capture list.
1292
1666
  # :first_invalid ::
1293
1667
  # Error conditions
1294
1668
  # :invalid_file ::
@@ -1311,7 +1685,7 @@ module FFIGen::Clang
1311
1685
  # expression is not reported.
1312
1686
  # :decl_ref_expr ::
1313
1687
  # An expression that refers to some value declaration, such
1314
- # as a function, varible, or enumerator.
1688
+ # as a function, variable, or enumerator.
1315
1689
  # :member_ref_expr ::
1316
1690
  # An expression that refers to a member of a struct, union,
1317
1691
  # class, Objective-C class, etc.
@@ -1362,7 +1736,7 @@ module FFIGen::Clang
1362
1736
  # :stmt_expr ::
1363
1737
  # This is the GNU Statement Expression extension: ({int X=4; X;})
1364
1738
  # :generic_selection_expr ::
1365
- # Represents a C1X generic selection.
1739
+ # Represents a C11 generic selection.
1366
1740
  # :gnu_null_expr ::
1367
1741
  # Implements the GNU __null extension, which is a name for a null
1368
1742
  # pointer constant that has integral type (e.g., int or long) and is the same
@@ -1371,15 +1745,15 @@ module FFIGen::Clang
1371
1745
  # The __null extension is typically only used by system headers, which define
1372
1746
  # NULL as __null in C++ rather than using 0 (which is an integer that may not
1373
1747
  # match the size of a pointer).
1374
- # :x_static_cast_expr ::
1748
+ # :cxx_static_cast_expr ::
1375
1749
  # C++'s static_cast<> expression.
1376
- # :x_dynamic_cast_expr ::
1750
+ # :cxx_dynamic_cast_expr ::
1377
1751
  # C++'s dynamic_cast<> expression.
1378
- # :x_reinterpret_cast_expr ::
1752
+ # :cxx_reinterpret_cast_expr ::
1379
1753
  # C++'s reinterpret_cast<> expression.
1380
- # :x_const_cast_expr ::
1754
+ # :cxx_const_cast_expr ::
1381
1755
  # C++'s const_cast<> expression.
1382
- # :x_functional_cast_expr ::
1756
+ # :cxx_functional_cast_expr ::
1383
1757
  # Represents an explicit C++ type conversion that uses "functional"
1384
1758
  # notion (C++ (expr.type.conv)).
1385
1759
  #
@@ -1387,35 +1761,35 @@ module FFIGen::Clang
1387
1761
  # \code
1388
1762
  # x = int(0.5);
1389
1763
  # \endcode
1390
- # :x_typeid_expr ::
1764
+ # :cxx_typeid_expr ::
1391
1765
  # A C++ typeid expression (C++ (expr.typeid)).
1392
- # :x_bool_literal_expr ::
1766
+ # :cxx_bool_literal_expr ::
1393
1767
  # (C++ 2.13.5) C++ Boolean Literal.
1394
- # :x_null_ptr_literal_expr ::
1768
+ # :cxx_null_ptr_literal_expr ::
1395
1769
  # (C++0x 2.14.7) C++ Pointer Literal.
1396
- # :x_this_expr ::
1770
+ # :cxx_this_expr ::
1397
1771
  # Represents the "this" expression in C++
1398
- # :x_throw_expr ::
1772
+ # :cxx_throw_expr ::
1399
1773
  # (C++ 15) C++ Throw Expression.
1400
1774
  #
1401
1775
  # This handles 'throw' and 'throw' assignment-expression. When
1402
1776
  # assignment-expression isn't present, Op will be null.
1403
- # :x_new_expr ::
1777
+ # :cxx_new_expr ::
1404
1778
  # A new expression for memory allocation and constructor calls, e.g:
1405
1779
  # "new CXXNewExpr(foo)".
1406
- # :x_delete_expr ::
1780
+ # :cxx_delete_expr ::
1407
1781
  # A delete expression for memory deallocation and destructor calls,
1408
1782
  # e.g. "delete() pArray".
1409
1783
  # :unary_expr ::
1410
1784
  # A unary expression.
1411
1785
  # :obj_c_string_literal ::
1412
- # ObjCStringLiteral, used for Objective-C string literals i.e. "foo".
1786
+ # An Objective-C string literal i.e. @"foo".
1413
1787
  # :obj_c_encode_expr ::
1414
- # ObjCEncodeExpr, used for in Objective-C.
1788
+ # An Objective-C \@encode expression.
1415
1789
  # :obj_c_selector_expr ::
1416
- # ObjCSelectorExpr used for in Objective-C.
1790
+ # An Objective-C \@selector expression.
1417
1791
  # :obj_c_protocol_expr ::
1418
- # Objective-C's protocol expression.
1792
+ # An Objective-C \@protocol expression.
1419
1793
  # :obj_c_bridged_cast_expr ::
1420
1794
  # An Objective-C "bridged" cast expression, which casts between
1421
1795
  # Objective-C pointers and C pointers, transferring ownership in the process.
@@ -1446,6 +1820,22 @@ module FFIGen::Clang
1446
1820
  # static const unsigned value = sizeof...(Types);
1447
1821
  # };
1448
1822
  # \endcode
1823
+ # :lambda_expr ::
1824
+ # Represents a C++ lambda expression that produces a local function
1825
+ # object.
1826
+ #
1827
+ # \code
1828
+ # void abssort(float *x, unsigned N) {
1829
+ # std::sort(x, x + N,
1830
+ # ()(float a, float b) {
1831
+ # return std::abs(a) < std::abs(b);
1832
+ # });
1833
+ # }
1834
+ # \endcode
1835
+ # :obj_c_bool_literal_expr ::
1836
+ # Objective-c Boolean Literal.
1837
+ # :obj_c_self_expr ::
1838
+ # Represents the "self" expression in an Objective-C method.
1449
1839
  # :first_stmt ::
1450
1840
  # Statements
1451
1841
  # :unexposed_stmt ::
@@ -1472,7 +1862,7 @@ module FFIGen::Clang
1472
1862
  # This cursor kind is used to describe compound statements, e.g. function
1473
1863
  # bodies.
1474
1864
  # :case_stmt ::
1475
- # A case statment.
1865
+ # A case statement.
1476
1866
  # :default_stmt ::
1477
1867
  # A default statement.
1478
1868
  # :if_stmt ::
@@ -1495,27 +1885,27 @@ module FFIGen::Clang
1495
1885
  # A break statement.
1496
1886
  # :return_stmt ::
1497
1887
  # A return statement.
1498
- # :asm_stmt ::
1499
- # A GNU inline assembly statement extension.
1888
+ # :gcc_asm_stmt ::
1889
+ # A GCC inline assembly statement extension.
1500
1890
  # :obj_c_at_try_stmt ::
1501
- # Objective-C's overall @try-@catc-@finall statement.
1891
+ # Objective-C's overall \@try-\@catch-\@finally statement.
1502
1892
  # :obj_c_at_catch_stmt ::
1503
- # Objective-C's @catch statement.
1893
+ # Objective-C's \@catch statement.
1504
1894
  # :obj_c_at_finally_stmt ::
1505
- # Objective-C's @finally statement.
1895
+ # Objective-C's \@finally statement.
1506
1896
  # :obj_c_at_throw_stmt ::
1507
- # Objective-C's @throw statement.
1897
+ # Objective-C's \@throw statement.
1508
1898
  # :obj_c_at_synchronized_stmt ::
1509
- # Objective-C's @synchronized statement.
1899
+ # Objective-C's \@synchronized statement.
1510
1900
  # :obj_c_autorelease_pool_stmt ::
1511
1901
  # Objective-C's autorelease pool statement.
1512
1902
  # :obj_c_for_collection_stmt ::
1513
1903
  # Objective-C's collection statement.
1514
- # :x_catch_stmt ::
1904
+ # :cxx_catch_stmt ::
1515
1905
  # C++'s catch statement.
1516
- # :x_try_stmt ::
1906
+ # :cxx_try_stmt ::
1517
1907
  # C++'s try statement.
1518
- # :x_for_range_stmt ::
1908
+ # :cxx_for_range_stmt ::
1519
1909
  # C++'s for (* : *) statement.
1520
1910
  # :seh_try_stmt ::
1521
1911
  # Windows Structured Exception Handling's try statement.
@@ -1523,6 +1913,8 @@ module FFIGen::Clang
1523
1913
  # Windows Structured Exception Handling's except statement.
1524
1914
  # :seh_finally_stmt ::
1525
1915
  # Windows Structured Exception Handling's finally statement.
1916
+ # :ms_asm_stmt ::
1917
+ # A MS inline assembly statement extension.
1526
1918
  # :null_stmt ::
1527
1919
  # The null satement ";": C99 6.8.3p3.
1528
1920
  #
@@ -1530,6 +1922,38 @@ module FFIGen::Clang
1530
1922
  # :decl_stmt ::
1531
1923
  # Adaptor class for mixing declarations with statements and
1532
1924
  # expressions.
1925
+ # :omp_parallel_directive ::
1926
+ # OpenMP parallel directive.
1927
+ # :omp_simd_directive ::
1928
+ # OpenMP simd directive.
1929
+ # :omp_for_directive ::
1930
+ # OpenMP for directive.
1931
+ # :omp_sections_directive ::
1932
+ # OpenMP sections directive.
1933
+ # :omp_section_directive ::
1934
+ # OpenMP section directive.
1935
+ # :omp_single_directive ::
1936
+ # OpenMP single directive.
1937
+ # :omp_parallel_for_directive ::
1938
+ # OpenMP parallel for directive.
1939
+ # :omp_parallel_sections_directive ::
1940
+ # OpenMP parallel sections directive.
1941
+ # :omp_task_directive ::
1942
+ # OpenMP task directive.
1943
+ # :omp_master_directive ::
1944
+ # OpenMP master directive.
1945
+ # :omp_critical_directive ::
1946
+ # OpenMP critical directive.
1947
+ # :omp_taskyield_directive ::
1948
+ # OpenMP taskyield directive.
1949
+ # :omp_barrier_directive ::
1950
+ # OpenMP barrier directive.
1951
+ # :omp_taskwait_directive ::
1952
+ # OpenMP taskwait directive.
1953
+ # :omp_flush_directive ::
1954
+ # OpenMP flush directive.
1955
+ # :seh_leave_stmt ::
1956
+ # Windows Structured Exception Handling's leave statement.
1533
1957
  # :translation_unit ::
1534
1958
  # Cursor that represents the translation unit itself.
1535
1959
  #
@@ -1546,12 +1970,30 @@ module FFIGen::Clang
1546
1970
  #
1547
1971
  # :ib_outlet_collection_attr ::
1548
1972
  #
1549
- # :x_final_attr ::
1973
+ # :cxx_final_attr ::
1550
1974
  #
1551
- # :x_override_attr ::
1975
+ # :cxx_override_attr ::
1552
1976
  #
1553
1977
  # :annotate_attr ::
1554
1978
  #
1979
+ # :asm_label_attr ::
1980
+ #
1981
+ # :packed_attr ::
1982
+ #
1983
+ # :pure_attr ::
1984
+ #
1985
+ # :const_attr ::
1986
+ #
1987
+ # :no_duplicate_attr ::
1988
+ #
1989
+ # :cuda_constant_attr ::
1990
+ #
1991
+ # :cuda_device_attr ::
1992
+ #
1993
+ # :cuda_global_attr ::
1994
+ #
1995
+ # :cuda_host_attr ::
1996
+ #
1555
1997
  # :preprocessing_directive ::
1556
1998
  # Preprocessing
1557
1999
  # :macro_definition ::
@@ -1560,6 +2002,8 @@ module FFIGen::Clang
1560
2002
  #
1561
2003
  # :inclusion_directive ::
1562
2004
  #
2005
+ # :module_import_decl ::
2006
+ # A module import declaration.
1563
2007
  #
1564
2008
  # @method _enum_cursor_kind_
1565
2009
  # @return [Symbol]
@@ -1585,7 +2029,7 @@ module FFIGen::Clang
1585
2029
  :obj_c_implementation_decl, 18,
1586
2030
  :obj_c_category_impl_decl, 19,
1587
2031
  :typedef_decl, 20,
1588
- :x_method, 21,
2032
+ :cxx_method, 21,
1589
2033
  :namespace, 22,
1590
2034
  :linkage_spec, 23,
1591
2035
  :constructor, 24,
@@ -1603,18 +2047,19 @@ module FFIGen::Clang
1603
2047
  :type_alias_decl, 36,
1604
2048
  :obj_c_synthesize_decl, 37,
1605
2049
  :obj_c_dynamic_decl, 38,
1606
- :x_access_specifier, 39,
2050
+ :cxx_access_specifier, 39,
1607
2051
  :first_ref, 40,
1608
2052
  :obj_c_super_class_ref, 40,
1609
2053
  :obj_c_protocol_ref, 41,
1610
2054
  :obj_c_class_ref, 42,
1611
2055
  :type_ref, 43,
1612
- :x_base_specifier, 44,
2056
+ :cxx_base_specifier, 44,
1613
2057
  :template_ref, 45,
1614
2058
  :namespace_ref, 46,
1615
2059
  :member_ref, 47,
1616
2060
  :label_ref, 48,
1617
2061
  :overloaded_decl_ref, 49,
2062
+ :variable_ref, 50,
1618
2063
  :first_invalid, 70,
1619
2064
  :invalid_file, 70,
1620
2065
  :no_decl_found, 71,
@@ -1645,18 +2090,18 @@ module FFIGen::Clang
1645
2090
  :stmt_expr, 121,
1646
2091
  :generic_selection_expr, 122,
1647
2092
  :gnu_null_expr, 123,
1648
- :x_static_cast_expr, 124,
1649
- :x_dynamic_cast_expr, 125,
1650
- :x_reinterpret_cast_expr, 126,
1651
- :x_const_cast_expr, 127,
1652
- :x_functional_cast_expr, 128,
1653
- :x_typeid_expr, 129,
1654
- :x_bool_literal_expr, 130,
1655
- :x_null_ptr_literal_expr, 131,
1656
- :x_this_expr, 132,
1657
- :x_throw_expr, 133,
1658
- :x_new_expr, 134,
1659
- :x_delete_expr, 135,
2093
+ :cxx_static_cast_expr, 124,
2094
+ :cxx_dynamic_cast_expr, 125,
2095
+ :cxx_reinterpret_cast_expr, 126,
2096
+ :cxx_const_cast_expr, 127,
2097
+ :cxx_functional_cast_expr, 128,
2098
+ :cxx_typeid_expr, 129,
2099
+ :cxx_bool_literal_expr, 130,
2100
+ :cxx_null_ptr_literal_expr, 131,
2101
+ :cxx_this_expr, 132,
2102
+ :cxx_throw_expr, 133,
2103
+ :cxx_new_expr, 134,
2104
+ :cxx_delete_expr, 135,
1660
2105
  :unary_expr, 136,
1661
2106
  :obj_c_string_literal, 137,
1662
2107
  :obj_c_encode_expr, 138,
@@ -1665,6 +2110,9 @@ module FFIGen::Clang
1665
2110
  :obj_c_bridged_cast_expr, 141,
1666
2111
  :pack_expansion_expr, 142,
1667
2112
  :size_of_pack_expr, 143,
2113
+ :lambda_expr, 144,
2114
+ :obj_c_bool_literal_expr, 145,
2115
+ :obj_c_self_expr, 146,
1668
2116
  :first_stmt, 200,
1669
2117
  :unexposed_stmt, 200,
1670
2118
  :label_stmt, 201,
@@ -1681,7 +2129,7 @@ module FFIGen::Clang
1681
2129
  :continue_stmt, 212,
1682
2130
  :break_stmt, 213,
1683
2131
  :return_stmt, 214,
1684
- :asm_stmt, 215,
2132
+ :gcc_asm_stmt, 215,
1685
2133
  :obj_c_at_try_stmt, 216,
1686
2134
  :obj_c_at_catch_stmt, 217,
1687
2135
  :obj_c_at_finally_stmt, 218,
@@ -1689,27 +2137,54 @@ module FFIGen::Clang
1689
2137
  :obj_c_at_synchronized_stmt, 220,
1690
2138
  :obj_c_autorelease_pool_stmt, 221,
1691
2139
  :obj_c_for_collection_stmt, 222,
1692
- :x_catch_stmt, 223,
1693
- :x_try_stmt, 224,
1694
- :x_for_range_stmt, 225,
2140
+ :cxx_catch_stmt, 223,
2141
+ :cxx_try_stmt, 224,
2142
+ :cxx_for_range_stmt, 225,
1695
2143
  :seh_try_stmt, 226,
1696
2144
  :seh_except_stmt, 227,
1697
2145
  :seh_finally_stmt, 228,
2146
+ :ms_asm_stmt, 229,
1698
2147
  :null_stmt, 230,
1699
2148
  :decl_stmt, 231,
2149
+ :omp_parallel_directive, 232,
2150
+ :omp_simd_directive, 233,
2151
+ :omp_for_directive, 234,
2152
+ :omp_sections_directive, 235,
2153
+ :omp_section_directive, 236,
2154
+ :omp_single_directive, 237,
2155
+ :omp_parallel_for_directive, 238,
2156
+ :omp_parallel_sections_directive, 239,
2157
+ :omp_task_directive, 240,
2158
+ :omp_master_directive, 241,
2159
+ :omp_critical_directive, 242,
2160
+ :omp_taskyield_directive, 243,
2161
+ :omp_barrier_directive, 244,
2162
+ :omp_taskwait_directive, 245,
2163
+ :omp_flush_directive, 246,
2164
+ :seh_leave_stmt, 247,
1700
2165
  :translation_unit, 300,
1701
2166
  :first_attr, 400,
1702
2167
  :unexposed_attr, 400,
1703
2168
  :ib_action_attr, 401,
1704
2169
  :ib_outlet_attr, 402,
1705
2170
  :ib_outlet_collection_attr, 403,
1706
- :x_final_attr, 404,
1707
- :x_override_attr, 405,
2171
+ :cxx_final_attr, 404,
2172
+ :cxx_override_attr, 405,
1708
2173
  :annotate_attr, 406,
2174
+ :asm_label_attr, 407,
2175
+ :packed_attr, 408,
2176
+ :pure_attr, 409,
2177
+ :const_attr, 410,
2178
+ :no_duplicate_attr, 411,
2179
+ :cuda_constant_attr, 412,
2180
+ :cuda_device_attr, 413,
2181
+ :cuda_global_attr, 414,
2182
+ :cuda_host_attr, 415,
1709
2183
  :preprocessing_directive, 500,
1710
2184
  :macro_definition, 501,
1711
2185
  :macro_expansion, 502,
1712
- :inclusion_directive, 503
2186
+ :inclusion_directive, 503,
2187
+ :module_import_decl, 600
1713
2188
  ]
1714
2189
 
1715
2190
  # A cursor representing some element in the abstract syntax tree for
@@ -1769,7 +2244,7 @@ module FFIGen::Clang
1769
2244
  # @scope class
1770
2245
  attach_function :equal_cursors, :clang_equalCursors, [Cursor.by_value, Cursor.by_value], :uint
1771
2246
 
1772
- # Returns non-zero if \arg cursor is null.
2247
+ # Returns non-zero if \p cursor is null.
1773
2248
  #
1774
2249
  # @method cursor_is_null(cursor)
1775
2250
  # @param [Cursor] cursor
@@ -1897,11 +2372,11 @@ module FFIGen::Clang
1897
2372
  # @return [Symbol]
1898
2373
  # @scope class
1899
2374
  enum :linkage_kind, [
1900
- :invalid,
1901
- :no_linkage,
1902
- :internal,
1903
- :unique_external,
1904
- :external
2375
+ :invalid, 0,
2376
+ :no_linkage, 1,
2377
+ :internal, 2,
2378
+ :unique_external, 3,
2379
+ :external, 4
1905
2380
  ]
1906
2381
 
1907
2382
  # Determine the linkage of the entity referred to by a given cursor.
@@ -1912,7 +2387,8 @@ module FFIGen::Clang
1912
2387
  # @scope class
1913
2388
  attach_function :get_cursor_linkage, :clang_getCursorLinkage, [Cursor.by_value], :linkage_kind
1914
2389
 
1915
- # Determine the availability of the entity that this cursor refers to.
2390
+ # Determine the availability of the entity that this cursor refers to,
2391
+ # taking the current target platform into account.
1916
2392
  #
1917
2393
  # @method get_cursor_availability(cursor)
1918
2394
  # @param [Cursor] cursor The cursor to query.
@@ -1920,6 +2396,76 @@ module FFIGen::Clang
1920
2396
  # @scope class
1921
2397
  attach_function :get_cursor_availability, :clang_getCursorAvailability, [Cursor.by_value], :availability_kind
1922
2398
 
2399
+ # Describes the availability of a given entity on a particular platform, e.g.,
2400
+ # a particular class might only be available on Mac OS 10.7 or newer.
2401
+ #
2402
+ # = Fields:
2403
+ # :platform ::
2404
+ # (String) A string that describes the platform for which this structure
2405
+ # provides availability information.
2406
+ #
2407
+ # Possible values are "ios" or "macosx".
2408
+ # :introduced ::
2409
+ # (Version) The version number in which this entity was introduced.
2410
+ # :deprecated ::
2411
+ # (Version) The version number in which this entity was deprecated (but is
2412
+ # still available).
2413
+ # :obsoleted ::
2414
+ # (Version) The version number in which this entity was obsoleted, and therefore
2415
+ # is no longer available.
2416
+ # :unavailable ::
2417
+ # (Integer) Whether the entity is unconditionally unavailable on this platform.
2418
+ # :message ::
2419
+ # (String) An optional message to provide to a user of this API, e.g., to
2420
+ # suggest replacement APIs.
2421
+ class PlatformAvailability < FFI::Struct
2422
+ layout :platform, String.by_value,
2423
+ :introduced, Version.by_value,
2424
+ :deprecated, Version.by_value,
2425
+ :obsoleted, Version.by_value,
2426
+ :unavailable, :int,
2427
+ :message, String.by_value
2428
+ end
2429
+
2430
+ # Determine the availability of the entity that this cursor refers to
2431
+ # on any platforms for which availability information is known.
2432
+ #
2433
+ # @method get_cursor_platform_availability(cursor, always_deprecated, deprecated_message, always_unavailable, unavailable_message, availability, availability_size)
2434
+ # @param [Cursor] cursor The cursor to query.
2435
+ # @param [FFI::Pointer(*Int)] always_deprecated If non-NULL, will be set to indicate whether the
2436
+ # entity is deprecated on all platforms.
2437
+ # @param [String] deprecated_message If non-NULL, will be set to the message text
2438
+ # provided along with the unconditional deprecation of this entity. The client
2439
+ # is responsible for deallocating this string.
2440
+ # @param [FFI::Pointer(*Int)] always_unavailable If non-NULL, will be set to indicate whether the
2441
+ # entity is unavailable on all platforms.
2442
+ # @param [String] unavailable_message If non-NULL, will be set to the message text
2443
+ # provided along with the unconditional unavailability of this entity. The
2444
+ # client is responsible for deallocating this string.
2445
+ # @param [PlatformAvailability] availability If non-NULL, an array of CXPlatformAvailability instances
2446
+ # that will be populated with platform availability information, up to either
2447
+ # the number of platforms for which availability information is available (as
2448
+ # returned by this function) or \c availability_size, whichever is smaller.
2449
+ # @param [Integer] availability_size The number of elements available in the
2450
+ # \c availability array.
2451
+ # @return [Integer] The number of platforms (N) for which availability information is
2452
+ # available (which is unrelated to \c availability_size).
2453
+ #
2454
+ # Note that the client is responsible for calling
2455
+ # \c clang_disposeCXPlatformAvailability to free each of the
2456
+ # platform-availability structures returned. There are
2457
+ # \c min(N, availability_size) such structures.
2458
+ # @scope class
2459
+ attach_function :get_cursor_platform_availability, :clang_getCursorPlatformAvailability, [Cursor.by_value, :pointer, String, :pointer, String, PlatformAvailability, :int], :int
2460
+
2461
+ # Free the memory associated with a \c CXPlatformAvailability structure.
2462
+ #
2463
+ # @method dispose_cx_platform_availability(availability)
2464
+ # @param [PlatformAvailability] availability
2465
+ # @return [nil]
2466
+ # @scope class
2467
+ attach_function :dispose_cx_platform_availability, :clang_disposeCXPlatformAvailability, [PlatformAvailability], :void
2468
+
1923
2469
  # Describe the "language" of the entity referred to by a cursor.
1924
2470
  #
1925
2471
  # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:language_kind).</em>
@@ -1939,9 +2485,9 @@ module FFIGen::Clang
1939
2485
  # @scope class
1940
2486
  enum :language_kind, [
1941
2487
  :invalid, 0,
1942
- :c,
1943
- :obj_c,
1944
- :c_plus_plus
2488
+ :c, 1,
2489
+ :obj_c, 2,
2490
+ :c_plus_plus, 3
1945
2491
  ]
1946
2492
 
1947
2493
  # Determine the "language" of the entity referred to by a given cursor.
@@ -2014,10 +2560,10 @@ module FFIGen::Clang
2014
2560
  # void C::f() { }
2015
2561
  # \endcode
2016
2562
  #
2017
- # In the out-of-line definition of \c C::f, the semantic parent is the
2563
+ # In the out-of-line definition of \c C::f, the semantic parent is
2018
2564
  # the class \c C, of which this function is a member. The lexical parent is
2019
2565
  # the place where the declaration actually occurs in the source code; in this
2020
- # case, the definition occurs in the translation unit. In general, the
2566
+ # case, the definition occurs in the translation unit. In general, the
2021
2567
  # lexical parent for a given entity can change without affecting the semantics
2022
2568
  # of the program, and the lexical parent of different declarations of the
2023
2569
  # same entity may be different. Changing the semantic parent of a declaration,
@@ -2052,10 +2598,10 @@ module FFIGen::Clang
2052
2598
  # void C::f() { }
2053
2599
  # \endcode
2054
2600
  #
2055
- # In the out-of-line definition of \c C::f, the semantic parent is the
2601
+ # In the out-of-line definition of \c C::f, the semantic parent is
2056
2602
  # the class \c C, of which this function is a member. The lexical parent is
2057
2603
  # the place where the declaration actually occurs in the source code; in this
2058
- # case, the definition occurs in the translation unit. In general, the
2604
+ # case, the definition occurs in the translation unit. In general, the
2059
2605
  # lexical parent for a given entity can change without affecting the semantics
2060
2606
  # of the program, and the lexical parent of different declarations of the
2061
2607
  # same entity may be different. Changing the semantic parent of a declaration,
@@ -2081,11 +2627,12 @@ module FFIGen::Clang
2081
2627
  # In both Objective-C and C++, a method (aka virtual member function,
2082
2628
  # in C++) can override a virtual method in a base class. For
2083
2629
  # Objective-C, a method is said to override any method in the class's
2084
- # interface (if we're coming from an implementation), its protocols,
2085
- # or its categories, that has the same selector and is of the same
2086
- # kind (class or instance). If no such method exists, the search
2087
- # continues to the class's superclass, its protocols, and its
2088
- # categories, and so on.
2630
+ # base class, its protocols, or its categories' protocols, that has the same
2631
+ # selector and is of the same kind (class or instance).
2632
+ # If no such method exists, the search continues to the class's superclass,
2633
+ # its protocols, and its categories, and so on. A method from an Objective-C
2634
+ # implementation is considered to override the same methods as its
2635
+ # corresponding method in the interface.
2089
2636
  #
2090
2637
  # For C++, a virtual member function overrides any virtual member
2091
2638
  # function with the same signature that occurs in its base
@@ -2175,7 +2722,7 @@ module FFIGen::Clang
2175
2722
  #
2176
2723
  # The extent of a cursor starts with the file/line/column pointing at the
2177
2724
  # first character within the source construct that the cursor refers to and
2178
- # ends with the last character withinin that source construct. For a
2725
+ # ends with the last character within that source construct. For a
2179
2726
  # declaration, the extent covers the declaration itself. For a reference,
2180
2727
  # the extent covers the location of the reference (e.g., where the referenced
2181
2728
  # entity was actually used).
@@ -2192,7 +2739,7 @@ module FFIGen::Clang
2192
2739
  #
2193
2740
  # === Options:
2194
2741
  # :invalid ::
2195
- # Reprents an invalid type (e.g., where no type is available).
2742
+ # Represents an invalid type (e.g., where no type is available).
2196
2743
  # :unexposed ::
2197
2744
  # A type whose specific kind is not exposed via this
2198
2745
  # interface.
@@ -2278,6 +2825,16 @@ module FFIGen::Clang
2278
2825
  #
2279
2826
  # :constant_array ::
2280
2827
  #
2828
+ # :vector ::
2829
+ #
2830
+ # :incomplete_array ::
2831
+ #
2832
+ # :variable_array ::
2833
+ #
2834
+ # :dependent_sized_array ::
2835
+ #
2836
+ # :member_pointer ::
2837
+ #
2281
2838
  #
2282
2839
  # @method _enum_type_kind_
2283
2840
  # @return [Symbol]
@@ -2325,15 +2882,74 @@ module FFIGen::Clang
2325
2882
  :obj_c_object_pointer, 109,
2326
2883
  :function_no_proto, 110,
2327
2884
  :function_proto, 111,
2328
- :constant_array, 112
2885
+ :constant_array, 112,
2886
+ :vector, 113,
2887
+ :incomplete_array, 114,
2888
+ :variable_array, 115,
2889
+ :dependent_sized_array, 116,
2890
+ :member_pointer, 117
2329
2891
  ]
2330
2892
 
2331
- # The type of an element in the abstract syntax tree.
2893
+ # Describes the calling convention of a function type
2332
2894
  #
2333
- # = Fields:
2334
- # :kind ::
2335
- # (Symbol from _enum_type_kind_)
2336
- # :data ::
2895
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:calling_conv).</em>
2896
+ #
2897
+ # === Options:
2898
+ # :default ::
2899
+ #
2900
+ # :c ::
2901
+ #
2902
+ # :x86_std_call ::
2903
+ #
2904
+ # :x86_fast_call ::
2905
+ #
2906
+ # :x86_this_call ::
2907
+ #
2908
+ # :x86_pascal ::
2909
+ #
2910
+ # :aapcs ::
2911
+ #
2912
+ # :aapcs_vfp ::
2913
+ #
2914
+ # :pnacl_call ::
2915
+ #
2916
+ # :intel_ocl_bicc ::
2917
+ #
2918
+ # :x86_64_win64 ::
2919
+ #
2920
+ # :x86_64_sys_v ::
2921
+ #
2922
+ # :invalid ::
2923
+ #
2924
+ # :unexposed ::
2925
+ #
2926
+ #
2927
+ # @method _enum_calling_conv_
2928
+ # @return [Symbol]
2929
+ # @scope class
2930
+ enum :calling_conv, [
2931
+ :default, 0,
2932
+ :c, 1,
2933
+ :x86_std_call, 2,
2934
+ :x86_fast_call, 3,
2935
+ :x86_this_call, 4,
2936
+ :x86_pascal, 5,
2937
+ :aapcs, 6,
2938
+ :aapcs_vfp, 7,
2939
+ :pnacl_call, 8,
2940
+ :intel_ocl_bicc, 9,
2941
+ :x86_64_win64, 10,
2942
+ :x86_64_sys_v, 11,
2943
+ :invalid, 100,
2944
+ :unexposed, 200
2945
+ ]
2946
+
2947
+ # The type of an element in the abstract syntax tree.
2948
+ #
2949
+ # = Fields:
2950
+ # :kind ::
2951
+ # (Symbol from _enum_type_kind_)
2952
+ # :data ::
2337
2953
  # (Array<FFI::Pointer(*Void)>)
2338
2954
  class Type < FFI::Struct
2339
2955
  layout :kind, :type_kind,
@@ -2348,13 +2964,107 @@ module FFIGen::Clang
2348
2964
  # @scope class
2349
2965
  attach_function :get_cursor_type, :clang_getCursorType, [Cursor.by_value], Type.by_value
2350
2966
 
2967
+ # Pretty-print the underlying type using the rules of the
2968
+ # language of the translation unit from which it came.
2969
+ #
2970
+ # If the type is invalid, an empty string is returned.
2971
+ #
2972
+ # @method get_type_spelling(ct)
2973
+ # @param [Type] ct
2974
+ # @return [String]
2975
+ # @scope class
2976
+ attach_function :get_type_spelling, :clang_getTypeSpelling, [Type.by_value], String.by_value
2977
+
2978
+ # Retrieve the underlying type of a typedef declaration.
2979
+ #
2980
+ # If the cursor does not reference a typedef declaration, an invalid type is
2981
+ # returned.
2982
+ #
2983
+ # @method get_typedef_decl_underlying_type(c)
2984
+ # @param [Cursor] c
2985
+ # @return [Type]
2986
+ # @scope class
2987
+ attach_function :get_typedef_decl_underlying_type, :clang_getTypedefDeclUnderlyingType, [Cursor.by_value], Type.by_value
2988
+
2989
+ # Retrieve the integer type of an enum declaration.
2990
+ #
2991
+ # If the cursor does not reference an enum declaration, an invalid type is
2992
+ # returned.
2993
+ #
2994
+ # @method get_enum_decl_integer_type(c)
2995
+ # @param [Cursor] c
2996
+ # @return [Type]
2997
+ # @scope class
2998
+ attach_function :get_enum_decl_integer_type, :clang_getEnumDeclIntegerType, [Cursor.by_value], Type.by_value
2999
+
3000
+ # Retrieve the integer value of an enum constant declaration as a signed
3001
+ # long long.
3002
+ #
3003
+ # If the cursor does not reference an enum constant declaration, LLONG_MIN is returned.
3004
+ # Since this is also potentially a valid constant value, the kind of the cursor
3005
+ # must be verified before calling this function.
3006
+ #
3007
+ # @method get_enum_constant_decl_value(c)
3008
+ # @param [Cursor] c
3009
+ # @return [Integer]
3010
+ # @scope class
3011
+ attach_function :get_enum_constant_decl_value, :clang_getEnumConstantDeclValue, [Cursor.by_value], :long_long
3012
+
3013
+ # Retrieve the integer value of an enum constant declaration as an unsigned
3014
+ # long long.
3015
+ #
3016
+ # If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned.
3017
+ # Since this is also potentially a valid constant value, the kind of the cursor
3018
+ # must be verified before calling this function.
3019
+ #
3020
+ # @method get_enum_constant_decl_unsigned_value(c)
3021
+ # @param [Cursor] c
3022
+ # @return [Integer]
3023
+ # @scope class
3024
+ attach_function :get_enum_constant_decl_unsigned_value, :clang_getEnumConstantDeclUnsignedValue, [Cursor.by_value], :ulong_long
3025
+
3026
+ # Retrieve the bit width of a bit field declaration as an integer.
3027
+ #
3028
+ # If a cursor that is not a bit field declaration is passed in, -1 is returned.
3029
+ #
3030
+ # @method get_field_decl_bit_width(c)
3031
+ # @param [Cursor] c
3032
+ # @return [Integer]
3033
+ # @scope class
3034
+ attach_function :get_field_decl_bit_width, :clang_getFieldDeclBitWidth, [Cursor.by_value], :int
3035
+
3036
+ # Retrieve the number of non-variadic arguments associated with a given
3037
+ # cursor.
3038
+ #
3039
+ # The number of arguments can be determined for calls as well as for
3040
+ # declarations of functions or methods. For other cursors -1 is returned.
3041
+ #
3042
+ # @method cursor_get_num_arguments(c)
3043
+ # @param [Cursor] c
3044
+ # @return [Integer]
3045
+ # @scope class
3046
+ attach_function :cursor_get_num_arguments, :clang_Cursor_getNumArguments, [Cursor.by_value], :int
3047
+
3048
+ # Retrieve the argument cursor of a function or method.
3049
+ #
3050
+ # The argument cursor can be determined for calls as well as for declarations
3051
+ # of functions or methods. For other cursors and for invalid indices, an
3052
+ # invalid cursor is returned.
3053
+ #
3054
+ # @method cursor_get_argument(c, i)
3055
+ # @param [Cursor] c
3056
+ # @param [Integer] i
3057
+ # @return [Cursor]
3058
+ # @scope class
3059
+ attach_function :cursor_get_argument, :clang_Cursor_getArgument, [Cursor.by_value, :uint], Cursor.by_value
3060
+
2351
3061
  # Determine whether two CXTypes represent the same type.
2352
3062
  #
2353
3063
  # @method equal_types(a, b)
2354
3064
  # @param [Type] a
2355
3065
  # @param [Type] b
2356
- # @return [Integer] non-zero if the CXTypes represent the same type and
2357
- # zero otherwise.
3066
+ # @return [Integer] non-zero if the CXTypes represent the same type and
3067
+ # zero otherwise.
2358
3068
  # @scope class
2359
3069
  attach_function :equal_types, :clang_equalTypes, [Type.by_value, Type.by_value], :uint
2360
3070
 
@@ -2371,8 +3081,9 @@ module FFIGen::Clang
2371
3081
  # @scope class
2372
3082
  attach_function :get_canonical_type, :clang_getCanonicalType, [Type.by_value], Type.by_value
2373
3083
 
2374
- # Determine whether a CXType has the "const" qualifier set,
2375
- # without looking through typedefs that may have added "const" at a different level.
3084
+ # Determine whether a CXType has the "const" qualifier set,
3085
+ # without looking through typedefs that may have added "const" at a
3086
+ # different level.
2376
3087
  #
2377
3088
  # @method is_const_qualified_type(t)
2378
3089
  # @param [Type] t
@@ -2380,8 +3091,9 @@ module FFIGen::Clang
2380
3091
  # @scope class
2381
3092
  attach_function :is_const_qualified_type, :clang_isConstQualifiedType, [Type.by_value], :uint
2382
3093
 
2383
- # Determine whether a CXType has the "volatile" qualifier set,
2384
- # without looking through typedefs that may have added "volatile" at a different level.
3094
+ # Determine whether a CXType has the "volatile" qualifier set,
3095
+ # without looking through typedefs that may have added "volatile" at
3096
+ # a different level.
2385
3097
  #
2386
3098
  # @method is_volatile_qualified_type(t)
2387
3099
  # @param [Type] t
@@ -2389,8 +3101,9 @@ module FFIGen::Clang
2389
3101
  # @scope class
2390
3102
  attach_function :is_volatile_qualified_type, :clang_isVolatileQualifiedType, [Type.by_value], :uint
2391
3103
 
2392
- # Determine whether a CXType has the "restrict" qualifier set,
2393
- # without looking through typedefs that may have added "restrict" at a different level.
3104
+ # Determine whether a CXType has the "restrict" qualifier set,
3105
+ # without looking through typedefs that may have added "restrict" at a
3106
+ # different level.
2394
3107
  #
2395
3108
  # @method is_restrict_qualified_type(t)
2396
3109
  # @param [Type] t
@@ -2430,7 +3143,19 @@ module FFIGen::Clang
2430
3143
  # @scope class
2431
3144
  attach_function :get_type_kind_spelling, :clang_getTypeKindSpelling, [:type_kind], String.by_value
2432
3145
 
2433
- # Retrieve the result type associated with a function type.
3146
+ # Retrieve the calling convention associated with a function type.
3147
+ #
3148
+ # If a non-function type is passed in, CXCallingConv_Invalid is returned.
3149
+ #
3150
+ # @method get_function_type_calling_conv(t)
3151
+ # @param [Type] t
3152
+ # @return [Symbol from _enum_calling_conv_]
3153
+ # @scope class
3154
+ attach_function :get_function_type_calling_conv, :clang_getFunctionTypeCallingConv, [Type.by_value], :calling_conv
3155
+
3156
+ # Retrieve the return type associated with a function type.
3157
+ #
3158
+ # If a non-function type is passed in, an invalid type is returned.
2434
3159
  #
2435
3160
  # @method get_result_type(t)
2436
3161
  # @param [Type] t
@@ -2438,8 +3163,40 @@ module FFIGen::Clang
2438
3163
  # @scope class
2439
3164
  attach_function :get_result_type, :clang_getResultType, [Type.by_value], Type.by_value
2440
3165
 
2441
- # Retrieve the result type associated with a given cursor. This only
2442
- # returns a valid type of the cursor refers to a function or method.
3166
+ # Retrieve the number of non-variadic parameters associated with a
3167
+ # function type.
3168
+ #
3169
+ # If a non-function type is passed in, -1 is returned.
3170
+ #
3171
+ # @method get_num_arg_types(t)
3172
+ # @param [Type] t
3173
+ # @return [Integer]
3174
+ # @scope class
3175
+ attach_function :get_num_arg_types, :clang_getNumArgTypes, [Type.by_value], :int
3176
+
3177
+ # Retrieve the type of a parameter of a function type.
3178
+ #
3179
+ # If a non-function type is passed in or the function does not have enough
3180
+ # parameters, an invalid type is returned.
3181
+ #
3182
+ # @method get_arg_type(t, i)
3183
+ # @param [Type] t
3184
+ # @param [Integer] i
3185
+ # @return [Type]
3186
+ # @scope class
3187
+ attach_function :get_arg_type, :clang_getArgType, [Type.by_value, :uint], Type.by_value
3188
+
3189
+ # Return 1 if the CXType is a variadic function type, and 0 otherwise.
3190
+ #
3191
+ # @method is_function_type_variadic(t)
3192
+ # @param [Type] t
3193
+ # @return [Integer]
3194
+ # @scope class
3195
+ attach_function :is_function_type_variadic, :clang_isFunctionTypeVariadic, [Type.by_value], :uint
3196
+
3197
+ # Retrieve the return type associated with a given cursor.
3198
+ #
3199
+ # This only returns a valid type if the cursor refers to a function or method.
2443
3200
  #
2444
3201
  # @method get_cursor_result_type(c)
2445
3202
  # @param [Cursor] c
@@ -2456,6 +3213,28 @@ module FFIGen::Clang
2456
3213
  # @scope class
2457
3214
  attach_function :is_pod_type, :clang_isPODType, [Type.by_value], :uint
2458
3215
 
3216
+ # Return the element type of an array, complex, or vector type.
3217
+ #
3218
+ # If a type is passed in that is not an array, complex, or vector type,
3219
+ # an invalid type is returned.
3220
+ #
3221
+ # @method get_element_type(t)
3222
+ # @param [Type] t
3223
+ # @return [Type]
3224
+ # @scope class
3225
+ attach_function :get_element_type, :clang_getElementType, [Type.by_value], Type.by_value
3226
+
3227
+ # Return the number of elements of an array or vector type.
3228
+ #
3229
+ # If a type is passed in that is not an array or vector type,
3230
+ # -1 is returned.
3231
+ #
3232
+ # @method get_num_elements(t)
3233
+ # @param [Type] t
3234
+ # @return [Integer]
3235
+ # @scope class
3236
+ attach_function :get_num_elements, :clang_getNumElements, [Type.by_value], :long_long
3237
+
2459
3238
  # Return the element type of an array type.
2460
3239
  #
2461
3240
  # If a non-array type is passed in, an invalid type is returned.
@@ -2466,7 +3245,7 @@ module FFIGen::Clang
2466
3245
  # @scope class
2467
3246
  attach_function :get_array_element_type, :clang_getArrayElementType, [Type.by_value], Type.by_value
2468
3247
 
2469
- # Return the the array size of a constant array.
3248
+ # Return the array size of a constant array.
2470
3249
  #
2471
3250
  # If a non-array type is passed in, -1 is returned.
2472
3251
  #
@@ -2476,6 +3255,164 @@ module FFIGen::Clang
2476
3255
  # @scope class
2477
3256
  attach_function :get_array_size, :clang_getArraySize, [Type.by_value], :long_long
2478
3257
 
3258
+ # List the possible error codes for \c clang_Type_getSizeOf,
3259
+ # \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and
3260
+ # \c clang_Cursor_getOffsetOf.
3261
+ #
3262
+ # A value of this enumeration type can be returned if the target type is not
3263
+ # a valid argument to sizeof, alignof or offsetof.
3264
+ #
3265
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:type_layout_error).</em>
3266
+ #
3267
+ # === Options:
3268
+ # :invalid ::
3269
+ # Type is of kind CXType_Invalid.
3270
+ # :incomplete ::
3271
+ # The type is an incomplete Type.
3272
+ # :dependent ::
3273
+ # The type is a dependent Type.
3274
+ # :not_constant_size ::
3275
+ # The type is not a constant size type.
3276
+ # :invalid_field_name ::
3277
+ # The Field name is not valid for this record.
3278
+ #
3279
+ # @method _enum_type_layout_error_
3280
+ # @return [Symbol]
3281
+ # @scope class
3282
+ enum :type_layout_error, [
3283
+ :invalid, -1,
3284
+ :incomplete, -2,
3285
+ :dependent, -3,
3286
+ :not_constant_size, -4,
3287
+ :invalid_field_name, -5
3288
+ ]
3289
+
3290
+ # Return the alignment of a type in bytes as per C++(expr.alignof)
3291
+ # standard.
3292
+ #
3293
+ # If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
3294
+ # If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
3295
+ # is returned.
3296
+ # If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
3297
+ # returned.
3298
+ # If the type declaration is not a constant size type,
3299
+ # CXTypeLayoutError_NotConstantSize is returned.
3300
+ #
3301
+ # @method type_get_align_of(t)
3302
+ # @param [Type] t
3303
+ # @return [Integer]
3304
+ # @scope class
3305
+ attach_function :type_get_align_of, :clang_Type_getAlignOf, [Type.by_value], :long_long
3306
+
3307
+ # Return the class type of an member pointer type.
3308
+ #
3309
+ # If a non-member-pointer type is passed in, an invalid type is returned.
3310
+ #
3311
+ # @method type_get_class_type(t)
3312
+ # @param [Type] t
3313
+ # @return [Type]
3314
+ # @scope class
3315
+ attach_function :type_get_class_type, :clang_Type_getClassType, [Type.by_value], Type.by_value
3316
+
3317
+ # Return the size of a type in bytes as per C++(expr.sizeof) standard.
3318
+ #
3319
+ # If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
3320
+ # If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
3321
+ # is returned.
3322
+ # If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
3323
+ # returned.
3324
+ #
3325
+ # @method type_get_size_of(t)
3326
+ # @param [Type] t
3327
+ # @return [Integer]
3328
+ # @scope class
3329
+ attach_function :type_get_size_of, :clang_Type_getSizeOf, [Type.by_value], :long_long
3330
+
3331
+ # Return the offset of a field named S in a record of type T in bits
3332
+ # as it would be returned by __offsetof__ as per C++11(18.2p4)
3333
+ #
3334
+ # If the cursor is not a record field declaration, CXTypeLayoutError_Invalid
3335
+ # is returned.
3336
+ # If the field's type declaration is an incomplete type,
3337
+ # CXTypeLayoutError_Incomplete is returned.
3338
+ # If the field's type declaration is a dependent type,
3339
+ # CXTypeLayoutError_Dependent is returned.
3340
+ # If the field's name S is not found,
3341
+ # CXTypeLayoutError_InvalidFieldName is returned.
3342
+ #
3343
+ # @method type_get_offset_of(t, s)
3344
+ # @param [Type] t
3345
+ # @param [String] s
3346
+ # @return [Integer]
3347
+ # @scope class
3348
+ attach_function :type_get_offset_of, :clang_Type_getOffsetOf, [Type.by_value, :string], :long_long
3349
+
3350
+ # (Not documented)
3351
+ #
3352
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:ref_qualifier_kind).</em>
3353
+ #
3354
+ # === Options:
3355
+ # :none ::
3356
+ # No ref-qualifier was provided.
3357
+ # :l_value ::
3358
+ # An lvalue ref-qualifier was provided (\c &).
3359
+ # :r_value ::
3360
+ # An rvalue ref-qualifier was provided (\c &&).
3361
+ #
3362
+ # @method _enum_ref_qualifier_kind_
3363
+ # @return [Symbol]
3364
+ # @scope class
3365
+ enum :ref_qualifier_kind, [
3366
+ :none, 0,
3367
+ :l_value, 1,
3368
+ :r_value, 2
3369
+ ]
3370
+
3371
+ # Returns the number of template arguments for given class template
3372
+ # specialization, or -1 if type \c T is not a class template specialization.
3373
+ #
3374
+ # Variadic argument packs count as only one argument, and can not be inspected
3375
+ # further.
3376
+ #
3377
+ # @method type_get_num_template_arguments(t)
3378
+ # @param [Type] t
3379
+ # @return [Integer]
3380
+ # @scope class
3381
+ attach_function :type_get_num_template_arguments, :clang_Type_getNumTemplateArguments, [Type.by_value], :int
3382
+
3383
+ # Returns the type template argument of a template class specialization
3384
+ # at given index.
3385
+ #
3386
+ # This function only returns template type arguments and does not handle
3387
+ # template template arguments or variadic packs.
3388
+ #
3389
+ # @method type_get_template_argument_as_type(t, i)
3390
+ # @param [Type] t
3391
+ # @param [Integer] i
3392
+ # @return [Type]
3393
+ # @scope class
3394
+ attach_function :type_get_template_argument_as_type, :clang_Type_getTemplateArgumentAsType, [Type.by_value, :uint], Type.by_value
3395
+
3396
+ # Retrieve the ref-qualifier kind of a function or method.
3397
+ #
3398
+ # The ref-qualifier is returned for C++ functions or methods. For other types
3399
+ # or non-C++ declarations, CXRefQualifier_None is returned.
3400
+ #
3401
+ # @method type_get_cxx_ref_qualifier(t)
3402
+ # @param [Type] t
3403
+ # @return [Symbol from _enum_ref_qualifier_kind_]
3404
+ # @scope class
3405
+ attach_function :type_get_cxx_ref_qualifier, :clang_Type_getCXXRefQualifier, [Type.by_value], :ref_qualifier_kind
3406
+
3407
+ # Returns non-zero if the cursor specifies a Record member that is a
3408
+ # bitfield.
3409
+ #
3410
+ # @method cursor_is_bit_field(c)
3411
+ # @param [Cursor] c
3412
+ # @return [Integer]
3413
+ # @scope class
3414
+ attach_function :cursor_is_bit_field, :clang_Cursor_isBitField, [Cursor.by_value], :uint
3415
+
2479
3416
  # Returns 1 if the base class specified by the cursor with kind
2480
3417
  # CX_CXXBaseSpecifier is virtual.
2481
3418
  #
@@ -2491,28 +3428,30 @@ module FFIGen::Clang
2491
3428
  # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:cxx_access_specifier).</em>
2492
3429
  #
2493
3430
  # === Options:
2494
- # :x_invalid_access_specifier ::
3431
+ # :invalid_access_specifier ::
2495
3432
  #
2496
- # :x_public ::
3433
+ # :public ::
2497
3434
  #
2498
- # :x_protected ::
3435
+ # :protected ::
2499
3436
  #
2500
- # :x_private ::
3437
+ # :private ::
2501
3438
  #
2502
3439
  #
2503
3440
  # @method _enum_cxx_access_specifier_
2504
3441
  # @return [Symbol]
2505
3442
  # @scope class
2506
3443
  enum :cxx_access_specifier, [
2507
- :x_invalid_access_specifier,
2508
- :x_public,
2509
- :x_protected,
2510
- :x_private
3444
+ :invalid_access_specifier, 0,
3445
+ :public, 1,
3446
+ :protected, 2,
3447
+ :private, 3
2511
3448
  ]
2512
3449
 
2513
- # Returns the access control level for the C++ base specifier
2514
- # represented by a cursor with kind CXCursor_CXXBaseSpecifier or
2515
- # CXCursor_AccessSpecifier.
3450
+ # Returns the access control level for the referenced object.
3451
+ #
3452
+ # If the cursor refers to a C++ declaration, its access control level within its
3453
+ # parent scope is returned. Otherwise, if the cursor refers to a base specifier or
3454
+ # access specifier, the specifier itself is returned.
2516
3455
  #
2517
3456
  # @method get_cxx_access_specifier(cursor)
2518
3457
  # @param [Cursor] cursor
@@ -2562,7 +3501,7 @@ module FFIGen::Clang
2562
3501
  # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:child_visit_result).</em>
2563
3502
  #
2564
3503
  # === Options:
2565
- # :break ::
3504
+ # :break_ ::
2566
3505
  # Terminates the cursor traversal.
2567
3506
  # :continue ::
2568
3507
  # Continues the cursor traversal with the next sibling of
@@ -2575,9 +3514,9 @@ module FFIGen::Clang
2575
3514
  # @return [Symbol]
2576
3515
  # @scope class
2577
3516
  enum :child_visit_result, [
2578
- :break,
2579
- :continue,
2580
- :recurse
3517
+ :break_, 0,
3518
+ :continue, 1,
3519
+ :recurse, 2
2581
3520
  ]
2582
3521
 
2583
3522
  # Visitor invoked for each cursor found by a traversal.
@@ -2593,13 +3532,14 @@ module FFIGen::Clang
2593
3532
  #
2594
3533
  # <em>This entry is only for documentation and no real method.</em>
2595
3534
  #
2596
- # @method _callback_cursor_visitor_(cursor, parent, client_data)
3535
+ # @method _callback_cursor_visitor_(enum cx_child_visit_result, cursor, parent, client_data)
3536
+ # @param [Symbol from _enum_child_visit_result_] enum cx_child_visit_result
2597
3537
  # @param [Cursor] cursor
2598
3538
  # @param [Cursor] parent
2599
3539
  # @param [FFI::Pointer(ClientData)] client_data
2600
3540
  # @return [Symbol from _enum_child_visit_result_]
2601
3541
  # @scope class
2602
- callback :cursor_visitor, [Cursor.by_value, Cursor.by_value, :pointer], :child_visit_result
3542
+ callback :cursor_visitor, [:child_visit_result, Cursor.by_value, Cursor.by_value, :pointer], :child_visit_result
2603
3543
 
2604
3544
  # Visit the children of a particular cursor.
2605
3545
  #
@@ -2700,6 +3640,20 @@ module FFIGen::Clang
2700
3640
  # @scope class
2701
3641
  attach_function :get_cursor_spelling, :clang_getCursorSpelling, [Cursor.by_value], String.by_value
2702
3642
 
3643
+ # Retrieve a range for a piece that forms the cursors spelling name.
3644
+ # Most of the times there is only one range for the complete spelling but for
3645
+ # Objective-C methods and Objective-C message expressions, there are multiple
3646
+ # pieces for each selector identifier.
3647
+ #
3648
+ # @method cursor_get_spelling_name_range(cursor, piece_index, options)
3649
+ # @param [Cursor] cursor
3650
+ # @param [Integer] piece_index the index of the spelling name piece. If this is greater
3651
+ # than the actual number of pieces, it will return a NULL (invalid) range.
3652
+ # @param [Integer] options Reserved.
3653
+ # @return [SourceRange]
3654
+ # @scope class
3655
+ attach_function :cursor_get_spelling_name_range, :clang_Cursor_getSpellingNameRange, [Cursor.by_value, :uint, :uint], SourceRange.by_value
3656
+
2703
3657
  # Retrieve the display name for the entity referenced by this cursor.
2704
3658
  #
2705
3659
  # The display name contains extra information that helps identify the cursor,
@@ -2728,32 +3682,32 @@ module FFIGen::Clang
2728
3682
  # @scope class
2729
3683
  attach_function :get_cursor_referenced, :clang_getCursorReferenced, [Cursor.by_value], Cursor.by_value
2730
3684
 
2731
- # For a cursor that is either a reference to or a declaration
2732
- # of some entity, retrieve a cursor that describes the definition of
2733
- # that entity.
2734
- #
2735
- # Some entities can be declared multiple times within a translation
2736
- # unit, but only one of those declarations can also be a
2737
- # definition. For example, given:
2738
- #
2739
- # \code
2740
- # int f(int, int);
2741
- # int g(int x, int y) { return f(x, y); }
2742
- # int f(int a, int b) { return a + b; }
2743
- # int f(int, int);
2744
- # \endcode
2745
- #
2746
- # there are three declarations of the function "f", but only the
2747
- # second one is a definition. The clang_getCursorDefinition()
2748
- # function will take any cursor pointing to a declaration of "f"
2749
- # (the first or fourth lines of the example) or a cursor referenced
2750
- # that uses "f" (the call to "f' inside "g") and will return a
2751
- # declaration cursor pointing to the definition (the second "f"
2752
- # declaration).
2753
- #
2754
- # If given a cursor for which there is no corresponding definition,
2755
- # e.g., because there is no definition of that entity within this
2756
- # translation unit, returns a NULL cursor.
3685
+ # For a cursor that is either a reference to or a declaration
3686
+ # of some entity, retrieve a cursor that describes the definition of
3687
+ # that entity.
3688
+ #
3689
+ # Some entities can be declared multiple times within a translation
3690
+ # unit, but only one of those declarations can also be a
3691
+ # definition. For example, given:
3692
+ #
3693
+ # \code
3694
+ # int f(int, int);
3695
+ # int g(int x, int y) { return f(x, y); }
3696
+ # int f(int a, int b) { return a + b; }
3697
+ # int f(int, int);
3698
+ # \endcode
3699
+ #
3700
+ # there are three declarations of the function "f", but only the
3701
+ # second one is a definition. The clang_getCursorDefinition()
3702
+ # function will take any cursor pointing to a declaration of "f"
3703
+ # (the first or fourth lines of the example) or a cursor referenced
3704
+ # that uses "f" (the call to "f' inside "g") and will return a
3705
+ # declaration cursor pointing to the definition (the second "f"
3706
+ # declaration).
3707
+ #
3708
+ # If given a cursor for which there is no corresponding definition,
3709
+ # e.g., because there is no definition of that entity within this
3710
+ # translation unit, returns a NULL cursor.
2757
3711
  #
2758
3712
  # @method get_cursor_definition(cursor)
2759
3713
  # @param [Cursor] cursor
@@ -2797,56 +3751,346 @@ module FFIGen::Clang
2797
3751
  # @scope class
2798
3752
  attach_function :get_canonical_cursor, :clang_getCanonicalCursor, [Cursor.by_value], Cursor.by_value
2799
3753
 
2800
- # Determine if a C++ member function or member function template is
2801
- # declared 'static'.
3754
+ # If the cursor points to a selector identifier in an Objective-C
3755
+ # method or message expression, this returns the selector index.
2802
3756
  #
2803
- # @method cxx_method_is_static(c)
3757
+ # After getting a cursor with #clang_getCursor, this can be called to
3758
+ # determine if the location points to a selector identifier.
3759
+ #
3760
+ # @method cursor_get_obj_c_selector_index(cursor)
3761
+ # @param [Cursor] cursor
3762
+ # @return [Integer] The selector index if the cursor is an Objective-C method or message
3763
+ # expression and the cursor is pointing to a selector identifier, or -1
3764
+ # otherwise.
3765
+ # @scope class
3766
+ attach_function :cursor_get_obj_c_selector_index, :clang_Cursor_getObjCSelectorIndex, [Cursor.by_value], :int
3767
+
3768
+ # Given a cursor pointing to a C++ method call or an Objective-C
3769
+ # message, returns non-zero if the method/message is "dynamic", meaning:
3770
+ #
3771
+ # For a C++ method: the call is virtual.
3772
+ # For an Objective-C message: the receiver is an object instance, not 'super'
3773
+ # or a specific class.
3774
+ #
3775
+ # If the method/message is "static" or the cursor does not point to a
3776
+ # method/message, it will return zero.
3777
+ #
3778
+ # @method cursor_is_dynamic_call(c)
2804
3779
  # @param [Cursor] c
2805
3780
  # @return [Integer]
2806
3781
  # @scope class
2807
- attach_function :cxx_method_is_static, :clang_CXXMethod_isStatic, [Cursor.by_value], :uint
3782
+ attach_function :cursor_is_dynamic_call, :clang_Cursor_isDynamicCall, [Cursor.by_value], :int
2808
3783
 
2809
- # Determine if a C++ member function or member function template is
2810
- # explicitly declared 'virtual' or if it overrides a virtual method from
2811
- # one of the base classes.
3784
+ # Given a cursor pointing to an Objective-C message, returns the CXType
3785
+ # of the receiver.
2812
3786
  #
2813
- # @method cxx_method_is_virtual(c)
3787
+ # @method cursor_get_receiver_type(c)
2814
3788
  # @param [Cursor] c
2815
- # @return [Integer]
3789
+ # @return [Type]
2816
3790
  # @scope class
2817
- attach_function :cxx_method_is_virtual, :clang_CXXMethod_isVirtual, [Cursor.by_value], :uint
3791
+ attach_function :cursor_get_receiver_type, :clang_Cursor_getReceiverType, [Cursor.by_value], Type.by_value
2818
3792
 
2819
- # Given a cursor that represents a template, determine
2820
- # the cursor kind of the specializations would be generated by instantiating
2821
- # the template.
3793
+ # Property attributes for a \c CXCursor_ObjCPropertyDecl.
2822
3794
  #
2823
- # This routine can be used to determine what flavor of function template,
2824
- # class template, or class template partial specialization is stored in the
2825
- # cursor. For example, it can describe whether a class template cursor is
2826
- # declared with "struct", "class" or "union".
3795
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:obj_c_property_attr_kind).</em>
2827
3796
  #
2828
- # @method get_template_cursor_kind(c)
2829
- # @param [Cursor] c The cursor to query. This cursor should represent a template
2830
- # declaration.
2831
- # @return [Symbol from _enum_cursor_kind_] The cursor kind of the specializations that would be generated
2832
- # by instantiating the template \p C. If \p C is not a template, returns
2833
- # \c CXCursor_NoDeclFound.
3797
+ # === Options:
3798
+ # :noattr ::
3799
+ #
3800
+ # :readonly ::
3801
+ #
3802
+ # :getter ::
3803
+ #
3804
+ # :assign ::
3805
+ #
3806
+ # :readwrite ::
3807
+ #
3808
+ # :retain ::
3809
+ #
3810
+ # :copy ::
3811
+ #
3812
+ # :nonatomic ::
3813
+ #
3814
+ # :setter ::
3815
+ #
3816
+ # :atomic ::
3817
+ #
3818
+ # :weak ::
3819
+ #
3820
+ # :strong ::
3821
+ #
3822
+ # :unsafe_unretained ::
3823
+ #
3824
+ #
3825
+ # @method _enum_obj_c_property_attr_kind_
3826
+ # @return [Symbol]
2834
3827
  # @scope class
2835
- attach_function :get_template_cursor_kind, :clang_getTemplateCursorKind, [Cursor.by_value], :cursor_kind
3828
+ enum :obj_c_property_attr_kind, [
3829
+ :noattr, 0,
3830
+ :readonly, 1,
3831
+ :getter, 2,
3832
+ :assign, 4,
3833
+ :readwrite, 8,
3834
+ :retain, 16,
3835
+ :copy, 32,
3836
+ :nonatomic, 64,
3837
+ :setter, 128,
3838
+ :atomic, 256,
3839
+ :weak, 512,
3840
+ :strong, 1024,
3841
+ :unsafe_unretained, 2048
3842
+ ]
2836
3843
 
2837
- # Given a cursor that may represent a specialization or instantiation
2838
- # of a template, retrieve the cursor that represents the template that it
2839
- # specializes or from which it was instantiated.
3844
+ # Given a cursor that represents a property declaration, return the
3845
+ # associated property attributes. The bits are formed from
3846
+ # \c CXObjCPropertyAttrKind.
2840
3847
  #
2841
- # This routine determines the template involved both for explicit
2842
- # specializations of templates and for implicit instantiations of the template,
2843
- # both of which are referred to as "specializations". For a class template
2844
- # specialization (e.g., \c std::vector<bool>), this routine will return
2845
- # either the primary template (\c std::vector) or, if the specialization was
2846
- # instantiated from a class template partial specialization, the class template
2847
- # partial specialization. For a class template partial specialization and a
2848
- # function template specialization (including instantiations), this
2849
- # this routine will return the specialized template.
3848
+ # @method cursor_get_obj_c_property_attributes(c, reserved)
3849
+ # @param [Cursor] c
3850
+ # @param [Integer] reserved Reserved for future use, pass 0.
3851
+ # @return [Integer]
3852
+ # @scope class
3853
+ attach_function :cursor_get_obj_c_property_attributes, :clang_Cursor_getObjCPropertyAttributes, [Cursor.by_value, :uint], :uint
3854
+
3855
+ # 'Qualifiers' written next to the return and parameter types in
3856
+ # Objective-C method declarations.
3857
+ #
3858
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:obj_c_decl_qualifier_kind).</em>
3859
+ #
3860
+ # === Options:
3861
+ # :none ::
3862
+ #
3863
+ # :in_ ::
3864
+ #
3865
+ # :inout ::
3866
+ #
3867
+ # :out ::
3868
+ #
3869
+ # :bycopy ::
3870
+ #
3871
+ # :byref ::
3872
+ #
3873
+ # :oneway ::
3874
+ #
3875
+ #
3876
+ # @method _enum_obj_c_decl_qualifier_kind_
3877
+ # @return [Symbol]
3878
+ # @scope class
3879
+ enum :obj_c_decl_qualifier_kind, [
3880
+ :none, 0,
3881
+ :in_, 1,
3882
+ :inout, 2,
3883
+ :out, 4,
3884
+ :bycopy, 8,
3885
+ :byref, 16,
3886
+ :oneway, 32
3887
+ ]
3888
+
3889
+ # Given a cursor that represents an Objective-C method or parameter
3890
+ # declaration, return the associated Objective-C qualifiers for the return
3891
+ # type or the parameter respectively. The bits are formed from
3892
+ # CXObjCDeclQualifierKind.
3893
+ #
3894
+ # @method cursor_get_obj_c_decl_qualifiers(c)
3895
+ # @param [Cursor] c
3896
+ # @return [Integer]
3897
+ # @scope class
3898
+ attach_function :cursor_get_obj_c_decl_qualifiers, :clang_Cursor_getObjCDeclQualifiers, [Cursor.by_value], :uint
3899
+
3900
+ # Given a cursor that represents an Objective-C method or property
3901
+ # declaration, return non-zero if the declaration was affected by "@optional".
3902
+ # Returns zero if the cursor is not such a declaration or it is "@required".
3903
+ #
3904
+ # @method cursor_is_obj_c_optional(c)
3905
+ # @param [Cursor] c
3906
+ # @return [Integer]
3907
+ # @scope class
3908
+ attach_function :cursor_is_obj_c_optional, :clang_Cursor_isObjCOptional, [Cursor.by_value], :uint
3909
+
3910
+ # Returns non-zero if the given cursor is a variadic function or method.
3911
+ #
3912
+ # @method cursor_is_variadic(c)
3913
+ # @param [Cursor] c
3914
+ # @return [Integer]
3915
+ # @scope class
3916
+ attach_function :cursor_is_variadic, :clang_Cursor_isVariadic, [Cursor.by_value], :uint
3917
+
3918
+ # Given a cursor that represents a declaration, return the associated
3919
+ # comment's source range. The range may include multiple consecutive comments
3920
+ # with whitespace in between.
3921
+ #
3922
+ # @method cursor_get_comment_range(c)
3923
+ # @param [Cursor] c
3924
+ # @return [SourceRange]
3925
+ # @scope class
3926
+ attach_function :cursor_get_comment_range, :clang_Cursor_getCommentRange, [Cursor.by_value], SourceRange.by_value
3927
+
3928
+ # Given a cursor that represents a declaration, return the associated
3929
+ # comment text, including comment markers.
3930
+ #
3931
+ # @method cursor_get_raw_comment_text(c)
3932
+ # @param [Cursor] c
3933
+ # @return [String]
3934
+ # @scope class
3935
+ attach_function :cursor_get_raw_comment_text, :clang_Cursor_getRawCommentText, [Cursor.by_value], String.by_value
3936
+
3937
+ # Given a cursor that represents a documentable entity (e.g.,
3938
+ # declaration), return the associated \paragraph; otherwise return the
3939
+ # first paragraph.
3940
+ #
3941
+ # @method cursor_get_brief_comment_text(c)
3942
+ # @param [Cursor] c
3943
+ # @return [String]
3944
+ # @scope class
3945
+ attach_function :cursor_get_brief_comment_text, :clang_Cursor_getBriefCommentText, [Cursor.by_value], String.by_value
3946
+
3947
+ # Given a CXCursor_ModuleImportDecl cursor, return the associated module.
3948
+ #
3949
+ # @method cursor_get_module(c)
3950
+ # @param [Cursor] c
3951
+ # @return [FFI::Pointer(Module)]
3952
+ # @scope class
3953
+ attach_function :cursor_get_module, :clang_Cursor_getModule, [Cursor.by_value], :pointer
3954
+
3955
+ # Given a CXFile header file, return the module that contains it, if one
3956
+ # exists.
3957
+ #
3958
+ # @method get_module_for_file(translation_unit_impl, file)
3959
+ # @param [TranslationUnitImpl] translation_unit_impl
3960
+ # @param [FFI::Pointer(File)] file
3961
+ # @return [FFI::Pointer(Module)]
3962
+ # @scope class
3963
+ attach_function :get_module_for_file, :clang_getModuleForFile, [TranslationUnitImpl, :pointer], :pointer
3964
+
3965
+ # (Not documented)
3966
+ #
3967
+ # @method module_get_ast_file(module_)
3968
+ # @param [FFI::Pointer(Module)] module_ a module object.
3969
+ # @return [FFI::Pointer(File)] the module file where the provided module object came from.
3970
+ # @scope class
3971
+ attach_function :module_get_ast_file, :clang_Module_getASTFile, [:pointer], :pointer
3972
+
3973
+ # (Not documented)
3974
+ #
3975
+ # @method module_get_parent(module_)
3976
+ # @param [FFI::Pointer(Module)] module_ a module object.
3977
+ # @return [FFI::Pointer(Module)] the parent of a sub-module or NULL if the given module is top-level,
3978
+ # e.g. for 'std.vector' it will return the 'std' module.
3979
+ # @scope class
3980
+ attach_function :module_get_parent, :clang_Module_getParent, [:pointer], :pointer
3981
+
3982
+ # (Not documented)
3983
+ #
3984
+ # @method module_get_name(module_)
3985
+ # @param [FFI::Pointer(Module)] module_ a module object.
3986
+ # @return [String] the name of the module, e.g. for the 'std.vector' sub-module it
3987
+ # will return "vector".
3988
+ # @scope class
3989
+ attach_function :module_get_name, :clang_Module_getName, [:pointer], String.by_value
3990
+
3991
+ # (Not documented)
3992
+ #
3993
+ # @method module_get_full_name(module_)
3994
+ # @param [FFI::Pointer(Module)] module_ a module object.
3995
+ # @return [String] the full name of the module, e.g. "std.vector".
3996
+ # @scope class
3997
+ attach_function :module_get_full_name, :clang_Module_getFullName, [:pointer], String.by_value
3998
+
3999
+ # (Not documented)
4000
+ #
4001
+ # @method module_is_system(module_)
4002
+ # @param [FFI::Pointer(Module)] module_ a module object.
4003
+ # @return [Integer] non-zero if the module is a system one.
4004
+ # @scope class
4005
+ attach_function :module_is_system, :clang_Module_isSystem, [:pointer], :int
4006
+
4007
+ # (Not documented)
4008
+ #
4009
+ # @method module_get_num_top_level_headers(translation_unit_impl, module_)
4010
+ # @param [TranslationUnitImpl] translation_unit_impl
4011
+ # @param [FFI::Pointer(Module)] module_ a module object.
4012
+ # @return [Integer] the number of top level headers associated with this module.
4013
+ # @scope class
4014
+ attach_function :module_get_num_top_level_headers, :clang_Module_getNumTopLevelHeaders, [TranslationUnitImpl, :pointer], :uint
4015
+
4016
+ # (Not documented)
4017
+ #
4018
+ # @method module_get_top_level_header(translation_unit_impl, module_, index)
4019
+ # @param [TranslationUnitImpl] translation_unit_impl
4020
+ # @param [FFI::Pointer(Module)] module_ a module object.
4021
+ # @param [Integer] index top level header index (zero-based).
4022
+ # @return [FFI::Pointer(File)] the specified top level header associated with the module.
4023
+ # @scope class
4024
+ attach_function :module_get_top_level_header, :clang_Module_getTopLevelHeader, [TranslationUnitImpl, :pointer, :uint], :pointer
4025
+
4026
+ # Determine if a C++ member function or member function template is
4027
+ # pure virtual.
4028
+ #
4029
+ # @method cxx_method_is_pure_virtual(c)
4030
+ # @param [Cursor] c
4031
+ # @return [Integer]
4032
+ # @scope class
4033
+ attach_function :cxx_method_is_pure_virtual, :clang_CXXMethod_isPureVirtual, [Cursor.by_value], :uint
4034
+
4035
+ # Determine if a C++ member function or member function template is
4036
+ # declared 'static'.
4037
+ #
4038
+ # @method cxx_method_is_static(c)
4039
+ # @param [Cursor] c
4040
+ # @return [Integer]
4041
+ # @scope class
4042
+ attach_function :cxx_method_is_static, :clang_CXXMethod_isStatic, [Cursor.by_value], :uint
4043
+
4044
+ # Determine if a C++ member function or member function template is
4045
+ # explicitly declared 'virtual' or if it overrides a virtual method from
4046
+ # one of the base classes.
4047
+ #
4048
+ # @method cxx_method_is_virtual(c)
4049
+ # @param [Cursor] c
4050
+ # @return [Integer]
4051
+ # @scope class
4052
+ attach_function :cxx_method_is_virtual, :clang_CXXMethod_isVirtual, [Cursor.by_value], :uint
4053
+
4054
+ # Determine if a C++ member function or member function template is
4055
+ # declared 'const'.
4056
+ #
4057
+ # @method cxx_method_is_const(c)
4058
+ # @param [Cursor] c
4059
+ # @return [Integer]
4060
+ # @scope class
4061
+ attach_function :cxx_method_is_const, :clang_CXXMethod_isConst, [Cursor.by_value], :uint
4062
+
4063
+ # Given a cursor that represents a template, determine
4064
+ # the cursor kind of the specializations would be generated by instantiating
4065
+ # the template.
4066
+ #
4067
+ # This routine can be used to determine what flavor of function template,
4068
+ # class template, or class template partial specialization is stored in the
4069
+ # cursor. For example, it can describe whether a class template cursor is
4070
+ # declared with "struct", "class" or "union".
4071
+ #
4072
+ # @method get_template_cursor_kind(c)
4073
+ # @param [Cursor] c The cursor to query. This cursor should represent a template
4074
+ # declaration.
4075
+ # @return [Symbol from _enum_cursor_kind_] The cursor kind of the specializations that would be generated
4076
+ # by instantiating the template \p C. If \p C is not a template, returns
4077
+ # \c CXCursor_NoDeclFound.
4078
+ # @scope class
4079
+ attach_function :get_template_cursor_kind, :clang_getTemplateCursorKind, [Cursor.by_value], :cursor_kind
4080
+
4081
+ # Given a cursor that may represent a specialization or instantiation
4082
+ # of a template, retrieve the cursor that represents the template that it
4083
+ # specializes or from which it was instantiated.
4084
+ #
4085
+ # This routine determines the template involved both for explicit
4086
+ # specializations of templates and for implicit instantiations of the template,
4087
+ # both of which are referred to as "specializations". For a class template
4088
+ # specialization (e.g., \c std::vector<bool>), this routine will return
4089
+ # either the primary template (\c std::vector) or, if the specialization was
4090
+ # instantiated from a class template partial specialization, the class template
4091
+ # partial specialization. For a class template partial specialization and a
4092
+ # function template specialization (including instantiations), this
4093
+ # this routine will return the specialized template.
2850
4094
  #
2851
4095
  # For members of a class template (e.g., member functions, member classes, or
2852
4096
  # static data members), returns the specialized or instantiated member.
@@ -2875,7 +4119,7 @@ module FFIGen::Clang
2875
4119
  # @param [Integer] piece_index For contiguous names or when passing the flag
2876
4120
  # CXNameRange_WantSinglePiece, only one piece with index 0 is
2877
4121
  # available. When the CXNameRange_WantSinglePiece flag is not passed for a
2878
- # non-contiguous names, this index can be used to retreive the individual
4122
+ # non-contiguous names, this index can be used to retrieve the individual
2879
4123
  # pieces of the name. See also CXNameRange_WantSinglePiece.
2880
4124
  # @return [SourceRange] The piece of the name pointed to by the given cursor. If there is no
2881
4125
  # name, or if the PieceIndex is out-of-range, a null-cursor will be returned.
@@ -2887,19 +4131,19 @@ module FFIGen::Clang
2887
4131
  # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:name_ref_flags).</em>
2888
4132
  #
2889
4133
  # === Options:
2890
- # :want_qualifier ::
4134
+ # :range_want_qualifier ::
2891
4135
  # Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the
2892
4136
  # range.
2893
- # :want_template_args ::
2894
- # Include the explicit template arguments, e.g. <int> in x.f<int>, in
2895
- # the range.
2896
- # :want_single_piece ::
4137
+ # :range_want_template_args ::
4138
+ # Include the explicit template arguments, e.g. \<int> in x.f<int>,
4139
+ # in the range.
4140
+ # :range_want_single_piece ::
2897
4141
  # If the name is non-contiguous, return the full spanning range.
2898
4142
  #
2899
4143
  # Non-contiguous names occur in Objective-C when a selector with two or more
2900
4144
  # parameters is used, or in C++ when using an operator:
2901
4145
  # \code
2902
- # (object doSomething:here withValue:there); // ObjC
4146
+ # (object doSomething:here withValue:there); // Objective-C
2903
4147
  # return some_vector(1); // C++
2904
4148
  # \endcode
2905
4149
  #
@@ -2907,9 +4151,9 @@ module FFIGen::Clang
2907
4151
  # @return [Symbol]
2908
4152
  # @scope class
2909
4153
  enum :name_ref_flags, [
2910
- :want_qualifier, 0x1,
2911
- :want_template_args, 0x2,
2912
- :want_single_piece, 0x4
4154
+ :range_want_qualifier, 1,
4155
+ :range_want_template_args, 2,
4156
+ :range_want_single_piece, 4
2913
4157
  ]
2914
4158
 
2915
4159
  # Describes a kind of token.
@@ -2932,11 +4176,11 @@ module FFIGen::Clang
2932
4176
  # @return [Symbol]
2933
4177
  # @scope class
2934
4178
  enum :token_kind, [
2935
- :punctuation,
2936
- :keyword,
2937
- :identifier,
2938
- :literal,
2939
- :comment
4179
+ :punctuation, 0,
4180
+ :keyword, 1,
4181
+ :identifier, 2,
4182
+ :literal, 3,
4183
+ :comment, 4
2940
4184
  ]
2941
4185
 
2942
4186
  # Describes a single preprocessing token.
@@ -3057,8 +4301,8 @@ module FFIGen::Clang
3057
4301
  #
3058
4302
  # @method get_definition_spelling_and_extent(cursor, start_buf, end_buf, start_line, start_column, end_line, end_column)
3059
4303
  # @param [Cursor] cursor
3060
- # @param [FFI::Pointer(**Char_S)] start_buf
3061
- # @param [FFI::Pointer(**Char_S)] end_buf
4304
+ # @param [FFI::Pointer(**CharS)] start_buf
4305
+ # @param [FFI::Pointer(**CharS)] end_buf
3062
4306
  # @param [FFI::Pointer(*UInt)] start_line
3063
4307
  # @param [FFI::Pointer(*UInt)] start_column
3064
4308
  # @param [FFI::Pointer(*UInt)] end_line
@@ -3237,27 +4481,27 @@ module FFIGen::Clang
3237
4481
  # @return [Symbol]
3238
4482
  # @scope class
3239
4483
  enum :completion_chunk_kind, [
3240
- :optional,
3241
- :typed_text,
3242
- :text,
3243
- :placeholder,
3244
- :informative,
3245
- :current_parameter,
3246
- :left_paren,
3247
- :right_paren,
3248
- :left_bracket,
3249
- :right_bracket,
3250
- :left_brace,
3251
- :right_brace,
3252
- :left_angle,
3253
- :right_angle,
3254
- :comma,
3255
- :result_type,
3256
- :colon,
3257
- :semi_colon,
3258
- :equal,
3259
- :horizontal_space,
3260
- :vertical_space
4484
+ :optional, 0,
4485
+ :typed_text, 1,
4486
+ :text, 2,
4487
+ :placeholder, 3,
4488
+ :informative, 4,
4489
+ :current_parameter, 5,
4490
+ :left_paren, 6,
4491
+ :right_paren, 7,
4492
+ :left_bracket, 8,
4493
+ :right_bracket, 9,
4494
+ :left_brace, 10,
4495
+ :right_brace, 11,
4496
+ :left_angle, 12,
4497
+ :right_angle, 13,
4498
+ :comma, 14,
4499
+ :result_type, 15,
4500
+ :colon, 16,
4501
+ :semi_colon, 17,
4502
+ :equal, 18,
4503
+ :horizontal_space, 19,
4504
+ :vertical_space, 20
3261
4505
  ]
3262
4506
 
3263
4507
  # Determine the kind of a particular chunk within a completion string.
@@ -3341,6 +4585,31 @@ module FFIGen::Clang
3341
4585
  # @scope class
3342
4586
  attach_function :get_completion_annotation, :clang_getCompletionAnnotation, [:pointer, :uint], String.by_value
3343
4587
 
4588
+ # Retrieve the parent context of the given completion string.
4589
+ #
4590
+ # The parent context of a completion string is the semantic parent of
4591
+ # the declaration (if any) that the code completion represents. For example,
4592
+ # a code completion for an Objective-C method would have the method's class
4593
+ # or protocol as its context.
4594
+ #
4595
+ # @method get_completion_parent(completion_string, kind)
4596
+ # @param [FFI::Pointer(CompletionString)] completion_string The code completion string whose parent is
4597
+ # being queried.
4598
+ # @param [FFI::Pointer(*CursorKind)] kind DEPRECATED: always set to CXCursor_NotImplemented if non-NULL.
4599
+ # @return [String] The name of the completion parent, e.g., "NSObject" if
4600
+ # the completion string represents a method in the NSObject class.
4601
+ # @scope class
4602
+ attach_function :get_completion_parent, :clang_getCompletionParent, [:pointer, :pointer], String.by_value
4603
+
4604
+ # Retrieve the brief documentation comment attached to the declaration
4605
+ # that corresponds to the given completion string.
4606
+ #
4607
+ # @method get_completion_brief_comment(completion_string)
4608
+ # @param [FFI::Pointer(CompletionString)] completion_string
4609
+ # @return [String]
4610
+ # @scope class
4611
+ attach_function :get_completion_brief_comment, :clang_getCompletionBriefComment, [:pointer], String.by_value
4612
+
3344
4613
  # Retrieve a completion string for an arbitrary declaration or macro
3345
4614
  # definition cursor.
3346
4615
  #
@@ -3383,13 +4652,17 @@ module FFIGen::Clang
3383
4652
  # :include_code_patterns ::
3384
4653
  # Whether to include code patterns for language constructs
3385
4654
  # within the set of code completions, e.g., for loops.
4655
+ # :include_brief_comments ::
4656
+ # Whether to include brief documentation within the set of code
4657
+ # completions returned.
3386
4658
  #
3387
4659
  # @method _enum_code_complete_flags_
3388
4660
  # @return [Symbol]
3389
4661
  # @scope class
3390
4662
  enum :code_complete_flags, [
3391
- :include_macros, 0x01,
3392
- :include_code_patterns, 0x02
4663
+ :include_macros, 1,
4664
+ :include_code_patterns, 2,
4665
+ :include_brief_comments, 4
3393
4666
  ]
3394
4667
 
3395
4668
  # Bits that represent the context under which completion is occurring.
@@ -3400,15 +4673,100 @@ module FFIGen::Clang
3400
4673
  # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:completion_context).</em>
3401
4674
  #
3402
4675
  # === Options:
3403
- # :completion_context_unexposed ::
4676
+ # :unexposed ::
3404
4677
  # The context for completions is unexposed, as only Clang results
3405
4678
  # should be included. (This is equivalent to having no context bits set.)
4679
+ # :any_type ::
4680
+ # Completions for any possible type should be included in the results.
4681
+ # :any_value ::
4682
+ # Completions for any possible value (variables, function calls, etc.)
4683
+ # should be included in the results.
4684
+ # :obj_c_object_value ::
4685
+ # Completions for values that resolve to an Objective-C object should
4686
+ # be included in the results.
4687
+ # :obj_c_selector_value ::
4688
+ # Completions for values that resolve to an Objective-C selector
4689
+ # should be included in the results.
4690
+ # :cxx_class_type_value ::
4691
+ # Completions for values that resolve to a C++ class type should be
4692
+ # included in the results.
4693
+ # :dot_member_access ::
4694
+ # Completions for fields of the member being accessed using the dot
4695
+ # operator should be included in the results.
4696
+ # :arrow_member_access ::
4697
+ # Completions for fields of the member being accessed using the arrow
4698
+ # operator should be included in the results.
4699
+ # :obj_c_property_access ::
4700
+ # Completions for properties of the Objective-C object being accessed
4701
+ # using the dot operator should be included in the results.
4702
+ # :enum_tag ::
4703
+ # Completions for enum tags should be included in the results.
4704
+ # :union_tag ::
4705
+ # Completions for union tags should be included in the results.
4706
+ # :struct_tag ::
4707
+ # Completions for struct tags should be included in the results.
4708
+ # :class_tag ::
4709
+ # Completions for C++ class names should be included in the results.
4710
+ # :namespace ::
4711
+ # Completions for C++ namespaces and namespace aliases should be
4712
+ # included in the results.
4713
+ # :nested_name_specifier ::
4714
+ # Completions for C++ nested name specifiers should be included in
4715
+ # the results.
4716
+ # :obj_c_interface ::
4717
+ # Completions for Objective-C interfaces (classes) should be included
4718
+ # in the results.
4719
+ # :obj_c_protocol ::
4720
+ # Completions for Objective-C protocols should be included in
4721
+ # the results.
4722
+ # :obj_c_category ::
4723
+ # Completions for Objective-C categories should be included in
4724
+ # the results.
4725
+ # :obj_c_instance_message ::
4726
+ # Completions for Objective-C instance messages should be included
4727
+ # in the results.
4728
+ # :obj_c_class_message ::
4729
+ # Completions for Objective-C class messages should be included in
4730
+ # the results.
4731
+ # :obj_c_selector_name ::
4732
+ # Completions for Objective-C selector names should be included in
4733
+ # the results.
4734
+ # :macro_name ::
4735
+ # Completions for preprocessor macro names should be included in
4736
+ # the results.
4737
+ # :natural_language ::
4738
+ # Natural language completions should be included in the results.
4739
+ # :unknown ::
4740
+ # The current context is unknown, so set all contexts.
3406
4741
  #
3407
4742
  # @method _enum_completion_context_
3408
4743
  # @return [Symbol]
3409
4744
  # @scope class
3410
4745
  enum :completion_context, [
3411
- :completion_context_unexposed, 0
4746
+ :unexposed, 0,
4747
+ :any_type, 1,
4748
+ :any_value, 2,
4749
+ :obj_c_object_value, 4,
4750
+ :obj_c_selector_value, 8,
4751
+ :cxx_class_type_value, 16,
4752
+ :dot_member_access, 32,
4753
+ :arrow_member_access, 64,
4754
+ :obj_c_property_access, 128,
4755
+ :enum_tag, 256,
4756
+ :union_tag, 512,
4757
+ :struct_tag, 1024,
4758
+ :class_tag, 2048,
4759
+ :namespace, 4096,
4760
+ :nested_name_specifier, 8192,
4761
+ :obj_c_interface, 16384,
4762
+ :obj_c_protocol, 32768,
4763
+ :obj_c_category, 65536,
4764
+ :obj_c_instance_message, 131072,
4765
+ :obj_c_class_message, 262144,
4766
+ :obj_c_selector_name, 524288,
4767
+ :macro_name, 1048576,
4768
+ :natural_language, 2097152,
4769
+ :unknown, 4194303
3412
4770
  ]
3413
4771
 
3414
4772
  # Returns a default set of code-completion options that can be
@@ -3511,18 +4869,15 @@ module FFIGen::Clang
3511
4869
 
3512
4870
  # Retrieve a diagnostic associated with the given code completion.
3513
4871
  #
3514
- # Result:
3515
- # the code completion results to query.
3516
- #
3517
4872
  # @method code_complete_get_diagnostic(results, index)
3518
- # @param [CodeCompleteResults] results
4873
+ # @param [CodeCompleteResults] results the code completion results to query.
3519
4874
  # @param [Integer] index the zero-based diagnostic number to retrieve.
3520
4875
  # @return [FFI::Pointer(Diagnostic)] the requested diagnostic. This diagnostic must be freed
3521
4876
  # via a call to \c clang_disposeDiagnostic().
3522
4877
  # @scope class
3523
4878
  attach_function :code_complete_get_diagnostic, :clang_codeCompleteGetDiagnostic, [CodeCompleteResults, :uint], :pointer
3524
4879
 
3525
- # Determines what compeltions are appropriate for the context
4880
+ # Determines what completions are appropriate for the context
3526
4881
  # the given code completion.
3527
4882
  #
3528
4883
  # @method code_complete_get_contexts(results)
@@ -3580,12 +4935,9 @@ module FFIGen::Clang
3580
4935
 
3581
4936
  # Enable/disable crash recovery.
3582
4937
  #
3583
- # Flag:
3584
- # to indicate if crash recovery is enabled. A non-zero value
3585
- # enables crash recovery, while 0 disables it.
3586
- #
3587
4938
  # @method toggle_crash_recovery(is_enabled)
3588
- # @param [Integer] is_enabled
4939
+ # @param [Integer] is_enabled Flag to indicate if crash recovery is enabled. A non-zero
4940
+ # value enables crash recovery, while 0 disables it.
3589
4941
  # @return [nil]
3590
4942
  # @scope class
3591
4943
  attach_function :toggle_crash_recovery, :clang_toggleCrashRecovery, [:uint], :void
@@ -3594,7 +4946,7 @@ module FFIGen::Clang
3594
4946
  # (used with clang_getInclusions()).
3595
4947
  #
3596
4948
  # This visitor function will be invoked by clang_getInclusions() for each
3597
- # file included (either at the top-level or by #include directives) within
4949
+ # file included (either at the top-level or by \#include directives) within
3598
4950
  # a translation unit. The first argument is the file being included, and
3599
4951
  # the second and third arguments provide the inclusion stack. The
3600
4952
  # array is sorted in order of immediate inclusion. For example,
@@ -3602,13 +4954,14 @@ module FFIGen::Clang
3602
4954
  #
3603
4955
  # <em>This entry is only for documentation and no real method.</em>
3604
4956
  #
3605
- # @method _callback_inclusion_visitor_(inclusion_stack, include_len, client_data)
4957
+ # @method _callback_inclusion_visitor_(included_file, inclusion_stack, include_len, client_data)
4958
+ # @param [FFI::Pointer(File)] included_file
3606
4959
  # @param [SourceLocation] inclusion_stack
3607
4960
  # @param [Integer] include_len
3608
4961
  # @param [FFI::Pointer(ClientData)] client_data
3609
4962
  # @return [FFI::Pointer(File)]
3610
4963
  # @scope class
3611
- callback :inclusion_visitor, [SourceLocation, :uint, :pointer], :pointer
4964
+ callback :inclusion_visitor, [:pointer, SourceLocation, :uint, :pointer], :pointer
3612
4965
 
3613
4966
  # Visit the set of preprocessor inclusions in a translation unit.
3614
4967
  # The visitor function is called with the provided data for every included
@@ -3632,6 +4985,16 @@ module FFIGen::Clang
3632
4985
  # @scope class
3633
4986
  attach_function :get_remappings, :clang_getRemappings, [:string], :pointer
3634
4987
 
4988
+ # Retrieve a remapping.
4989
+ #
4990
+ # @method get_remappings_from_file_list(file_paths, num_files)
4991
+ # @param [FFI::Pointer(**CharS)] file_paths pointer to an array of file paths containing remapping info.
4992
+ # @param [Integer] num_files number of file paths.
4993
+ # @return [FFI::Pointer(Remapping)] the requested remapping. This remapping must be freed
4994
+ # via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
4995
+ # @scope class
4996
+ attach_function :get_remappings_from_file_list, :clang_getRemappingsFromFileList, [:pointer, :uint], :pointer
4997
+
3635
4998
  # Determine the number of remappings.
3636
4999
  #
3637
5000
  # @method remap_get_num_files(remapping)
@@ -3667,22 +5030,20 @@ module FFIGen::Clang
3667
5030
  # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:visitor_result).</em>
3668
5031
  #
3669
5032
  # === Options:
3670
- # :break ::
5033
+ # :visit_break ::
3671
5034
  #
3672
- # :continue ::
5035
+ # :visit_continue ::
3673
5036
  #
3674
5037
  #
3675
5038
  # @method _enum_visitor_result_
3676
5039
  # @return [Symbol]
3677
5040
  # @scope class
3678
5041
  enum :visitor_result, [
3679
- :break,
3680
- :continue
5042
+ :visit_break, 0,
5043
+ :visit_continue, 1
3681
5044
  ]
3682
5045
 
3683
- # \defgroup CINDEX_HIGH Higher level API functions
3684
- #
3685
- # @{
5046
+ # (Not documented)
3686
5047
  #
3687
5048
  # = Fields:
3688
5049
  # :context ::
@@ -3694,6 +5055,28 @@ module FFIGen::Clang
3694
5055
  :visit, :pointer
3695
5056
  end
3696
5057
 
5058
+ # (Not documented)
5059
+ #
5060
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:result).</em>
5061
+ #
5062
+ # === Options:
5063
+ # :success ::
5064
+ # Function returned successfully.
5065
+ # :invalid ::
5066
+ # One of the parameters was invalid for the function.
5067
+ # :visit_break ::
5068
+ # The function was terminated by a callback (e.g. it returned
5069
+ # CXVisit_Break)
5070
+ #
5071
+ # @method _enum_result_
5072
+ # @return [Symbol]
5073
+ # @scope class
5074
+ enum :result, [
5075
+ :success, 0,
5076
+ :invalid, 1,
5077
+ :visit_break, 2
5078
+ ]
5079
+
3697
5080
  # Find references of a declaration in a specific file.
3698
5081
  #
3699
5082
  # @method find_references_in_file(cursor, file, visitor)
@@ -3703,8 +5086,847 @@ module FFIGen::Clang
3703
5086
  # each reference found.
3704
5087
  # The CXSourceRange will point inside the file; if the reference is inside
3705
5088
  # a macro (and not a macro argument) the CXSourceRange will be invalid.
5089
+ # @return [Symbol from _enum_result_] one of the CXResult enumerators.
5090
+ # @scope class
5091
+ attach_function :find_references_in_file, :clang_findReferencesInFile, [Cursor.by_value, :pointer, CursorAndRangeVisitor.by_value], :result
5092
+
5093
+ # Find #import/#include directives in a specific file.
5094
+ #
5095
+ # @method find_includes_in_file(tu, file, visitor)
5096
+ # @param [TranslationUnitImpl] tu translation unit containing the file to query.
5097
+ # @param [FFI::Pointer(File)] file to search for #import/#include directives.
5098
+ # @param [CursorAndRangeVisitor] visitor callback that will receive pairs of CXCursor/CXSourceRange for
5099
+ # each directive found.
5100
+ # @return [Symbol from _enum_result_] one of the CXResult enumerators.
5101
+ # @scope class
5102
+ attach_function :find_includes_in_file, :clang_findIncludesInFile, [TranslationUnitImpl, :pointer, CursorAndRangeVisitor.by_value], :result
5103
+
5104
+ # Source location passed to index callbacks.
5105
+ #
5106
+ # = Fields:
5107
+ # :ptr_data ::
5108
+ # (Array<FFI::Pointer(*Void)>)
5109
+ # :int_data ::
5110
+ # (Integer)
5111
+ class IdxLoc < FFI::Struct
5112
+ layout :ptr_data, [:pointer, 2],
5113
+ :int_data, :uint
5114
+ end
5115
+
5116
+ # Data for ppIncludedFile callback.
5117
+ #
5118
+ # = Fields:
5119
+ # :hash_loc ::
5120
+ # (IdxLoc) Location of '#' in the \#include/\#import directive.
5121
+ # :filename ::
5122
+ # (String) Filename as written in the \#include/\#import directive.
5123
+ # :file ::
5124
+ # (FFI::Pointer(File)) The actual file that the \#include/\#import directive resolved to.
5125
+ # :is_import ::
5126
+ # (Integer)
5127
+ # :is_angled ::
5128
+ # (Integer)
5129
+ # :is_module_import ::
5130
+ # (Integer) Non-zero if the directive was automatically turned into a module
5131
+ # import.
5132
+ class IdxIncludedFileInfo < FFI::Struct
5133
+ layout :hash_loc, IdxLoc.by_value,
5134
+ :filename, :string,
5135
+ :file, :pointer,
5136
+ :is_import, :int,
5137
+ :is_angled, :int,
5138
+ :is_module_import, :int
5139
+ end
5140
+
5141
+ # Data for IndexerCallbacks#importedASTFile.
5142
+ #
5143
+ # = Fields:
5144
+ # :file ::
5145
+ # (FFI::Pointer(File)) Top level AST file containing the imported PCH, module or submodule.
5146
+ # :module_ ::
5147
+ # (FFI::Pointer(Module)) The imported module or NULL if the AST file is a PCH.
5148
+ # :loc ::
5149
+ # (IdxLoc) Location where the file is imported. Applicable only for modules.
5150
+ # :is_implicit ::
5151
+ # (Integer) Non-zero if an inclusion directive was automatically turned into
5152
+ # a module import. Applicable only for modules.
5153
+ class IdxImportedASTFileInfo < FFI::Struct
5154
+ layout :file, :pointer,
5155
+ :module_, :pointer,
5156
+ :loc, IdxLoc.by_value,
5157
+ :is_implicit, :int
5158
+ end
5159
+
5160
+ # (Not documented)
5161
+ #
5162
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:idx_entity_kind).</em>
5163
+ #
5164
+ # === Options:
5165
+ # :unexposed ::
5166
+ #
5167
+ # :typedef ::
5168
+ #
5169
+ # :function ::
5170
+ #
5171
+ # :variable ::
5172
+ #
5173
+ # :field ::
5174
+ #
5175
+ # :enum_constant ::
5176
+ #
5177
+ # :obj_c_class ::
5178
+ #
5179
+ # :obj_c_protocol ::
5180
+ #
5181
+ # :obj_c_category ::
5182
+ #
5183
+ # :obj_c_instance_method ::
5184
+ #
5185
+ # :obj_c_class_method ::
5186
+ #
5187
+ # :obj_c_property ::
5188
+ #
5189
+ # :obj_c_ivar ::
5190
+ #
5191
+ # :enum ::
5192
+ #
5193
+ # :struct ::
5194
+ #
5195
+ # :union ::
5196
+ #
5197
+ # :cxx_class ::
5198
+ #
5199
+ # :cxx_namespace ::
5200
+ #
5201
+ # :cxx_namespace_alias ::
5202
+ #
5203
+ # :cxx_static_variable ::
5204
+ #
5205
+ # :cxx_static_method ::
5206
+ #
5207
+ # :cxx_instance_method ::
5208
+ #
5209
+ # :cxx_constructor ::
5210
+ #
5211
+ # :cxx_destructor ::
5212
+ #
5213
+ # :cxx_conversion_function ::
5214
+ #
5215
+ # :cxx_type_alias ::
5216
+ #
5217
+ # :cxx_interface ::
5218
+ #
5219
+ #
5220
+ # @method _enum_idx_entity_kind_
5221
+ # @return [Symbol]
5222
+ # @scope class
5223
+ enum :idx_entity_kind, [
5224
+ :unexposed, 0,
5225
+ :typedef, 1,
5226
+ :function, 2,
5227
+ :variable, 3,
5228
+ :field, 4,
5229
+ :enum_constant, 5,
5230
+ :obj_c_class, 6,
5231
+ :obj_c_protocol, 7,
5232
+ :obj_c_category, 8,
5233
+ :obj_c_instance_method, 9,
5234
+ :obj_c_class_method, 10,
5235
+ :obj_c_property, 11,
5236
+ :obj_c_ivar, 12,
5237
+ :enum, 13,
5238
+ :struct, 14,
5239
+ :union, 15,
5240
+ :cxx_class, 16,
5241
+ :cxx_namespace, 17,
5242
+ :cxx_namespace_alias, 18,
5243
+ :cxx_static_variable, 19,
5244
+ :cxx_static_method, 20,
5245
+ :cxx_instance_method, 21,
5246
+ :cxx_constructor, 22,
5247
+ :cxx_destructor, 23,
5248
+ :cxx_conversion_function, 24,
5249
+ :cxx_type_alias, 25,
5250
+ :cxx_interface, 26
5251
+ ]
5252
+
5253
+ # (Not documented)
5254
+ #
5255
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:idx_entity_language).</em>
5256
+ #
5257
+ # === Options:
5258
+ # :lang_none ::
5259
+ #
5260
+ # :lang_c ::
5261
+ #
5262
+ # :lang_obj_c ::
5263
+ #
5264
+ # :lang_cxx ::
5265
+ #
5266
+ #
5267
+ # @method _enum_idx_entity_language_
5268
+ # @return [Symbol]
5269
+ # @scope class
5270
+ enum :idx_entity_language, [
5271
+ :lang_none, 0,
5272
+ :lang_c, 1,
5273
+ :lang_obj_c, 2,
5274
+ :lang_cxx, 3
5275
+ ]
5276
+
5277
+ # Extra C++ template information for an entity. This can apply to:
5278
+ # CXIdxEntity_Function
5279
+ # CXIdxEntity_CXXClass
5280
+ # CXIdxEntity_CXXStaticMethod
5281
+ # CXIdxEntity_CXXInstanceMethod
5282
+ # CXIdxEntity_CXXConstructor
5283
+ # CXIdxEntity_CXXConversionFunction
5284
+ # CXIdxEntity_CXXTypeAlias
5285
+ #
5286
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:idx_entity_cxx_template_kind).</em>
5287
+ #
5288
+ # === Options:
5289
+ # :non_template ::
5290
+ #
5291
+ # :template ::
5292
+ #
5293
+ # :template_partial_specialization ::
5294
+ #
5295
+ # :template_specialization ::
5296
+ #
5297
+ #
5298
+ # @method _enum_idx_entity_cxx_template_kind_
5299
+ # @return [Symbol]
5300
+ # @scope class
5301
+ enum :idx_entity_cxx_template_kind, [
5302
+ :non_template, 0,
5303
+ :template, 1,
5304
+ :template_partial_specialization, 2,
5305
+ :template_specialization, 3
5306
+ ]
5307
+
5308
+ # (Not documented)
5309
+ #
5310
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:idx_attr_kind).</em>
5311
+ #
5312
+ # === Options:
5313
+ # :unexposed ::
5314
+ #
5315
+ # :ib_action ::
5316
+ #
5317
+ # :ib_outlet ::
5318
+ #
5319
+ # :ib_outlet_collection ::
5320
+ #
5321
+ #
5322
+ # @method _enum_idx_attr_kind_
5323
+ # @return [Symbol]
5324
+ # @scope class
5325
+ enum :idx_attr_kind, [
5326
+ :unexposed, 0,
5327
+ :ib_action, 1,
5328
+ :ib_outlet, 2,
5329
+ :ib_outlet_collection, 3
5330
+ ]
5331
+
5332
+ # (Not documented)
5333
+ #
5334
+ # = Fields:
5335
+ # :kind ::
5336
+ # (Symbol from _enum_idx_attr_kind_)
5337
+ # :cursor ::
5338
+ # (Cursor)
5339
+ # :loc ::
5340
+ # (IdxLoc)
5341
+ class IdxAttrInfo < FFI::Struct
5342
+ layout :kind, :idx_attr_kind,
5343
+ :cursor, Cursor.by_value,
5344
+ :loc, IdxLoc.by_value
5345
+ end
5346
+
5347
+ # (Not documented)
5348
+ #
5349
+ # = Fields:
5350
+ # :kind ::
5351
+ # (Symbol from _enum_idx_entity_kind_)
5352
+ # :template_kind ::
5353
+ # (Symbol from _enum_idx_entity_cxx_template_kind_)
5354
+ # :lang ::
5355
+ # (Symbol from _enum_idx_entity_language_)
5356
+ # :name ::
5357
+ # (String)
5358
+ # :usr ::
5359
+ # (String)
5360
+ # :cursor ::
5361
+ # (Cursor)
5362
+ # :attributes ::
5363
+ # (FFI::Pointer(**IdxAttrInfo))
5364
+ # :num_attributes ::
5365
+ # (Integer)
5366
+ class IdxEntityInfo < FFI::Struct
5367
+ layout :kind, :idx_entity_kind,
5368
+ :template_kind, :idx_entity_cxx_template_kind,
5369
+ :lang, :idx_entity_language,
5370
+ :name, :string,
5371
+ :usr, :string,
5372
+ :cursor, Cursor.by_value,
5373
+ :attributes, :pointer,
5374
+ :num_attributes, :uint
5375
+ end
5376
+
5377
+ # (Not documented)
5378
+ #
5379
+ # = Fields:
5380
+ # :cursor ::
5381
+ # (Cursor)
5382
+ class IdxContainerInfo < FFI::Struct
5383
+ layout :cursor, Cursor.by_value
5384
+ end
5385
+
5386
+ # (Not documented)
5387
+ #
5388
+ # = Fields:
5389
+ # :attr_info ::
5390
+ # (IdxAttrInfo)
5391
+ # :objc_class ::
5392
+ # (IdxEntityInfo)
5393
+ # :class_cursor ::
5394
+ # (Cursor)
5395
+ # :class_loc ::
5396
+ # (IdxLoc)
5397
+ class IdxIBOutletCollectionAttrInfo < FFI::Struct
5398
+ layout :attr_info, IdxAttrInfo,
5399
+ :objc_class, IdxEntityInfo,
5400
+ :class_cursor, Cursor.by_value,
5401
+ :class_loc, IdxLoc.by_value
5402
+ end
5403
+
5404
+ # (Not documented)
5405
+ #
5406
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:idx_decl_info_flags).</em>
5407
+ #
5408
+ # === Options:
5409
+ # :idx_decl_flag_skipped ::
5410
+ #
5411
+ #
5412
+ # @method _enum_idx_decl_info_flags_
5413
+ # @return [Symbol]
5414
+ # @scope class
5415
+ enum :idx_decl_info_flags, [
5416
+ :idx_decl_flag_skipped, 1
5417
+ ]
5418
+
5419
+ # (Not documented)
5420
+ #
5421
+ # = Fields:
5422
+ # :entity_info ::
5423
+ # (IdxEntityInfo)
5424
+ # :cursor ::
5425
+ # (Cursor)
5426
+ # :loc ::
5427
+ # (IdxLoc)
5428
+ # :semantic_container ::
5429
+ # (IdxContainerInfo)
5430
+ # :lexical_container ::
5431
+ # (IdxContainerInfo) Generally same as #semanticContainer but can be different in
5432
+ # cases like out-of-line C++ member functions.
5433
+ # :is_redeclaration ::
5434
+ # (Integer)
5435
+ # :is_definition ::
5436
+ # (Integer)
5437
+ # :is_container ::
5438
+ # (Integer)
5439
+ # :decl_as_container ::
5440
+ # (IdxContainerInfo)
5441
+ # :is_implicit ::
5442
+ # (Integer) Whether the declaration exists in code or was created implicitly
5443
+ # by the compiler, e.g. implicit Objective-C methods for properties.
5444
+ # :attributes ::
5445
+ # (FFI::Pointer(**IdxAttrInfo))
5446
+ # :num_attributes ::
5447
+ # (Integer)
5448
+ # :flags ::
5449
+ # (Integer)
5450
+ class IdxDeclInfo < FFI::Struct
5451
+ layout :entity_info, IdxEntityInfo,
5452
+ :cursor, Cursor.by_value,
5453
+ :loc, IdxLoc.by_value,
5454
+ :semantic_container, IdxContainerInfo,
5455
+ :lexical_container, IdxContainerInfo,
5456
+ :is_redeclaration, :int,
5457
+ :is_definition, :int,
5458
+ :is_container, :int,
5459
+ :decl_as_container, IdxContainerInfo,
5460
+ :is_implicit, :int,
5461
+ :attributes, :pointer,
5462
+ :num_attributes, :uint,
5463
+ :flags, :uint
5464
+ end
5465
+
5466
+ # (Not documented)
5467
+ #
5468
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:idx_obj_c_container_kind).</em>
5469
+ #
5470
+ # === Options:
5471
+ # :forward_ref ::
5472
+ #
5473
+ # :interface ::
5474
+ #
5475
+ # :implementation ::
5476
+ #
5477
+ #
5478
+ # @method _enum_idx_obj_c_container_kind_
5479
+ # @return [Symbol]
5480
+ # @scope class
5481
+ enum :idx_obj_c_container_kind, [
5482
+ :forward_ref, 0,
5483
+ :interface, 1,
5484
+ :implementation, 2
5485
+ ]
5486
+
5487
+ # (Not documented)
5488
+ #
5489
+ # = Fields:
5490
+ # :decl_info ::
5491
+ # (IdxDeclInfo)
5492
+ # :kind ::
5493
+ # (Symbol from _enum_idx_obj_c_container_kind_)
5494
+ class IdxObjCContainerDeclInfo < FFI::Struct
5495
+ layout :decl_info, IdxDeclInfo,
5496
+ :kind, :idx_obj_c_container_kind
5497
+ end
5498
+
5499
+ # (Not documented)
5500
+ #
5501
+ # = Fields:
5502
+ # :base ::
5503
+ # (IdxEntityInfo)
5504
+ # :cursor ::
5505
+ # (Cursor)
5506
+ # :loc ::
5507
+ # (IdxLoc)
5508
+ class IdxBaseClassInfo < FFI::Struct
5509
+ layout :base, IdxEntityInfo,
5510
+ :cursor, Cursor.by_value,
5511
+ :loc, IdxLoc.by_value
5512
+ end
5513
+
5514
+ # (Not documented)
5515
+ #
5516
+ # = Fields:
5517
+ # :protocol ::
5518
+ # (IdxEntityInfo)
5519
+ # :cursor ::
5520
+ # (Cursor)
5521
+ # :loc ::
5522
+ # (IdxLoc)
5523
+ class IdxObjCProtocolRefInfo < FFI::Struct
5524
+ layout :protocol, IdxEntityInfo,
5525
+ :cursor, Cursor.by_value,
5526
+ :loc, IdxLoc.by_value
5527
+ end
5528
+
5529
+ # (Not documented)
5530
+ #
5531
+ # = Fields:
5532
+ # :protocols ::
5533
+ # (FFI::Pointer(**IdxObjCProtocolRefInfo))
5534
+ # :num_protocols ::
5535
+ # (Integer)
5536
+ class IdxObjCProtocolRefListInfo < FFI::Struct
5537
+ layout :protocols, :pointer,
5538
+ :num_protocols, :uint
5539
+ end
5540
+
5541
+ # (Not documented)
5542
+ #
5543
+ # = Fields:
5544
+ # :container_info ::
5545
+ # (IdxObjCContainerDeclInfo)
5546
+ # :super_info ::
5547
+ # (IdxBaseClassInfo)
5548
+ # :protocols ::
5549
+ # (IdxObjCProtocolRefListInfo)
5550
+ class IdxObjCInterfaceDeclInfo < FFI::Struct
5551
+ layout :container_info, IdxObjCContainerDeclInfo,
5552
+ :super_info, IdxBaseClassInfo,
5553
+ :protocols, IdxObjCProtocolRefListInfo
5554
+ end
5555
+
5556
+ # (Not documented)
5557
+ #
5558
+ # = Fields:
5559
+ # :container_info ::
5560
+ # (IdxObjCContainerDeclInfo)
5561
+ # :objc_class ::
5562
+ # (IdxEntityInfo)
5563
+ # :class_cursor ::
5564
+ # (Cursor)
5565
+ # :class_loc ::
5566
+ # (IdxLoc)
5567
+ # :protocols ::
5568
+ # (IdxObjCProtocolRefListInfo)
5569
+ class IdxObjCCategoryDeclInfo < FFI::Struct
5570
+ layout :container_info, IdxObjCContainerDeclInfo,
5571
+ :objc_class, IdxEntityInfo,
5572
+ :class_cursor, Cursor.by_value,
5573
+ :class_loc, IdxLoc.by_value,
5574
+ :protocols, IdxObjCProtocolRefListInfo
5575
+ end
5576
+
5577
+ # (Not documented)
5578
+ #
5579
+ # = Fields:
5580
+ # :decl_info ::
5581
+ # (IdxDeclInfo)
5582
+ # :getter ::
5583
+ # (IdxEntityInfo)
5584
+ # :setter ::
5585
+ # (IdxEntityInfo)
5586
+ class IdxObjCPropertyDeclInfo < FFI::Struct
5587
+ layout :decl_info, IdxDeclInfo,
5588
+ :getter, IdxEntityInfo,
5589
+ :setter, IdxEntityInfo
5590
+ end
5591
+
5592
+ # (Not documented)
5593
+ #
5594
+ # = Fields:
5595
+ # :decl_info ::
5596
+ # (IdxDeclInfo)
5597
+ # :bases ::
5598
+ # (FFI::Pointer(**IdxBaseClassInfo))
5599
+ # :num_bases ::
5600
+ # (Integer)
5601
+ class IdxCXXClassDeclInfo < FFI::Struct
5602
+ layout :decl_info, IdxDeclInfo,
5603
+ :bases, :pointer,
5604
+ :num_bases, :uint
5605
+ end
5606
+
5607
+ # Data for IndexerCallbacks#indexEntityReference.
5608
+ #
5609
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:idx_entity_ref_kind).</em>
5610
+ #
5611
+ # === Options:
5612
+ # :direct ::
5613
+ # The entity is referenced directly in user's code.
5614
+ # :implicit ::
5615
+ # An implicit reference, e.g. a reference of an Objective-C method
5616
+ # via the dot syntax.
5617
+ #
5618
+ # @method _enum_idx_entity_ref_kind_
5619
+ # @return [Symbol]
5620
+ # @scope class
5621
+ enum :idx_entity_ref_kind, [
5622
+ :direct, 1,
5623
+ :implicit, 2
5624
+ ]
5625
+
5626
+ # Data for IndexerCallbacks#indexEntityReference.
5627
+ #
5628
+ # = Fields:
5629
+ # :kind ::
5630
+ # (Symbol from _enum_idx_entity_ref_kind_)
5631
+ # :cursor ::
5632
+ # (Cursor) Reference cursor.
5633
+ # :loc ::
5634
+ # (IdxLoc)
5635
+ # :referenced_entity ::
5636
+ # (IdxEntityInfo) The entity that gets referenced.
5637
+ # :parent_entity ::
5638
+ # (IdxEntityInfo) Immediate "parent" of the reference. For example:
5639
+ #
5640
+ # \code
5641
+ # Foo *var;
5642
+ # \endcode
5643
+ #
5644
+ # The parent of reference of type 'Foo' is the variable 'var'.
5645
+ # For references inside statement bodies of functions/methods,
5646
+ # the parentEntity will be the function/method.
5647
+ # :container ::
5648
+ # (IdxContainerInfo) Lexical container context of the reference.
5649
+ class IdxEntityRefInfo < FFI::Struct
5650
+ layout :kind, :idx_entity_ref_kind,
5651
+ :cursor, Cursor.by_value,
5652
+ :loc, IdxLoc.by_value,
5653
+ :referenced_entity, IdxEntityInfo,
5654
+ :parent_entity, IdxEntityInfo,
5655
+ :container, IdxContainerInfo
5656
+ end
5657
+
5658
+ # A group of callbacks used by #clang_indexSourceFile and
5659
+ # #clang_indexTranslationUnit.
5660
+ #
5661
+ # = Fields:
5662
+ # :abort_query ::
5663
+ # (FFI::Pointer(*)) Called periodically to check whether indexing should be aborted.
5664
+ # Should return 0 to continue, and non-zero to abort.
5665
+ # :diagnostic ::
5666
+ # (FFI::Pointer(*)) Called at the end of indexing; passes the complete diagnostic set.
5667
+ # :entered_main_file ::
5668
+ # (FFI::Pointer(*))
5669
+ # :pp_included_file ::
5670
+ # (FFI::Pointer(*)) Called when a file gets \#included/\#imported.
5671
+ # :imported_ast_file ::
5672
+ # (FFI::Pointer(*)) Called when a AST file (PCH or module) gets imported.
5673
+ #
5674
+ # AST files will not get indexed (there will not be callbacks to index all
5675
+ # the entities in an AST file). The recommended action is that, if the AST
5676
+ # file is not already indexed, to initiate a new indexing job specific to
5677
+ # the AST file.
5678
+ # :started_translation_unit ::
5679
+ # (FFI::Pointer(*)) Called at the beginning of indexing a translation unit.
5680
+ # :index_declaration ::
5681
+ # (FFI::Pointer(*))
5682
+ # :index_entity_reference ::
5683
+ # (FFI::Pointer(*)) Called to index a reference of an entity.
5684
+ class IndexerCallbacks < FFI::Struct
5685
+ layout :abort_query, :pointer,
5686
+ :diagnostic, :pointer,
5687
+ :entered_main_file, :pointer,
5688
+ :pp_included_file, :pointer,
5689
+ :imported_ast_file, :pointer,
5690
+ :started_translation_unit, :pointer,
5691
+ :index_declaration, :pointer,
5692
+ :index_entity_reference, :pointer
5693
+ end
5694
+
5695
+ # (Not documented)
5696
+ #
5697
+ # @method index_is_entity_obj_c_container_kind(idx_entity_kind)
5698
+ # @param [Symbol from _enum_idx_entity_kind_] idx_entity_kind
5699
+ # @return [Integer]
5700
+ # @scope class
5701
+ attach_function :index_is_entity_obj_c_container_kind, :clang_index_isEntityObjCContainerKind, [:idx_entity_kind], :int
5702
+
5703
+ # (Not documented)
5704
+ #
5705
+ # @method index_get_obj_c_container_decl_info(idx_decl_info)
5706
+ # @param [IdxDeclInfo] idx_decl_info
5707
+ # @return [IdxObjCContainerDeclInfo]
5708
+ # @scope class
5709
+ attach_function :index_get_obj_c_container_decl_info, :clang_index_getObjCContainerDeclInfo, [IdxDeclInfo], IdxObjCContainerDeclInfo
5710
+
5711
+ # (Not documented)
5712
+ #
5713
+ # @method index_get_obj_c_interface_decl_info(idx_decl_info)
5714
+ # @param [IdxDeclInfo] idx_decl_info
5715
+ # @return [IdxObjCInterfaceDeclInfo]
5716
+ # @scope class
5717
+ attach_function :index_get_obj_c_interface_decl_info, :clang_index_getObjCInterfaceDeclInfo, [IdxDeclInfo], IdxObjCInterfaceDeclInfo
5718
+
5719
+ # (Not documented)
5720
+ #
5721
+ # @method index_get_obj_c_category_decl_info(idx_decl_info)
5722
+ # @param [IdxDeclInfo] idx_decl_info
5723
+ # @return [IdxObjCCategoryDeclInfo]
5724
+ # @scope class
5725
+ attach_function :index_get_obj_c_category_decl_info, :clang_index_getObjCCategoryDeclInfo, [IdxDeclInfo], IdxObjCCategoryDeclInfo
5726
+
5727
+ # (Not documented)
5728
+ #
5729
+ # @method index_get_obj_c_protocol_ref_list_info(idx_decl_info)
5730
+ # @param [IdxDeclInfo] idx_decl_info
5731
+ # @return [IdxObjCProtocolRefListInfo]
5732
+ # @scope class
5733
+ attach_function :index_get_obj_c_protocol_ref_list_info, :clang_index_getObjCProtocolRefListInfo, [IdxDeclInfo], IdxObjCProtocolRefListInfo
5734
+
5735
+ # (Not documented)
5736
+ #
5737
+ # @method index_get_obj_c_property_decl_info(idx_decl_info)
5738
+ # @param [IdxDeclInfo] idx_decl_info
5739
+ # @return [IdxObjCPropertyDeclInfo]
5740
+ # @scope class
5741
+ attach_function :index_get_obj_c_property_decl_info, :clang_index_getObjCPropertyDeclInfo, [IdxDeclInfo], IdxObjCPropertyDeclInfo
5742
+
5743
+ # (Not documented)
5744
+ #
5745
+ # @method index_get_ib_outlet_collection_attr_info(idx_attr_info)
5746
+ # @param [IdxAttrInfo] idx_attr_info
5747
+ # @return [IdxIBOutletCollectionAttrInfo]
5748
+ # @scope class
5749
+ attach_function :index_get_ib_outlet_collection_attr_info, :clang_index_getIBOutletCollectionAttrInfo, [IdxAttrInfo], IdxIBOutletCollectionAttrInfo
5750
+
5751
+ # (Not documented)
5752
+ #
5753
+ # @method index_get_cxx_class_decl_info(idx_decl_info)
5754
+ # @param [IdxDeclInfo] idx_decl_info
5755
+ # @return [IdxCXXClassDeclInfo]
5756
+ # @scope class
5757
+ attach_function :index_get_cxx_class_decl_info, :clang_index_getCXXClassDeclInfo, [IdxDeclInfo], IdxCXXClassDeclInfo
5758
+
5759
+ # For retrieving a custom CXIdxClientContainer attached to a
5760
+ # container.
5761
+ #
5762
+ # @method index_get_client_container(idx_container_info)
5763
+ # @param [IdxContainerInfo] idx_container_info
5764
+ # @return [FFI::Pointer(IdxClientContainer)]
5765
+ # @scope class
5766
+ attach_function :index_get_client_container, :clang_index_getClientContainer, [IdxContainerInfo], :pointer
5767
+
5768
+ # For setting a custom CXIdxClientContainer attached to a
5769
+ # container.
5770
+ #
5771
+ # @method index_set_client_container(idx_container_info, idx_client_container)
5772
+ # @param [IdxContainerInfo] idx_container_info
5773
+ # @param [FFI::Pointer(IdxClientContainer)] idx_client_container
5774
+ # @return [nil]
5775
+ # @scope class
5776
+ attach_function :index_set_client_container, :clang_index_setClientContainer, [IdxContainerInfo, :pointer], :void
5777
+
5778
+ # For retrieving a custom CXIdxClientEntity attached to an entity.
5779
+ #
5780
+ # @method index_get_client_entity(idx_entity_info)
5781
+ # @param [IdxEntityInfo] idx_entity_info
5782
+ # @return [FFI::Pointer(IdxClientEntity)]
5783
+ # @scope class
5784
+ attach_function :index_get_client_entity, :clang_index_getClientEntity, [IdxEntityInfo], :pointer
5785
+
5786
+ # For setting a custom CXIdxClientEntity attached to an entity.
5787
+ #
5788
+ # @method index_set_client_entity(idx_entity_info, idx_client_entity)
5789
+ # @param [IdxEntityInfo] idx_entity_info
5790
+ # @param [FFI::Pointer(IdxClientEntity)] idx_client_entity
5791
+ # @return [nil]
5792
+ # @scope class
5793
+ attach_function :index_set_client_entity, :clang_index_setClientEntity, [IdxEntityInfo, :pointer], :void
5794
+
5795
+ # An indexing action/session, to be applied to one or multiple
5796
+ # translation units.
5797
+ #
5798
+ # @method index_action_create(c_idx)
5799
+ # @param [FFI::Pointer(Index)] c_idx The index object with which the index action will be associated.
5800
+ # @return [FFI::Pointer(IndexAction)]
5801
+ # @scope class
5802
+ attach_function :index_action_create, :clang_IndexAction_create, [:pointer], :pointer
5803
+
5804
+ # Destroy the given index action.
5805
+ #
5806
+ # The index action must not be destroyed until all of the translation units
5807
+ # created within that index action have been destroyed.
5808
+ #
5809
+ # @method index_action_dispose(index_action)
5810
+ # @param [FFI::Pointer(IndexAction)] index_action
3706
5811
  # @return [nil]
3707
5812
  # @scope class
3708
- attach_function :find_references_in_file, :clang_findReferencesInFile, [Cursor.by_value, :pointer, CursorAndRangeVisitor.by_value], :void
5813
+ attach_function :index_action_dispose, :clang_IndexAction_dispose, [:pointer], :void
5814
+
5815
+ # (Not documented)
5816
+ #
5817
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:index_opt_flags).</em>
5818
+ #
5819
+ # === Options:
5820
+ # :none ::
5821
+ # Used to indicate that no special indexing options are needed.
5822
+ # :suppress_redundant_refs ::
5823
+ # Used to indicate that IndexerCallbacks#indexEntityReference should
5824
+ # be invoked for only one reference of an entity per source file that does
5825
+ # not also include a declaration/definition of the entity.
5826
+ # :index_function_local_symbols ::
5827
+ # Function-local symbols should be indexed. If this is not set
5828
+ # function-local symbols will be ignored.
5829
+ # :index_implicit_template_instantiations ::
5830
+ # Implicit function/class template instantiations should be indexed.
5831
+ # If this is not set, implicit instantiations will be ignored.
5832
+ # :suppress_warnings ::
5833
+ # Suppress all compiler warnings when parsing for indexing.
5834
+ # :skip_parsed_bodies_in_session ::
5835
+ # Skip a function/method body that was already parsed during an
5836
+ # indexing session associated with a \c CXIndexAction object.
5837
+ # Bodies in system headers are always skipped.
5838
+ #
5839
+ # @method _enum_index_opt_flags_
5840
+ # @return [Symbol]
5841
+ # @scope class
5842
+ enum :index_opt_flags, [
5843
+ :none, 0,
5844
+ :suppress_redundant_refs, 1,
5845
+ :index_function_local_symbols, 2,
5846
+ :index_implicit_template_instantiations, 4,
5847
+ :suppress_warnings, 8,
5848
+ :skip_parsed_bodies_in_session, 16
5849
+ ]
5850
+
5851
+ # Index the given source file and the translation unit corresponding
5852
+ # to that file via callbacks implemented through #IndexerCallbacks.
5853
+ #
5854
+ # @method index_source_file(index_action, client_data, index_callbacks, index_callbacks_size, index_options, source_filename, command_line_args, num_command_line_args, unsaved_files, num_unsaved_files, out_tu, tu_options)
5855
+ # @param [FFI::Pointer(IndexAction)] index_action
5856
+ # @param [FFI::Pointer(ClientData)] client_data pointer data supplied by the client, which will
5857
+ # be passed to the invoked callbacks.
5858
+ # @param [IndexerCallbacks] index_callbacks Pointer to indexing callbacks that the client
5859
+ # implements.
5860
+ # @param [Integer] index_callbacks_size Size of #IndexerCallbacks structure that gets
5861
+ # passed in index_callbacks.
5862
+ # @param [Integer] index_options A bitmask of options that affects how indexing is
5863
+ # performed. This should be a bitwise OR of the CXIndexOpt_XXX flags.
5864
+ #
5865
+ # \param(out) out_TU pointer to store a \c CXTranslationUnit that can be
5866
+ # reused after indexing is finished. Set to \c NULL if you do not require it.
5867
+ # @param [String] source_filename
5868
+ # @param [FFI::Pointer(**CharS)] command_line_args
5869
+ # @param [Integer] num_command_line_args
5870
+ # @param [UnsavedFile] unsaved_files
5871
+ # @param [Integer] num_unsaved_files
5872
+ # @param [FFI::Pointer(*TranslationUnit)] out_tu
5873
+ # @param [Integer] tu_options
5874
+ # @return [Integer] 0 on success or if there were errors from which the compiler could
5875
+ # recover. If there is a failure from which the there is no recovery, returns
5876
+ # a non-zero \c CXErrorCode.
5877
+ #
5878
+ # The rest of the parameters are the same as #clang_parseTranslationUnit.
5879
+ # @scope class
5880
+ attach_function :index_source_file, :clang_indexSourceFile, [:pointer, :pointer, IndexerCallbacks, :uint, :uint, :string, :pointer, :int, UnsavedFile, :uint, :pointer, :uint], :int
5881
+
5882
+ # Index the given translation unit via callbacks implemented through
5883
+ # #IndexerCallbacks.
5884
+ #
5885
+ # The order of callback invocations is not guaranteed to be the same as
5886
+ # when indexing a source file. The high level order will be:
5887
+ #
5888
+ # -Preprocessor callbacks invocations
5889
+ # -Declaration/reference callbacks invocations
5890
+ # -Diagnostic callback invocations
5891
+ #
5892
+ # The parameters are the same as #clang_indexSourceFile.
5893
+ #
5894
+ # @method index_translation_unit(index_action, client_data, index_callbacks, index_callbacks_size, index_options, translation_unit_impl)
5895
+ # @param [FFI::Pointer(IndexAction)] index_action
5896
+ # @param [FFI::Pointer(ClientData)] client_data
5897
+ # @param [IndexerCallbacks] index_callbacks
5898
+ # @param [Integer] index_callbacks_size
5899
+ # @param [Integer] index_options
5900
+ # @param [TranslationUnitImpl] translation_unit_impl
5901
+ # @return [Integer] If there is a failure from which the there is no recovery, returns
5902
+ # non-zero, otherwise returns 0.
5903
+ # @scope class
5904
+ attach_function :index_translation_unit, :clang_indexTranslationUnit, [:pointer, :pointer, IndexerCallbacks, :uint, :uint, TranslationUnitImpl], :int
5905
+
5906
+ # Retrieve the CXIdxFile, file, line, column, and offset represented by
5907
+ # the given CXIdxLoc.
5908
+ #
5909
+ # If the location refers into a macro expansion, retrieves the
5910
+ # location of the macro expansion and if it refers into a macro argument
5911
+ # retrieves the location of the argument.
5912
+ #
5913
+ # @method index_loc_get_file_location(loc, index_file, file, line, column, offset)
5914
+ # @param [IdxLoc] loc
5915
+ # @param [FFI::Pointer(*IdxClientFile)] index_file
5916
+ # @param [FFI::Pointer(*File)] file
5917
+ # @param [FFI::Pointer(*UInt)] line
5918
+ # @param [FFI::Pointer(*UInt)] column
5919
+ # @param [FFI::Pointer(*UInt)] offset
5920
+ # @return [nil]
5921
+ # @scope class
5922
+ attach_function :index_loc_get_file_location, :clang_indexLoc_getFileLocation, [IdxLoc.by_value, :pointer, :pointer, :pointer, :pointer, :pointer], :void
5923
+
5924
+ # Retrieve the CXSourceLocation represented by the given CXIdxLoc.
5925
+ #
5926
+ # @method index_loc_get_cx_source_location(loc)
5927
+ # @param [IdxLoc] loc
5928
+ # @return [SourceLocation]
5929
+ # @scope class
5930
+ attach_function :index_loc_get_cx_source_location, :clang_indexLoc_getCXSourceLocation, [IdxLoc.by_value], SourceLocation.by_value
3709
5931
 
3710
5932
  end