-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Swift: add CFG and PrintAst consistency queries, enabling them in CI #13270
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
Conversation
@@ -0,0 +1 @@ | |||
import codeql.swift.printast.Consistency |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should not include these queries in the codeql/swift-queries
pack. They are not meant for users. Other languages seem to store them in separate packs LANG/ql/consistency-queries
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Previously there was code that was treating `BraceStmt` within `TapExpr` in a special way, skipping the first variable declaration element which was purposedly visited first in the `TapExpr` itself. This might have introduced CFG inconsistencies, and here this is switched to a simpler setup where the tap expression variable declaration is visited in the body as is normal for `BraceStmt`.
I discussed a plan with @MathiasVP:
The current status of this PR is highly incomplete, also the fix to the property wrapper double needs to be revisited, as it turns out the initializer is not always shared between a var decl and its synthesized property wrapper backing binding. |
@@ -969,6 +959,9 @@ module Decls { | |||
result.asAstNode() = ast.getPattern(j).getFullyUnresolved() | |||
) | |||
or | |||
// PropertyWrapperBackingVarBinding is a special case as it shares the init | |||
// with the original variable binding (see also PrintAstNode.qll) | |||
ast != any(VarDecl d).getPropertyWrapperBackingVarBinding() and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed in our sync. See https://codeql.github.com/docs/ql-language-reference/formulas/#equality.
ast != any(VarDecl d).getPropertyWrapperBackingVarBinding() and | |
not ast = any(VarDecl d).getPropertyWrapperBackingVarBinding() and |
No description provided.