From 6d5d57accaa75fa32268f8f9b7d6e4b3172b86a1 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Tue, 12 May 2026 11:29:30 +0100 Subject: [PATCH] C++: Add missing overrides. --- .../semmle/code/cpp/ir/dataflow/internal/SsaImpl.qll | 10 ++++++++++ cpp/ql/test/library-tests/dataflow/certain/test.cpp | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaImpl.qll b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaImpl.qll index a3a069b0fac..fc3a8740c52 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaImpl.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaImpl.qll @@ -1357,6 +1357,16 @@ class PhiNode extends Definition instanceof SsaImpl::PhiNode { final predicate hasInputFromBlock(Definition input, IRBlock bb) { phiHasInputFromBlock(this, input, bb) } + + override int getIndirection() { result = this.getSourceVariable().getIndirection() } + + override predicate isCertain() { + forex(Definition inp | inp = this.getAnInput() | inp.isCertain()) + } + + final override Declaration getFunction() { + result = SsaImpl::PhiNode.super.getBasicBlock().getEnclosingFunction() + } } /** An static single assignment (SSA) definition. */ diff --git a/cpp/ql/test/library-tests/dataflow/certain/test.cpp b/cpp/ql/test/library-tests/dataflow/certain/test.cpp index 535b21cede0..b161d25e815 100644 --- a/cpp/ql/test/library-tests/dataflow/certain/test.cpp +++ b/cpp/ql/test/library-tests/dataflow/certain/test.cpp @@ -28,7 +28,7 @@ void test2(bool b) { // $ certain="SSA def(&b)" certain="SSA def(b)" } else { x = 1; // $ certain="SSA def(x)" } - use(x); // $ uncertain="SSA phi(x)" + use(x); // $ certain="SSA phi(x)" } { @@ -38,7 +38,7 @@ void test2(bool b) { // $ certain="SSA def(&b)" certain="SSA def(b)" } else { } - use(x); // $ uncertain="SSA phi(x)" + use(x); // $ certain="SSA phi(x)" } {