
Sometimes when a GC happens while processing a C fragment with libclang, a pointer-typed integer with value 0x1 ends up on the Go stack and the GC will trip over it. This commit changes the offending struct type to be uintptr_t instead of void*. See https://go-review.googlesource.com/c/go/+/66332 for a similar change.
46 строки
1,3 КиБ
C
46 строки
1,3 КиБ
C
|
|
// This file implements some small trampoline functions. The signatures
|
|
// are slightly different from the ones defined in libclang.go, but they
|
|
// should be ABI compatible.
|
|
|
|
#include <clang-c/Index.h> // if this fails, install libclang-8-dev
|
|
|
|
CXCursor tinygo_clang_getTranslationUnitCursor(CXTranslationUnit tu) {
|
|
return clang_getTranslationUnitCursor(tu);
|
|
}
|
|
|
|
unsigned tinygo_clang_visitChildren(CXCursor parent, CXCursorVisitor visitor, CXClientData client_data) {
|
|
return clang_visitChildren(parent, visitor, client_data);
|
|
}
|
|
|
|
CXString tinygo_clang_getCursorSpelling(CXCursor c) {
|
|
return clang_getCursorSpelling(c);
|
|
}
|
|
|
|
enum CXCursorKind tinygo_clang_getCursorKind(CXCursor c) {
|
|
return clang_getCursorKind(c);
|
|
}
|
|
|
|
CXType tinygo_clang_getCursorType(CXCursor c) {
|
|
return clang_getCursorType(c);
|
|
}
|
|
|
|
CXCursor tinygo_clang_getTypeDeclaration(CXType t) {
|
|
return clang_getTypeDeclaration(t);
|
|
}
|
|
|
|
CXType tinygo_clang_getTypedefDeclUnderlyingType(CXCursor c) {
|
|
return clang_getTypedefDeclUnderlyingType(c);
|
|
}
|
|
|
|
CXType tinygo_clang_getCursorResultType(CXCursor c) {
|
|
return clang_getCursorResultType(c);
|
|
}
|
|
|
|
int tinygo_clang_Cursor_getNumArguments(CXCursor c) {
|
|
return clang_Cursor_getNumArguments(c);
|
|
}
|
|
|
|
CXCursor tinygo_clang_Cursor_getArgument(CXCursor c, unsigned i) {
|
|
return clang_Cursor_getArgument(c, i);
|
|
}
|