forked from SimonRichards/clang-sharp
/
Interop.cs
519 lines (367 loc) · 25.9 KB
/
Interop.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
using System;
using System.Runtime.InteropServices;
using Index = System.IntPtr;
using File = System.IntPtr;
using TranslationUnit = System.IntPtr;
using ClientData = System.IntPtr;
using Diagnostic = System.IntPtr;
using CompletionString = System.IntPtr;
namespace ClangSharp {
internal class Interop {
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
internal unsafe struct ClangString {
readonly void* Spelling;
readonly uint MustFreeString;
public string ManagedString {
get {
string res = Marshal.PtrToStringAnsi((IntPtr)Spelling);
Interop.clang_disposeString(this);
return res;
}
}
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
internal struct UnsavedFile {
internal string Filename;
internal string Contents;
internal ulong Length;
}
[StructLayout(LayoutKind.Sequential)]
internal struct Type {
internal ClangSharp.Type.Kind kind;
readonly IntPtr data0, data1;
};
[StructLayout(LayoutKind.Sequential)]
internal struct SourceLocation {
readonly IntPtr data0;
readonly IntPtr data1;
readonly uint data2;
public bool Equals(SourceLocation other) {
return data0 == other.data0 && data1 == other.data1 && data2 == other.data2;
}
}
[StructLayout(LayoutKind.Sequential)]
internal struct SourceRange {
readonly IntPtr data0;
readonly IntPtr data1;
readonly uint beginIntData;
readonly uint endIntData;
}
[StructLayout(LayoutKind.Sequential)]
internal struct Cursor {
readonly CursorKind kind;
readonly int xdata;
readonly IntPtr data0, data1, data2;
};
[StructLayout(LayoutKind.Sequential)]
internal struct CompletionResult {
internal CursorKind kind;
internal CompletionString completionString;
}
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct CodeCompleteResults {
internal CompletionResult* results;
internal uint NumResults;
}
[StructLayout(LayoutKind.Sequential)]
internal struct Token {
readonly uint data0, data1, data2, data3;
readonly internal IntPtr ptr;
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void InclusionVisitor(
IntPtr includedFile,
IntPtr inclusionStack,
uint stackSize,
ClientData clientData);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate ClangSharp.Cursor.ChildVisitResult CursorVisitor(Cursor cursor, Cursor parent, ClientData data);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void ChildVistor(Cursor cursor, Cursor parent, ClientData clientData);
const string nativeLib = "libclang";
const CallingConvention convention = CallingConvention.Cdecl;
const CharSet charSet = CharSet.Ansi;
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern void clang_disposeString(ClangString str);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern IntPtr clang_createIndex(int excludeDeclarationsFromPch, int displayDiagnostics);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern void clang_disposeIndex(IntPtr index);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern void clang_setUseExternalASTGeneration(IntPtr index, int value);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_getFileName(IntPtr file);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern long clang_getFileTime(IntPtr file);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_isFileMultipleIncludeGuarded(IntPtr tu, IntPtr file);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern IntPtr clang_getFile(IntPtr tu, string filename);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern SourceLocation clang_getNullLocation();
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_equalLocations(SourceLocation loc1, SourceLocation loc2);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern SourceLocation clang_getLocation(IntPtr tu, IntPtr file, uint line, uint column);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern SourceRange clang_getNullRange();
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern SourceRange clang_getRange(SourceLocation begin, SourceLocation end);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public unsafe static extern void clang_getInstantiationLocation(
SourceLocation location, IntPtr* file, out uint line, out uint column, out uint offset);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern SourceLocation clang_getRangeStart(SourceRange range);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern SourceLocation clang_getRangeEnd(SourceRange range);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_getNumDiagnostics(IntPtr tu);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern IntPtr clang_getDiagnostic(IntPtr tu, uint index);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern void clang_disposeDiagnostic(IntPtr diag);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_formatDiagnostic(
IntPtr diag, Diagnostic.DisplayOptions options);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_defaultDiagnosticDisplayOptions();
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern Diagnostic.Severity clang_getDiagnosticSeverity(IntPtr diag);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern SourceLocation clang_getDiagnosticLocation(IntPtr diag);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_getDiagnosticSpelling(IntPtr diag);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_getDiagnosticNumRanges(IntPtr diag);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern SourceRange clang_getDiagnosticRange(IntPtr diag, uint range);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_getDiagnosticNumFixIts(IntPtr diag);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_getDiagnosticFixIt(
IntPtr diag, uint fixit, out SourceRange replacementRange);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_getTranslationUnitSpelling(IntPtr tu);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern IntPtr clang_createTranslationUnitFromSourceFile(
IntPtr index, string sourceFilename, int numClangCommandLineArgs,
string[] clangCommandLineArgs, uint numUnsavedFiles, UnsavedFile[] unsavedFiles);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern IntPtr clang_createTranslationUnit(IntPtr index, string astFilename);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern IntPtr clang_parseTranslationUnit(
IntPtr index, string filename, string[] args, int numArgs,
UnsavedFile[] unsavedFiles, uint numUnsavedFiles, TranslationUnitFlags options);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern void clang_disposeTranslationUnit(IntPtr tu);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_hashCursor(Cursor cursor);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern Cursor clang_getNullCursor();
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern Cursor clang_getTranslationUnitCursor(IntPtr tu);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_equalCursors(Cursor a, Cursor b);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern CursorKind clang_getCursorKind(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern Cursor clang_getCursorLexicalParent(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern Cursor clang_getCursorSemanticParent(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_isDeclaration(CursorKind ck);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_isReference(CursorKind ck);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_isExpression(CursorKind ck);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_isStatement(CursorKind ck);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_isAttribute(CursorKind ck);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_isInvalid(CursorKind ck);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_isTranslationUnit(CursorKind ck);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_isPreprocessing(CursorKind ck);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_isUnexposed(CursorKind ck);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern LinkageKind clang_getCursorLinkage(Cursor cursor);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern LanguageKind clang_getCursorLanguage(Cursor cursor);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern Cursor clang_getCursor(IntPtr tu, SourceLocation loc);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern SourceLocation clang_getCursorLocation(Cursor cursor);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern SourceRange clang_getCursorExtent(Cursor cursor);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern Type clang_getCursorType(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_getTypeSpelling(Type c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern Type clang_getTypedefDeclUnderlyingType(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern Type clang_getEnumDeclIntegerType(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern long clang_getEnumConstantDeclValue(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern int clang_getFieldDeclBitWidth(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_getNumOverloadedDecls(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
internal static extern Cursor clang_getOverloadedDecl(Cursor c, uint i);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
internal static extern int clang_Cursor_getNumArguments(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
internal static extern Cursor clang_Cursor_getArgument(Cursor c, uint i);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
internal static extern Type clang_getArgType(Cursor c, uint i);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
internal static extern bool clang_isPODType(Type c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_equalTypes(Type a, Type b);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern Type clang_getCanonicalType(Type t);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern Type clang_getPointeeType(Type t);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern Cursor clang_getTypeDeclaration(Type t);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_getTypeKindSpelling(ClangSharp.Type.Kind k);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern Type clang_getResultType(Type t);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
internal static extern Type clang_getArrayElementType(Type t);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern long clang_getArraySize(Type t);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
internal static extern int clang_getNumArgTypes(Type t);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
internal static extern Type clang_getArgType(Type t, uint i);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_isConstQualifiedType(Type ck);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_isRestrictQualifiedType(Type ck);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_isVolatileQualifiedType(Type ck);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
internal static extern uint clang_isFunctionTypeVariadic(Type t);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern Type clang_getCursorResultType(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_getCursorUSR(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_constructUSR_ObjCClass(string className);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_constructUSR_ObjCCategory(string className, string categoryName);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_constructUSR_ObjCProtocol(string protocolName);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_constructUSR_ObjCIvar(string name, ClangString classUSR);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_constructUSR_ObjCMethod(
string name, uint isInstanceMethod, ClangString classUSR);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_constructUSR_ObjCProperty(string prop, ClangString classUSR);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_getCursorSpelling(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_getCursorDisplayName(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern Cursor clang_getCursorReferenced(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern Cursor clang_getCursorDefinition(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_isCursorDefinition(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_CXXMethod_isStatic(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
internal static extern uint clang_CXXMethod_isPureVirtual(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
internal static extern uint clang_CXXMethod_isVirtual(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
internal static extern CursorKind clang_getTemplateCursorKind(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
internal static extern Cursor clang_getSpecializedCursorTemplate(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
internal static extern SourceRange clang_getCursorReferenceNameRange(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
internal static extern AccessSpecifier clang_getCXXAccessSpecifier(Cursor c);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern TokenKind clang_getTokenKind(Token t);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_getTokenSpelling(IntPtr tu, Token t);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern SourceLocation clang_getTokenLocation(IntPtr tu, Token t);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern SourceRange clang_getTokenExtent(IntPtr tu, Token t);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern void clang_tokenize(IntPtr tu, SourceRange range, out IntPtr tokens, out uint numTokens);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern void clang_annotateTokens(IntPtr tu, IntPtr tokens, uint numTokens, IntPtr cursors);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern void clang_disposeTokens(IntPtr tu, IntPtr tokens, uint numTokens);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_getCursorKindSpelling(CursorKind ck);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern CodeCompletion.Chunk.ChunkKind clang_getCompletionChunkKind(CompletionString cs, uint chunk);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_getCompletionChunkText(CompletionString cs, uint chunk);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern CompletionString clang_getCompletionChunkCompletionString(CompletionString cs, uint chunk);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_getNumCompletionChunks(CompletionString cs);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_getCompletionPriority(CompletionString cs);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern CodeCompletion.AvailabilityKind clang_getCompletionAvailability(CompletionString native);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_getCompletionNumAnnotations(CompletionString native);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_getCompletionAnnotation(CompletionString native, uint index);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_getCompletionAnnotation(CompletionString native);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public unsafe static extern CodeCompleteResults* clang_codeCompleteAt(
IntPtr translationUnit, string filename, uint line, uint column,
UnsavedFile[] unsavedFiles, uint numUnsavedFiles, uint options);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public unsafe static extern void clang_disposeCodeCompleteResults(CodeCompleteResults* results);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public unsafe static extern uint clang_codeCompleteGetNumDiagnostics(CodeCompleteResults* results);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public unsafe static extern IntPtr clang_codeCompleteGetDiagnostic(CodeCompleteResults* results, uint index);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_defaultCodeCompleteOptions();
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern IntPtr clang_getDiagnosticSetFromTU(IntPtr translationUnit);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_getNumDiagnosticsInSet(IntPtr diagnosticSet);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern IntPtr clang_getDiagnosticInSet(IntPtr diagnosticSet, uint index);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern ClangString clang_getClangVersion();
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern void clang_toggleCrashRecovery(uint isEnabled);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern void clang_getInclusions(IntPtr tu, InclusionVisitor visitor, ClientData data);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_visitChildren(Cursor parent, CursorVisitor visitor, ClientData clientData);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern IntPtr clang_Cursor_getTranslationUnit(Cursor cursor); // TODO Does this need disposing?
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_Cursor_isBitField(Cursor native);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern int clang_Cursor_isDynamicCall(Cursor native);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern int clang_Cursor_isNull(Cursor native);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_Cursor_isObjCOptional(Cursor native);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_Cursor_isVariadic(Cursor native);
[DllImport(nativeLib, CallingConvention = convention, CharSet = charSet)]
public static extern uint clang_isVirtualBase(Cursor c);
}
}