Skip to content

Commit c62430a

Browse files
Fix C# CustomPathStateProblem compilation and enhance test with meaningful results
Co-authored-by: MichaelRFairhurst <1627771+MichaelRFairhurst@users.noreply.github.com>
1 parent 4cae451 commit c62430a

8 files changed

Lines changed: 14 additions & 53 deletions

File tree

csharp/src/qtil/csharp/graph/CustomPathStateProblem.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ private import qtil.locations.CustomPathStateProblem
22
private import qtil.csharp.locations.Locatable
33
private import csharp
44
// Import the C# specific configuration for making custom path state problems.
5-
import PathStateProblem<csharp::Location, CsharpLocatableConfig>
5+
import PathStateProblem<Location, CsharpLocatableConfig>
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
edges
2+
| test.cs:4:13:4:15 | mid | test.cs:3:13:3:15 | end | | |
3+
| test.cs:5:13:5:17 | start | test.cs:4:13:4:15 | mid | | |
24
nodes
3-
#select
5+
| test.cs:3:13:3:15 | end | semmle.label | end |
6+
| test.cs:4:13:4:15 | mid | semmle.label | mid |
7+
| test.cs:5:13:5:17 | start | semmle.label | start |
8+
#select
9+
| test.cs:5:13:5:17 | start | test.cs:3:13:3:15 | end | Path from $@ to $@. | start | test.cs:5:13:5:17 | start | end | test.cs:3:13:3:15 | end |

csharp/test/qtil/csharp/graph/CustomPathStateProblemTest.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module CallGraphPathStateProblemConfig implements CustomPathStateProblemConfigSi
1010
predicate start(Node n, int depth) { n.getName() = "start" and depth = 0 }
1111

1212
bindingset[depth]
13-
predicate end(Node n, int depth) { n.getName() = "end" }
13+
predicate end(Node n, int depth) { n.getName() = "end" and depth >= 0 }
1414

1515
bindingset[depth1]
1616
bindingset[depth2]
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
public class Test {
22
void f1() {
3-
int mid = 0;
4-
int start = 0;
5-
int end = 0;
3+
int end = 42;
4+
int mid = end;
5+
int start = mid;
66
int unrelated = 0;
7-
start = mid;
8-
start = unrelated;
9-
mid = end;
107
}
118
}

ruby/test/qtil/ruby/graph/CustomPathStateProblemTest.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ import CustomPathStateProblem<CallGraphPathStateProblemConfig>
2828

2929
from Ast::VariableWriteAccess start, Ast::VariableWriteAccess end
3030
where problem(start, end)
31-
select start, end, "Path from $@ to $@.", start.getVariable().getName(), start, end.getVariable().getName(), end
31+
select start, end, "Path from $@ to $@.", start.getVariable().getName(), start,
32+
end.getVariable().getName(), end

swift/test/qtil/swift/graph/graph.testproj/codeql-database.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

swift/test/qtil/swift/graph/graph.testproj/diagnostic/extractors/swift/extractor/1757743446422564217-5421.jsonl

Lines changed: 0 additions & 1 deletion
This file was deleted.

swift/test/qtil/swift/graph/graph.testproj/log/qltest.log

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)