Merge pull request #5064 from zeyi2/fix-clang-22-building

Fix building under clang-22
This commit is contained in:
Tony Wasserka authored and GitHub committed 2026-02-26 15:06:05 +00:00
commit 3c517f514f
3 files changed
+24 -3

No files matched your search

+6 -1
View File
@@ -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");
}
@@ -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 {});
}
+9 -1
View File
@@ -3,6 +3,7 @@
#include "diagnostics.h"
#include "interface.h"
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Basic/DiagnosticOptions.h>
#include <fstream>
#include <numeric>
@@ -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);
@@ -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);
+9 -1
View File
@@ -116,7 +116,10 @@ public:
Compiler.setInvocation(std::move(invocation));
#endif
Compiler.setFileManager(files);
#if LLVM_VERSION_MAJOR >= 20
#if LLVM_VERSION_MAJOR >= 22
auto Diags = clang::CompilerInstance::createDiagnostics(Compiler.getVirtualFileSystem(), Compiler.getDiagnosticOpts(), diag_consumer, false);
Compiler.setDiagnostics(std::move(Diags));
#elif LLVM_VERSION_MAJOR >= 20
Compiler.createDiagnostics(Compiler.getVirtualFileSystem(), diag_consumer, false);
#else
Compiler.createDiagnostics(diag_consumer, false);
@@ -124,7 +127,12 @@ public:
if (!Compiler.hasDiagnostics()) {
return false;
}
#if LLVM_VERSION_MAJOR >= 22
Compiler.createSourceManager();
#else
Compiler.createSourceManager(*files);
#endif
const bool Success = Compiler.ExecuteAction(ScopedToolAction);