mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 10:37:46 +00:00
all: add LLVM 22 support
Builder: - Update clang.cpp for LLVM 22 API changes: DiagnosticOptions is no longer ref-counted, TextDiagnosticPrinter and DiagnosticsEngine take references instead of pointers, createDiagnostics() signature changed. - Update cc1as.cpp: clang/Driver/Options.h moved to clang/Options/Options.h, namespace changed from clang::driver::options to clang::options, MCInstPrinter now passed as unique_ptr. - Add new LLVM 22 libraries to GNUmakefile: clangAnalysisLifetimeSafety, clangOptions, LLVMDTLTO, and dtlto component. - Add llvm22 build tag to all build/test commands. CGo: - Handle CXType_Unexposed in libclang.go by resolving via canonical type. LLVM 22 reports builtin type aliases (e.g. __size_t) as Unexposed instead of Typedef. - Always make C typedefs into Go type aliases. LLVM 22 changed getTypedefDeclUnderlyingType to return CXType_Enum directly instead of wrapping in an elaborated type. Compileopts: - Add build-tag-guarded ClangTriple() to substitute wasm32-unknown-wasi with wasm32-unknown-wasip1 for LLVM 22 (deprecated triple). - Add build-tag-guarded patchFeatures() to map renamed Xtensa features (atomctl, memctl, timerint, esp32s3) for LLVM 22. Targets: - Remove -zca from RISC-V target feature strings (esp32c3, esp32c6, fe310, k210, riscv-qemu, tkey). LLVM 22 now implies +zca from +c. - Remove -zcd from k210. LLVM 22 now implies +zcd from +c,+d. Tests: - Change TestClangAttributes to check individual feature flags instead of exact string match, allowing new LLVM features without failures. - Update TestBinarySize expected values for LLVM 22 codegen. Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
+4
-4
@@ -27,9 +27,9 @@ bool tinygo_clang_driver(int argc, char **argv) {
|
||||
std::vector<const char*> args(argv, argv + argc);
|
||||
|
||||
// The compiler invocation needs a DiagnosticsEngine so it can report problems
|
||||
llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions> DiagOpts = new clang::DiagnosticOptions();
|
||||
clang::TextDiagnosticPrinter DiagnosticPrinter(llvm::errs(), &*DiagOpts);
|
||||
clang::DiagnosticsEngine Diags(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>(new clang::DiagnosticIDs()), &*DiagOpts, &DiagnosticPrinter, false);
|
||||
clang::DiagnosticOptions DiagOpts;
|
||||
clang::TextDiagnosticPrinter DiagnosticPrinter(llvm::errs(), DiagOpts);
|
||||
clang::DiagnosticsEngine Diags(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>(new clang::DiagnosticIDs()), DiagOpts, &DiagnosticPrinter, false);
|
||||
|
||||
// Create the clang driver
|
||||
clang::driver::Driver TheDriver(args[0], llvm::sys::getDefaultTargetTriple(), Diags);
|
||||
@@ -60,7 +60,7 @@ bool tinygo_clang_driver(int argc, char **argv) {
|
||||
}
|
||||
|
||||
// Create the actual diagnostics engine.
|
||||
Clang->createDiagnostics(*llvm::vfs::getRealFileSystem());
|
||||
Clang->createDiagnostics();
|
||||
if (!Clang->hasDiagnostics()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user