Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -907,9 +907,13 @@ module TestOutput {

query predicate edges(RelevantNode pred, RelevantNode succ, string attr, string val) {
attr = "semmle.label" and
exists(SuccessorType t | succ = getASuccessor(pred, t) |
if successorTypeIsSimple(t) then val = "" else val = t.toString()
)
val =
strictconcat(SuccessorType t, string s |
succ = getASuccessor(pred, t) and
if successorTypeIsSimple(t) then s = "" else s = t.toString()
|
s, ", " order by s
)
or
attr = "semmle.order" and
val =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2775,7 +2775,7 @@ Assert.cs:
#-----| true -> access to parameter b2

# 140| [assertion failure] access to parameter b2
#-----| false -> [assertion failure] access to parameter b3
#-----| false, true -> [assertion failure] access to parameter b3

# 140| access to parameter b2
#-----| false -> [assertion success] access to parameter b3
Expand Down Expand Up @@ -4924,7 +4924,7 @@ ExitMethods.cs:
#-----| -> ...;

# 22| call to method ErrorAlways
#-----| exception(Exception) -> exit M3 (abnormal)
#-----| exception(ArgumentException), exception(Exception) -> exit M3 (abnormal)

# 22| ...;
#-----| -> true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -907,9 +907,13 @@ module TestOutput {

query predicate edges(RelevantNode pred, RelevantNode succ, string attr, string val) {
attr = "semmle.label" and
exists(SuccessorType t | succ = getASuccessor(pred, t) |
if successorTypeIsSimple(t) then val = "" else val = t.toString()
)
val =
strictconcat(SuccessorType t, string s |
succ = getASuccessor(pred, t) and
if successorTypeIsSimple(t) then s = "" else s = t.toString()
|
s, ", " order by s
)
or
attr = "semmle.order" and
val =
Expand Down
20 changes: 10 additions & 10 deletions ruby/ql/test/library-tests/controlflow/graph/Cfg.expected
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ case.rb:
#-----| -> [ ..., * ]

# 35| [ ..., * ]
#-----| match -> x
#-----| false, match, true -> x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually right? I wonder where the true and false edges come from.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is a bug. It may be addressed already by @hmac's CFG changes, but in all cases, I think we should handle it follow-up.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect!

#-----| no-match -> in ... then ...

# 35| x
Expand All @@ -821,7 +821,7 @@ case.rb:
#-----| -> [ ..., * ]

# 36| [ ..., * ]
#-----| match -> x
#-----| false, match, true -> x
#-----| no-match -> in ... then ...

# 36| x
Expand All @@ -836,7 +836,7 @@ case.rb:

# 37| [ ..., * ]
#-----| raise -> exit case_match_array (abnormal)
#-----| match -> a
#-----| false, match, true -> a

# 37| a
#-----| match -> b
Expand Down Expand Up @@ -881,7 +881,7 @@ case.rb:

# 43| [ *,...,* ]
#-----| raise -> exit case_match_find (abnormal)
#-----| match -> x
#-----| false, match, true -> x

# 43| x
#-----| -> 1
Expand Down Expand Up @@ -931,7 +931,7 @@ case.rb:
#-----| no-match -> in ... then ...

# 49| { ..., ** }
#-----| match -> 1
#-----| false, match, true -> 1
#-----| no-match -> in ... then ...

# 49| 1
Expand All @@ -952,7 +952,7 @@ case.rb:
#-----| no-match -> in ... then ...

# 50| { ..., ** }
#-----| match -> 1
#-----| false, match, true -> 1
#-----| no-match -> in ... then ...

# 50| 1
Expand All @@ -968,7 +968,7 @@ case.rb:

# 51| { ..., ** }
#-----| raise -> exit case_match_hash (abnormal)
#-----| match -> case ...
#-----| false, match, true -> case ...

# 55| case_match_variable
#-----| -> case_match_underscore
Expand Down Expand Up @@ -1372,7 +1372,7 @@ case.rb:

# 91| { ..., ** }
#-----| raise -> exit case_match_various (abnormal)
#-----| match -> case ...
#-----| false, match, true -> case ...

# 95| case_match_guard_no_else
#-----| -> exit case.rb (normal)
Expand Down Expand Up @@ -2559,7 +2559,7 @@ cfg.rb:
#-----| -> type

# 101| value
#-----| no-match -> 42
#-----| false, no-match, true -> 42
#-----| match -> key

# 101| 42
Expand Down Expand Up @@ -6535,7 +6535,7 @@ raise.rb:
#-----| -> m11

# 121| p
#-----| no-match -> self
#-----| false, no-match, true -> self
#-----| match -> self

# 121| call to raise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -907,9 +907,13 @@ module TestOutput {

query predicate edges(RelevantNode pred, RelevantNode succ, string attr, string val) {
attr = "semmle.label" and
exists(SuccessorType t | succ = getASuccessor(pred, t) |
if successorTypeIsSimple(t) then val = "" else val = t.toString()
)
val =
strictconcat(SuccessorType t, string s |
succ = getASuccessor(pred, t) and
if successorTypeIsSimple(t) then s = "" else s = t.toString()
|
s, ", " order by s
)
or
attr = "semmle.order" and
val =
Expand Down
8 changes: 4 additions & 4 deletions swift/ql/test/library-tests/controlflow/graph/Cfg.expected
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,14 @@ cfg.swift:
#-----| match -> 0

# 33| .error1
#-----| no-match -> ... is ...
#-----| match, no-match -> ... is ...

# 33| ... is ...
#-----| no-match -> call to isZero(x:)
#-----| match, no-match -> call to isZero(x:)
#-----| no-match -> case ...

# 33| .error2
#-----| no-match -> ... is ...
#-----| match, no-match -> ... is ...

# 33| ... is ... where ...
#-----| -> .error2
Expand Down Expand Up @@ -1577,7 +1577,7 @@ cfg.swift:
#-----| -> =~ ... where ...

# 144| =~ ...
#-----| no-match -> ... .&&(_:_:) ...
#-----| match, no-match -> ... .&&(_:_:) ...
#-----| no-match -> case ...

# 144| x
Expand Down