Skip to content

Conversation

@MathiasVP
Copy link
Contributor

@MathiasVP MathiasVP commented Sep 10, 2025

Another preparation for adopting the shared guards library.

Commit-by-commit review recommended.

@github-actions github-actions bot added the C++ label Sep 10, 2025
@MathiasVP MathiasVP marked this pull request as ready for review September 10, 2025 15:14
@MathiasVP MathiasVP requested a review from a team as a code owner September 10, 2025 15:14
Copilot AI review requested due to automatic review settings September 10, 2025 15:14
Copy link
Contributor

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

This pull request cleans up the ScanfChecks.qll file as preparation for adopting a shared guards library. The changes primarily involve refactoring the existing predicate logic to be more concise and maintainable.

Key Changes:

  • Simplified predicate structure by combining nested exists clauses
  • Improved readability through better variable organization
  • Removed one branch from exprInBooleanContext predicate

@MathiasVP MathiasVP added the no-change-note-required This PR does not need a change note label Sep 10, 2025
Comment on lines -12 to -13
or
gc.getUnconvertedResultExpression() = e
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can this be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, yes. Sorry I should have made that clear.

This is a left-over from back when we didn't have guard conditions for unary conditions. When we only had the binary guard conditions we did not have a guard condition logic for stuff like if(x) { } and if(!x) { }. So the workaround was to check whether the guard condition was equal to the expression.

I switched the ScanfChecks library to use the unary guard condition predicate in decede5, but I forgot to delete this disjunct.

@MathiasVP MathiasVP merged commit 4227dd7 into github:main Sep 10, 2025
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C++ 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.

2 participants