Skip to content

C++: Add support for getting literals in using declarations #19603

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

IdrissRio
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the C++ label May 28, 2025
@IdrissRio IdrissRio added the depends on internal PR This PR should only be merged in sync with an internal Semmle PR label May 28, 2025
@IdrissRio IdrissRio force-pushed the idrissrio/comments-using branch from ff24105 to 20edf34 Compare May 28, 2025 06:18
@IdrissRio IdrissRio changed the title C++: Add support for retrieving referenced literals in using declarations C++: Add support for getting literals in using declarations May 28, 2025
@IdrissRio IdrissRio force-pushed the idrissrio/comments-using branch from 20edf34 to b322892 Compare May 28, 2025 12:32
@IdrissRio IdrissRio marked this pull request as ready for review May 28, 2025 15:47
@Copilot Copilot AI review requested due to automatic review settings May 28, 2025 15:47
@IdrissRio IdrissRio requested a review from a team as a code owner May 28, 2025 15:47
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds the ability to retrieve the specific member referenced by a using declaration in a templated base class and updates toString() to fall back to this new API.

  • Introduces getReferencedMember() in UsingDeclarationEntry.
  • Modifies toString() to use getDeclaration() first or getReferencedMember() as a fallback.
  • Documents the feature in a new change-notes entry.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
cpp/ql/lib/semmle/code/cpp/Namespace.qll Added getReferencedMember() and updated toString()
cpp/ql/lib/change-notes/2025-05-28-using-template.md Added feature note for getReferencedMember
Comments suppressed due to low confidence (2)

cpp/ql/lib/semmle/code/cpp/Namespace.qll:191

  • The use of or between two assignment statements here is invalid syntax and won't produce the intended fallback behavior. Consider computing both descriptions first or use a conditional expression to assign a single result value.
result = "using " + this.getDeclaration().getDescription() or

cpp/ql/lib/semmle/code/cpp/Namespace.qll:192

  • getReferencedMember() returns an Element, not a string. You need to call its .getDescription() (or equivalent) to produce a textual representation.
result = "using " + this.getReferencedMember()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ depends on internal PR This PR should only be merged in sync with an internal Semmle PR documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant