ffi-clang 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9dcbefd7f0ba372cb4d7b1f7cdc0486840d8dd22
4
- data.tar.gz: b00aec280bd1ae965af5dbe99336bc65a94499f6
3
+ metadata.gz: 0711385ae78d16e56e06a6bb827a08951c1128dd
4
+ data.tar.gz: 5eb03fd538e2949c1063a07c071ab778e000b7cb
5
5
  SHA512:
6
- metadata.gz: c668b1273d5650d12de4a757629a2b02cf398288dc148b5e10a8fef34020d1ff354357c60381baa8597538b871e360d0e188cb6ec7a51420f2d202a5c4c726f3
7
- data.tar.gz: b2fadb72c282ee775c8aedc146870d95e12872ee14b1ae182731116b05a2353ce9855554f305004ef0cac5310d252085c10e7a7466daa1ef38a8bc407557331a
6
+ metadata.gz: 95fe823fc29639734c09302303b96c92a50060c0a5ac09adc9936f3d7b37ade0d90a6bf878eaf4bf4415f5a22f20807e086de7b0e8a242bd00cfa2f12edbde73
7
+ data.tar.gz: 54e2bfa618b2eeff3b0920ea731f9e3391179c761fce11c1a86ede8f1b40894d0770a3ece965942680ab4f0985e61501b1bb9d903a08d761d46eda0de010aece
@@ -1,8 +1,18 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - "2.0"
4
+ - "2.1"
5
+ env:
6
+ - LLVM_VERSION=3.2
7
+ - LLVM_VERSION=3.3
8
+ - LLVM_VERSION=3.4
9
+ - LLVM_VERSION=3.5
4
10
  install:
5
11
  - sudo add-apt-repository --yes ppa:h-rayflood/llvm
12
+ - sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
13
+ - sudo add-apt-repository --yes 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main'
14
+ - wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
6
15
  - sudo apt-get -qq update
7
- - sudo apt-get -qq install libclang-3.3-dev
8
- - bundle install
16
+ - sudo apt-get -qq install libclang-${LLVM_VERSION}-dev
17
+ - export LD_LIBRARY_PATH=/usr/lib/llvm-${LLVM_VERSION}/lib/
18
+ - bundle install
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # FFI::Clang
2
2
 
3
- Ruby FFI bindings for libclang. WIP.
4
-
5
- http://llvm.org/devmtg/2010-11/Gregor-libclang.pdf
3
+ A light weight wrapper for Ruby exposing libclang.
6
4
 
