mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
QL4QL: Discard predicates are always alive
This commit is contained in:
@@ -39,6 +39,10 @@ private AstNode queryPredicate() {
|
|||||||
result = queryPredicate().getAChild()
|
result = queryPredicate().getAChild()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AstNode discardPredicate() {
|
||||||
|
result.(Predicate).getAnAnnotation() instanceof OverlayDiscardEntity
|
||||||
|
}
|
||||||
|
|
||||||
AstNode hackyShouldBeTreatedAsAlive() {
|
AstNode hackyShouldBeTreatedAsAlive() {
|
||||||
// Stages from the shared DataFlow impl are copy-pasted, so predicates that are dead in one stage are not dead in another.
|
// Stages from the shared DataFlow impl are copy-pasted, so predicates that are dead in one stage are not dead in another.
|
||||||
result = any(Module mod | mod.getName().matches("Stage%")).getAMember().(ClasslessPredicate) and
|
result = any(Module mod | mod.getName().matches("Stage%")).getAMember().(ClasslessPredicate) and
|
||||||
@@ -58,7 +62,7 @@ AstNode hackyShouldBeTreatedAsAlive() {
|
|||||||
*/
|
*/
|
||||||
private AstNode alive() {
|
private AstNode alive() {
|
||||||
//
|
//
|
||||||
// The 4 base cases.
|
// The 5 base cases.
|
||||||
//
|
//
|
||||||
// 1) everything that can be imported.
|
// 1) everything that can be imported.
|
||||||
result = publicApi()
|
result = publicApi()
|
||||||
@@ -73,6 +77,9 @@ private AstNode alive() {
|
|||||||
// 4) Things that aren't really alive, but that this query treats as live.
|
// 4) Things that aren't really alive, but that this query treats as live.
|
||||||
result = hackyShouldBeTreatedAsAlive()
|
result = hackyShouldBeTreatedAsAlive()
|
||||||
or
|
or
|
||||||
|
// 5) discard predicates
|
||||||
|
result = discardPredicate()
|
||||||
|
or
|
||||||
result instanceof TopLevel // toplevel is always alive.
|
result instanceof TopLevel // toplevel is always alive.
|
||||||
or
|
or
|
||||||
// recursive cases
|
// recursive cases
|
||||||
|
|||||||
Reference in New Issue
Block a user