Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ThunkLibs/Generator/analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,12 @@ void AnalysisAction::ParseInterface(clang::ASTContext& context) {
}

// Get or add parent type to list of structure types
#if CLANG_VERSION_MAJOR >= 22
auto parent_qt = context.getTagType(clang::ElaboratedTypeKeyword::None, std::nullopt, annotated_member->getParent(), false);
auto repack_info_it = types.emplace(context.getCanonicalType(parent_qt).getTypePtr(), RepackedType {}).first;
#else
auto repack_info_it = types.emplace(context.getCanonicalType(annotated_member->getParent()->getTypeForDecl()), RepackedType {}).first;
#endif
if (repack_info_it->second.assumed_compatible) {
throw report_error(template_arg_loc, "May not annotate members of opaque types");
}
Expand Down Expand Up @@ -498,7 +503,7 @@ void AnalysisAction::ParseInterface(clang::ASTContext& context) {
// Convert variadic argument list into a count + pointer pair
data.param_types.push_back(context.getSizeType());
data.param_types.push_back(context.getPointerType(*annotations.uniform_va_type));
types.emplace(context.getSizeType()->getTypePtr(), RepackedType {});
types.emplace(context.getSizeType().getTypePtr(), RepackedType {});
if (!annotations.uniform_va_type.value()->isVoidPointerType()) {
types.emplace(annotations.uniform_va_type->getTypePtr(), RepackedType {});
}
Expand Down
10 changes: 9 additions & 1 deletion ThunkLibs/Generator/gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "diagnostics.h"
#include "interface.h"
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Basic/DiagnosticOptions.h>

#include <fstream>
#include <numeric>
Expand Down Expand Up @@ -816,7 +817,10 @@ bool GenerateThunkLibsActionFactory::runInvocation(std::shared_ptr<clang::Compil

GenerateThunkLibsAction Action(libname, output_filenames, abi);

#if LLVM_VERSION_MAJOR >= 20
#if LLVM_VERSION_MAJOR >= 22
auto Diags = clang::CompilerInstance::createDiagnostics(Compiler.getVirtualFileSystem(), Compiler.getDiagnosticOpts(), DiagConsumer, false);
Compiler.setDiagnostics(std::move(Diags));
#elif LLVM_VERSION_MAJOR >= 20
Compiler.createDiagnostics(Compiler.getVirtualFileSystem(), DiagConsumer, false);
#else
Compiler.createDiagnostics(DiagConsumer, false);
Expand All @@ -825,7 +829,11 @@ bool GenerateThunkLibsActionFactory::runInvocation(std::shared_ptr<clang::Compil
return false;
}

#if LLVM_VERSION_MAJOR >= 22
Compiler.createSourceManager();
#else
Compiler.createSourceManager(*Files);
#endif

const bool Success = Compiler.ExecuteAction(Action);

Expand Down
Loading