Skip to content

Commit 9b26921

Browse files
committed
Control flow: add order disambuigation customization
1 parent ebf650c commit 9b26921

File tree

3 files changed

+30
-9
lines changed

3 files changed

+30
-9
lines changed

csharp/ql/lib/semmle/code/csharp/controlflow/internal/ControlFlowGraphImplShared.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,12 @@ import Cached
881881
* graph is restricted to nodes from `RelevantNode`.
882882
*/
883883
module TestOutput {
884-
abstract class RelevantNode extends Node { }
884+
abstract class RelevantNode extends Node {
885+
/**
886+
* Gets a string used to resolve ties in node and edge ordering.
887+
*/
888+
string getOrderDisambuigation() { result = "" }
889+
}
885890

886891
query predicate nodes(RelevantNode n, string attr, string val) {
887892
attr = "semmle.order" and
@@ -894,7 +899,8 @@ module TestOutput {
894899
p
895900
order by
896901
l.getFile().getBaseName(), l.getFile().getAbsolutePath(), l.getStartLine(),
897-
l.getStartColumn(), l.getEndLine(), l.getEndColumn(), p.toString()
902+
l.getStartColumn(), l.getEndLine(), l.getEndColumn(), p.toString(),
903+
p.getOrderDisambuigation()
898904
)
899905
).toString()
900906
}
@@ -916,7 +922,8 @@ module TestOutput {
916922
s
917923
order by
918924
l.getFile().getBaseName(), l.getFile().getAbsolutePath(), l.getStartLine(),
919-
l.getStartColumn(), l.getEndLine(), l.getEndColumn(), t.toString(), s.toString()
925+
l.getStartColumn(), l.getEndLine(), l.getEndColumn(), t.toString(), s.toString(),
926+
s.getOrderDisambuigation()
920927
)
921928
).toString()
922929
}

ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImplShared.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,12 @@ import Cached
881881
* graph is restricted to nodes from `RelevantNode`.
882882
*/
883883
module TestOutput {
884-
abstract class RelevantNode extends Node { }
884+
abstract class RelevantNode extends Node {
885+
/**
886+
* Gets a string used to resolve ties in node and edge ordering.
887+
*/
888+
string getOrderDisambuigation() { result = "" }
889+
}
885890

886891
query predicate nodes(RelevantNode n, string attr, string val) {
887892
attr = "semmle.order" and
@@ -894,7 +899,8 @@ module TestOutput {
894899
p
895900
order by
896901
l.getFile().getBaseName(), l.getFile().getAbsolutePath(), l.getStartLine(),
897-
l.getStartColumn(), l.getEndLine(), l.getEndColumn(), p.toString()
902+
l.getStartColumn(), l.getEndLine(), l.getEndColumn(), p.toString(),
903+
p.getOrderDisambuigation()
898904
)
899905
).toString()
900906
}
@@ -916,7 +922,8 @@ module TestOutput {
916922
s
917923
order by
918924
l.getFile().getBaseName(), l.getFile().getAbsolutePath(), l.getStartLine(),
919-
l.getStartColumn(), l.getEndLine(), l.getEndColumn(), t.toString(), s.toString()
925+
l.getStartColumn(), l.getEndLine(), l.getEndColumn(), t.toString(), s.toString(),
926+
s.getOrderDisambuigation()
920927
)
921928
).toString()
922929
}

swift/ql/lib/codeql/swift/controlflow/internal/ControlFlowGraphImplShared.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,12 @@ import Cached
881881
* graph is restricted to nodes from `RelevantNode`.
882882
*/
883883
module TestOutput {
884-
abstract class RelevantNode extends Node { }
884+
abstract class RelevantNode extends Node {
885+
/**
886+
* Gets a string used to resolve ties in node and edge ordering.
887+
*/
888+
string getOrderDisambuigation() { result = "" }
889+
}
885890

886891
query predicate nodes(RelevantNode n, string attr, string val) {
887892
attr = "semmle.order" and
@@ -894,7 +899,8 @@ module TestOutput {
894899
p
895900
order by
896901
l.getFile().getBaseName(), l.getFile().getAbsolutePath(), l.getStartLine(),
897-
l.getStartColumn(), l.getEndLine(), l.getEndColumn(), p.toString()
902+
l.getStartColumn(), l.getEndLine(), l.getEndColumn(), p.toString(),
903+
p.getOrderDisambuigation()
898904
)
899905
).toString()
900906
}
@@ -916,7 +922,8 @@ module TestOutput {
916922
s
917923
order by
918924
l.getFile().getBaseName(), l.getFile().getAbsolutePath(), l.getStartLine(),
919-
l.getStartColumn(), l.getEndLine(), l.getEndColumn(), t.toString(), s.toString()
925+
l.getStartColumn(), l.getEndLine(), l.getEndColumn(), t.toString(), s.toString(),
926+
s.getOrderDisambuigation()
920927
)
921928
).toString()
922929
}

0 commit comments

Comments
 (0)