
This commit adds support for LLVM 16 and switches to it by default. That means three LLVM versions are supported at the same time: LLVM 14, 15, and 16. This commit includes work by QuLogic: * Part of this work was based on a PR by QuLogic: https://github.com/tinygo-org/tinygo/pull/3649 But I also had parts of this already implemented in an old branch I already made for LLVM 16. * QuLogic also provided a CGo fix here, which is also incorporated in this commit: https://github.com/tinygo-org/tinygo/pull/3869 The difference with the original PR by QuLogic is that this commit is more complete: * It switches to LLVM 16 by default. * It updates some things to also make it work with a self-built LLVM. * It fixes the CGo bug in a slightly different way, and also fixes another one not included in the original PR. * It does not keep compiler tests passing on older LLVM versions. I have found this to be quite burdensome and therefore don't generally do this - the smoke tests should hopefully catch most regressions.
86 строки
2,4 КиБ
C
86 строки
2,4 КиБ
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, libclang headers aren't available. Please take a look here: https://tinygo.org/docs/guides/build/
|
|
|
|
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);
|
|
}
|
|
|
|
CXString tinygo_clang_getCursorPrettyPrinted(CXCursor c, CXPrintingPolicy policy) {
|
|
return clang_getCursorPrettyPrinted(c, policy);
|
|
}
|
|
|
|
CXPrintingPolicy tinygo_clang_getCursorPrintingPolicy(CXCursor c) {
|
|
return clang_getCursorPrintingPolicy(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);
|
|
}
|
|
|
|
enum CX_StorageClass tinygo_clang_Cursor_getStorageClass(CXCursor c) {
|
|
return clang_Cursor_getStorageClass(c);
|
|
}
|
|
|
|
CXSourceLocation tinygo_clang_getCursorLocation(CXCursor c) {
|
|
return clang_getCursorLocation(c);
|
|
}
|
|
|
|
CXSourceRange tinygo_clang_getCursorExtent(CXCursor c) {
|
|
return clang_getCursorExtent(c);
|
|
}
|
|
|
|
CXTranslationUnit tinygo_clang_Cursor_getTranslationUnit(CXCursor c) {
|
|
return clang_Cursor_getTranslationUnit(c);
|
|
}
|
|
|
|
long long tinygo_clang_getEnumConstantDeclValue(CXCursor c) {
|
|
return clang_getEnumConstantDeclValue(c);
|
|
}
|
|
|
|
CXType tinygo_clang_getEnumDeclIntegerType(CXCursor c) {
|
|
return clang_getEnumDeclIntegerType(c);
|
|
}
|
|
|
|
unsigned tinygo_clang_Cursor_isAnonymous(CXCursor c) {
|
|
return clang_Cursor_isAnonymous(c);
|
|
}
|
|
|
|
unsigned tinygo_clang_Cursor_isBitField(CXCursor c) {
|
|
return clang_Cursor_isBitField(c);
|
|
}
|