ffi-clang 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/ext/rakefile.rb +2 -2
  4. data/lib/ffi/clang/clang_version.rb +7 -3
  5. data/lib/ffi/clang/code_completion.rb +121 -44
  6. data/lib/ffi/clang/comment.rb +164 -57
  7. data/lib/ffi/clang/compilation_database.rb +79 -25
  8. data/lib/ffi/clang/cursor.rb +395 -149
  9. data/lib/ffi/clang/diagnostic.rb +57 -23
  10. data/lib/ffi/clang/error.rb +12 -0
  11. data/lib/ffi/clang/file.rb +30 -11
  12. data/lib/ffi/clang/index.rb +37 -13
  13. data/lib/ffi/clang/lib/clang_version.rb +2 -2
  14. data/lib/ffi/clang/lib/code_completion.rb +15 -11
  15. data/lib/ffi/clang/lib/comment.rb +16 -14
  16. data/lib/ffi/clang/lib/compilation_database.rb +5 -5
  17. data/lib/ffi/clang/lib/cursor.rb +74 -56
  18. data/lib/ffi/clang/lib/diagnostic.rb +14 -14
  19. data/lib/ffi/clang/lib/file.rb +10 -6
  20. data/lib/ffi/clang/lib/inclusions.rb +3 -3
  21. data/lib/ffi/clang/lib/index.rb +7 -5
  22. data/lib/ffi/clang/lib/printing_policy.rb +36 -36
  23. data/lib/ffi/clang/lib/source_location.rb +9 -7
  24. data/lib/ffi/clang/lib/source_range.rb +5 -3
  25. data/lib/ffi/clang/lib/string.rb +9 -4
  26. data/lib/ffi/clang/lib/token.rb +17 -4
  27. data/lib/ffi/clang/lib/translation_unit.rb +17 -13
  28. data/lib/ffi/clang/lib/type.rb +19 -17
  29. data/lib/ffi/clang/lib.rb +35 -19
  30. data/lib/ffi/clang/platform.rb +25 -0
  31. data/lib/ffi/clang/printing_policy.rb +31 -18
  32. data/lib/ffi/clang/source_location.rb +119 -36
  33. data/lib/ffi/clang/source_range.rb +30 -12
  34. data/lib/ffi/clang/token.rb +48 -23
  35. data/lib/ffi/clang/translation_unit.rb +97 -33
  36. data/lib/ffi/clang/types/array.rb +15 -1
  37. data/lib/ffi/clang/types/elaborated.rb +19 -4
  38. data/lib/ffi/clang/types/function.rb +35 -10
  39. data/lib/ffi/clang/types/pointer.rb +23 -7
  40. data/lib/ffi/clang/types/record.rb +23 -8
  41. data/lib/ffi/clang/types/type.rb +80 -36
  42. data/lib/ffi/clang/types/type_def.rb +14 -2
  43. data/lib/ffi/clang/types/vector.rb +13 -1
  44. data/lib/ffi/clang/unsaved_file.rb +18 -8
  45. data/lib/ffi/clang/version.rb +4 -2
  46. data/lib/ffi/clang.rb +23 -45
  47. data/license.md +3 -2
  48. data/readme.md +12 -13
  49. data/releases.md +5 -0
  50. data.tar.gz.sig +0 -0
  51. metadata +10 -5
  52. metadata.gz.sig +0 -0
@@ -3,96 +3,130 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2010, by Jari Bakken.
5
5
  # Copyright, 2012, by Hal Brodigan.
6
- # Copyright, 2013-2024, by Samuel Williams.
6
+ # Copyright, 2013-2025, by Samuel Williams.
7
7
  # Copyright, 2013, by Garry Marshall.
8
8
  # Copyright, 2014, by Masahiro Sano.
9
9
  # Copyright, 2023, by Charlie Savage.
10
10
 
11
- require_relative 'lib/diagnostic'
12
- require_relative 'source_range'
11
+ require_relative "lib/diagnostic"
12
+ require_relative "source_range"
13
13
 
14
14
  module FFI
15
15
  module Clang
16
+ # Represents a diagnostic message from the compiler.
16
17
  class Diagnostic < AutoPointer
18
+ # Get the default diagnostic display options.
19
+ # @returns [Array(Symbol)] The default display options.
17
20
  def self.default_display_opts
18
21
  Lib.opts_from(Lib::DiagnosticDisplayOptions, Lib.default_diagnostic_display_options)
