From fdd3b901f798f02ea1828d3bf79e43d0f12c6049 Mon Sep 17 00:00:00 2001 From: Jonas Jensen Date: Wed, 21 Aug 2019 13:04:10 +0200 Subject: [PATCH] C/C#/Java: Share ConfigurationRecursionPrevention This class was copy-pasted in all `DataFlowN.qll` files without using the identical-files system to keep the copies in sync. The class is now moved to the `DataFlowImplN.qll` files. This also has the effect of preventing recursion through first data flow library copy for C/C++. Such recursion has been deprecated for over a year, and some forms of recursions are already ruled out by the library implementation. --- .../semmle/code/cpp/dataflow/DataFlow2.qll | 23 ------------------- .../semmle/code/cpp/dataflow/DataFlow3.qll | 23 ------------------- .../semmle/code/cpp/dataflow/DataFlow4.qll | 23 ------------------- .../cpp/dataflow/internal/DataFlowImpl.qll | 22 ++++++++++++++++++ .../cpp/dataflow/internal/DataFlowImpl2.qll | 22 ++++++++++++++++++ .../cpp/dataflow/internal/DataFlowImpl3.qll | 22 ++++++++++++++++++ .../cpp/dataflow/internal/DataFlowImpl4.qll | 22 ++++++++++++++++++ .../semmle/code/cpp/ir/dataflow/DataFlow2.qll | 23 ------------------- .../semmle/code/cpp/ir/dataflow/DataFlow3.qll | 23 ------------------- .../semmle/code/cpp/ir/dataflow/DataFlow4.qll | 23 ------------------- .../cpp/ir/dataflow/internal/DataFlowImpl.qll | 22 ++++++++++++++++++ .../ir/dataflow/internal/DataFlowImpl2.qll | 22 ++++++++++++++++++ .../ir/dataflow/internal/DataFlowImpl3.qll | 22 ++++++++++++++++++ .../ir/dataflow/internal/DataFlowImpl4.qll | 22 ++++++++++++++++++ .../semmle/code/csharp/dataflow/DataFlow.qll | 19 --------------- .../semmle/code/csharp/dataflow/DataFlow2.qll | 19 --------------- .../semmle/code/csharp/dataflow/DataFlow3.qll | 19 --------------- .../semmle/code/csharp/dataflow/DataFlow4.qll | 19 --------------- .../semmle/code/csharp/dataflow/DataFlow5.qll | 19 --------------- .../csharp/dataflow/internal/DataFlowImpl.qll | 22 ++++++++++++++++++ .../dataflow/internal/DataFlowImpl2.qll | 22 ++++++++++++++++++ .../dataflow/internal/DataFlowImpl3.qll | 22 ++++++++++++++++++ .../dataflow/internal/DataFlowImpl4.qll | 22 ++++++++++++++++++ .../dataflow/internal/DataFlowImpl5.qll | 22 ++++++++++++++++++ .../semmle/code/java/dataflow/DataFlow.qll | 19 --------------- .../semmle/code/java/dataflow/DataFlow2.qll | 19 --------------- .../semmle/code/java/dataflow/DataFlow3.qll | 19 --------------- .../semmle/code/java/dataflow/DataFlow4.qll | 19 --------------- .../semmle/code/java/dataflow/DataFlow5.qll | 19 --------------- .../java/dataflow/internal/DataFlowImpl.qll | 22 ++++++++++++++++++ .../java/dataflow/internal/DataFlowImpl2.qll | 22 ++++++++++++++++++ .../java/dataflow/internal/DataFlowImpl3.qll | 22 ++++++++++++++++++ .../java/dataflow/internal/DataFlowImpl4.qll | 22 ++++++++++++++++++ .../java/dataflow/internal/DataFlowImpl5.qll | 22 ++++++++++++++++++ 34 files changed, 396 insertions(+), 328 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/dataflow/DataFlow2.qll b/cpp/ql/src/semmle/code/cpp/dataflow/DataFlow2.qll index 6f6c41ee16c..c651ead3b01 100644 --- a/cpp/ql/src/semmle/code/cpp/dataflow/DataFlow2.qll +++ b/cpp/ql/src/semmle/code/cpp/dataflow/DataFlow2.qll @@ -12,27 +12,4 @@ import cpp module DataFlow2 { import semmle.code.cpp.dataflow.internal.DataFlowImpl2 - - /** - * This class exists to prevent mutual recursion between the user-overridden - * member predicates of `Configuration` and the rest of the data-flow library. - * Good performance cannot be guaranteed in the presence of such recursion, so - * it should be replaced by using more than one copy of the data flow library. - * Four copies are available: `DataFlow` through `DataFlow4`. - */ - private abstract - class ConfigurationRecursionPrevention extends Configuration { - bindingset[this] - ConfigurationRecursionPrevention() { any() } - - override predicate hasFlow(Node source, Node sink) { - strictcount(Node n | this.isSource(n)) < 0 - or - strictcount(Node n | this.isSink(n)) < 0 - or - strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 - or - super.hasFlow(source, sink) - } - } } diff --git a/cpp/ql/src/semmle/code/cpp/dataflow/DataFlow3.qll b/cpp/ql/src/semmle/code/cpp/dataflow/DataFlow3.qll index 77385b2dbe5..53293eb2f22 100644 --- a/cpp/ql/src/semmle/code/cpp/dataflow/DataFlow3.qll +++ b/cpp/ql/src/semmle/code/cpp/dataflow/DataFlow3.qll @@ -12,27 +12,4 @@ import cpp module DataFlow3 { import semmle.code.cpp.dataflow.internal.DataFlowImpl3 - - /** - * This class exists to prevent mutual recursion between the user-overridden - * member predicates of `Configuration` and the rest of the data-flow library. - * Good performance cannot be guaranteed in the presence of such recursion, so - * it should be replaced by using more than one copy of the data flow library. - * Four copies are available: `DataFlow` through `DataFlow4`. - */ - private abstract - class ConfigurationRecursionPrevention extends Configuration { - bindingset[this] - ConfigurationRecursionPrevention() { any() } - - override predicate hasFlow(Node source, Node sink) { - strictcount(Node n | this.isSource(n)) < 0 - or - strictcount(Node n | this.isSink(n)) < 0 - or - strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 - or - super.hasFlow(source, sink) - } - } } diff --git a/cpp/ql/src/semmle/code/cpp/dataflow/DataFlow4.qll b/cpp/ql/src/semmle/code/cpp/dataflow/DataFlow4.qll index 30b7273f451..c4963e46a7b 100644 --- a/cpp/ql/src/semmle/code/cpp/dataflow/DataFlow4.qll +++ b/cpp/ql/src/semmle/code/cpp/dataflow/DataFlow4.qll @@ -12,27 +12,4 @@ import cpp module DataFlow4 { import semmle.code.cpp.dataflow.internal.DataFlowImpl4 - - /** - * This class exists to prevent mutual recursion between the user-overridden - * member predicates of `Configuration` and the rest of the data-flow library. - * Good performance cannot be guaranteed in the presence of such recursion, so - * it should be replaced by using more than one copy of the data flow library. - * Four copies are available: `DataFlow` through `DataFlow4`. - */ - private abstract - class ConfigurationRecursionPrevention extends Configuration { - bindingset[this] - ConfigurationRecursionPrevention() { any() } - - override predicate hasFlow(Node source, Node sink) { - strictcount(Node n | this.isSource(n)) < 0 - or - strictcount(Node n | this.isSink(n)) < 0 - or - strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 - or - super.hasFlow(source, sink) - } - } } diff --git a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll index f797b3bcf35..96238a91d09 100644 --- a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll +++ b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll index f797b3bcf35..96238a91d09 100644 --- a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll +++ b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll index f797b3bcf35..96238a91d09 100644 --- a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll +++ b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll index f797b3bcf35..96238a91d09 100644 --- a/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll +++ b/cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/cpp/ql/src/semmle/code/cpp/ir/dataflow/DataFlow2.qll b/cpp/ql/src/semmle/code/cpp/ir/dataflow/DataFlow2.qll index 9d849c510c5..0e24e2949f0 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/dataflow/DataFlow2.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/dataflow/DataFlow2.qll @@ -12,27 +12,4 @@ import cpp module DataFlow2 { import semmle.code.cpp.ir.dataflow.internal.DataFlowImpl2 - - /** - * This class exists to prevent mutual recursion between the user-overridden - * member predicates of `Configuration` and the rest of the data-flow library. - * Good performance cannot be guaranteed in the presence of such recursion, so - * it should be replaced by using more than one copy of the data flow library. - * Four copies are available: `DataFlow` through `DataFlow4`. - */ - private abstract - class ConfigurationRecursionPrevention extends Configuration { - bindingset[this] - ConfigurationRecursionPrevention() { any() } - - override predicate hasFlow(Node source, Node sink) { - strictcount(Node n | this.isSource(n)) < 0 - or - strictcount(Node n | this.isSink(n)) < 0 - or - strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 - or - super.hasFlow(source, sink) - } - } } diff --git a/cpp/ql/src/semmle/code/cpp/ir/dataflow/DataFlow3.qll b/cpp/ql/src/semmle/code/cpp/ir/dataflow/DataFlow3.qll index 459b80d5e27..9ea19b45a37 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/dataflow/DataFlow3.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/dataflow/DataFlow3.qll @@ -12,27 +12,4 @@ import cpp module DataFlow3 { import semmle.code.cpp.ir.dataflow.internal.DataFlowImpl3 - - /** - * This class exists to prevent mutual recursion between the user-overridden - * member predicates of `Configuration` and the rest of the data-flow library. - * Good performance cannot be guaranteed in the presence of such recursion, so - * it should be replaced by using more than one copy of the data flow library. - * Four copies are available: `DataFlow` through `DataFlow4`. - */ - private abstract - class ConfigurationRecursionPrevention extends Configuration { - bindingset[this] - ConfigurationRecursionPrevention() { any() } - - override predicate hasFlow(Node source, Node sink) { - strictcount(Node n | this.isSource(n)) < 0 - or - strictcount(Node n | this.isSink(n)) < 0 - or - strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 - or - super.hasFlow(source, sink) - } - } } diff --git a/cpp/ql/src/semmle/code/cpp/ir/dataflow/DataFlow4.qll b/cpp/ql/src/semmle/code/cpp/ir/dataflow/DataFlow4.qll index c67509bd7e4..cd9bb5869c1 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/dataflow/DataFlow4.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/dataflow/DataFlow4.qll @@ -12,27 +12,4 @@ import cpp module DataFlow4 { import semmle.code.cpp.ir.dataflow.internal.DataFlowImpl4 - - /** - * This class exists to prevent mutual recursion between the user-overridden - * member predicates of `Configuration` and the rest of the data-flow library. - * Good performance cannot be guaranteed in the presence of such recursion, so - * it should be replaced by using more than one copy of the data flow library. - * Four copies are available: `DataFlow` through `DataFlow4`. - */ - private abstract - class ConfigurationRecursionPrevention extends Configuration { - bindingset[this] - ConfigurationRecursionPrevention() { any() } - - override predicate hasFlow(Node source, Node sink) { - strictcount(Node n | this.isSource(n)) < 0 - or - strictcount(Node n | this.isSink(n)) < 0 - or - strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 - or - super.hasFlow(source, sink) - } - } } diff --git a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll index f797b3bcf35..96238a91d09 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll index f797b3bcf35..96238a91d09 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll index f797b3bcf35..96238a91d09 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll index f797b3bcf35..96238a91d09 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow.qll b/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow.qll index d7e7106694a..1d3d53e2316 100644 --- a/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow.qll +++ b/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow.qll @@ -7,23 +7,4 @@ import csharp module DataFlow { import semmle.code.csharp.dataflow.internal.DataFlowImpl - - /** - * This class exists to prevent mutual recursion between the user-overridden - * member predicates of `Configuration` and the rest of the data-flow library. - * Good performance cannot be guaranteed in the presence of such recursion, so - * it should be replaced by using more than one copy of the data flow library. - * Five copies are available: `DataFlow` through `DataFlow5`. - */ - abstract private class ConfigurationRecursionPrevention extends Configuration { - bindingset[this] - ConfigurationRecursionPrevention() { any() } - - override predicate hasFlow(Node source, Node sink) { - strictcount(Node n | this.isSource(n)) < 0 or - strictcount(Node n | this.isSink(n)) < 0 or - strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 or - super.hasFlow(source, sink) - } - } } diff --git a/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow2.qll b/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow2.qll index b2e18f6ef11..60525016d31 100644 --- a/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow2.qll +++ b/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow2.qll @@ -7,23 +7,4 @@ import csharp module DataFlow2 { import semmle.code.csharp.dataflow.internal.DataFlowImpl2 - - /** - * This class exists to prevent mutual recursion between the user-overridden - * member predicates of `Configuration` and the rest of the data-flow library. - * Good performance cannot be guaranteed in the presence of such recursion, so - * it should be replaced by using more than one copy of the data flow library. - * Five copies are available: `DataFlow` through `DataFlow5`. - */ - abstract private class ConfigurationRecursionPrevention extends Configuration { - bindingset[this] - ConfigurationRecursionPrevention() { any() } - - override predicate hasFlow(Node source, Node sink) { - strictcount(Node n | this.isSource(n)) < 0 or - strictcount(Node n | this.isSink(n)) < 0 or - strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 or - super.hasFlow(source, sink) - } - } } diff --git a/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow3.qll b/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow3.qll index 6d3fcc86b0b..7f3b9469449 100644 --- a/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow3.qll +++ b/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow3.qll @@ -7,23 +7,4 @@ import csharp module DataFlow3 { import semmle.code.csharp.dataflow.internal.DataFlowImpl3 - - /** - * This class exists to prevent mutual recursion between the user-overridden - * member predicates of `Configuration` and the rest of the data-flow library. - * Good performance cannot be guaranteed in the presence of such recursion, so - * it should be replaced by using more than one copy of the data flow library. - * Five copies are available: `DataFlow` through `DataFlow5`. - */ - abstract private class ConfigurationRecursionPrevention extends Configuration { - bindingset[this] - ConfigurationRecursionPrevention() { any() } - - override predicate hasFlow(Node source, Node sink) { - strictcount(Node n | this.isSource(n)) < 0 or - strictcount(Node n | this.isSink(n)) < 0 or - strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 or - super.hasFlow(source, sink) - } - } } diff --git a/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow4.qll b/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow4.qll index 7334e406a4a..29c994a2eec 100644 --- a/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow4.qll +++ b/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow4.qll @@ -7,23 +7,4 @@ import csharp module DataFlow4 { import semmle.code.csharp.dataflow.internal.DataFlowImpl4 - - /** - * This class exists to prevent mutual recursion between the user-overridden - * member predicates of `Configuration` and the rest of the data-flow library. - * Good performance cannot be guaranteed in the presence of such recursion, so - * it should be replaced by using more than one copy of the data flow library. - * Five copies are available: `DataFlow` through `DataFlow5`. - */ - abstract private class ConfigurationRecursionPrevention extends Configuration { - bindingset[this] - ConfigurationRecursionPrevention() { any() } - - override predicate hasFlow(Node source, Node sink) { - strictcount(Node n | this.isSource(n)) < 0 or - strictcount(Node n | this.isSink(n)) < 0 or - strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 or - super.hasFlow(source, sink) - } - } } diff --git a/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow5.qll b/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow5.qll index 6990f0b2e51..48148117166 100644 --- a/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow5.qll +++ b/csharp/ql/src/semmle/code/csharp/dataflow/DataFlow5.qll @@ -7,23 +7,4 @@ import csharp module DataFlow5 { import semmle.code.csharp.dataflow.internal.DataFlowImpl5 - - /** - * This class exists to prevent mutual recursion between the user-overridden - * member predicates of `Configuration` and the rest of the data-flow library. - * Good performance cannot be guaranteed in the presence of such recursion, so - * it should be replaced by using more than one copy of the data flow library. - * Five copies are available: `DataFlow` through `DataFlow5`. - */ - abstract private class ConfigurationRecursionPrevention extends Configuration { - bindingset[this] - ConfigurationRecursionPrevention() { any() } - - override predicate hasFlow(Node source, Node sink) { - strictcount(Node n | this.isSource(n)) < 0 or - strictcount(Node n | this.isSink(n)) < 0 or - strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 or - super.hasFlow(source, sink) - } - } } diff --git a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll index f797b3bcf35..96238a91d09 100644 --- a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll +++ b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll index f797b3bcf35..96238a91d09 100644 --- a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll +++ b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll index f797b3bcf35..96238a91d09 100644 --- a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll +++ b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll index f797b3bcf35..96238a91d09 100644 --- a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll +++ b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll index f797b3bcf35..96238a91d09 100644 --- a/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll +++ b/csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/java/ql/src/semmle/code/java/dataflow/DataFlow.qll b/java/ql/src/semmle/code/java/dataflow/DataFlow.qll index c6d12c8f657..1b4409234e6 100644 --- a/java/ql/src/semmle/code/java/dataflow/DataFlow.qll +++ b/java/ql/src/semmle/code/java/dataflow/DataFlow.qll @@ -7,23 +7,4 @@ import java module DataFlow { import semmle.code.java.dataflow.internal.DataFlowImpl - - /** - * This class exists to prevent mutual recursion between the user-overridden - * member predicates of `Configuration` and the rest of the data-flow library. - * Good performance cannot be guaranteed in the presence of such recursion, so - * it should be replaced by using more than one copy of the data flow library. - * Four copies are available: `DataFlow` through `DataFlow4`. - */ - abstract private class ConfigurationRecursionPrevention extends Configuration { - bindingset[this] - ConfigurationRecursionPrevention() { any() } - - override predicate hasFlow(Node source, Node sink) { - strictcount(Node n | this.isSource(n)) < 0 or - strictcount(Node n | this.isSink(n)) < 0 or - strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 or - super.hasFlow(source, sink) - } - } } diff --git a/java/ql/src/semmle/code/java/dataflow/DataFlow2.qll b/java/ql/src/semmle/code/java/dataflow/DataFlow2.qll index 43e319b503b..92003314778 100644 --- a/java/ql/src/semmle/code/java/dataflow/DataFlow2.qll +++ b/java/ql/src/semmle/code/java/dataflow/DataFlow2.qll @@ -7,23 +7,4 @@ import java module DataFlow2 { import semmle.code.java.dataflow.internal.DataFlowImpl2 - - /** - * This class exists to prevent mutual recursion between the user-overridden - * member predicates of `Configuration` and the rest of the data-flow library. - * Good performance cannot be guaranteed in the presence of such recursion, so - * it should be replaced by using more than one copy of the data flow library. - * Four copies are available: `DataFlow` through `DataFlow4`. - */ - abstract private class ConfigurationRecursionPrevention extends Configuration { - bindingset[this] - ConfigurationRecursionPrevention() { any() } - - override predicate hasFlow(Node source, Node sink) { - strictcount(Node n | this.isSource(n)) < 0 or - strictcount(Node n | this.isSink(n)) < 0 or - strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 or - super.hasFlow(source, sink) - } - } } diff --git a/java/ql/src/semmle/code/java/dataflow/DataFlow3.qll b/java/ql/src/semmle/code/java/dataflow/DataFlow3.qll index 5a9cc7cdb1a..c8d614e0879 100644 --- a/java/ql/src/semmle/code/java/dataflow/DataFlow3.qll +++ b/java/ql/src/semmle/code/java/dataflow/DataFlow3.qll @@ -7,23 +7,4 @@ import java module DataFlow3 { import semmle.code.java.dataflow.internal.DataFlowImpl3 - - /** - * This class exists to prevent mutual recursion between the user-overridden - * member predicates of `Configuration` and the rest of the data-flow library. - * Good performance cannot be guaranteed in the presence of such recursion, so - * it should be replaced by using more than one copy of the data flow library. - * Four copies are available: `DataFlow` through `DataFlow4`. - */ - abstract private class ConfigurationRecursionPrevention extends Configuration { - bindingset[this] - ConfigurationRecursionPrevention() { any() } - - override predicate hasFlow(Node source, Node sink) { - strictcount(Node n | this.isSource(n)) < 0 or - strictcount(Node n | this.isSink(n)) < 0 or - strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 or - super.hasFlow(source, sink) - } - } } diff --git a/java/ql/src/semmle/code/java/dataflow/DataFlow4.qll b/java/ql/src/semmle/code/java/dataflow/DataFlow4.qll index 1df0d5db293..852cfd9f813 100644 --- a/java/ql/src/semmle/code/java/dataflow/DataFlow4.qll +++ b/java/ql/src/semmle/code/java/dataflow/DataFlow4.qll @@ -7,23 +7,4 @@ import java module DataFlow4 { import semmle.code.java.dataflow.internal.DataFlowImpl4 - - /** - * This class exists to prevent mutual recursion between the user-overridden - * member predicates of `Configuration` and the rest of the data-flow library. - * Good performance cannot be guaranteed in the presence of such recursion, so - * it should be replaced by using more than one copy of the data flow library. - * Four copies are available: `DataFlow` through `DataFlow4`. - */ - abstract private class ConfigurationRecursionPrevention extends Configuration { - bindingset[this] - ConfigurationRecursionPrevention() { any() } - - override predicate hasFlow(Node source, Node sink) { - strictcount(Node n | this.isSource(n)) < 0 or - strictcount(Node n | this.isSink(n)) < 0 or - strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 or - super.hasFlow(source, sink) - } - } } diff --git a/java/ql/src/semmle/code/java/dataflow/DataFlow5.qll b/java/ql/src/semmle/code/java/dataflow/DataFlow5.qll index b932e7d0d10..f8986a03524 100644 --- a/java/ql/src/semmle/code/java/dataflow/DataFlow5.qll +++ b/java/ql/src/semmle/code/java/dataflow/DataFlow5.qll @@ -7,23 +7,4 @@ import java module DataFlow5 { import semmle.code.java.dataflow.internal.DataFlowImpl5 - - /** - * This class exists to prevent mutual recursion between the user-overridden - * member predicates of `Configuration` and the rest of the data-flow library. - * Good performance cannot be guaranteed in the presence of such recursion, so - * it should be replaced by using more than one copy of the data flow library. - * Four copies are available: `DataFlow` through `DataFlow4`. - */ - abstract private class ConfigurationRecursionPrevention extends Configuration { - bindingset[this] - ConfigurationRecursionPrevention() { any() } - - override predicate hasFlow(Node source, Node sink) { - strictcount(Node n | this.isSource(n)) < 0 or - strictcount(Node n | this.isSink(n)) < 0 or - strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 or - super.hasFlow(source, sink) - } - } } diff --git a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll index f797b3bcf35..96238a91d09 100644 --- a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll +++ b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl2.qll b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl2.qll index f797b3bcf35..96238a91d09 100644 --- a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl2.qll +++ b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl2.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl3.qll b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl3.qll index f797b3bcf35..96238a91d09 100644 --- a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl3.qll +++ b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl3.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl4.qll b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl4.qll index f797b3bcf35..96238a91d09 100644 --- a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl4.qll +++ b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl4.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node) diff --git a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl5.qll b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl5.qll index f797b3bcf35..96238a91d09 100644 --- a/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl5.qll +++ b/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl5.qll @@ -121,6 +121,28 @@ abstract class Configuration extends string { deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) } } +/** + * This class exists to prevent mutual recursion between the user-overridden + * member predicates of `Configuration` and the rest of the data-flow library. + * Good performance cannot be guaranteed in the presence of such recursion, so + * it should be replaced by using more than one copy of the data flow library. + */ +private abstract +class ConfigurationRecursionPrevention extends Configuration { + bindingset[this] + ConfigurationRecursionPrevention() { any() } + + override predicate hasFlow(Node source, Node sink) { + strictcount(Node n | this.isSource(n)) < 0 + or + strictcount(Node n | this.isSink(n)) < 0 + or + strictcount(Node n1, Node n2 | this.isAdditionalFlowStep(n1, n2)) < 0 + or + super.hasFlow(source, sink) + } +} + private predicate inBarrier(Node node, Configuration config) { config.isBarrierIn(node) and config.isSource(node)