mirror of
https://github.com/github/codeql.git
synced 2026-04-29 02:35:15 +02:00
C#: Exclude call inside static field initializers from consistency check
This commit is contained in:
@@ -2,6 +2,7 @@ import csharp
|
||||
import cil
|
||||
import semmle.code.csharp.dataflow.internal.DataFlowPrivate
|
||||
import semmle.code.csharp.dataflow.internal.DataFlowPublic
|
||||
import semmle.code.csharp.dataflow.internal.DataFlowDispatch
|
||||
import semmle.code.csharp.dataflow.internal.DataFlowImplConsistency::Consistency
|
||||
|
||||
private class MyConsistencyConfiguration extends ConsistencyConfiguration {
|
||||
@@ -14,6 +15,15 @@ private class MyConsistencyConfiguration extends ConsistencyConfiguration {
|
||||
)
|
||||
}
|
||||
|
||||
override predicate uniqueCallEnclosingCallableExclude(DataFlowCall call) {
|
||||
// TODO: Remove once static initializers are folded into the
|
||||
// static constructors
|
||||
exists(ControlFlow::Node cfn |
|
||||
cfn.getElement() = any(FieldOrProperty f | f.isStatic()).getAChild+() and
|
||||
cfn = call.getControlFlowNode()
|
||||
)
|
||||
}
|
||||
|
||||
override predicate uniqueNodeLocationExclude(Node n) {
|
||||
// Methods with multiple implementations
|
||||
n instanceof ParameterNode
|
||||
|
||||
Reference in New Issue
Block a user