diff --git a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll index 7da63f6c4fa..e154491f795 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll @@ -58,6 +58,9 @@ module Consistency { predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) { none() } + + /** Holds if `n` should be excluded from the consistency test `identityLocalStep`. */ + predicate identityLocalStepExclude(Node n) { none() } } private class RelevantNode extends Node { @@ -287,4 +290,10 @@ module Consistency { not exists(unique(ContentApprox approx | approx = getContentApprox(c))) and msg = "Non-unique content approximation." } + + query predicate identityLocalStep(Node n, string msg) { + simpleLocalFlowStep(n, n) and + not any(ConsistencyConfiguration c).identityLocalStepExclude(n) and + msg = "Node steps to itself" + } }