QL: Add more dead-code tests

This commit is contained in:
Tom Hvitved
2023-06-22 11:07:09 +02:00
parent 7c2f26e0c3
commit 04f388f8c4
2 changed files with 44 additions and 2 deletions

View File

@@ -1,2 +1,8 @@
| Foo.qll:2:21:2:25 | ClasslessPredicate dead1 | This code is never used, and it's not publicly exported. |
| Foo.qll:6:13:6:17 | ClasslessPredicate dead2 | This code is never used, and it's not publicly exported. |
| Foo.qll:4:21:4:25 | ClasslessPredicate dead1 | This code is never used, and it's not publicly exported. |
| Foo.qll:8:13:8:17 | ClasslessPredicate dead2 | This code is never used, and it's not publicly exported. |
| Foo.qll:42:16:42:21 | Module Input1 | This code is never used, and it's not publicly exported. |
| Foo.qll:46:16:46:21 | Module Input2 | This code is never used, and it's not publicly exported. |
| Foo.qll:50:16:50:21 | Module Input3 | This code is never used, and it's not publicly exported. |
| Foo.qll:56:16:56:17 | Module M2 | This code is never used, and it's not publicly exported. |
| Foo.qll:64:15:64:20 | Class CImpl1 | This code is never used, and it's not publicly exported. |
| Foo.qll:68:15:68:20 | Class CImpl2 | This code is never used, and it's not publicly exported. |

View File

@@ -1,3 +1,5 @@
import ql
private module Mixed {
private predicate dead1() { none() }
@@ -30,3 +32,37 @@ private module Foo {
module ValidationMethod<Foo::bar/0 sig> {
predicate impl() { sig() }
}
signature module InputSig {
predicate foo();
}
module ParameterizedModule<InputSig Input> { }
private module Input1 implements InputSig {
predicate foo() { any() }
}
private module Input2 implements InputSig {
predicate foo() { any() }
}
private module Input3 implements InputSig {
predicate foo() { any() }
}
module M1 = ParameterizedModule<Input1>;
private module M2 = ParameterizedModule<Input2>;
import ParameterizedModule<Input3>
private module MImpl { }
module MPublic = MImpl;
private class CImpl1 extends AstNode { }
final class CPublic1 = CImpl1;
private class CImpl2 extends AstNode { }