FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

C++: Add model validation for constructor summary models by owen-mc · Pull Request #21426 · github/codeql · GitHub

/ codeql Public

C++: Add model validation for constructor summary models - #21426

Merged
owen-mc merged 5 commits into
github:mainfrom
owen-mc:cpp/validate-constructor-summary-models
Mar 10, 2026
Merged

C++: Add model validation for constructor summary models#21426
owen-mc merged 5 commits into
github:mainfrom
owen-mc:cpp/validate-constructor-summary-models

Conversation

owen-mc commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

The output column of a summary model for a constructor should use Argument[this] instead of ReturnValue.

This didn't find anything, but it did for java (#21415). I also manually tested it by changing two constructor summary models (with a generic type and one with a non-generic type) to use ReturnValue and it was correctly identified when I ran cpp/ql/test/library-tests/dataflow/external-models/validatemodels.ql.

Copilot AI review requested due to automatic review settings March 7, 2026 10:10
owen-mc requested a review from a team as a code owner March 7, 2026 10:10
owen-mc added the no-change-note-required This PR does not need a change note label Mar 7, 2026
github-actions Bot added the C++ label Mar 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull request overview

Adds model validation for constructor summary models in C++, ensuring that the output column uses Argument[this] (or Argument[-1]) instead of ReturnValue, consistent with a similar validation already added for Java.

Changes:

  • Adds getIncorrectConstructorSummaryOutput() predicate to detect constructor summary models that incorrectly use ReturnValue in the output column.
  • Integrates the new predicate into the existing invalidModelRow query.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
)
}

string getIncorrectConstructorSummaryOutput() {

jketema Mar 9, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Is there a reason this predicate is not private?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nope, I should have done that. I've done it now, and taken the liberty of fixing it for Java and C# in this PR as well. (I had to merge main in first.)

owen-mc requested review from a team as code owners March 9, 2026 13:45
owen-mc merged commit 0215ea3 into github:main Mar 10, 2026
44 checks passed
owen-mc deleted the cpp/validate-constructor-summary-models branch March 10, 2026 09:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C# C++ Java no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL