-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Changes from all commits
5db231c
bb7999c
70e4c60
e212feb
065cd02
60eb8b0
279f282
8667e67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| import codeql.swift.printast.Consistency |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| name: codeql/swift-consistency-queries | ||
| groups: [swift, test, consistency-queries] | ||
| dependencies: | ||
| codeql/swift-all: ${workspace} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| private import codeql.swift.printast.PrintAstNode | ||
|
|
||
| query predicate doubleChildren( | ||
| PrintAstNode parent, int index, string label1, PrintAstNode child1, string label2, | ||
| PrintAstNode child2 | ||
| ) { | ||
| child1 != child2 and | ||
| parent.hasChild(child1, index, label1) and | ||
| parent.hasChild(child2, index, label2) | ||
| } | ||
|
|
||
| query predicate doubleIndexes( | ||
| PrintAstNode parent, int index1, string label1, int index2, string label2, PrintAstNode child | ||
| ) { | ||
| index1 != index2 and | ||
| parent.hasChild(child, index1, label1) and | ||
| parent.hasChild(child, index2, label2) | ||
| } | ||
|
|
||
| query predicate doubleParents( | ||
| PrintAstNode parent1, string label1, PrintAstNode parent2, string label2, PrintAstNode child | ||
| ) { | ||
| parent1 != parent2 and | ||
| parent1.hasChild(child, _, label1) and | ||
| parent2.hasChild(child, _, label2) | ||
| } | ||
|
|
||
| private predicate isChildOf(PrintAstNode parent, PrintAstNode child) { | ||
| parent.hasChild(child, _, _) | ||
| } | ||
|
|
||
| query predicate parentChildLoops(PrintAstNode parent, PrintAstNode child) { | ||
| isChildOf(parent, child) and isChildOf*(child, parent) | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| | open_existential.swift:14:5:14:19 | OpenExistentialExpr | hasType: | yes | getSubExpr: | open_existential.swift:14:5:14:19 | call to foo() | getExistential: | open_existential.swift:14:5:14:13 | call to createP() | getOpaqueExpr: | open_existential.swift:14:5:14:13 | OpaqueValueExpr | |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| | open_existential.swift:14:5:14:19 | OpenExistentialExpr | () | |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| protocol P { | ||
| func foo() -> () | ||
| } | ||
|
|
||
| class C : P { | ||
| func foo() {} | ||
| } | ||
|
|
||
| func createP() -> P { | ||
| return C() | ||
| } | ||
|
|
||
| func test() { | ||
| createP().foo() | ||
| } |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
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.