C++: Fix IR printing when multiple edges point to the same block

This commit is contained in:
Jeroen Ketema
2024-12-10 20:04:51 +01:00
parent e43f7fbb48
commit 35403d4299
3 changed files with 33 additions and 12 deletions

View File

@@ -427,11 +427,18 @@ query predicate edges(PrintableIRBlock pred, PrintableIRBlock succ, string key,
succBlock = succ.getBlock() and
predBlock.getSuccessor(kind) = succBlock and
(
(
key = "semmle.label" and
key = "semmle.label" and
exists(string kinds |
kinds =
concat(EdgeKind k |
predBlock.getSuccessor(k) = succBlock
|
k.toString(), "|" order by k.toString()
)
|
if predBlock.getBackEdgeSuccessor(kind) = succBlock
then value = kind.toString() + " (back edge)"
else value = kind.toString()
then value = kinds + " (back edge)"
else value = kinds
)
or
key = "semmle.order" and

View File

@@ -427,11 +427,18 @@ query predicate edges(PrintableIRBlock pred, PrintableIRBlock succ, string key,
succBlock = succ.getBlock() and
predBlock.getSuccessor(kind) = succBlock and
(
(
key = "semmle.label" and
key = "semmle.label" and
exists(string kinds |
kinds =
concat(EdgeKind k |
predBlock.getSuccessor(k) = succBlock
|
k.toString(), "|" order by k.toString()
)
|
if predBlock.getBackEdgeSuccessor(kind) = succBlock
then value = kind.toString() + " (back edge)"
else value = kind.toString()
then value = kinds + " (back edge)"
else value = kinds
)
or
key = "semmle.order" and

View File

@@ -427,11 +427,18 @@ query predicate edges(PrintableIRBlock pred, PrintableIRBlock succ, string key,
succBlock = succ.getBlock() and
predBlock.getSuccessor(kind) = succBlock and
(
(
key = "semmle.label" and
key = "semmle.label" and
exists(string kinds |
kinds =
concat(EdgeKind k |
predBlock.getSuccessor(k) = succBlock
|
k.toString(), "|" order by k.toString()
)
|
if predBlock.getBackEdgeSuccessor(kind) = succBlock
then value = kind.toString() + " (back edge)"
else value = kind.toString()
then value = kinds + " (back edge)"
else value = kinds
)
or
key = "semmle.order" and