Update ROOT and Cling to LLVM22#21658
Conversation
255c7e6 to
cfd796b
Compare
Test Results 23 files 23 suites 3d 19h 47m 28s ⏱️ For more details on these failures, see this check. Results for commit a80f916. ♻️ This comment has been updated with latest results. |
Related: AdaptiveCpp/AdaptiveCpp#1986 |
|
Here is the PR I have updating CppInterOp to llvm 22 compiler-research/CppInterOp#812 . It builds with llvm 22 (tested through the ci with upstream llvm 22 and clang-repl), but several tests currently fail. Unsure how the patch would fair with roots llvm 22 and cling. |
7738727 to
d68c1c7
Compare
7640bdc to
8920b0a
Compare
88b794b to
6284651
Compare
8d87ccb to
1aa5aae
Compare
69156a4 to
8f2e30f
Compare
c7b7cf3 to
45543a0
Compare
This fixes dictionary generation for ROOT types such as ROOT::Math::IParametricFunctionMultiDimTempl<double> (exposed as IModelFunction via a typedef chain), where the missing prefix caused incorrect class names in the generated dictionary. This is needed after the nested name specifier changes in LLVM22.
Fix tests: - pyunittests-bindings-pyroot-cppyy-cppyy-test-advancedcpp - root-io-newstl-run
… in LLVM22
LLVM22 removed ElaboratedType from the Clang type system and moved
NestedNameSpecifier directly into RecordType.
In LLVM20, ElaboratedType::desugar() stripped the global qualifier,
and we get "Object" from "::Object".
In LLVM22 this ElaboratedType no longer exists, prefix is stored directly
causing RecordType nodes to retain the global namespace prefix.
We try to restore the previous partial-desugaring behavior by explicitly
detecting RecordType instances with a global NestedNameSpecifier and
reconstructing the underlying canonical declaration type.
Only the global namespace ("::") is stripped; user-defined namespaces
("std::", "NS::") are preserved.
ElaboratedType was completely removed in LLVM22 There is no equivalent equivalent way to replace it with. getPrefix() was used as a drop-in replacement for the `ElaboratedType` during the rebase, this was wrong and not really needed. This caused types accessed via 'using namespace' to enter code paths that were never taken in LLVM20. Without this fix rootcling fails with: ``` Error in <CloseStreamerInfoROOTFile>: Cannot find enum ROOT::Math::Integration::Type. ``` Where ROOT::Math::Integration::Type is resolved from a using namespace
…o standard types TODO: This fixed macos failure. Need to look into this more. Ref: llvm/llvm-project@7c402b8
… removal This will fix gtest-tree-ntuple-ntuple-type-name, that was failing prior to this commit. We probably need to revisit this and find a better/generalized way to handle all similar cases. Fix for cppyy-test-pythonization
The Transform.C test was constructing a bare Transform::Config that did not populate m_toReplace, so the basic_string<char> to std::string substitution could not fire during partial desugaring, causing the test to produce "std::pair<const std::basic_string<char>, int>" instead of the expected "std::pair<const std::string, int>". Mirror what TNormalizedCtxImpl does: look up std::string, take its canonical type pointer as the key, and insert the typedef type as the replacement value in m_toReplace.
Prior to LLVM22, GetNormalizedName would strip Class keyword from nested template arguments as a side-effect of ElaboratedType desugaring. This was accidental erasure of user-written syntax. In LLVM22, ElaboratedType was removed and the keyword is stored directly on TagType. The normalization code no longer strips it, so the output now reflects what the user wrote:
The change in getFullyQualifiedType() in the commit llvm/llvm-project@af27466 added explicit desugaring of UsingType: ``` if (isa<UsingType>(QT.getTypePtr())) { return getFullyQualifiedType(QT.getSingleStepDesugaredType(Ctx), Ctx, WithGlobalNsPrefix); } ``` This has been there since LLVM14 and we could disentagle this from the upgrade. This causes `SG::sgkey_t` to be resolved to its underlying type `uint32_t` when GetFullTypeName() is called, rather than preserving the typedef alias name as before. For now, update the test expectation to reflect the new behavior or move this to a separate PR.
Unmark xfail for test14_templated_return_type
…ePaths CopyIncludePaths assumed that a framework entry always implies `Group==Angled` and called `report_fatal_error` for any other group. This changed after LLVM commit: llvm/llvm-project@515b4a4 Framework entries land in UserEntries with `IsFramework=true` and `Group=frontend::System` and cling fails on macos with "Invalid option set!" Fix by also allowing `Group=frontend::System` for framework entries. See compiler-research/CppInterOp#672 (comment)
LLVM22 introduced UnsubstitutedConstraintSatisfactionCache: llvm/llvm-project@e9972de This causes some stale results to persist across transactions For example, evaluating is_default_constructible_v<Inner<int>> for an incomplete Inner<int> caches the 'false' value here. Completing Inner<int> in the next transaction will see the cached 'false' instead of re-evaluating. There is a TODO in clang to make this a private member, so this solution is not ideal. This might not be the right fix, clang and clang-repl also fails for the below, maybe we should just update the test-case `roottest-root-meta-ROOT-7462-Test` to prevent this condition (gcc14 and above). Minimal reproducer: ``` template <typename T> struct X; // Forward declaration template <typename T> struct S { S() requires std::is_default_constructible_v<T> = default;}; bool b = std::is_default_constructible_v<S<X<int>>>; template <> struct X<int> {}; // Complete the definition of X<int> S<X<int>> s; // Fails without this patch ``` In ROOT: ``` { gInterpreter->Declare(R"( #include <type_traits> template <typename T> struct X; template <typename T> struct S { S() requires std::is_default_constructible_v<T> = default;}; )"); gInterpreter->Declare("bool b = std::is_default_constructible_v<S<X<int>>>;"); gInterpreter->Declare("template <> struct X<int> {};"); bool ok = gInterpreter->Declare("S<X<int>> s;"); printf("%s\n", ok ? "PASS" : "FAIL"); } ```
LLVM21 implements CWG2369 ("Ordering between constraints and substitution",
llvm/llvm-project@e04e140
This moves constraint checking before full template argument substitution.
Alias templates may be expanded eagerly during parameter type substitution,
causing hard diagnostics to be emitted for substitution failures that are
expected and handled by InstantiateTemplateWithDefaults().
Use SFINAETrap so that substitution failures are treated as silent
failures, matching the previous behaviour.
Fix the remaining failing `pyunittests` on macos:
- pyunittests-bindings-distrdf-backend-distrdf-unit-backend-dist
- pyunittests-bindings-distrdf-backend-distrdf-unit-backend-graph-caching
- pyunittests-bindings-pyroot-cppyy-cppyy-test-cpp11features
- pyunittests-bindings-pyroot-pythonizations-pyroot-roofit
- pyunittests-io-io-rfile-py
- pyunittests-tree-dataframe-dataframe-merge-results
- pyunittests-tree-ntuple-ntuple-py-basics
- pyunittests-tree-ntuple-ntuple-py-model
AdaptiveCpp does not support LLVM22 yet, there is a PR open, still need some work to get this building with static LLVM, adaptiveCpp is designed to be used as a clang plugin using libLLVM.so, for now, disable this so that this does not become a blocker for LLVM22 upgrade.
Clad support for LLVM22 hasn't been released yet. Temporarily turn this off for CI.
We need to keep siphash folder after the llvm commit: llvm/llvm-project@7f3afab9
We also need to update after the changes in: llvm/llvm-project@88b77073
Seems like it is still the case. I am debugging this on a local windows machine I have. EDIT: This should fix the windows build issue: vgvassilev/clad#1867 |
Since LLVM12, suppressing inline and anonymous namespaces were separated into distinct flags: - SuppressUnwrittenScope: suppresses anonymous namespaces - SuppressInlineNamespace: suppresses redundant inline namespaces See: llvm/llvm-project@5f12f4ff Add `SuppressUnwrittenScope = true` to strip anonymous namespace prefixes Without this, types in anonymous namespaces are printed as '::(anonymous namespace)::EvNavHandler' which is invalid C++ and causes compilation failures in rootcling-generated dictionary code as seen when building dd4hep against ROOT LLVM22. We were relying on `SuppressScope` which was removed in LLVM22. Also update the Transform.C test to reflect the corrected output
|
cmssw tests passed cms-sw#233 (comment) |
This Pull request:
This is a draft PR. Some tests are expected to fail.
We need LLVM22 support for the following before we can merge this:
TODO:
Changes or fixes:
Checklist:
This PR fixes #