19
22
  end
20
-
23
+
24
+ # Initialize a diagnostic.
25
+ # @parameter translation_unit [TranslationUnit] The parent translation unit.
26
+ # @parameter pointer [FFI::Pointer] The diagnostic pointer.
21
27
  def initialize(translation_unit, pointer)
22
28
  super pointer
23
-
29
+
24
30
  @translation_unit = translation_unit
25
31
  end
26
-
32
+
33
+ # Release the diagnostic pointer.
34
+ # @parameter pointer [FFI::Pointer] The pointer to release.
27
35
  def self.release(pointer)
28
36
  Lib.dispose_diagnostic(pointer)
29
37
  end
30
-
38
+
39
+ # Format the diagnostic as a string.
40
+ # @parameter opts [Hash] Display options.
41
+ # @returns [String] The formatted diagnostic.
31
42
  def format(opts = {})
32
43
  cxstring = Lib.format_diagnostic(self, display_opts(opts))
33
44
  Lib.extract_string cxstring
34
45
  end
35
-
46
+
47
+ # Get the severity of the diagnostic.
48
+ # @returns [Symbol] The severity level.
36
49
  def severity
37
50
  Lib.get_diagnostic_severity self
38
51
  end
39
-
52
+
53
+ # Get the diagnostic message text.
54
+ # @returns [String] The diagnostic spelling.
40
55
  def spelling
41
56
  Lib.get_string Lib.get_diagnostic_spelling(self)
42
57
  end
43
-
58
+
59
+ # Get the source location of the diagnostic.
60
+ # @returns [ExpansionLocation] The diagnostic location.
44
61
  def location
45
62
  sl = Lib.get_diagnostic_location(self)
46
63
  ExpansionLocation.new sl
47
64
  end
48
-
65
+
66
+ # Get fix-it hints for the diagnostic.
67
+ # @returns [Array(Hash)] Array of fix-its with `:text` and `:range` keys.
49
68
  def fixits
50
69
  n = Lib.get_diagnostic_num_fix_its(self)
