Skip to content

A5-0-2: exclude compiler generated conditions #510

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

Merged
merged 4 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions change_notes/2024-01-26-exclusion-a5-0-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
`A5-0-2` - `NonBooleanIfStmt.qll`, `NonBooleanIterationStmt.qll`:
- Exclude compiler generated conditions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ query predicate problems(Expr condition, string message) {
not isExcluded(condition, getQuery()) and
exists(IfStmt ifStmt, Type explicitConversionType |
condition = ifStmt.getCondition() and
//exclude any generated conditions
not condition.isCompilerGenerated() and
not ifStmt.isFromUninstantiatedTemplate(_) and
explicitConversionType = condition.getExplicitlyConverted().getUnderlyingType() and
not explicitConversionType instanceof BoolType and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ query predicate problems(Loop loopStmt, string message) {
condition = loopStmt.getCondition() and
explicitConversionType = condition.getExplicitlyConverted().getType().getUnspecifiedType() and
not explicitConversionType instanceof BoolType and
//exclude any generated conditions
not condition.isCompilerGenerated() and
message = "Iteration condition has non boolean type " + explicitConversionType + "."
)
}