Skip to content

Conversation

@Vipul-Cariappa
Copy link
Collaborator

Description

Shadow constructor need to be reconstructed for the base classes

Fixes # (issue)

Helps fix 1 test in cppyy

Type of change

Please tick all options which are relevant.

  • Bug fix
  • New feature
  • Requires documentation updates

Testing

Checklist

  • I have read the contribution guide recently

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@codecov
Copy link

codecov bot commented Jul 30, 2025

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.65%. Comparing base (55b47ba) to head (0ba1726).
⚠️ Report is 33 commits behind head on main.

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

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #689      +/-   ##
==========================================
+ Coverage   79.64%   79.65%   +0.01%     
==========================================
  Files           9        9              
  Lines        3930     3942      +12     
==========================================
+ Hits         3130     3140      +10     
- Misses        800      802       +2     
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 87.75% <92.85%> (-0.03%) ⬇️
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 87.75% <92.85%> (-0.03%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

dyn_cast_or_null<CXXConstructorDecl>(CUSD->getTargetDecl())) {
CXXConstructorDecl* Result = getSema().findInheritingConstructor(
SourceLocation(), CXXCD, CUSD);
// Result is appended to the decls, i.e. CXXRD, iterator
Copy link
Contributor

Choose a reason for hiding this comment

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

The implementation is awkward... Would that mean that the iterators are invalidated?

for (Decl* DI : CXXRD->decls()) {
if (auto* MD = dyn_cast<DeclType>(DI))
methods.push_back(MD);
else if (auto* USD = dyn_cast<UsingShadowDecl>(DI))
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we could simplify the levels of indentation if we did:

for (Decl* DI : CXXRD->decls()) {
  if (auto* USD = dyn_cast<UsingShadowDecl>(DI))
    DI = USD->getTargetDecl();
  ...

Copy link
Contributor

Choose a reason for hiding this comment

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

Why my approach here did not work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We want ConstructorUsingShadowDecl to pass to findInheritingConstructor. UsingShadowDecl::getTargetDecl will return NamedDecl, in this case CXXConstructorDecl.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but then you will do the usual checks with dyn_cast, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, we cannot do it, because we require the original DI later, in line 862.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, ok.

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

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

LGTM!

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2025

clang-tidy review says "All clean, LGTM! 👍"

@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2025

clang-tidy review says "All clean, LGTM! 👍"

Vipul-Cariappa and others added 2 commits August 2, 2025 09:09
shadow constructor need to be reconstructed for the base classes
@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2025

clang-tidy review says "All clean, LGTM! 👍"

@Vipul-Cariappa Vipul-Cariappa merged commit c849ba4 into compiler-research:main Aug 2, 2025
41 checks passed
@Vipul-Cariappa Vipul-Cariappa deleted the dev/shadow-ctor branch August 2, 2025 15:22
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