51
- n.times.map { |i|
52
- ptr = MemoryPointer.new Lib::CXSourceRange
70
+ n.times.map {|i|
71
+ ptr = MemoryPointer.new Lib::CXSourceRange
53
72
  replace_text = Lib.extract_string(Lib.get_diagnostic_fix_it(self, i, ptr))
54
73
  {text: replace_text, range: SourceRange.new(ptr)}
55
74
  }
56
75
  end
57
-
76
+
77
+ # Get the source ranges associated with the diagnostic.
78
+ # @returns [Array(SourceRange)] Array of source ranges.
58
79
  def ranges
59
80
  n = Lib.get_diagnostic_num_ranges(self)
60
81
 
61
82
  n.times.map {|i| SourceRange.new Lib.get_diagnostic_range(self, i)}
62
83
  end
63
-
84
+
85
+ # Get child diagnostics.
86
+ # @returns [Array(Diagnostic)] Array of child diagnostics.
64
87
  def children
65
88
  diagnostic_set = Lib.get_child_diagnostics(self)
66
89
  num_diagnostics = Lib.get_num_diagnostics_in_set(diagnostic_set)
67
- num_diagnostics.times.map { |i|
90
+ num_diagnostics.times.map {|i|
68
91
  Diagnostic.new(@translation_unit, Lib.get_diagnostic_in_set(diagnostic_set, i))
69
92
  }
70
93
  end
71
-
94
+
95
+ # Get the compiler option that enables this diagnostic.
96
+ # @returns [String] The enable option.
72
97
  def enable_option
73
98
  Lib.extract_string Lib.get_diagnostic_option(self, nil)
74
99
  end
75
-
100
+
101
+ # Get the compiler option that disables this diagnostic.
102
+ # @returns [String] The disable option.
76
103
  def disable_option
77
104
  ptr = MemoryPointer.new Lib::CXString
78
105
  Lib.get_diagnostic_option(self, ptr)
79
106
  Lib.extract_string ptr
80
107
  end
81
-
108
+
109
+ # Get the category text for the diagnostic.
110
+ # @returns [String] The category text.
82
111
  def category
83
112
  Lib.extract_string Lib.get_diagnostic_category_text(self)
84
113
  end
85
-
114
+
115
+ # Get the category ID for the diagnostic.
116
+ # @returns [Integer] The category ID.
86
117
  def category_id
87
118
  Lib.get_diagnostic_category(self)
88
119
  end
89
-
120
+
121
+ # Get a string representation of the diagnostic.
122
+ # @returns [String] The diagnostic string.
90
123
  def inspect
91
124
  "#{self.location}: #{self.format}"
92
125
  end
93
-
126
+
94
127
  private
95
-
128
+
129
+ # @private
96
130
  def display_opts(opts)
97
131
  if opts.empty?
98
132
  Lib.default_diagnostic_display_options
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2025, by Samuel Williams.
5
+
6
+ module FFI
7
+ module Clang
8
+ # Represents an error that occurred during libclang operations.
9
+ class Error < StandardError
10
+ end
11
+ end
12
+ end
@@ -2,48 +2,67 @@
2
2
 
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2014, by Masahiro Sano.
5
- # Copyright, 2014-2022, by Samuel Williams.
5
+ # Copyright, 2014-2025, by Samuel Williams.
6
6
 
7
- require_relative 'lib/file'
7
+ require_relative "lib/file"
8
8
 
9
9
  module FFI
10
10
  module Clang
11
+ # Represents a file in a translation unit.
11
12
  class File < Pointer
13
+ # @attribute [TranslationUnit] The translation unit this file belongs to.
12
14
  attr_reader :translation_unit
13
-
15
+
16
+ # Initialize a file with a pointer and translation unit.
17
+ # @parameter pointer [FFI::Pointer] The file pointer.
18
+ # @parameter translation_unit [TranslationUnit] The parent translation unit.
14
19
  def initialize(pointer, translation_unit)
15
20
  super pointer
16
21
  @translation_unit = translation_unit
17
-
22
+
18
23
  pointer = MemoryPointer.new(Lib::CXFileUniqueID)
19
24
  Lib.get_file_unique_id(self, pointer)
20
25
  @unique_id = Lib::CXFileUniqueID.new(pointer)
21
26
  end
22
-
27
+
28
+ # Get the file name as a string.
29
+ # @returns [String] The file name.
23
30
  def to_s
24
31
  name
25
32
  end
26
-
33
+
34
+ # Get the file name.
35
+ # @returns [String] The file name.
27
36
  def name
28
37
  Lib.extract_string Lib.get_file_name(self)
29
38
  end
30
-
39
+
40
+ # Get the file modification time.
41
+ # @returns [Time] The file modification time.
31
42
  def time
32
43
  Time.at(Lib.get_file_time(self))
33
44
  end
34
-
45
+
46
+ # Check if the file has include guards.
47
+ # @returns [Boolean] True if the file is include guarded.
35
48
  def include_guarded?
36
49
  Lib.is_file_multiple_include_guarded(@translation_unit, self) != 0
37
50
  end
38
-
51
+
52
+ # Get the device ID of the file.
53
+ # @returns [Integer] The device ID.
39
54
  def device
40
55
  @unique_id[:device]
41
56
  end
42
-
57
+
58
+ # Get the inode number of the file.
59
+ # @returns [Integer] The inode number.
43
60
  def inode
44
61
  @unique_id[:inode]
45
62
  end
46
-
63
+
64
+ # Get the modification time from the unique ID.
65
+ # @returns [Time] The modification time.
47
66
  def modification
48
67
  Time.at(@unique_id[:modification])
49
68
  end
@@ -3,62 +3,86 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2010, by Jari Bakken.
5
5
  # Copyright, 2012, by Hal Brodigan.
6
- # Copyright, 2013-2024, by Samuel Williams.
6
+ # Copyright, 2013-2025, by Samuel Williams.
7
7
  # Copyright, 2013, by Carlos Martín Nieto.
8
8
  # Copyright, 2013, by Dave Wilkinson.
9
9
  # Copyright, 2013, by Takeshi Watanabe.
10
10
  # Copyright, 2014, by Masahiro Sano.
11
11
  # Copyright, 2023, by Charlie Savage.
12
12
 
13
- require_relative 'lib/index'
13
+ require_relative "lib/index"
14
+ require_relative "error"
14
15
 
15
16
  module FFI
16
17
  module Clang
18
+ # Represents a libclang index that manages translation units and provides a top-level context for parsing.
17
19
  class Index < AutoPointer
20
+ # Initialize a new index for managing translation units.
21
+ # @parameter exclude_declarations [Boolean] Whether to exclude declarations from PCH.
22
+ # @parameter display_diagnostics [Boolean] Whether to display diagnostics during parsing.
18
23
  def initialize(exclude_declarations = true, display_diagnostics = false)
19
24
  super Lib.create_index(exclude_declarations ? 1 : 0, display_diagnostics ? 1 : 0)
20
25
  end
21
-
26
+
27
+ # Release the index pointer.
28
+ # @parameter pointer [FFI::Pointer] The index pointer to release.
22
29
  def self.release(pointer)
23
30
  Lib.dispose_index(pointer)
24
31
  end
25
-
32
+
33
+ # Parse a source file and create a translation unit.
34
+ # @parameter source_file [String] The path to the source file to parse.
35
+ # @parameter command_line_args [Array(String) | String | Nil] Compiler arguments for parsing.
36
+ # @parameter unsaved [Array(UnsavedFile)] Unsaved file buffers.
37
+ # @parameter opts [Hash] Parsing options as a hash of flags.
38
+ # @returns [TranslationUnit] The parsed translation unit.
39
+ # @raises [Error] If parsing fails.
26
40
  def parse_translation_unit(source_file, command_line_args = nil, unsaved = [], opts = {})
27
41
  command_line_args = Array(command_line_args)
28
42
  unsaved_files = UnsavedFile.unsaved_pointer_from(unsaved)
29
-
43
+
30
44
  translation_unit_pointer_out = FFI::MemoryPointer.new(:pointer)
31
-
45
+
32
46
  error_code = Lib.parse_translation_unit2(self, source_file, args_pointer_from(command_line_args), command_line_args.size, unsaved_files, unsaved.length, options_bitmask_from(opts), translation_unit_pointer_out)
33
47
  if error_code != :cx_error_success
34
48
  error_name = Lib::ErrorCodes.from_native(error_code, nil)
35
49
  message = "Error parsing file. Code: #{error_name}. File: #{source_file.inspect}"
36
50
  raise(Error, message)
37
51
  end
38
-
52
+
39
53
  translation_unit_pointer = translation_unit_pointer_out.read_pointer
40
54
  TranslationUnit.new translation_unit_pointer, self
41
55
  end
42
-
56
+
57
+ # Create a translation unit from a precompiled AST file.
58
+ # @parameter ast_filename [String] The path to the AST file.
59
+ # @returns [TranslationUnit] The loaded translation unit.
60
+ # @raises [Error] If loading the AST file fails.
43
61
  def create_translation_unit(ast_filename)
44
62
  translation_unit_pointer = Lib.create_translation_unit(self, ast_filename)
45
63
  raise Error, "error parsing #{ast_filename.inspect}" if translation_unit_pointer.null?
46
64
  TranslationUnit.new translation_unit_pointer, self
47
65
  end
48
-
66
+
49
67
  private
50
-
68
+
69
+ # Convert command line arguments to a pointer array for libclang.
70
+ # @parameter command_line_args [Array(String)] The command line arguments.
71
+ # @returns [FFI::MemoryPointer] A pointer to the arguments array.
51
72
  def args_pointer_from(command_line_args)
52
73
  args_pointer = MemoryPointer.new(:pointer, command_line_args.length)
53
-
74
+
54
75
  strings = command_line_args.map do |arg|
55
76
  MemoryPointer.from_string(arg.to_s)
56
77
  end
57
-
78
+
58
79
  args_pointer.put_array_of_pointer(0, strings) unless strings.empty?
59
80
  args_pointer
60
81
  end
61
-
82
+
83
+ # Convert options hash to a bitmask for libclang.
84
+ # @parameter opts [Hash] The options hash.
85
+ # @returns [Integer] The bitmask representing the options.
62
86
  def options_bitmask_from(opts)
63
87
  Lib.bitmask_from(Lib::TranslationUnitFlags, opts)
64
88
  end
@@ -2,9 +2,9 @@
2
2
 
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2014, by Masahiro Sano.
5
- # Copyright, 2014-2022, by Samuel Williams.
5
+ # Copyright, 2014-2025, by Samuel Williams.
6
6
 
7
- require_relative 'string'
7
+ require_relative "string"
8
8
 
9
9
  module FFI
10
10
  module Clang
@@ -2,31 +2,35 @@
2
2
 
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2014, by Masahiro Sano.
5
- # Copyright, 2014-2022, by Samuel Williams.
5
+ # Copyright, 2014-2025, by Samuel Williams.
6
6
  # Copyright, 2024, by Charlie Savage.
7
7
 
8
- require_relative 'cursor'
9
- require_relative 'diagnostic'
8
+ require_relative "cursor"
9
+ require_relative "diagnostic"
10
10
 
11
11
  module FFI
12
12
  module Clang
13
13
  module Lib
14
14
  typedef :pointer, :CXCompletionString
15
-
15
+
16
+ # FFI struct representing a single code completion result from libclang.
17
+ # @private
16
18
  class CXCompletionResult < FFI::Struct
17
19
  layout(
18
20
  :kind, :cursor_kind,
19
21
  :string, :CXCompletionString,
20
22
  )
21
23
  end
22
-
24
+
25
+ # FFI struct representing the results of code completion from libclang.
26
+ # @private
23
27
  class CXCodeCompleteResults < FFI::Struct
24
28
  layout(
25
29
  :results, :pointer,
26
30
  :num, :uint,
27
31
  )
28
32
  end
29
-
33
+
30
34
  enum :completion_chunk_kind, [
31
35
  :optional,
32
36
  :typed_text,
@@ -50,13 +54,13 @@ module FFI
50
54
  :horizontal_space,
51
55
  :vertical_space
52
56
  ]
53
-
57
+
54
58
  CodeCompleteFlags = enum :code_complete_flags, [
55
59
  :include_macros, 0x01,
56
60
  :include_code_patterns, 0x02,
57
61
  :include_brief_comments, 0x04
58
62
  ]
59
-
63
+
60
64
  CompletionContext = enum :completion_context, [
61
65
  :unexposed, 0,
62
66
  :any_type, 1 << 0,
@@ -83,7 +87,7 @@ module FFI
83
87
  :natural_language, 1 << 21,
84
88
  :unknown, ((1 << 22) - 1),
85
89
  ]
86
-
90
+
87
91
  # CXCompletionString functions
88
92
  attach_function :get_completion_chunk_kind, :clang_getCompletionChunkKind, [:CXCompletionString, :uint], :completion_chunk_kind
89
93
  attach_function :get_completion_text, :clang_getCompletionChunkText, [:CXCompletionString, :uint], CXString.by_value
@@ -95,7 +99,7 @@ module FFI
95
99
  attach_function :get_completion_annotation, :clang_getCompletionAnnotation, [:CXCompletionString, :uint], CXString.by_value
96
100
  attach_function :get_completion_parent, :clang_getCompletionParent, [:CXCompletionString, :pointer], CXString.by_value
97
101
  attach_function :get_completion_brief_comment, :clang_getCompletionBriefComment, [:CXCompletionString], CXString.by_value
98
-
102
+
99
103
  # CXCodeCompleteResults functions
100
104
  attach_function :get_code_complete_get_num_diagnostics, :clang_codeCompleteGetNumDiagnostics, [CXCodeCompleteResults.by_ref], :uint
101
105
  attach_function :get_code_complete_get_diagnostic, :clang_codeCompleteGetDiagnostic, [CXCodeCompleteResults.by_ref, :uint], :CXDiagnostic
@@ -103,7 +107,7 @@ module FFI
103
107
  attach_function :get_code_complete_get_container_kind, :clang_codeCompleteGetContainerKind, [CXCodeCompleteResults.by_ref, :pointer], :cursor_kind
104
108
  attach_function :get_code_complete_get_container_usr, :clang_codeCompleteGetContainerUSR, [CXCodeCompleteResults.by_ref], CXString.by_value
105
109
  attach_function :get_code_complete_get_objc_selector, :clang_codeCompleteGetObjCSelector, [CXCodeCompleteResults.by_ref], CXString.by_value
106
-
110
+
107
111
  # Other functions
108
112
  attach_function :code_complete_at, :clang_codeCompleteAt, [:CXTranslationUnit, :string, :uint, :uint, :pointer, :uint, :uint], CXCodeCompleteResults.by_ref
109
113
  attach_function :dispose_code_complete_results, :clang_disposeCodeCompleteResults, [CXCodeCompleteResults.by_ref], :void
@@ -2,20 +2,22 @@
2
2
 
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2013, by Carlos Martín Nieto.
5
- # Copyright, 2013-2022, by Samuel Williams.
5
+ # Copyright, 2013-2025, by Samuel Williams.
6
6
  # Copyright, 2014, by George Pimm.
7
7
  # Copyright, 2014, by Masahiro Sano.
8
8
 
9
9
  module FFI
10
10
  module Clang
11
11
  module Lib
12
+ # FFI struct representing a comment in the libclang AST.
13
+ # @private
12
14
  class CXComment < FFI::Struct
13
15
  layout(
14
16
  :ast_node, :pointer,
15
17
  :translation_unit, :pointer
16
18
  )
17
19
  end
18
-
20
+
19
21
  enum :kind, [
20
22
  :comment_null, 0,
21
23
  :comment_text, 1,
@@ -31,36 +33,36 @@ module FFI
31
33
  :comment_verbatim_line, 11,
32
34
  :comment_full, 12,
33
35
  ]
34
-
36
+
35
37
  enum :render_kind, [
36
38
  :normal,
37
39
  :bold,
38
40
  :monospaced,
39
41
  :emphasized
40
42
  ]
41
-
43
+
42
44
  enum :pass_direction, [
43
45
  :pass_direction_in, 0,
44
46
  :pass_direction_out, 1,
45
47
  :pass_direction_inout, 2
46
48
  ]
47
-
49
+
48
50
  # common functions
49
51
  attach_function :comment_get_kind, :clang_Comment_getKind, [CXComment.by_value], :kind
50
52
  attach_function :comment_get_num_children, :clang_Comment_getNumChildren, [CXComment.by_value], :uint
51
53
  attach_function :comment_get_child, :clang_Comment_getChild, [CXComment.by_value, :uint], CXComment.by_value
52
54
  attach_function :comment_is_whitespace, :clang_Comment_isWhitespace, [CXComment.by_value], :uint
53
-
55
+
54
56
  # TextComment functions
55
57
  attach_function :text_comment_get_text, :clang_TextComment_getText, [CXComment.by_value], CXString.by_value
56
-
58
+
57
59
  # InlineCommandComment functions
58
60
  attach_function :inline_command_comment_get_command_name, :clang_InlineCommandComment_getCommandName, [CXComment.by_value], CXString.by_value
59
61
  attach_function :inline_command_comment_get_num_args, :clang_InlineCommandComment_getNumArgs, [CXComment.by_value], :uint
60
62
  attach_function :inline_content_comment_has_trailing_newline, :clang_InlineContentComment_hasTrailingNewline, [CXComment.by_value], :uint
61
63
  attach_function :inline_command_comment_get_render_kind, :clang_InlineCommandComment_getRenderKind, [CXComment.by_value], :render_kind
62
64
  attach_function :inline_command_comment_get_arg_text, :clang_InlineCommandComment_getArgText, [CXComment.by_value, :uint], CXString.by_value
63
-
65
+
64
66
  # HTMLTagComment functions
65
67
  attach_function :html_tag_comment_get_as_string, :clang_HTMLTagComment_getAsString, [CXComment.by_value], CXString.by_value
66
68
  attach_function :html_tag_comment_get_tag_name, :clang_HTMLTagComment_getTagName, [CXComment.by_value], CXString.by_value
@@ -68,32 +70,32 @@ module FFI
68
70
  attach_function :html_start_tag_comment_get_num_attrs, :clang_HTMLStartTag_getNumAttrs, [CXComment.by_value], :uint
69
71
  attach_function :html_start_tag_comment_get_attr_name, :clang_HTMLStartTag_getAttrName, [CXComment.by_value, :uint], CXString.by_value
70
72
  attach_function :html_start_tag_comment_get_attr_value, :clang_HTMLStartTag_getAttrValue,[CXComment.by_value, :uint], CXString.by_value
71
-
73
+
72
74
  # ParamCommandComment functions
73
75
  attach_function :param_command_comment_is_direction_explicit, :clang_ParamCommandComment_isDirectionExplicit, [CXComment.by_value], :uint
74
76
  attach_function :param_command_comment_get_direction, :clang_ParamCommandComment_getDirection, [CXComment.by_value], :pass_direction
75
77
  attach_function :param_command_comment_get_param_name, :clang_ParamCommandComment_getParamName, [CXComment.by_value], CXString.by_value
76
78
  attach_function :param_command_comment_is_param_index_valid, :clang_ParamCommandComment_isParamIndexValid, [CXComment.by_value], :uint
77
79
  attach_function :param_command_comment_get_param_index, :clang_ParamCommandComment_getParamIndex, [CXComment.by_value], :uint
78
-
80
+
79
81
  # TParamCommandComment functions
80
82
  attach_function :tparam_command_comment_get_param_name, :clang_TParamCommandComment_getParamName, [CXComment.by_value], CXString.by_value
81
83
  attach_function :tparam_command_comment_is_param_position_valid, :clang_TParamCommandComment_isParamPositionValid, [CXComment.by_value], :uint
82
84
  attach_function :tparam_command_comment_get_depth, :clang_TParamCommandComment_getDepth, [CXComment.by_value], :uint
83
85
  attach_function :tparam_command_comment_get_index, :clang_TParamCommandComment_getIndex, [CXComment.by_value, :uint], :uint
84
-
86
+
85
87
  # BlockCommandComment functions
86
88
  attach_function :block_command_comment_get_paragraph, :clang_BlockCommandComment_getParagraph, [CXComment.by_value], CXComment.by_value
87
89
  attach_function :block_command_comment_get_command_name, :clang_BlockCommandComment_getCommandName, [CXComment.by_value], CXString.by_value
88
90
  attach_function :block_command_comment_get_num_args, :clang_BlockCommandComment_getNumArgs, [CXComment.by_value], :uint
89
91
  attach_function :block_command_comment_get_arg_text, :clang_BlockCommandComment_getArgText, [CXComment.by_value, :uint], CXString.by_value
90
-
92
+
91
93
  # VerbatimBlockLineComment functions
92
94
  attach_function :verbatim_block_line_comment_get_text, :clang_VerbatimBlockLineComment_getText, [CXComment.by_value], CXString.by_value
93
-
95
+
94
96
  # VerbatimLineComment functions
95
97
  attach_function :verbatim_line_comment_get_text, :clang_VerbatimLineComment_getText, [CXComment.by_value], CXString.by_value
96
-
98
+
97
99
  # FullComment functions
98
100
  attach_function :full_comment_get_as_html, :clang_FullComment_getAsHTML, [CXComment.by_value], CXString.by_value
99
101
  attach_function :full_comment_get_as_xml, :clang_FullComment_getAsXML, [CXComment.by_value], CXString.by_value
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2014, by Masahiro Sano.
5
- # Copyright, 2014-2022, by Samuel Williams.
5
+ # Copyright, 2014-2025, by Samuel Williams.
6
6
 
7
7
  module FFI
8
8
  module Clang
@@ -10,23 +10,23 @@ module FFI
10
10
  typedef :pointer, :CXCompilationDatabase
11
11
  typedef :pointer, :CXCompileCommands
12
12
  typedef :pointer, :CXCompileCommand
13
-
13
+
14
14
  CompilationDatabaseError = enum [
15
15
  :no_error, 0,
16
16
  :can_not_load_database, 1,
17
17
  ]
18
-
18
+
19
19
  # CompilationDatabase
20
20
  attach_function :compilation_database_from_directory, :clang_CompilationDatabase_fromDirectory, [:string, :pointer], :CXCompilationDatabase
21
21
  attach_function :compilation_database_dispose, :clang_CompilationDatabase_dispose, [:CXCompilationDatabase], :uint
22
22
  attach_function :compilation_database_get_compile_commands, :clang_CompilationDatabase_getCompileCommands, [:CXCompilationDatabase, :string], :CXCompileCommands
23
23
  attach_function :compilation_database_get_all_compile_commands, :clang_CompilationDatabase_getAllCompileCommands, [:CXCompilationDatabase], :CXCompileCommands
24
-
24
+
25
25
  # CompilationDatabase::CompileCommands
26
26
  attach_function :compile_commands_dispose, :clang_CompileCommands_dispose, [:CXCompileCommands], :void
27
27
  attach_function :compile_commands_get_size, :clang_CompileCommands_getSize, [:CXCompileCommands], :uint
28
28
  attach_function :compile_commands_get_command, :clang_CompileCommands_getCommand, [:CXCompileCommands, :uint], :CXCompileCommand
29
-
29
+
30
30
  # CompilationDatabase::CompileCommand
31
31
  attach_function :compile_command_get_directory, :clang_CompileCommand_getDirectory, [:CXCompileCommand], CXString.by_value
32
32
  attach_function :compile_command_get_num_args, :clang_CompileCommand_getNumArgs, [:CXCompileCommand], :uint