7
5
  [![Build Status](https://secure.travis-ci.org/ioquatix/ffi-clang.png)](http://travis-ci.org/ioquatix/ffi-clang)
8
6
  [![Code Climate](https://codeclimate.com/github/ioquatix/ffi-clang.png)](https://codeclimate.com/github/ioquatix/ffi-clang)
@@ -11,19 +9,34 @@ http://llvm.org/devmtg/2010-11/Gregor-libclang.pdf
11
9
 
12
10
  Add this line to your application's Gemfile:
13
11
 
14
- gem 'ffi-clang'
12
+ gem 'ffi-clang'
15
13
 
16
14
  And then execute:
17
15
 
18
- $ bundle
16
+ $ bundle
19
17
 
20
18
  Or install it yourself as:
21
19
 
22
- $ gem install ffi-clang
20
+ $ gem install ffi-clang
23
21
 
24
22
  ## Usage
25
23
 
26
- TODO: Write usage instructions here
24
+ Traverse the AST in the given file:
25
+
26
+ index = Index.new
27
+ translation_unit = index.parse_translation_unit("list.c")
28
+ cursor = translation_unit.cursor
29
+ cursor.visit_children do |cursor, parent|
30
+ puts "#{cursor.kind} #{cursor.spelling.inspect}"
31
+
32
+ next :recurse
33
+ end
34
+
35
+ ### Library Version
36
+
37
+ Due to issues figuring out which library to use, we require you to manually specify it. For example, to run the tests, with MacPorts llvm/clang 3.4, use the following:
38
+
39
+ LLVM_CONFIG=llvm-config-mp-3.4 rake
27
40
 
28
41
  ## Contributing
29
42
 
@@ -35,9 +48,10 @@ TODO: Write usage instructions here
35
48
 
36
49
  ## License
37
50
 
38
- Copyright, 2010-2012 by Jari Bakken.
39
- Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com>
40
- Copyright, 2013, by Garry C. Marshall. <http://www.meaningfulname.net>
51
+ Copyright, 2010-2012, by Jari Bakken.
52
+ Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com>
53
+ Copyright, 2013, by Garry C. Marshall. <http://www.meaningfulname.net>
54
+ Copyright, 2014, by Masahiro Sano.
41
55
 
42
56
  Permission is hereby granted, free of charge, to any person obtaining a copy
43
57
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,12 @@
1
+
2
+ require 'teapot'
3
+
4
+ task :default do
5
+ controller = Teapot::Controller.new(__dir__)
6
+
7
+ controller.fetch
8
+
9
+ packages = ["Dependencies/ffi-clang", "variant-release", "platform-darwin-osx"]
10
+
11
+ controller.build(packages)
12
+ end
@@ -0,0 +1,16 @@
1
+ #
2
+ # This file is part of the "Teapot" project, and is released under the MIT license.
3
+ #
4
+
5
+ teapot_version "0.8.0"
6
+
7
+ define_target "ffi-clang" do |target|
8
+ target.depends "Library/clang"
9
+ target.provides "Dependencies/ffi-clang"
10
+ end
11
+
12
+ define_configuration "ffi-clang" do |configuration|
13
+ configuration[:source] = "https://github.com/dream-framework/"
14
+
15
+ configuration.require "clang"
16
+ end
@@ -31,7 +31,7 @@ module FFI::Clang
31
31
 
32
32
  case os
33
33
  when /darwin/
34
- :osx
34
+ :darwin
35
35
  when /linux/
36
36
  :linux
37
37
  when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
@@ -42,6 +42,7 @@ module FFI::Clang
42
42
  end
43
43
  end
44
44
 
45
+ require 'ffi/clang/utils'
45
46
  require 'ffi/clang/lib'
46
47
  require 'ffi/clang/index'
47
48
  require 'ffi/clang/translation_unit'
@@ -27,12 +27,16 @@ require 'ffi/clang/type'
27
27
  module FFI
28
28
  module Clang
29
29
  class Cursor
30
+ attr_reader :cursor
31
+ attr_reader :translation_unit
32
+
30
33
  def self.null_cursor
31
- Cursor.new Lib.get_null_cursor
34
+ Cursor.new Lib.get_null_cursor, nil
32
35
  end
33
36
 
34
- def initialize( cxcursor )
37
+ def initialize(cxcursor, translation_unit)
35
38
  @cursor = cxcursor
39
+ @translation_unit = translation_unit
36
40
  end
37
41
 
38
42
  def null?
@@ -67,6 +71,18 @@ module FFI
67
71
  Lib.is_attribute(kind) != 0
68
72
  end
69
73
 
74
+ def public?
75
+ Lib.cxx_get_access_specifier(@cursor) == :public
76
+ end
77
+
78
+ def private?
79
+ Lib.cxx_get_access_specifier(@cursor) == :private
80
+ end
81
+
82
+ def protected?
83
+ Lib.cxx_get_access_specifier(@cursor) == :protected
84
+ end
85
+
70
86
  def invalid?
71
87
  Lib.is_invalid(kind) != 0
72
88
  end
@@ -99,26 +115,129 @@ module FFI
99
115
  Lib.extract_string Lib.get_cursor_spelling(@cursor)
100
116
  end
101
117
 
118
+ def usr
119
+ Lib.extract_string Lib.get_cursor_usr(@cursor)
120
+ end
121
+
102
122
  def kind
103
123
  @cursor[:kind]
104
124
  end
105
125
 
106
126
  def type
107
- Type.new Lib.get_cursor_type(@cursor)
127
+ Type.new Lib.get_cursor_type(@cursor), @translation_unit
108
128
  end
109
129
 
110
130
  def result_type
111
- Type.new Lib.get_cursor_result_type(@cursor)
131
+ Type.new Lib.get_cursor_result_type(@cursor), @translation_unit
132
+ end
133
+
134
+ def underlying_type
135
+ Type.new Lib.get_typedef_decl_underlying_type(@cursor), @translation_unit
136
+ end
137
+
138
+ def enum_decl_integer_type
139
+ Type.new Lib.get_decl_integer_type(@cursor), @translation_unit
140
+ end
141
+
142
+ def virtual_base?
143
+ Lib.is_virtual_base(@cursor) != 0
144
+ end
145
+
146
+ def dynamic_call?
147
+ Lib.is_dynamic_call(@cursor) != 0
148
+ end
149
+
150
+ def variadic?
151
+ Lib.is_variadic(@cursor) != 0
152
+ end
153
+
154
+ def definition?
155
+ Lib.is_definition(@cursor) != 0
156
+ end
157
+
158
+ def static?
159
+ Lib.cxx_method_is_static(@cursor) != 0
160
+ end
161
+
162
+ def virtual?
163
+ Lib.cxx_method_is_virtual(@cursor) != 0
164
+ end
165
+
166
+ def pure_virtual?
167
+ Lib.cxx_method_is_pure_virtual(@cursor) != 0
168
+ end
169
+
170
+ def enum_value
171
+ Lib.get_enum_value @cursor
172
+ end
173
+
174
+ def specialized_template
175
+ Cursor.new Lib.get_specialized_cursor_template(@cursor), @translation_unit
176
+ end
177
+
178
+ def canonical
179
+ Cursor.new Lib.get_canonical_cursor(@cursor), @translation_unit
180
+ end
181
+
182
+ def definition
183
+ Cursor.new Lib.get_cursor_definition(@cursor), @translation_unit
184
+ end
185
+
186
+ def referenced
187
+ Cursor.new Lib.get_cursor_referenced(@cursor), @translation_unit
188
+ end
189
+
190
+ def semantic_parent
191
+ Cursor.new Lib.get_cursor_semantic_parent(@cursor), @translation_unit
192
+ end
193
+
194
+ def lexical_parent
195
+ Cursor.new Lib.get_cursor_lexical_parent(@cursor), @translation_unit
196
+ end
197
+
198
+ def template_kind
199
+ Lib.get_template_cursor_kind @cursor
200
+ end
201
+
202
+ def access_specifier
203
+ Lib.get_cxx_access_specifier @cursor
204
+ end
205
+
206
+ def language
207
+ Lib.get_language @cursor
112
208
  end
113
209
 
114
210
  def visit_children(&block)
115
- adapter = Proc.new do | cxcursor, parent_cursor, unused |
116
- block.call Cursor.new(cxcursor), Cursor.new(parent_cursor)
211
+ adapter = Proc.new do |cxcursor, parent_cursor, unused|
212
+ block.call Cursor.new(cxcursor, @translation_unit), Cursor.new(parent_cursor, @translation_unit)
117
213
  end
214
+
118
215
  Lib.visit_children(@cursor, adapter, nil)
119
216
  end
120
217
 
121
- attr_reader :cursor
218
+ def linkage
219
+ Lib.get_cursor_linkage(@cursor)
220
+ end
221
+
222
+ def availability
223
+ Lib.get_cursor_availability(@cursor)
224
+ end
225
+
226
+ def included_file
227
+ raise NotImplementedError
228
+ end
229
+
230
+ def platform_availability
231
+ raise NotImplementedError
232
+ end
233
+
234
+ def get_overridden_cursors
235
+ raise NotImplementedError
236
+ end
237
+
238
+ def hash
239
+ Lib.get_cursor_hash(@cursor)
240
+ end
122
241
 
123
242
  def ==(other)
124
243
  Lib.are_equal(@cursor, other.cursor) != 0
@@ -38,21 +38,21 @@ module FFI
38
38
 
39
39
  translation_unit_pointer = Lib.parse_translation_unit(self, source_file, args_pointer_from(command_line_args), command_line_args.size, unsaved_files, unsaved.length, options_bitmask_from(opts))
40
40
 
41
- raise Error, "error parsing #{source_file.inspect}" unless translation_unit_pointer
41
+ raise Error, "error parsing #{source_file.inspect}" if translation_unit_pointer.null?
42
42
 
43
- TranslationUnit.new translation_unit_pointer
43
+ TranslationUnit.new translation_unit_pointer, self
44
44
  end
45
45
 
46
46
  private
47
47
 
48
48
  def args_pointer_from(command_line_args)
49
- args_pointer = MemoryPointer.new(:pointer)
49
+ args_pointer = MemoryPointer.new(:pointer, command_line_args.length)
50
50
 
51
51
  strings = command_line_args.map do |arg|
52
52
  MemoryPointer.from_string(arg.to_s)
53
53
  end
54
54
 
55
- args_pointer.put_array_of_pointer(strings) unless strings.empty?
55
+ args_pointer.put_array_of_pointer(0, strings) unless strings.empty?
56
56
  args_pointer
57
57
  end
58
58
 
@@ -26,11 +26,10 @@ module FFI
26
26
 
27
27
  libs = ["clang"]
28
28
 
29
- if Clang.platform == :linux
30
- libs += [
31
- "/usr/lib/llvm-3.3/lib/libclang.so",
32
- "/usr/lib64/llvm-3.3/lib/libclang.so"
33
- ]
29
+ if ENV['LLVM_CONFIG']
30
+ llvm_library_dir = `#{ENV['LLVM_CONFIG']} --libdir`.chomp
31
+
32
+ libs << llvm_library_dir + '/libclang.dylib'
34
33
  end
35
34
 
36
35
  ffi_lib libs
@@ -28,14 +28,178 @@ require 'ffi/clang/lib/type'
28
28
  module FFI
29
29
  module Clang
30
30
  module Lib
31
- enum :kind, [:cursor_struct, 2,
31
+ enum :kind, [
32
+ :cursor_unexposed_decl, 1,
33
+ :cursor_struct, 2,
34
+ :cursor_union, 3,
35
+ :cursor_class_decl, 4,
32
36
  :cursor_enum_decl, 5,
37
+ :cursor_field_decl, 6,
33
38
  :cursor_enum_constant_decl, 7,
34
39
  :cursor_function, 8,
40
+ :cursor_variable, 9,
35
41
  :cursor_parm_decl, 10,
42
+ :cursor_obj_c_interface_decl, 11,
43
+ :cursor_obj_c_category_decl, 12,
44
+ :cursor_obj_c_protocol_decl, 13,
45
+ :cursor_obj_c_property_decl, 14,
46
+ :cursor_obj_c_instance_var_decl, 15,
47
+ :cursor_obj_c_instance_method_decl, 16,
48
+ :cursor_obj_c_class_method_decl, 17,
49
+ :cursor_obj_c_implementation_decl, 18,
50
+ :cursor_obj_c_category_impl_decl, 19,
36
51
  :cursor_typedef_decl, 20,
52
+ :cursor_cxx_method, 21,
53
+ :cursor_namespace, 22,
54
+ :cursor_linkage_spec, 23,
55
+ :cursor_constructor, 24,
56
+ :cursor_destructor, 25,
57
+ :cursor_conversion_function, 26,
58
+ :cursor_template_type_parameter, 27,
59
+ :cursor_non_type_template_parameter, 28,
60
+ :cursor_template_template_parameter, 29,
61
+ :cursor_function_template, 30,
62
+ :cursor_class_template, 31,
63
+ :cursor_class_template_partial_specialization, 32,
64
+ :cursor_namespace_alias, 33,
65
+ :cursor_using_directive, 34,
66
+ :cursor_using_declaration, 35,
67
+ :cursor_type_alias_decl, 36,
68
+ :cursor_obj_c_synthesize_decl, 37,
69
+ :cursor_obj_c_dynamic_decl, 38,
70
+ :cursor_cxx_access_specifier, 39,
71
+ :cursor_obj_c_super_class_ref, 40,
72
+ :cursor_obj_c_protocol_ref, 41,
73
+ :cursor_obj_c_class_ref, 42,
74
+ :cursor_type_ref, 43,
75
+ :cursor_cxx_base_specifier, 44,
76
+ :cursor_template_ref, 45,
77
+ :cursor_namespace_ref, 46,
78
+ :cursor_member_ref, 47,
79
+ :cursor_label_ref, 48,
80
+ :cursor_overloaded_decl_ref, 49,
81
+ :cursor_variable_ref, 50,
37
82
  :cursor_invalid_file, 70,
38
- :cursor_translation_unit, 300
83
+ :cursor_no_decl_found, 71,
84
+ :cursor_not_implemented, 72,
85
+ :cursor_invalid_code, 73,
86
+ :cursor_first_expr, 100,
87
+ :cursor_decl_ref_expr, 101,
88
+ :cursor_member_ref_expr, 102,
89
+ :cursor_call_expr, 103,
90
+ :cursor_obj_c_message_expr, 104,
91
+ :cursor_block_expr, 105,
92
+ :cursor_integer_literal, 106,
93
+ :cursor_floating_literal, 107,
94
+ :cursor_imaginary_literal, 108,
95
+ :cursor_string_literal, 109,
96
+ :cursor_character_literal, 110,
97
+ :cursor_paren_expr, 111,
98
+ :cursor_unary_operator, 112,
99
+ :cursor_array_subscript_expr, 113,
100
+ :cursor_binary_operator, 114,
101
+ :cursor_compound_assign_operator, 115,
102
+ :cursor_conditional_operator, 116,
103
+ :cursor_c_style_cast_expr, 117,
104
+ :cursor_compound_literal_expr, 118,
105
+ :cursor_init_list_expr, 119,
106
+ :cursor_addr_label_expr, 120,
107
+ :cursor_stmt_expr, 121,
108
+ :cursor_generic_selection_expr, 122,
109
+ :cursor_gnu_null_expr, 123,
110
+ :cursor_cxx_static_cast_expr, 124,
111
+ :cursor_cxx_dynamic_cast_expr, 125,
112
+ :cursor_cxx_reinterpret_cast_expr, 126,
113
+ :cursor_cxx_const_cast_expr, 127,
114
+ :cursor_cxx_functional_cast_expr, 128,
115
+ :cursor_cxx_typeid_expr, 129,
116
+ :cursor_cxx_bool_literal_expr, 130,
117
+ :cursor_cxx_null_ptr_literal_expr, 131,
118
+ :cursor_cxx_this_expr, 132,
119
+ :cursor_cxx_throw_expr, 133,
120
+ :cursor_cxx_new_expr, 134,
121
+ :cursor_cxx_delete_expr, 135,
122
+ :cursor_unary_expr, 136,
123
+ :cursor_obj_c_string_literal, 137,
124
+ :cursor_obj_c_encode_expr, 138,
125
+ :cursor_obj_c_selector_expr, 139,
126
+ :cursor_obj_c_protocol_expr, 140,
127
+ :cursor_obj_c_bridged_cast_expr, 141,
128
+ :cursor_pack_expansion_expr, 142,
129
+ :cursor_size_of_pack_expr, 143,
130
+ :cursor_lambda_expr, 144,
131
+ :cursor_obj_c_bool_literal_expr, 145,
132
+ :cursor_obj_c_self_expr, 146,
133
+ :cursor_unexposed_stmt, 200,
134
+ :cursor_label_stmt, 201,
135
+ :cursor_compound_stmt, 202,
136
+ :cursor_case_stmt, 203,
137
+ :cursor_default_stmt, 204,
138
+ :cursor_if_stmt, 205,
139
+ :cursor_switch_stmt, 206,
140
+ :cursor_while_stmt, 207,
141
+ :cursor_do_stmt, 208,
142
+ :cursor_for_stmt, 209,
143
+ :cursor_goto_stmt, 210,
144
+ :cursor_indirect_goto_stmt, 211,
145
+ :cursor_continue_stmt, 212,
146
+ :cursor_break_stmt, 213,
147
+ :cursor_return_stmt, 214,
148
+ :cursor_gcc_asm_stmt, 215,
149
+ :cursor_obj_c_at_try_stmt, 216,
150
+ :cursor_obj_c_at_catch_stmt, 217,
151
+ :cursor_obj_c_at_finally_stmt, 218,
152
+ :cursor_obj_c_at_throw_stmt, 219,
153
+ :cursor_obj_c_at_synchronized_stmt, 220,
154
+ :cursor_obj_c_autorelease_pool_stmt, 221,
155
+ :cursor_obj_c_for_collection_stmt, 222,
156
+ :cursor_cxx_catch_stmt, 223,
157
+ :cursor_cxx_try_stmt, 224,
158
+ :cursor_cxx_for_range_stmt, 225,
159
+ :cursor_seh_try_stmt, 226,
160
+ :cursor_seh_except_stmt, 227,
161
+ :cursor_seh_finally_stmt, 228,
162
+ :cursor_ms_asm_stmt, 229,
163
+ :cursor_null_stmt, 230,
164
+ :cursor_decl_stmt, 231,
165
+ :cursor_omp_parallel_directive, 232,
166
+ :cursor_translation_unit, 300,
167
+ :cursor_unexposed_attr, 400,
168
+ :cursor_ibaction_attr, 401,
169
+ :cursor_iboutlet_attr, 402,
170
+ :cursor_iboutlet_collection_attr, 403,
171
+ :cursor_cxx_final_attr, 404,
172
+ :cursor_cxx_override_attr, 405,
173
+ :cursor_annotate_attr, 406,
174
+ :cursor_asm_label_attr, 407,
175
+ :cursor_packed_attr, 408,
176
+ :cursor_preprocessing_directive, 500,
177
+ :cursor_macro_definition, 501,
178
+ :cursor_macro_expansion, 502,
179
+ :cursor_inclusion_directive, 503,
180
+ :cursor_module_import_decl, 600,
181
+ ]
182
+
183
+ enum :access_specifier, [
184
+ :invalid, 0,
185
+ :public, 1,
186
+ :protected, 2,
187
+ :private, 3
188
+ ]
189
+
190
+ enum :availability, [
191
+ :available, 0,
192
+ :deprecated, 1,
193
+ :not_available, 2,
194
+ :not_accesible, 3
195
+ ]
196
+
197
+ enum :linkage_kind, [
198
+ :invalid, 0,
199
+ :no_linkage, 1,
200
+ :internal, 2,
201
+ :unique_external, 3,
202
+ :external, 4,
39
203
  ]
40
204
 
41
205
  class CXCursor < FFI::Struct
@@ -46,7 +210,34 @@ module FFI
46
210
  )
47
211
  end
48
212
 
213
+ enum :cxx_access_specifier, [:invalid, :public, :protected, :private]
214
+ attach_function :get_cxx_access_specifier, :clang_getCXXAccessSpecifier, [CXCursor.by_value], :cxx_access_specifier
215
+
216
+ attach_function :get_enum_value, :clang_getEnumConstantDeclValue, [CXCursor.by_value], :long_long
217
+
218
+ attach_function :is_virtual_base, :clang_isVirtualBase, [CXCursor.by_value], :uint
219
+ attach_function :is_dynamic_call, :clang_Cursor_isDynamicCall, [CXCursor.by_value], :uint
220
+ if FFI::Clang::Utils.satisfy_version?('3.3')
221
+ attach_function :is_variadic, :clang_Cursor_isVariadic, [CXCursor.by_value], :uint
222
+ end
223
+ attach_function :is_definition, :clang_isCursorDefinition, [CXCursor.by_value], :uint
224
+ attach_function :cxx_method_is_static, :clang_CXXMethod_isStatic, [CXCursor.by_value], :uint
225
+ attach_function :cxx_method_is_virtual, :clang_CXXMethod_isVirtual, [CXCursor.by_value], :uint
226
+ if FFI::Clang::Utils.satisfy_version?('3.4')
227
+ attach_function :cxx_method_is_pure_virtual, :clang_CXXMethod_isPureVirtual, [CXCursor.by_value], :uint
228
+ end
229
+ attach_function :cxx_get_access_specifier, :clang_getCXXAccessSpecifier, [CXCursor.by_value], :access_specifier
230
+
231
+ enum :language_kind, [:invalid, :c, :obj_c, :c_plus_plus]
232
+ attach_function :get_language, :clang_getCursorLanguage, [CXCursor.by_value], :language_kind
233
+
234
+ attach_function :get_canonical_cursor, :clang_getCanonicalCursor, [CXCursor.by_value], CXCursor.by_value
235
+ attach_function :get_cursor_definition, :clang_getCursorDefinition, [CXCursor.by_value], CXCursor.by_value
236
+ attach_function :get_specialized_cursor_template, :clang_getSpecializedCursorTemplate, [CXCursor.by_value], CXCursor.by_value
237
+ attach_function :get_template_cursor_kind, :clang_getTemplateCursorKind, [CXCursor.by_value], :kind
238
+
49
239
  attach_function :get_translation_unit_cursor, :clang_getTranslationUnitCursor, [:CXTranslationUnit], CXCursor.by_value
240
+ attach_function :cursor_get_translation_unit, :clang_Cursor_getTranslationUnit, [CXCursor.by_value], :CXTranslationUnit
50
241
 
51
242
  attach_function :get_null_cursor, :clang_getNullCursor, [], CXCursor.by_value
52
243
 
@@ -55,11 +246,13 @@ module FFI
55
246
  attach_function :cursor_get_raw_comment_text, :clang_Cursor_getRawCommentText, [CXCursor.by_value], CXString.by_value
56
247
  attach_function :cursor_get_parsed_comment, :clang_Cursor_getParsedComment, [CXCursor.by_value], CXComment.by_value
57
248
 
249
+ attach_function :get_cursor, :clang_getCursor, [:CXTranslationUnit, CXSourceLocation.by_value], CXCursor.by_value
58
250
  attach_function :get_cursor_location, :clang_getCursorLocation, [CXCursor.by_value], CXSourceLocation.by_value
59
251
  attach_function :get_cursor_extent, :clang_getCursorExtent, [CXCursor.by_value], CXSourceRange.by_value
60
252
  attach_function :get_cursor_display_name, :clang_getCursorDisplayName, [CXCursor.by_value], CXString.by_value
61
253
  attach_function :get_cursor_spelling, :clang_getCursorSpelling, [CXCursor.by_value], CXString.by_value
62
-
254
+ attach_function :get_cursor_usr, :clang_getCursorUSR, [CXCursor.by_value], CXString.by_value
255
+
63
256
  attach_function :are_equal, :clang_equalCursors, [CXCursor.by_value, CXCursor.by_value], :uint
64
257
 
65
258
  attach_function :is_declaration, :clang_isDeclaration, [:kind], :uint
@@ -79,8 +272,18 @@ module FFI
79
272
 
80
273
  attach_function :get_cursor_type, :clang_getCursorType, [CXCursor.by_value], CXType.by_value
81
274
  attach_function :get_cursor_result_type, :clang_getCursorResultType, [CXCursor.by_value], CXType.by_value
275
+ attach_function :get_typedef_decl_underlying_type, :clang_getTypedefDeclUnderlyingType, [CXCursor.by_value], CXType.by_value
276
+ attach_function :get_enum_decl_integer_type, :clang_getEnumDeclIntegerType, [CXCursor.by_value], CXType.by_value
277
+ attach_function :get_type_declaration, :clang_getTypeDeclaration, [CXType.by_value], FFI::Clang::Lib::CXCursor.by_value
82
278
 
279
+ attach_function :get_cursor_referenced, :clang_getCursorReferenced, [CXCursor.by_value], CXCursor.by_value
280
+ attach_function :get_cursor_semantic_parent, :clang_getCursorSemanticParent, [CXCursor.by_value], CXCursor.by_value
281
+ attach_function :get_cursor_lexical_parent, :clang_getCursorLexicalParent, [CXCursor.by_value], CXCursor.by_value
282
+
283
+ attach_function :get_cursor_availability, :clang_getCursorAvailability, [CXCursor.by_value], :availability
284
+ attach_function :get_cursor_linkage, :clang_getCursorLinkage, [CXCursor.by_value], :linkage_kind
285
+ # attach_function :get_included_file, :clang_getIncludedFile, [CXCursor.by_value], :CXFile
286
+ attach_function :get_cursor_hash, :clang_hashCursor, [CXCursor.by_value], :uint
83
287
  end
84
288
  end
85
289
  end
86
-