forked from ghedo/p5-Clang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClang.xs
37 lines (28 loc) · 807 Bytes
/
Clang.xs
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
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include <clang-c/Index.h>
typedef CXIndex Index;
typedef CXTranslationUnit TUnit;
typedef CXCursor * Cursor;
typedef enum CXCursorKind CursorKind;
typedef CXType * Type;
typedef enum CXTypeKind TypeKind;
typedef CXDiagnostic Diagnostic;
enum CXChildVisitResult visitor(CXCursor cursor, CXCursor parent, CXClientData data) {
SV *child;
AV *children = data;
CXCursor *ref = malloc(sizeof(CXCursor));
*ref = cursor;
child = sv_setref_pv(newSV(0), "Clang::Cursor", (void *) ref);
av_push(children, child);
return CXChildVisit_Continue;
}
MODULE = Clang PACKAGE = Clang
INCLUDE: xs/Index.xs
INCLUDE: xs/TUnit.xs
INCLUDE: xs/Cursor.xs
INCLUDE: xs/CursorKind.xs
INCLUDE: xs/Type.xs
INCLUDE: xs/TypeKind.xs
INCLUDE: xs/Diagnostic.xs