-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathgo-clang.h
38 lines (32 loc) · 991 Bytes
/
go-clang.h
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
#ifndef _GO_CLANG
#define _GO_CLANG 1
/*
* include our own clang-c/Index.h.
* It should be exactly the same than the upstream one, except that:
* - CXComment
* - CXCursor
* - CXIdxLoc
* - CXSourceLocation
* - CXSourceRange
* - CXString
* - CXTUResourceUsage
* - CXToken
* - CXType
* have been modified to hide the 'void *field[x]' fields from the Go GC.
* Not hiding these fields confuses the Go GC during garbage collection and pointer scanning,
* making it think the heap/stack has been somehow corrupted.
*/
#include "clang-c/Index.h"
inline static
CXCursor _go_clang_ocursor_at(CXCursor *c, int idx) {
return c[idx];
}
inline static
CXPlatformAvailability
_goclang_get_platform_availability_at(CXPlatformAvailability* array, int idx) {
return array[idx];
}
unsigned _go_clang_visit_children(CXCursor c, uintptr_t callback_id);
CXPlatformAvailability
_goclang_get_platform_availability_at(CXPlatformAvailability* array, int idx);
#endif /* !_GO_CLANG */