Skip to content
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] Make cling::utils::Lookup::Named look into using directives #15458

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

devajithvs
Copy link
Contributor

This Pull request:

Changes or fixes:

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #15407

@devajithvs devajithvs requested a review from dpiparo as a code owner May 8, 2024 16:04
@devajithvs devajithvs changed the title [cling] Make cling::utils::Lookup::Named look into using directive [cling] Make cling::utils::Lookup::Named look into using directives May 8, 2024
@devajithvs devajithvs self-assigned this May 8, 2024
if (!res && primaryWithin->isNamespace())
for (auto* UD : primaryWithin->using_directives())
if (NamespaceDecl* NS = UD->getNominatedNamespace())
res = S->LookupQualifiedName(R, NS);
Copy link
Member

Choose a reason for hiding this comment

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

Sema has an interface Sema::LookupName that follows the language rules. Can we use that one? We need to create some scope which describes the lookup position but I guess most of the time we care about the TUScope...

Copy link
Member

Choose a reason for hiding this comment

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

Sema::LookupName is already used (since the inception of this function) on line 1492 for the TUScope. I suspect we did not know (do we know now?) how to create "some scope which describes the lookup position".

Copy link
Member

Choose a reason for hiding this comment

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

I suspect we can push a scope with the namespace we want to look from, but we need to be careful to rebuild the scope nesting going from that namespace towards TU.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if it's the best solution, I realized that clang doesn't look into namespaces unless the RedeclarationKind is set to Sema::NotForRedeclaration

Copy link
Member

Choose a reason for hiding this comment

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

The intent of my comment was to avoid duplication of code that already exists in clang. The new version of that patch seems to address it.

@pcanal
Copy link
Member

pcanal commented May 8, 2024

Is there a corresponding roottest PR enabling/adding test for this?

Copy link

github-actions bot commented May 8, 2024

Test Results

     9 files   -     1       9 suites   - 1   1d 20h 21m 49s ⏱️ - 3h 26m 49s
 2 635 tests ±    0   2 635 ✅ ±    0  0 💤 ±0  0 ❌ ±0 
22 356 runs   - 2 512  22 356 ✅  - 2 512  0 💤 ±0  0 ❌ ±0 

Results for commit 863ffc9. ± Comparison against base commit bf035b8.

♻️ This comment has been updated with latest results.

@devajithvs
Copy link
Contributor Author

Is there a corresponding roottest PR enabling/adding test for this?

Added a cling test for this.

@devajithvs devajithvs force-pushed the dev.fix_15407 branch 3 times, most recently from 3267681 to f938114 Compare May 13, 2024 07:00
@@ -6,6 +6,7 @@
// LICENSE.TXT for details.
//------------------------------------------------------------------------------

// clang-format off
Copy link
Member

Choose a reason for hiding this comment

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

Can we put a .clang-format file in the test folder instructing clang-format to ignore that folder?

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.

cling::utils::Lookup::Named does not look into using directive
3 participants