mirror of
https://github.com/github/codeql.git
synced 2026-05-24 08:07:07 +02:00
C++: Fix internal SCC edges and accept test changes.
This commit is contained in:
@@ -1379,15 +1379,11 @@ class PhiNode extends Definition instanceof SsaImpl::PhiNode {
|
||||
|
||||
private PhiNode getAnInput(PhiNode phi) { result = phi.getAnInput() }
|
||||
|
||||
private predicate definitionCycle(PhiNode phi) { getAnInput+(phi) = phi }
|
||||
|
||||
private predicate hasAnInput(PhiNode phi1, PhiNode phi2) {
|
||||
definitionCycle(phi1) and
|
||||
definitionCycle(phi2) and
|
||||
getAnInput(phi1) = phi2
|
||||
private predicate sccEdge(PhiNode phi1, PhiNode phi2) {
|
||||
getAnInput(phi1) = phi2 and getAnInput+(phi2) = phi1
|
||||
}
|
||||
|
||||
private module PhiCycleEquivalence = QlBuiltins::EquivalenceRelation<PhiNode, hasAnInput/2>;
|
||||
private module PhiCycleEquivalence = QlBuiltins::EquivalenceRelation<PhiNode, sccEdge/2>;
|
||||
|
||||
private PhiCycle getCycle(PhiNode phi) { result.getAPhiNode() = phi }
|
||||
|
||||
|
||||
@@ -67,11 +67,11 @@ void test(int x, bool b1, bool b2) { // $ certain="SSA def(&x)" certain="SSA def
|
||||
int* p = &x; // $ certain="SSA def(&p)" certain="SSA def(p)" certain="SSA def(*p)"
|
||||
int i = 0; // $ certain="SSA def(&i)" certain="SSA def(i)"
|
||||
int j = 0; // $ certain="SSA def(&j)" certain="SSA def(j)"
|
||||
while (i < 10) { // $ certain="SSA phi(i)" uncertain="SSA phi(*p)"
|
||||
while (i < 10) { // $ certain="SSA phi(i)" certain="SSA phi(*p)"
|
||||
if (b1) {
|
||||
*p = 0; // $ certain="SSA def(*p)"
|
||||
}
|
||||
++i; // $ certain="SSA def(i)" uncertain="SSA phi(*p)"
|
||||
++i; // $ certain="SSA def(i)" certain="SSA phi(*p)"
|
||||
}
|
||||
while (j < 10) { // $ uncertain="SSA phi(*p)" certain="SSA phi(j)"
|
||||
if (b2) {
|
||||
|
||||
Reference in New Issue
Block a user