clangc 1.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ext/clangc/_clangc_functions.c +303 -0
- data/ext/clangc/_clangc_functions.h +51 -0
- data/ext/clangc/clangc.c +376 -0
- data/ext/clangc/class_CodeCompleteResults.c +186 -0
- data/ext/clangc/class_CodeCompleteResults.h +51 -0
- data/ext/clangc/class_CompletionResult.c +98 -0
- data/ext/clangc/class_CompletionResult.h +36 -0
- data/ext/clangc/class_CompletionString.c +231 -0
- data/ext/clangc/class_CompletionString.h +57 -0
- data/ext/clangc/class_Cursor.c +1677 -0
- data/ext/clangc/class_Cursor.h +259 -0
- data/ext/clangc/class_CursorSet.c +109 -0
- data/ext/clangc/class_CursorSet.h +39 -0
- data/ext/clangc/class_Diagnostic.c +322 -0
- data/ext/clangc/class_Diagnostic.h +66 -0
- data/ext/clangc/class_File.c +145 -0
- data/ext/clangc/class_File.h +45 -0
- data/ext/clangc/class_Index.c +461 -0
- data/ext/clangc/class_Index.h +58 -0
- data/ext/clangc/class_Module.c +181 -0
- data/ext/clangc/class_Module.h +51 -0
- data/ext/clangc/class_OverriddenCursor.c +51 -0
- data/ext/clangc/class_OverriddenCursor.h +31 -0
- data/ext/clangc/class_SourceLocation.c +197 -0
- data/ext/clangc/class_SourceLocation.h +45 -0
- data/ext/clangc/class_SourceRange.c +123 -0
- data/ext/clangc/class_SourceRange.h +42 -0
- data/ext/clangc/class_TranslationUnit.c +457 -0
- data/ext/clangc/class_TranslationUnit.h +63 -0
- data/ext/clangc/class_Type.c +564 -0
- data/ext/clangc/class_Type.h +108 -0
- data/ext/clangc/constants.c +660 -0
- data/ext/clangc/constants.h +21 -0
- data/ext/clangc/extconf.rb +34 -0
- data/ext/clangc/macros.h +230 -0
- data/lib/clangc.rb +397 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 45e07e9b9db18eeca9b0a85378ecea78a7c052d1
|
4
|
+
data.tar.gz: fd2d61448951cf4a9cce3854ffdddde76bec3df5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b3bf07d69593b7a8a1da428a0a0f5615d4411d918d2ef64f6784a4beef6a9819d8587ad58f57ae2f4c9ad62e71fe684c5f2884e0a531d8129c67069dc0b997b2
|
7
|
+
data.tar.gz: b1e9423bf2c78e60ec92de23cac45150fb07dcc31aadeff1f15d45f0d0a54988af7cac0ff9cc0a30eb36fdda7f642b3d7c197874f42e134fad3ab0556540f391
|
@@ -0,0 +1,303 @@
|
|
1
|
+
/*
|
2
|
+
* ruby-clangc ruby bindings for the C interface of Clang
|
3
|
+
* Copyright (C) 2015-2016 Cedric Le Moigne cedlemo <cedlemo@gmx.com>
|
4
|
+
*
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
8
|
+
* (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
* GNU General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU General Public License
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
*/
|
18
|
+
|
19
|
+
#include "_clangc_functions.h"
|
20
|
+
#include "clang-c/Index.h"
|
21
|
+
#include "class_SourceRange.h"
|
22
|
+
#include "class_SourceLocation.h"
|
23
|
+
#include "class_Cursor.h"
|
24
|
+
|
25
|
+
/**
|
26
|
+
* call-seq:
|
27
|
+
* Clangc.version => String
|
28
|
+
*
|
29
|
+
* Return a version string, suitable for showing to a user, but not
|
30
|
+
* intended to be parsed (the format is not guaranteed to be stable).
|
31
|
+
*/
|
32
|
+
|
33
|
+
VALUE
|
34
|
+
m_clangc_get_version(VALUE self)
|
35
|
+
{
|
36
|
+
return CXSTR_2_RVAL(clang_getClangVersion());
|
37
|
+
}
|
38
|
+
|
39
|
+
/**
|
40
|
+
* call-seq:
|
41
|
+
* Clangc.default_diagnostic_display_options => Fixnum
|
42
|
+
*
|
43
|
+
* Retrieve the set of display options most similar to the
|
44
|
+
* default behavior of the clang compiler.
|
45
|
+
*
|
46
|
+
* A set of display options suitable for use with Clangc::Diagnostic#format
|
47
|
+
*/
|
48
|
+
|
49
|
+
VALUE
|
50
|
+
m_clangc_get_default_diagnostic_display_options(VALUE self)
|
51
|
+
{
|
52
|
+
return CUINT_2_NUM(clang_defaultDiagnosticDisplayOptions());
|
53
|
+
}
|
54
|
+
|
55
|
+
/**
|
56
|
+
* call-seq:
|
57
|
+
* Clangc.default_editing_translation_unit_options => Fixnum
|
58
|
+
*
|
59
|
+
* Returns the set of flags that is suitable for parsing a translation
|
60
|
+
* unit that is being edited. (Clangc::TranslationUnit_Flags constants)
|
61
|
+
*
|
62
|
+
* The set of flags returned provide options for
|
63
|
+
* Clangc::Index#parseTranslationUnit
|
64
|
+
* to indicate that the translation unit is likely to be reparsed many times,
|
65
|
+
* either explicitly (via Clangc::TranslationUnit#reparse) or implicitly
|
66
|
+
* (e.g., by code completion ( Clangc::TranslationUnit#CodeCompleteAt). The
|
67
|
+
* returned flag
|
68
|
+
* set contains an unspecified set of optimizations (e.g., the precompiled
|
69
|
+
* preamble) geared toward improving the performance of these routines. The
|
70
|
+
* set of optimizations enabled may change from one version to the next.
|
71
|
+
*/
|
72
|
+
|
73
|
+
VALUE
|
74
|
+
m_clangc_get_default_editing_translation_unit_options(VALUE self)
|
75
|
+
{
|
76
|
+
return CUINT_2_NUM(clang_defaultEditingTranslationUnitOptions());
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* call-seq:
|
81
|
+
* Clangc.default_code_complete_options => Fixnum
|
82
|
+
*
|
83
|
+
* Returns a default set of code-completion options that can be
|
84
|
+
* passed to Clangc::TranslationUnit#codeCompleteAt.
|
85
|
+
* This set is be bitwise-OR'd constants of the Clangc::CodeComplete_Flags
|
86
|
+
*/
|
87
|
+
|
88
|
+
VALUE
|
89
|
+
m_clangc_get_default_code_complete_options(VALUE self)
|
90
|
+
{
|
91
|
+
return CUINT_2_NUM(clang_defaultCodeCompleteOptions());
|
92
|
+
}
|
93
|
+
|
94
|
+
/**
|
95
|
+
* call-seq:
|
96
|
+
* Clangc.null_source_range
|
97
|
+
*
|
98
|
+
* Retrieve a NULL (invalid) source range
|
99
|
+
*/
|
100
|
+
|
101
|
+
VALUE
|
102
|
+
m_clangc_get_null_source_range(VALUE self)
|
103
|
+
{
|
104
|
+
SourceRange_t *s;
|
105
|
+
VALUE source_range;
|
106
|
+
R_GET_CLASS_DATA("Clangc", SourceRange, source_range, s);
|
107
|
+
s->data = clang_getNullRange();
|
108
|
+
return source_range;
|
109
|
+
}
|
110
|
+
|
111
|
+
/**
|
112
|
+
* call-seq:
|
113
|
+
* Clangc.null_source_location
|
114
|
+
*
|
115
|
+
* Retrieve a NULL (invalid) source location.
|
116
|
+
*/
|
117
|
+
|
118
|
+
VALUE
|
119
|
+
m_clangc_get_null_source_location(VALUE self)
|
120
|
+
{
|
121
|
+
SourceLocation_t *s;
|
122
|
+
VALUE source_location;
|
123
|
+
R_GET_CLASS_DATA("Clangc", SourceLocation, source_location, s);
|
124
|
+
s->data = clang_getNullLocation();
|
125
|
+
return source_location;
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
* call-seq:
|
130
|
+
* Clangc.null_cursor
|
131
|
+
*
|
132
|
+
* Retrieve a NULL cursor which represents no entity
|
133
|
+
*/
|
134
|
+
|
135
|
+
VALUE
|
136
|
+
m_clangc_get_null_cursor(VALUE self)
|
137
|
+
{
|
138
|
+
Cursor_t *c;
|
139
|
+
VALUE cursor;
|
140
|
+
R_GET_CLASS_DATA("Clangc", Cursor, cursor, c);
|
141
|
+
c->data = clang_getNullCursor();
|
142
|
+
return cursor;
|
143
|
+
}
|
144
|
+
|
145
|
+
static enum CXChildVisitResult
|
146
|
+
visitor(CXCursor cursor, CXCursor parent, CXClientData client_data)
|
147
|
+
{
|
148
|
+
VALUE callback, mClangc, cCursor;
|
149
|
+
VALUE r_cursor, r_parent;
|
150
|
+
VALUE r_ret;
|
151
|
+
Cursor_t *c;
|
152
|
+
Cursor_t *p;
|
153
|
+
unsigned ret;
|
154
|
+
|
155
|
+
callback = (VALUE) client_data;
|
156
|
+
|
157
|
+
mClangc = rb_const_get(rb_cObject, rb_intern("Clangc"));
|
158
|
+
cCursor = rb_const_get(mClangc, rb_intern("Cursor"));
|
159
|
+
|
160
|
+
r_cursor = rb_class_new_instance(0, NULL, cCursor);
|
161
|
+
Data_Get_Struct(r_cursor, Cursor_t, c);
|
162
|
+
c->data = cursor;
|
163
|
+
|
164
|
+
r_parent = rb_class_new_instance(0, NULL, cCursor);
|
165
|
+
Data_Get_Struct(r_parent, Cursor_t, p);
|
166
|
+
p->data = parent;
|
167
|
+
|
168
|
+
r_ret = rb_funcall(callback, rb_intern("call"), 2, r_cursor, r_parent);
|
169
|
+
|
170
|
+
if (TYPE(r_ret) == T_FIXNUM)
|
171
|
+
{
|
172
|
+
ret = NUM2UINT(r_ret);
|
173
|
+
if (ret == CXChildVisit_Break || ret == CXChildVisit_Continue ||
|
174
|
+
ret == CXChildVisit_Recurse)
|
175
|
+
return ret;
|
176
|
+
else
|
177
|
+
return CXChildVisit_Break;
|
178
|
+
}
|
179
|
+
else
|
180
|
+
return CXChildVisit_Break;
|
181
|
+
}
|
182
|
+
|
183
|
+
/**
|
184
|
+
* call-seq:
|
185
|
+
* Clangc.visit_children_with_proc(cursor, visitor) => Qtrue/ Qfalse
|
186
|
+
*
|
187
|
+
* Visit the children of a particular cursor.
|
188
|
+
*
|
189
|
+
* This function visits all the direct children of the given cursor,
|
190
|
+
* invoking the given visitor Proc with the cursors of each
|
191
|
+
* visited child. The traversal may be recursive, if the visitor returns
|
192
|
+
* Clangc::ChildVisitResult::Recurse. The traversal may also be ended
|
193
|
+
* prematurely, if
|
194
|
+
* the visitor returns Clangc::ChildVisit::Break.
|
195
|
+
*
|
196
|
+
* cursor the cursor whose child may be visited. All kinds of
|
197
|
+
* cursors can be visited, including invalid cursors (which, by
|
198
|
+
* definition, have no children).
|
199
|
+
*
|
200
|
+
* visitor the visitor function that will be invoked for each
|
201
|
+
* child of cursor.
|
202
|
+
*
|
203
|
+
* returns a true if the traversal was terminated
|
204
|
+
* prematurely by the visitor returning Clangc::ChildVisitiResult::Break.
|
205
|
+
*
|
206
|
+
* You should prefer to use :
|
207
|
+
*
|
208
|
+
* Clangc.visit_children(cursor: cursor, visitor: callback)
|
209
|
+
*/
|
210
|
+
|
211
|
+
VALUE
|
212
|
+
m_clangc_visit_children_with_proc(VALUE self, VALUE cursor, VALUE aproc)
|
213
|
+
{
|
214
|
+
if (rb_class_of(aproc) != rb_cProc) rb_raise(rb_eTypeError, "Need a block");
|
215
|
+
|
216
|
+
VALUE callback = aproc;
|
217
|
+
Cursor_t *c;
|
218
|
+
unsigned ret_with_break;
|
219
|
+
|
220
|
+
Data_Get_Struct(cursor, Cursor_t, c);
|
221
|
+
ret_with_break = clang_visitChildren(c->data,
|
222
|
+
visitor,
|
223
|
+
(CXClientData) callback);
|
224
|
+
return NOT_0_2_RVAL(ret_with_break);
|
225
|
+
}
|
226
|
+
|
227
|
+
/**
|
228
|
+
* call-seq:
|
229
|
+
* Clangc.visit_children_with_block(cursor) => Qtrue/ Qfalse
|
230
|
+
*
|
231
|
+
* Visit the children of a particular cursor.
|
232
|
+
*
|
233
|
+
* This function visits all the direct children of the given cursor,
|
234
|
+
* invoking the block with the cursors of each
|
235
|
+
* visited child. The traversal may be recursive, if the visitor returns
|
236
|
+
* Clangc::ChildVisitResult::Recurse. The traversal may also be ended
|
237
|
+
* prematurely, if
|
238
|
+
* the visitor returns Clangc::ChildVisit::Break.
|
239
|
+
*
|
240
|
+
* cursor the cursor whose child may be visited. All kinds of
|
241
|
+
* cursors can be visited, including invalid cursors (which, by
|
242
|
+
* definition, have no children).
|
243
|
+
*
|
244
|
+
* visitor the visitor function that will be invoked for each
|
245
|
+
* child of cursor.
|
246
|
+
*
|
247
|
+
* returns a true if the traversal was terminated
|
248
|
+
* prematurely by the visitor returning Clangc::ChildVisitiResult::Break.
|
249
|
+
*
|
250
|
+
* You should prefer to use :
|
251
|
+
*
|
252
|
+
* Clangc.visit_children(cursor: cursor, visitor: callback)
|
253
|
+
*/
|
254
|
+
VALUE
|
255
|
+
m_clangc_visit_children_with_block(VALUE self, VALUE cursor)
|
256
|
+
{
|
257
|
+
if (rb_block_given_p() == 0) rb_raise(rb_eTypeError, "Need a block");
|
258
|
+
|
259
|
+
VALUE callback = rb_block_proc();
|
260
|
+
Cursor_t *c;
|
261
|
+
unsigned ret_with_break;
|
262
|
+
|
263
|
+
Data_Get_Struct(cursor, Cursor_t, c);
|
264
|
+
ret_with_break = clang_visitChildren(c->data,
|
265
|
+
visitor,
|
266
|
+
(CXClientData) callback);
|
267
|
+
return NOT_0_2_RVAL(ret_with_break);
|
268
|
+
}
|
269
|
+
|
270
|
+
/**
|
271
|
+
* call-seq:
|
272
|
+
* Clangc.range(Clangc::SourceLocation, Clangc::SourceLocation) =>
|
273
|
+
* Clangc::SourceRange
|
274
|
+
*
|
275
|
+
* Retrieve a source range given the beginning and ending source
|
276
|
+
* locations.
|
277
|
+
*/
|
278
|
+
VALUE
|
279
|
+
m_clangc_get_range(VALUE self, VALUE begin, VALUE end)
|
280
|
+
{
|
281
|
+
CHECK_ARG_TYPE(begin, SourceLocation);
|
282
|
+
CHECK_ARG_TYPE(end, SourceLocation);
|
283
|
+
|
284
|
+
SourceLocation_t *b;
|
285
|
+
SourceLocation_t *e;
|
286
|
+
VALUE range;
|
287
|
+
SourceRange_t *s;
|
288
|
+
SourceRange_t *p;
|
289
|
+
|
290
|
+
Data_Get_Struct(begin, SourceLocation_t, b);
|
291
|
+
Data_Get_Struct(end, SourceLocation_t, e);
|
292
|
+
// TODO Should I add a check to see if they come from the same
|
293
|
+
// file / TU
|
294
|
+
R_GET_CLASS_DATA("Clangc", SourceRange, range, s);
|
295
|
+
|
296
|
+
s->data = clang_getRange(b->data, e->data);
|
297
|
+
|
298
|
+
// We use the parent of the first parameter (no real reason)
|
299
|
+
Data_Get_Struct(b->parent, SourceRange_t, p);
|
300
|
+
s->parent = p->parent;
|
301
|
+
|
302
|
+
return range;
|
303
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/*
|
2
|
+
* ruby-clangc ruby bindings for the C interface of Clang
|
3
|
+
* Copyright (C) 2015-2016 Cedric Le Moigne cedlemo <cedlemo@gmx.com>
|
4
|
+
*
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
8
|
+
* (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
* GNU General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU General Public License
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
*/
|
18
|
+
#ifndef _CLANGC_FUNCTIONS_H
|
19
|
+
#define _CLANGC_FUNCTIONS_H
|
20
|
+
#include <ruby/ruby.h>
|
21
|
+
#include "macros.h"
|
22
|
+
VALUE
|
23
|
+
m_clangc_get_version(VALUE);
|
24
|
+
|
25
|
+
VALUE
|
26
|
+
m_clangc_get_default_diagnostic_display_options(VALUE);
|
27
|
+
|
28
|
+
VALUE
|
29
|
+
m_clangc_get_default_editing_translation_unit_options(VALUE);
|
30
|
+
|
31
|
+
VALUE
|
32
|
+
m_clangc_get_default_code_complete_options(VALUE);
|
33
|
+
|
34
|
+
VALUE
|
35
|
+
m_clangc_get_null_source_range(VALUE);
|
36
|
+
|
37
|
+
VALUE
|
38
|
+
m_clangc_get_null_source_location(VALUE);
|
39
|
+
|
40
|
+
VALUE
|
41
|
+
m_clangc_get_null_cursor(VALUE);
|
42
|
+
|
43
|
+
VALUE
|
44
|
+
m_clangc_visit_children_with_proc(VALUE, VALUE, VALUE);
|
45
|
+
|
46
|
+
VALUE
|
47
|
+
m_clangc_visit_children_with_block(VALUE, VALUE);
|
48
|
+
|
49
|
+
VALUE
|
50
|
+
m_clangc_get_range(VALUE, VALUE, VALUE);
|
51
|
+
#endif
|
data/ext/clangc/clangc.c
ADDED
@@ -0,0 +1,376 @@
|
|
1
|
+
/*
|
2
|
+
* ruby-clangc ruby bindings for the C interface of Clang
|
3
|
+
* Copyright (C) 2015-2016 Cedric Le Moigne <cedlemo@gmx.com>
|
4
|
+
*
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
8
|
+
* (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
* GNU General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU General Public License
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
*/
|
18
|
+
#include <ruby/ruby.h>
|
19
|
+
#include "clang-c/Index.h"
|
20
|
+
|
21
|
+
#include "constants.h"
|
22
|
+
#include "_clangc_functions.h"
|
23
|
+
#include "class_Index.h"
|
24
|
+
#include "class_TranslationUnit.h"
|
25
|
+
#include "class_Diagnostic.h"
|
26
|
+
#include "class_File.h"
|
27
|
+
#include "class_SourceRange.h"
|
28
|
+
#include "class_SourceLocation.h"
|
29
|
+
#include "class_Cursor.h"
|
30
|
+
#include "class_Type.h"
|
31
|
+
#include "class_CursorSet.h"
|
32
|
+
#include "class_CompletionString.h"
|
33
|
+
#include "class_OverriddenCursor.h"
|
34
|
+
#include "class_Module.h"
|
35
|
+
#include "class_CodeCompleteResults.h"
|
36
|
+
#include "class_CompletionResult.h"
|
37
|
+
|
38
|
+
void Init_clangc(void) {
|
39
|
+
VALUE m_Clangc;
|
40
|
+
VALUE c_Index;
|
41
|
+
VALUE c_TranslationUnit;
|
42
|
+
VALUE c_Diagnostic;
|
43
|
+
VALUE c_File;
|
44
|
+
VALUE c_SourceRange;
|
45
|
+
VALUE c_SourceLocation;
|
46
|
+
VALUE c_Cursor;
|
47
|
+
VALUE c_OverriddenCursor;
|
48
|
+
VALUE c_Type;
|
49
|
+
VALUE c_CursorSet;
|
50
|
+
VALUE c_CompletionString;
|
51
|
+
VALUE c_Module;
|
52
|
+
VALUE c_CodeCompleteResults;
|
53
|
+
VALUE c_CompletionResult;
|
54
|
+
|
55
|
+
m_Clangc = rb_define_module("Clangc");
|
56
|
+
|
57
|
+
rb_define_module_function(m_Clangc, "version", RUBY_METHOD_FUNC(m_clangc_get_version), 0);// in _clangc_functions.c
|
58
|
+
rb_define_module_function(m_Clangc, "default_diagnostic_display_options", RUBY_METHOD_FUNC(m_clangc_get_default_diagnostic_display_options), 0);// in _clangc_functions.c
|
59
|
+
rb_define_module_function(m_Clangc, "default_editing_translation_unit_options", RUBY_METHOD_FUNC(m_clangc_get_default_editing_translation_unit_options), 0);// in _clangc_functions.c
|
60
|
+
rb_define_module_function(m_Clangc, "default_code_complete_options", RUBY_METHOD_FUNC(m_clangc_get_default_code_complete_options), 0);// in _clangc_functions.c
|
61
|
+
rb_define_module_function(m_Clangc, "null_source_range", RUBY_METHOD_FUNC(m_clangc_get_null_source_range), 0);// in _clangc_functions.c
|
62
|
+
rb_define_module_function(m_Clangc, "null_source_location", RUBY_METHOD_FUNC(m_clangc_get_null_source_location), 0);// in _clangc_functions.c
|
63
|
+
rb_define_module_function(m_Clangc, "null_cursor", RUBY_METHOD_FUNC(m_clangc_get_null_cursor), 0);// in _clangc_functions.c
|
64
|
+
rb_define_module_function(m_Clangc, "visit_children_with_proc", RUBY_METHOD_FUNC(m_clangc_visit_children_with_proc), 2);// in _clangc_functions.c
|
65
|
+
rb_define_module_function(m_Clangc, "visit_children_with_block", RUBY_METHOD_FUNC(m_clangc_visit_children_with_block), 1);// in _clangc_functions.c
|
66
|
+
rb_define_module_function(m_Clangc, "range", RUBY_METHOD_FUNC(m_clangc_get_range), 2);// in _clangc_functions.c
|
67
|
+
|
68
|
+
init_clang_enums_to_constants(m_Clangc);
|
69
|
+
init_clang_errors_enums_to_constants(m_Clangc);
|
70
|
+
|
71
|
+
/*
|
72
|
+
* An "index" consists of a set of translation units that would
|
73
|
+
* typically be linked together into an executable or library.
|
74
|
+
*/
|
75
|
+
c_Index = rb_define_class_under(m_Clangc, "Index", rb_cObject);
|
76
|
+
rb_define_alloc_func(c_Index, c_Index_struct_alloc);
|
77
|
+
rb_define_private_method(c_Index, "initialize", RUBY_METHOD_FUNC(c_Index_initialize), 2);// in class_Index.c
|
78
|
+
rb_define_method(c_Index, "global_options=", RUBY_METHOD_FUNC(c_Index_set_global_options), 1);// in class_Index.c
|
79
|
+
rb_define_method(c_Index, "global_options", RUBY_METHOD_FUNC(c_Index_get_global_options), 0);// in class_Index.c
|
80
|
+
rb_define_method(c_Index, "create_translation_unit_from_source_file", RUBY_METHOD_FUNC(c_Index_create_TU_from_source_file), 2);// in class_Index.c
|
81
|
+
rb_define_method(c_Index, "create_translation_unit", RUBY_METHOD_FUNC(c_Index_create_TU), 1);// in class_Index.c
|
82
|
+
rb_define_method(c_Index, "create_translation_unit2", RUBY_METHOD_FUNC(c_Index_create_TU2), 1);// in class_Index.c
|
83
|
+
rb_define_method(c_Index, "parse_translation_unit", RUBY_METHOD_FUNC(c_Index_parse_TU), 3);// in class_Index.c
|
84
|
+
rb_define_method(c_Index, "parse_translation_unit2", RUBY_METHOD_FUNC(c_Index_parse_TU2), 3);// in class_Index.c
|
85
|
+
#if (CINDEX_VERSION_MINOR >= 32)
|
86
|
+
rb_define_method(c_Index, "parse_translation_unit2_full_argv", RUBY_METHOD_FUNC(c_Index_parse_TU2_full_argv), 3);// in class_Index.c
|
87
|
+
#endif
|
88
|
+
|
89
|
+
/*
|
90
|
+
* A single TranslationUnit which resides in an Index
|
91
|
+
*/
|
92
|
+
c_TranslationUnit = rb_define_class_under(m_Clangc, "TranslationUnit", rb_cObject);
|
93
|
+
rb_define_alloc_func(c_TranslationUnit, c_TranslationUnit_struct_alloc);
|
94
|
+
rb_define_method(c_TranslationUnit, "diagnostics_num", RUBY_METHOD_FUNC(c_TranslationUnit_get_diagnostics_num), 0);// in class_TranslationUnit.c
|
95
|
+
rb_define_method(c_TranslationUnit, "default_save_options", RUBY_METHOD_FUNC(c_TranslationUnit_get_default_save_options), 0);// in class_TranslationUnit.c
|
96
|
+
rb_define_method(c_TranslationUnit, "spelling", RUBY_METHOD_FUNC(c_TranslationUnit_get_spelling), 0);// in class_TranslationUnit.c
|
97
|
+
rb_define_method(c_TranslationUnit, "default_reparse_options", RUBY_METHOD_FUNC(c_TranslationUnit_get_default_reparse_options), 0);// in class_TranslationUnit.c
|
98
|
+
rb_define_method(c_TranslationUnit, "diagnostic", RUBY_METHOD_FUNC(c_TranslationUnit_get_diagnostic), 1);// in class_TranslationUnit.c
|
99
|
+
rb_define_method(c_TranslationUnit, "file", RUBY_METHOD_FUNC(c_TranslationUnit_get_file), 1);// in class_TranslationUnit.c
|
100
|
+
rb_define_method(c_TranslationUnit, "cursor", RUBY_METHOD_FUNC(c_TranslationUnit_get_cursor), 0);// in class_TranslationUnit.c
|
101
|
+
rb_define_method(c_TranslationUnit, "module", RUBY_METHOD_FUNC(c_TranslationUnit_get_module), 1);// in class_TranslationUnit.c
|
102
|
+
rb_define_method(c_TranslationUnit, "code_complete_at", RUBY_METHOD_FUNC(c_TranslationUnit_code_complete_at), 4);// in class_TranslationUnit.c
|
103
|
+
rb_define_method(c_TranslationUnit, "reparse", RUBY_METHOD_FUNC(c_TranslationUnit_reparse), 1);// in class_TranslationUnit.c
|
104
|
+
rb_define_method(c_TranslationUnit, "skipped_ranges", RUBY_METHOD_FUNC(c_TranslationUnit_get_skipped_ranges), 1);// in class_TranslationUnit.c
|
105
|
+
|
106
|
+
/*
|
107
|
+
* A diagnostic object, containing the diagnostic's severity,
|
108
|
+
* location, text, source ranges, and fix-it hints.
|
109
|
+
*/
|
110
|
+
c_Diagnostic = rb_define_class_under(m_Clangc, "Diagnostic", rb_cObject);
|
111
|
+
rb_define_alloc_func(c_Diagnostic, c_Diagnostic_struct_alloc);
|
112
|
+
rb_define_method(c_Diagnostic, "severity", RUBY_METHOD_FUNC(c_Diagnostic_get_severity), 0);// in class_Diagnostic.c
|
113
|
+
rb_define_method(c_Diagnostic, "spelling", RUBY_METHOD_FUNC(c_Diagnostic_get_spelling), 0);// in class_Diagnostic.c
|
114
|
+
rb_define_method(c_Diagnostic, "category", RUBY_METHOD_FUNC(c_Diagnostic_get_category), 0);// in class_Diagnostic.c
|
115
|
+
rb_define_method(c_Diagnostic, "category_name", RUBY_METHOD_FUNC(c_Diagnostic_get_category_name), 0);// in class_Diagnostic.c
|
116
|
+
rb_define_method(c_Diagnostic, "category_text", RUBY_METHOD_FUNC(c_Diagnostic_get_category_text), 0);// in class_Diagnostic.c
|
117
|
+
rb_define_method(c_Diagnostic, "num_ranges", RUBY_METHOD_FUNC(c_Diagnostic_get_num_ranges), 0);// in class_Diagnostic.c
|
118
|
+
rb_define_method(c_Diagnostic, "num_fixits", RUBY_METHOD_FUNC(c_Diagnostic_get_num_fixits), 0);// in class_Diagnostic.c
|
119
|
+
rb_define_method(c_Diagnostic, "format", RUBY_METHOD_FUNC(c_Diagnostic_format), 1);// in class_Diagnostic.c
|
120
|
+
rb_define_method(c_Diagnostic, "option", RUBY_METHOD_FUNC(c_Diagnostic_get_option), 0);// in class_Diagnostic.c
|
121
|
+
rb_define_method(c_Diagnostic, "source_range", RUBY_METHOD_FUNC(c_Diagnostic_get_source_range), 1);// in class_Diagnostic.c
|
122
|
+
rb_define_method(c_Diagnostic, "source_location", RUBY_METHOD_FUNC(c_Diagnostic_get_source_location), 0);// in class_Diagnostic.c
|
123
|
+
rb_define_method(c_Diagnostic, "fixit", RUBY_METHOD_FUNC(c_Diagnostic_get_fixit), 1); // in class_Diagnostic.c
|
124
|
+
|
125
|
+
/*
|
126
|
+
* A particular source file that is part of a translation unit
|
127
|
+
*/
|
128
|
+
c_File = rb_define_class_under(m_Clangc, "File", rb_cObject);
|
129
|
+
rb_define_alloc_func(c_File, c_File_struct_alloc);
|
130
|
+
rb_define_method(c_File, "name", RUBY_METHOD_FUNC(c_File_get_name),0);// in class_File.c
|
131
|
+
rb_define_method(c_File, "mtime", RUBY_METHOD_FUNC(c_File_get_mtime),0);// in class_File.c
|
132
|
+
rb_define_method(c_File, "is_multiple_include_guarded", RUBY_METHOD_FUNC(c_File_is_multiple_include_guarded),0);// in class_File.c
|
133
|
+
#if (CINDEX_VERSION_MINOR >= 29)
|
134
|
+
rb_define_method(c_File, "is_equal", RUBY_METHOD_FUNC(c_File_is_equal), 1);// in class_File.c
|
135
|
+
#endif
|
136
|
+
|
137
|
+
/*
|
138
|
+
* Identifies a half-open character range in the source code.
|
139
|
+
*
|
140
|
+
* Use Clangc::SourceRange#start and Clangc::SourceRange#end to retrieve the
|
141
|
+
* starting and end locations from a source range, respectively.
|
142
|
+
*/
|
143
|
+
c_SourceRange = rb_define_class_under(m_Clangc, "SourceRange", rb_cObject);
|
144
|
+
rb_define_alloc_func(c_SourceRange, c_SourceRange_struct_alloc);
|
145
|
+
rb_define_method(c_SourceRange, "is_null", RUBY_METHOD_FUNC(c_SourceRange_is_null), 0);// in class_SourceRange.c
|
146
|
+
rb_define_method(c_SourceRange, "is_equal", RUBY_METHOD_FUNC(c_SourceRange_is_equal), 1);// in class_SourceRange.c
|
147
|
+
rb_define_method(c_SourceRange, "start", RUBY_METHOD_FUNC(c_SourceRange_get_start), 0);// in class_SourceRange.c
|
148
|
+
rb_define_method(c_SourceRange, "end", RUBY_METHOD_FUNC(c_SourceRange_get_end), 0);// in class_SourceRange.c
|
149
|
+
|
150
|
+
/**
|
151
|
+
* Identifies a specific source location within a translation
|
152
|
+
* unit.
|
153
|
+
*
|
154
|
+
* Use Clangc::SourceLocation#expansion or Clangc::SourceLocation#spelling
|
155
|
+
* to map a source location to a particular file, line, and column.
|
156
|
+
*/
|
157
|
+
c_SourceLocation = rb_define_class_under(m_Clangc, "SourceLocation", rb_cObject);
|
158
|
+
rb_define_alloc_func(c_SourceLocation, c_SourceLocation_struct_alloc);
|
159
|
+
rb_define_method(c_SourceLocation, "is_in_system_header", RUBY_METHOD_FUNC(c_SourceLocation_is_in_system_header), 0);// in class_SourceLocation.c
|
160
|
+
rb_define_method(c_SourceLocation, "is_from_main_file", RUBY_METHOD_FUNC(c_SourceLocation_is_from_main_file), 0);// in class_SourceLocation.c
|
161
|
+
rb_define_method(c_SourceLocation, "is_equal", RUBY_METHOD_FUNC(c_SourceLocation_is_equal), 1);// in class_SourceLocation.c
|
162
|
+
rb_define_method(c_SourceLocation, "spelling", RUBY_METHOD_FUNC(c_SourceLocation_get_spelling), 0);// in class_SourceLocation.c
|
163
|
+
rb_define_method(c_SourceLocation, "file_location", RUBY_METHOD_FUNC(c_SourceLocation_get_file_location), 0);// in class_SourceLocation.c
|
164
|
+
|
165
|
+
/**
|
166
|
+
* A cursor representing some element in the abstract syntax tree for
|
167
|
+
* a translation unit.
|
168
|
+
*
|
169
|
+
* The cursor abstraction unifies the different kinds of entities in a
|
170
|
+
* program--declaration, statements, expressions, references to declarations,
|
171
|
+
* etc.--under a single "cursor" abstraction with a common set of operations.
|
172
|
+
* Common operation for a cursor include: getting the physical location in
|
173
|
+
* a source file where the cursor points, getting the name associated with a
|
174
|
+
* cursor, and retrieving cursors for any child nodes of a particular cursor.
|
175
|
+
*
|
176
|
+
* Cursors can be produced in two specific ways.
|
177
|
+
* clangc::TranslationUnit.cursor produces a cursor for a translation unit,
|
178
|
+
* from which one can use clang.visitChildren to explore the rest of the
|
179
|
+
* translation unit. clang.getCursor maps from a physical source location
|
180
|
+
* to the entity that resides at that location, allowing one to map from the
|
181
|
+
* source code into the AST.
|
182
|
+
*/
|
183
|
+
c_Cursor = rb_define_class_under(m_Clangc, "Cursor", rb_cObject);
|
184
|
+
rb_define_alloc_func(c_Cursor, c_Cursor_struct_alloc);
|
185
|
+
rb_define_method(c_Cursor, "is_null", RUBY_METHOD_FUNC(c_Cursor_is_null), 0);// in class_Cursor.c
|
186
|
+
rb_define_method(c_Cursor, "is_equal", RUBY_METHOD_FUNC(c_Cursor_is_equal), 1);// in class_Cursor.c
|
187
|
+
rb_define_method(c_Cursor, "hash", RUBY_METHOD_FUNC(c_Cursor_get_hash), 0);// in class_Cursor.c
|
188
|
+
rb_define_method(c_Cursor, "kind", RUBY_METHOD_FUNC(c_Cursor_get_kind), 0);// in class_Cursor.c
|
189
|
+
rb_define_method(c_Cursor, "linkage", RUBY_METHOD_FUNC(c_Cursor_get_linkage), 0);// in class_Cursor.c
|
190
|
+
rb_define_method(c_Cursor, "availability", RUBY_METHOD_FUNC(c_Cursor_get_availability), 0);// in class_Cursor.c
|
191
|
+
rb_define_method(c_Cursor, "language", RUBY_METHOD_FUNC(c_Cursor_get_language), 0);// in class_Cursor.c
|
192
|
+
rb_define_method(c_Cursor, "type", RUBY_METHOD_FUNC(c_Cursor_get_type), 0);// in class_Cursor.c
|
193
|
+
rb_define_method(c_Cursor, "semantic_parent", RUBY_METHOD_FUNC(c_Cursor_get_semantic_parent), 0);// in class_Cursor.c
|
194
|
+
rb_define_method(c_Cursor, "lexical_parent", RUBY_METHOD_FUNC(c_Cursor_get_lexical_parent), 0);// in class_Cursor.c
|
195
|
+
rb_define_method(c_Cursor, "location", RUBY_METHOD_FUNC(c_Cursor_get_source_location), 0);// in class_Cursor.c
|
196
|
+
rb_define_method(c_Cursor, "extent", RUBY_METHOD_FUNC(c_Cursor_get_extent), 0);// in class_Cursor.c
|
197
|
+
rb_define_method(c_Cursor, "spelling", RUBY_METHOD_FUNC(c_Cursor_get_spelling), 0);// in class_Cursor.c
|
198
|
+
rb_define_method(c_Cursor, "typedef_decl_underlying_type", RUBY_METHOD_FUNC(c_Cursor_get_typedef_decl_underlying_type), 0);// in class_Cursor.c
|
199
|
+
rb_define_method(c_Cursor, "included_file", RUBY_METHOD_FUNC(c_Cursor_get_included_file), 0);// in class_Cursor.c
|
200
|
+
rb_define_method(c_Cursor, "is_declaration", RUBY_METHOD_FUNC(c_Cursor_is_declaration), 0);// in class_Cursor.c
|
201
|
+
rb_define_method(c_Cursor, "is_reference", RUBY_METHOD_FUNC(c_Cursor_is_reference), 0);// in class_Cursor.c
|
202
|
+
rb_define_method(c_Cursor, "is_expression", RUBY_METHOD_FUNC(c_Cursor_is_expression), 0);// in class_Cursor.c
|
203
|
+
rb_define_method(c_Cursor, "is_statement", RUBY_METHOD_FUNC(c_Cursor_is_statement), 0);// in class_Cursor.c
|
204
|
+
rb_define_method(c_Cursor, "is_attribute", RUBY_METHOD_FUNC(c_Cursor_is_attribute), 0);// in class_Cursor.c
|
205
|
+
rb_define_method(c_Cursor, "is_invalid", RUBY_METHOD_FUNC(c_Cursor_is_invalid), 0);// in class_Cursor.c
|
206
|
+
rb_define_method(c_Cursor, "is_translation_unit", RUBY_METHOD_FUNC(c_Cursor_is_translation_unit), 0);// in class_Cursor.c
|
207
|
+
rb_define_method(c_Cursor, "is_preprocessing", RUBY_METHOD_FUNC(c_Cursor_is_preprocessing), 0);// in class_Cursor.c
|
208
|
+
rb_define_method(c_Cursor, "enum_decl_integer_type", RUBY_METHOD_FUNC(c_Cursor_get_enum_decl_integer_type), 0);// in class_Cursor.c
|
209
|
+
rb_define_method(c_Cursor, "enum_const_decl_value", RUBY_METHOD_FUNC(c_Cursor_get_enum_const_decl_value), 0);// in class_Cursor.c
|
210
|
+
rb_define_method(c_Cursor, "enum_const_decl_unsigned_value", RUBY_METHOD_FUNC(c_Cursor_get_enum_const_decl_unsigned_value), 0);// in class_Cursor.c
|
211
|
+
rb_define_method(c_Cursor, "field_decl_bit_width", RUBY_METHOD_FUNC(c_Cursor_get_field_decl_bit_width), 0);// in class_Cursor.c
|
212
|
+
rb_define_method(c_Cursor, "num_arguments", RUBY_METHOD_FUNC(c_Cursor_get_num_arguments), 0);// in class_Cursor.c
|
213
|
+
rb_define_method(c_Cursor, "argument", RUBY_METHOD_FUNC(c_Cursor_get_argument), 1);// in class_Cursor.c
|
214
|
+
#if (CINDEX_VERSION_MINOR >= 29)
|
215
|
+
rb_define_method(c_Cursor, "num_template_arguments", RUBY_METHOD_FUNC(c_Cursor_get_num_template_arguments), 0);// in class_Cursor.c
|
216
|
+
#endif
|
217
|
+
rb_define_method(c_Cursor, "decl_obj_c_type_encoding", RUBY_METHOD_FUNC(c_Cursor_get_decl_obj_c_type_encoding), 0);// in class_Cursor.c
|
218
|
+
rb_define_method(c_Cursor, "result_type", RUBY_METHOD_FUNC(c_Cursor_get_result_type), 0);// in class_Cursor.c
|
219
|
+
#if (CINDEX_VERSION_MINOR >= 30)
|
220
|
+
rb_define_method(c_Cursor, "offset_of_field", RUBY_METHOD_FUNC(c_Cursor_get_offset_of_field), 0);// in class_Cursor.c
|
221
|
+
rb_define_method(c_Cursor, "is_anonymous", RUBY_METHOD_FUNC(c_Cursor_is_anonymous), 0);// in class_Cursor.c
|
222
|
+
#endif
|
223
|
+
rb_define_method(c_Cursor, "is_bit_field", RUBY_METHOD_FUNC(c_Cursor_is_bit_field), 0);// in class_Cursor.c
|
224
|
+
rb_define_method(c_Cursor, "is_virtual_base", RUBY_METHOD_FUNC(c_Cursor_is_virtual_base), 0);// in class_Cursor.c
|
225
|
+
rb_define_method(c_Cursor, "cxx_access_specifier", RUBY_METHOD_FUNC(c_Cursor_get_cxx_access_specifier), 0);// in class_Cursor.c
|
226
|
+
#if (CINDEX_VERSION_MINOR >= 29)
|
227
|
+
rb_define_method(c_Cursor, "storage_class", RUBY_METHOD_FUNC(c_Cursor_get_storage_class), 0);// in class_Cursor.c
|
228
|
+
#endif
|
229
|
+
rb_define_method(c_Cursor, "num_overloaded_decls", RUBY_METHOD_FUNC(c_Cursor_get_num_overloaded_decls), 0);// in class_Cursor.c
|
230
|
+
rb_define_method(c_Cursor, "overloaded_decl", RUBY_METHOD_FUNC(c_Cursor_get_overloaded_decl), 1);// in class_Cursor.c
|
231
|
+
rb_define_method(c_Cursor, "ib_outlet_collection_type", RUBY_METHOD_FUNC(c_Cursor_get_ib_outlet_collection_type), 0);// in class_Cursor.c
|
232
|
+
rb_define_method(c_Cursor, "usr", RUBY_METHOD_FUNC(c_Cursor_get_usr), 0);// in class_Cursor.c
|
233
|
+
rb_define_method(c_Cursor, "display_name", RUBY_METHOD_FUNC(c_Cursor_get_display_name), 0);// in class_Cursor.c
|
234
|
+
rb_define_method(c_Cursor, "referenced", RUBY_METHOD_FUNC(c_Cursor_get_referenced), 0);// in class_Cursor.c
|
235
|
+
rb_define_method(c_Cursor, "definition", RUBY_METHOD_FUNC(c_Cursor_get_definition), 0);// in class_Cursor.c
|
236
|
+
rb_define_method(c_Cursor, "is_definition", RUBY_METHOD_FUNC(c_Cursor_is_definition), 0);// in class_Cursor.c
|
237
|
+
rb_define_method(c_Cursor, "canonical_cursor", RUBY_METHOD_FUNC(c_Cursor_get_canonical_cursor), 0);// in class_Cursor.c
|
238
|
+
rb_define_method(c_Cursor, "obj_c_selector_index", RUBY_METHOD_FUNC(c_Cursor_get_obj_c_selector_index), 0);// in class_Cursor.c
|
239
|
+
rb_define_method(c_Cursor, "is_dynamic_call", RUBY_METHOD_FUNC(c_Cursor_is_dynamic_call), 0);// in class_Cursor.c
|
240
|
+
rb_define_method(c_Cursor, "receiver_type", RUBY_METHOD_FUNC(c_Cursor_get_receiver_type), 0);// in class_Cursor.c
|
241
|
+
rb_define_method(c_Cursor, "obj_c_decl_qualifiers", RUBY_METHOD_FUNC(c_Cursor_get_obj_c_decl_qualifiers), 0);// in class_Cursor.c
|
242
|
+
rb_define_method(c_Cursor, "is_obj_c_optional", RUBY_METHOD_FUNC(c_Cursor_is_obj_c_optional), 0);// in class_Cursor.c
|
243
|
+
rb_define_method(c_Cursor, "is_variadic", RUBY_METHOD_FUNC(c_Cursor_is_variadic), 0);// in class_Cursor.c
|
244
|
+
rb_define_method(c_Cursor, "comment_range", RUBY_METHOD_FUNC(c_Cursor_get_comment_range), 0);// in class_Cursor.c
|
245
|
+
rb_define_method(c_Cursor, "raw_comment_text", RUBY_METHOD_FUNC(c_Cursor_get_raw_comment_text), 0);// in class_Cursor.c
|
246
|
+
rb_define_method(c_Cursor, "brief_comment_text", RUBY_METHOD_FUNC(c_Cursor_get_brief_comment_text), 0);// in class_Cursor.c
|
247
|
+
#if (CINDEX_VERSION_MINOR >= 29)
|
248
|
+
rb_define_method(c_Cursor, "mangling", RUBY_METHOD_FUNC(c_Cursor_get_mangling), 0);// in class_Cursor.c
|
249
|
+
#endif
|
250
|
+
rb_define_method(c_Cursor, "cxx_method_is_pure_virtual", RUBY_METHOD_FUNC(c_Cursor_cxx_method_is_pure_virtual), 0);// in class_Cursor.c
|
251
|
+
rb_define_method(c_Cursor, "cxx_method_is_static", RUBY_METHOD_FUNC(c_Cursor_cxx_method_is_static), 0);// in class_Cursor.c
|
252
|
+
rb_define_method(c_Cursor, "cxx_method_is_virtual", RUBY_METHOD_FUNC(c_Cursor_cxx_method_is_virtual), 0);// in class_Cursor.c
|
253
|
+
rb_define_method(c_Cursor, "cxx_method_is_const", RUBY_METHOD_FUNC(c_Cursor_cxx_method_is_const), 0);// in class_Cursor.c
|
254
|
+
rb_define_method(c_Cursor, "template_cursor_kind", RUBY_METHOD_FUNC(c_Cursor_get_template_cursor_kind), 0);// in class_Cursor.c
|
255
|
+
rb_define_method(c_Cursor, "specialized_cursor_template", RUBY_METHOD_FUNC(c_Cursor_get_specialized_cursor_template), 0);// in class_Cursor.c
|
256
|
+
rb_define_method(c_Cursor, "completion_string", RUBY_METHOD_FUNC(c_Cursor_get_completion_string), 0);// in class_Cursor.c
|
257
|
+
#if (CINDEX_VERSION_MINOR >= 29)
|
258
|
+
rb_define_method(c_Cursor, "template_argument_kind", RUBY_METHOD_FUNC(c_Cursor_get_template_argument_kind), 1);// in class_Cursor.c
|
259
|
+
rb_define_method(c_Cursor, "template_argument_type", RUBY_METHOD_FUNC(c_Cursor_get_template_argument_type), 1);// in class_Cursor.c
|
260
|
+
rb_define_method(c_Cursor, "template_argument_value", RUBY_METHOD_FUNC(c_Cursor_get_template_argument_value), 1);// in class_Cursor.c
|
261
|
+
rb_define_method(c_Cursor, "template_argument_unsigned_value", RUBY_METHOD_FUNC(c_Cursor_get_template_argument_unsigned_value), 1);// in class_Cursor.c
|
262
|
+
#endif
|
263
|
+
rb_define_method(c_Cursor, "obj_c_property_attributes", RUBY_METHOD_FUNC(c_Cursor_get_obj_c_property_attributes), 1);// in class_Cursor.c
|
264
|
+
rb_define_method(c_Cursor, "overridden_cursors", RUBY_METHOD_FUNC(c_Cursor_get_overridden_cursors), 0);// in class_Cursor.c
|
265
|
+
rb_define_method(c_Cursor, "module", RUBY_METHOD_FUNC(c_Cursor_get_module), 0);// in class_Cursor.c
|
266
|
+
rb_define_method(c_Cursor, "spelling_name_range", RUBY_METHOD_FUNC(c_Cursor_get_spelling_name_range), 2);// in class_Cursor.c
|
267
|
+
rb_define_method(c_Cursor, "reference_name_range", RUBY_METHOD_FUNC(c_Cursor_get_reference_name_range), 2);// in class_Cursor.c
|
268
|
+
|
269
|
+
/*
|
270
|
+
* Overriden Cursor is a subclass of cursor created because they need to be freed
|
271
|
+
* unlike the basics Clangc::Cursor
|
272
|
+
* */
|
273
|
+
c_OverriddenCursor = rb_define_class_under(m_Clangc, "OverriddenCursor", c_Cursor);
|
274
|
+
rb_define_alloc_func(c_OverriddenCursor, c_OverriddenCursor_struct_alloc);
|
275
|
+
|
276
|
+
|
277
|
+
/*
|
278
|
+
* Type informations for Clangc::Cursor
|
279
|
+
*/
|
280
|
+
c_Type = rb_define_class_under(m_Clangc, "Type", rb_cObject);
|
281
|
+
rb_define_alloc_func(c_Type, c_Type_struct_alloc);
|
282
|
+
rb_define_method(c_Type, "kind", RUBY_METHOD_FUNC(c_Type_get_kind), 0);// in class_Type.c
|
283
|
+
rb_define_method(c_Type, "spelling", RUBY_METHOD_FUNC(c_Type_get_spelling), 0);// in class_Type.c
|
284
|
+
rb_define_method(c_Type, "is_equal", RUBY_METHOD_FUNC(c_Type_is_equal), 1);// in class_Type.c
|
285
|
+
rb_define_method(c_Type, "canonical_type", RUBY_METHOD_FUNC(c_Type_get_canonical_type), 0);// in class_Type.c
|
286
|
+
rb_define_method(c_Type, "pointee_type", RUBY_METHOD_FUNC(c_Type_get_pointee_type), 0);// in class_Type.c
|
287
|
+
rb_define_method(c_Type, "is_const_qualified", RUBY_METHOD_FUNC(c_Type_is_const_qualified), 0);// in class_Type.c
|
288
|
+
rb_define_method(c_Type, "is_volatile_qualified", RUBY_METHOD_FUNC(c_Type_is_volatile_qualified), 0);// in class_Type.c
|
289
|
+
rb_define_method(c_Type, "is_restrict_qualified", RUBY_METHOD_FUNC(c_Type_is_restrict_qualified), 0);// in class_Type.c
|
290
|
+
rb_define_method(c_Type, "result_type", RUBY_METHOD_FUNC(c_Type_get_result_type), 0);// in class_Type.c
|
291
|
+
rb_define_method(c_Type, "calling_conv", RUBY_METHOD_FUNC(c_Type_get_calling_conv), 0);// in class_Type.c
|
292
|
+
rb_define_method(c_Type, "num_arg_types", RUBY_METHOD_FUNC(c_Type_get_num_arg_types), 0);// in class_Type.c
|
293
|
+
rb_define_method(c_Type, "arg_type", RUBY_METHOD_FUNC(c_Type_get_arg_type), 1);// in class_Type.c
|
294
|
+
rb_define_method(c_Type, "element_type", RUBY_METHOD_FUNC(c_Type_get_element_type), 0);// in class_Type.c
|
295
|
+
rb_define_method(c_Type, "num_elements", RUBY_METHOD_FUNC(c_Type_get_num_elements), 0);// in class_Type.c
|
296
|
+
rb_define_method(c_Type, "array_element_type", RUBY_METHOD_FUNC(c_Type_get_array_element_type), 0);// in class_Type.c
|
297
|
+
rb_define_method(c_Type, "array_size", RUBY_METHOD_FUNC(c_Type_get_array_size), 0);// in class_Type.c
|
298
|
+
rb_define_method(c_Type, "is_pod", RUBY_METHOD_FUNC(c_Type_is_pod), 0);// in class_Type.c
|
299
|
+
rb_define_method(c_Type, "type_declaration", RUBY_METHOD_FUNC(c_Type_get_type_declaration), 0);// in class_Type.c
|
300
|
+
rb_define_method(c_Type, "is_function_type_variadic", RUBY_METHOD_FUNC(c_Type_is_function_type_variadic), 0);// in class_Type.c
|
301
|
+
rb_define_method(c_Type, "align_of", RUBY_METHOD_FUNC(c_Type_get_align_of), 0);// in class_Type.c
|
302
|
+
rb_define_method(c_Type, "size_of", RUBY_METHOD_FUNC(c_Type_get_size_of), 0);// in class_Type.c
|
303
|
+
rb_define_method(c_Type, "class_type", RUBY_METHOD_FUNC(c_Type_get_class_type), 0);// in class_Type.c
|
304
|
+
rb_define_method(c_Type, "offset_of", RUBY_METHOD_FUNC(c_Type_get_offset_of), 1);// in class_Type.c
|
305
|
+
rb_define_method(c_Type, "num_template_arguments", RUBY_METHOD_FUNC(c_Type_get_num_template_arguments), 0);// in class_Type.c
|
306
|
+
rb_define_method(c_Type, "template_argument_as_type", RUBY_METHOD_FUNC(c_Type_get_template_argument_as_type), 1);// in class_Type.c
|
307
|
+
rb_define_method(c_Type, "cxx_ref_qualifier", RUBY_METHOD_FUNC(c_Type_get_cxx_ref_qualifier), 0);// in class_Type.c
|
308
|
+
|
309
|
+
/**
|
310
|
+
* \brief A fast container representing a set of CXCursors.
|
311
|
+
*/
|
312
|
+
c_CursorSet = rb_define_class_under(m_Clangc, "CursorSet", rb_cObject);
|
313
|
+
rb_define_alloc_func(c_CursorSet, c_CursorSet_struct_alloc);
|
314
|
+
rb_define_private_method(c_CursorSet, "initialize", RUBY_METHOD_FUNC(c_CursorSet_initialize), 0);// in class_CursorSet.c
|
315
|
+
rb_define_method(c_CursorSet, "contains", RUBY_METHOD_FUNC(c_CursorSet_contains), 1);// in class_CursorSet.c
|
316
|
+
rb_define_method(c_CursorSet, "insert", RUBY_METHOD_FUNC(c_CursorSet_insert), 1);// in class_CursorSet.c
|
317
|
+
|
318
|
+
/**
|
319
|
+
* \brief A semantic string that describes a code-completion result.
|
320
|
+
*
|
321
|
+
* A semantic string that describes the formatting of a code-completion
|
322
|
+
* result as a single "template" of text that should be inserted into the
|
323
|
+
* source buffer when a particular code-completion result is selected.
|
324
|
+
* Each semantic string is made up of some number of "chunks", each of which
|
325
|
+
* contains some text along with a description of what that text means, e.g.,
|
326
|
+
* the name of the entity being referenced, whether the text chunk is part of
|
327
|
+
* the template, or whether it is a "placeholder" that the user should replace
|
328
|
+
* with actual code,of a specific kind. See \c CXCompletionChunkKind for a
|
329
|
+
* description of the different kinds of chunks.
|
330
|
+
*/
|
331
|
+
c_CompletionString = rb_define_class_under(m_Clangc, "CompletionString", rb_cObject);
|
332
|
+
rb_define_alloc_func(c_CompletionString, c_CompletionString_struct_alloc);
|
333
|
+
rb_define_method(c_CompletionString, "availability", RUBY_METHOD_FUNC(c_CompletionString_get_availability), 0);// in class_CompletionString.c
|
334
|
+
rb_define_method(c_CompletionString, "priority", RUBY_METHOD_FUNC(c_CompletionString_get_priority), 0);// in class_CompletionString.c
|
335
|
+
rb_define_method(c_CompletionString, "num_chunks", RUBY_METHOD_FUNC(c_CompletionString_get_num_chunks), 0);// in class_CompletionString.c
|
336
|
+
rb_define_method(c_CompletionString, "chunk_kind", RUBY_METHOD_FUNC(c_CompletionString_get_chunk_kind), 1);// in class_CompletionString.c
|
337
|
+
rb_define_method(c_CompletionString, "chunk_text", RUBY_METHOD_FUNC(c_CompletionString_get_chunk_text), 1);// in class_CompletionString.c
|
338
|
+
rb_define_method(c_CompletionString, "num_annotations", RUBY_METHOD_FUNC(c_CompletionString_get_num_annotations), 0);// in class_CompletionString.c
|
339
|
+
rb_define_method(c_CompletionString, "annotation", RUBY_METHOD_FUNC(c_CompletionString_get_annotation), 1);// in class_CompletionString.c
|
340
|
+
rb_define_method(c_CompletionString, "brief_comment", RUBY_METHOD_FUNC(c_CompletionString_get_brief_comment), 0);// in class_CompletionString.c
|
341
|
+
rb_define_method(c_CompletionString, "chunk_completion_string", RUBY_METHOD_FUNC(c_CompletionString_get_chunk_completion_string), 1);// in class_CompletionString.c
|
342
|
+
|
343
|
+
/**
|
344
|
+
* CXModule class and method
|
345
|
+
*/
|
346
|
+
c_Module = rb_define_class_under(m_Clangc, "Module", rb_cObject);
|
347
|
+
rb_define_alloc_func(c_Module, c_Module_struct_alloc);
|
348
|
+
rb_define_method(c_Module, "ast_file", RUBY_METHOD_FUNC(c_Module_get_ast_file), 0);// in class_Module.c
|
349
|
+
rb_define_method(c_Module, "parent", RUBY_METHOD_FUNC(c_Module_get_parent), 0);// in class_Module.c
|
350
|
+
rb_define_method(c_Module, "name", RUBY_METHOD_FUNC(c_Module_get_name), 0);// in class_Module.c
|
351
|
+
rb_define_method(c_Module, "full_name", RUBY_METHOD_FUNC(c_Module_get_full_name), 0);// in class_Module.c
|
352
|
+
rb_define_method(c_Module, "is_system", RUBY_METHOD_FUNC(c_Module_is_system), 0);// in class_Module.c
|
353
|
+
rb_define_method(c_Module, "num_top_level_headers", RUBY_METHOD_FUNC(c_Module_get_num_top_level_headers), 1);// in class_Module.c
|
354
|
+
rb_define_method(c_Module, "top_level_header", RUBY_METHOD_FUNC(c_Module_get_top_level_header), 2);// in class_Module.c
|
355
|
+
|
356
|
+
/**
|
357
|
+
* CXCodeCompleteResults class and method
|
358
|
+
*/
|
359
|
+
c_CodeCompleteResults = rb_define_class_under(m_Clangc, "CodeCompleteResults", rb_cObject);
|
360
|
+
rb_define_alloc_func(c_CodeCompleteResults, c_CodeCompleteResults_struct_alloc);
|
361
|
+
rb_define_method(c_CodeCompleteResults, "num_results", RUBY_METHOD_FUNC(c_CodeCompleteResults_get_num_results), 0);// in class_CodeCompleteResults.c
|
362
|
+
rb_define_method(c_CodeCompleteResults, "result", RUBY_METHOD_FUNC(c_CodeCompleteResults_get_result), 1);// in class_CodeCompleteResults.c
|
363
|
+
rb_define_method(c_CodeCompleteResults, "container_usr", RUBY_METHOD_FUNC(c_CodeCompleteResults_get_container_usr), 0);// in class_CodeCompleteResults.c
|
364
|
+
rb_define_method(c_CodeCompleteResults, "num_diagnostics", RUBY_METHOD_FUNC(c_CodeCompleteResults_get_num_diagnostics), 0);// in class_CodeCompleteResults.c
|
365
|
+
rb_define_method(c_CodeCompleteResults, "diagnostic", RUBY_METHOD_FUNC(c_CodeCompleteResults_get_diagnostic), 1);// in class_CodeCompleteResults.c
|
366
|
+
rb_define_method(c_CodeCompleteResults, "sort_results", RUBY_METHOD_FUNC(c_CodeCompleteResults_sort_results), 0);// in class_CodeCompleteResults.c
|
367
|
+
rb_define_method(c_CodeCompleteResults, "contexts", RUBY_METHOD_FUNC(c_CodeCompleteResults_get_contexts), 0);// in class_CodeCompleteResults.c
|
368
|
+
|
369
|
+
/**
|
370
|
+
* CXCompletionResult class and method
|
371
|
+
*/
|
372
|
+
c_CompletionResult = rb_define_class_under(m_Clangc, "CompletionResult", rb_cObject);
|
373
|
+
rb_define_alloc_func(c_CompletionResult, c_CompletionResult_struct_alloc);
|
374
|
+
rb_define_method(c_CompletionResult, "cursor_kind", RUBY_METHOD_FUNC(c_CompletionResult_get_cursor_kind), 0);// in class_CompletionResult.c
|
375
|
+
rb_define_method(c_CompletionResult, "completion_string", RUBY_METHOD_FUNC(c_CompletionResult_get_completion_string), 0);// in class_CompletionResult.c
|
376
|
+
}
|