Skip to content

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
@devajithvs devajithvs requested review from hahnjo, pcanal and vgvassilev May 8, 2024 16:06
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?

@github-actions
Copy link

github-actions bot commented May 8, 2024

Test Results

    14 files      14 suites   3d 10h 44m 0s ⏱️
 2 697 tests  2 697 ✅ 0 💤 0 ❌
35 511 runs  35 511 ✅ 0 💤 0 ❌

Results for commit ca410ed.

♻️ 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
Copy link
Member

@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!

@devajithvs devajithvs merged commit b22b08c into root-project:master Sep 26, 2024
@hahnjo
Copy link
Member

hahnjo commented Sep 26, 2024

@devajithvs can you try enabling the test in roottest that was conditional on the fix: root-project/roottest#1118 ?

@devajithvs
Copy link
Contributor Author

Check running here: #16535 corresponding to root-project/roottest#1194

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

4 participants