-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cling] DeclUnloader: fix unloading of member functions of templated classes #13565
[cling] DeclUnloader: fix unloading of member functions of templated classes #13565
Conversation
Starting build on |
Build failed on windows10/default. |
Build failed on ROOT-ubuntu2004/python3. Failing tests: |
Build failed on ROOT-ubuntu2204/nortcxxmod. Failing tests: |
Build failed on ROOT-performance-centos8-multicore/soversion. Failing tests: |
Build failed on mac11/noimt. Failing tests: |
Build failed on mac12arm/cxx20. Failing tests: |
I'll check these failing tests in the next few days, but for the rest it should be ready for review. |
509ca0d
to
fdf6c53
Compare
Starting build on |
This patchset should be ready now 🚀! @Axel-Naumann, @hahnjo, @vgvassilev Could you review when you have some spare time? |
Build failed on ROOT-ubuntu2204/nortcxxmod. Failing tests: |
Build failed on mac11/noimt. Failing tests: |
Fantastic, thanks, @jalopezg-git ! Is the mac11 failure in stressInterpreter caused by this PR? |
Apparently, yes. Ugghh, that wasn't expected; all the other platforms seem to be happy now. Any chance that I can still access one of these machines to debug the issue? |
Build failed on mac12arm/cxx20. Failing tests:
|
@phsft-bot build just on mac11/noimt |
Starting build on |
Build failed on mac11/noimt. Failing tests: |
fdf6c53
to
0089635
Compare
Starting build on |
For now, this is just a rebase of Javier's original changes. I think I have an idea what could be wrong, but I first want to have a clean set of reports from Jenkins and the new CI. In any case, I'll try to take care of this PR now because it seems required for some recent progress I'm making regarding #13815, in turn blocking the upgrade to LLVM 16. |
Build failed on mac12arm/cxx20. Failing tests: |
StaticVarCollector recursively visited descendants of a `FunctionDecl` node to collect static local variables. However, these always appear in the enclosing DeclContext.
The body of member functions of a templated class only gets instantiated when the function is used. These `CXXMethodDecl` should not be deleted from the AST; instead return them to the 'instantiation pending' state.
This effectively reverts commit 74472ca ("[cling] Fixes issue in DeclUnloader: do not unload templates intantiated in the PCH"), it's not needed anymore, all tests pass and the snippet in the summary of root-project#4447 works, but it filters too many declarations from the unloader.
0089635
to
c224025
Compare
Starting build on |
Build failed on windows10/default. Failing tests:
|
Great! Let's give this a push 🙂! |
So it wasn't what I initially thought, but it seems to work now on all platforms (except the spurious failure on Windows). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm accepting this pro-forma, Javier's changes look good to me and my additional commit is a continuation of that work. All tests pass and check-cling
stays clean (on my EL8 at least). If others want more time to review this, please comment!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Awesome! @Axel-Naumann, @hahnjo, I'll let you decide when to click merge 🙂! |
This pull request fixes the unloading of member functions of templated classes.
Specifically, the body of member functions of a templated class only gets instantiated when the function is first used, e.g. in this example below, the body for the member function
T f(T x)
(whereT
is a typename template argument for the templated structFoo
) will not get instantiated untilf()
is first used.Such functions should not be deleted from the AST, but returned to the 'pending instantiation' state.
Also, any function template instantiation, even if coming from an external AST source, needs some handling in order for it to be re-emitted the next time.
Changes or fixes:
StaticVarCollector
by simpler code. Static local variables always appear in the enclosingDeclContext
Checklist:
This PR fixes #10049, #6439, #7970, ROOT-10848 and ROOT-8084 and (hopefully also ROOT-8245).