Skip to content

[wip] Add support for llvm 22#773

Draft
mcbarton wants to merge 27 commits intocompiler-research:mainfrom
mcbarton:Add-support-for-llvm-22
Draft

[wip] Add support for llvm 22#773
mcbarton wants to merge 27 commits intocompiler-research:mainfrom
mcbarton:Add-support-for-llvm-22

Conversation

@mcbarton
Copy link
Collaborator

Description

Please include a summary of changes, motivation and context for this PR.

Now that the release/22.x branch has been created, this PR will get CppInterOp ready for the llvm 22 release. It will concentrate on the native case for now, while the issue with wasm exceptions and llvm 21 is resolved.

Fixes # (issue)

Type of change

Please tick all options which are relevant.

  • Bug fix
  • New feature
  • Requires documentation updates

Testing

Please describe the test(s) that you added and ran to verify your changes.

Checklist

  • I have read the contribution guide recently

@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.07%. Comparing base (c0c0bb3) to head (9e4a484).

Files with missing lines Patch % Lines
lib/CppInterOp/CXCppInterOp.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #773   +/-   ##
=======================================
  Coverage   79.07%   79.07%           
=======================================
  Files           9        9           
  Lines        3899     3899           
=======================================
  Hits         3083     3083           
  Misses        816      816           
Files with missing lines Coverage Δ
lib/CppInterOp/Compatibility.h 87.39% <100.00%> (ø)
lib/CppInterOp/CppInterOp.cpp 87.62% <100.00%> (ø)
lib/CppInterOp/CXCppInterOp.cpp 48.09% <0.00%> (ø)
Files with missing lines Coverage Δ
lib/CppInterOp/Compatibility.h 87.39% <100.00%> (ø)
lib/CppInterOp/CppInterOp.cpp 87.62% <100.00%> (ø)
lib/CppInterOp/CXCppInterOp.cpp 48.09% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mcbarton
Copy link
Collaborator Author

mcbarton commented Jan 13, 2026

@vgvassilev do we plan to drop the clang20 out-of-process patch like this issue suggests #742, when migrating to llvm 22, or keep it for those who want to use llvm 20? I have ported the patch locally for llvm 21, so can put in a PR quickly with the patch for llvm 21, if people are worried about having a feature for llvm 20 and 22, but not 21.

The ci in CppInterOp would not support these patched llvms.

@mcbarton
Copy link
Collaborator Author

mcbarton commented Jan 13, 2026

Tasks needed for llvm upgrade

  • Fix build issues identified in the ci (in progress)
  • Drop oop patch for llvm 20 (done)
  • Update documentation
  • Update out of process ci job to llvm 22 (in progress)
  • Fix any tests which fail despite building (in progress)
  • Drop llvm 18 support (partially done)
  • Drop llvm 19 support
  • Update cling to version based on llvm 20

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

TKCASE(MemberPointer);
TKCASE(Auto);
TKCASE(Auto);
#if CLANG_VERSION_MAJOR < 22
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "CLANG_VERSION_MAJOR" is directly included [misc-include-cleaner]

lib/CppInterOp/CXCppInterOp.cpp:16:

- #include <cstring>
+ #include <clang/Basic/Version.h>
+ #include <cstring>

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

#include "clang/Config/config.h"
#include "clang/Sema/Sema.h"
#include <iostream>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header iostream is not used directly [misc-include-cleaner]

Suggested change

@mcbarton
Copy link
Collaborator Author

@anutosh491 @Vipul-Cariappa Since you'll probably know how to update CppInterOps oop related code to be compatible with llvm 22, I was wondering you could look at these build errors. I had a very quick go at fixing them last night without success. See https://github.com/compiler-research/CppInterOp/actions/runs/21064882331/job/60579731760#step:12:181 for the errors

@mcbarton mcbarton force-pushed the Add-support-for-llvm-22 branch from c404772 to ea2db56 Compare January 22, 2026 10:41
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

ASTContext& C = FD->getASTContext();
PrintingPolicy Policy(C.getPrintingPolicy());
Policy.SuppressElaboration = true;
Policy.Suppress_Elab = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto]

Suggested change
Policy.Suppress_Elab = true;
if (const auto* Typedef = dyn_cast<const TypedefDecl>(TD)) {

Comment on lines +372 to +373
// FIXME: Remove the need of exposing the low-level execution engine and kill
// this horrible hack.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vgvassilev does this fixme still apply?

The solution provided by you which had this fixme I had to remove as I determined it ws causing the segmentation fault which stopped the tests running, This solution comes from janks repo, and allows the tests to run

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fixme is still valid.

@vgvassilev
Copy link
Contributor

If only cppyy fails as it fails in master, then can you squash all into one commit and apply clang-format. This should be ready to go.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

This reverts commit 894b817.
#if CLANG_VERSION_MAJOR < 22
#define Suppress_Elab SuppressElaboration
#else
#define Suppress_Elab FullyQualifiedName
Copy link
Collaborator Author

@mcbarton mcbarton Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this is supposed to be. This is what I last tried, but have tried a few things in past commits. Jank effectively has removed all references to SuppressElaboration in their fork of CppInterOp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants