C#: Update QL tests.

This commit is contained in:
Michael Nebel
2024-02-27 16:06:34 +01:00
parent 58a1353ddc
commit 37677142b9
6 changed files with 16 additions and 22 deletions

View File

@@ -31,10 +31,7 @@ private module Input implements InputSig<CsharpDataFlow> {
n instanceof FlowInsensitiveFieldNode
}
predicate missingLocationExclude(Node n) {
// Some CIL methods are missing locations
n.asParameter() instanceof CIL::Parameter
}
predicate missingLocationExclude(Node n) { none() }
predicate postWithInFlowExclude(Node n) {
n instanceof FlowSummaryNode
@@ -48,8 +45,6 @@ private module Input implements InputSig<CsharpDataFlow> {
not exists(LocalFlow::getAPostUpdateNodeForArg(n.getControlFlowNode()))
or
n instanceof ParamsArgumentNode
or
n.asExpr() instanceof CIL::Expr
}
predicate postHasUniquePreExclude(PostUpdateNode n) {

View File

@@ -3,12 +3,12 @@ tooManyMatchingHandles
missingCil
csharpLocationViolation
matchingObjectMethods
| Equals(object) | System.Boolean System.Object.Equals(System.Object) |
| Equals(object, object) | System.Boolean System.Object.Equals(System.Object,System.Object) |
| GetHashCode() | System.Int32 System.Object.GetHashCode() |
| GetType() | System.Type System.Object.GetType() |
| MemberwiseClone() | System.Object System.Object.MemberwiseClone() |
| Object() | System.Void System.Object..ctor() |
| ReferenceEquals(object, object) | System.Boolean System.Object.ReferenceEquals(System.Object,System.Object) |
| ToString() | System.String System.Object.ToString() |
| ~Object() | System.Void System.Object.Finalize() |
| System.Boolean System.Object.Equals(System.Object) | System.Boolean System.Object.Equals(System.Object) |
| System.Boolean System.Object.Equals(System.Object,System.Object) | System.Boolean System.Object.Equals(System.Object,System.Object) |
| System.Boolean System.Object.ReferenceEquals(System.Object,System.Object) | System.Boolean System.Object.ReferenceEquals(System.Object,System.Object) |
| System.Int32 System.Object.GetHashCode() | System.Int32 System.Object.GetHashCode() |
| System.Object System.Object.MemberwiseClone() | System.Object System.Object.MemberwiseClone() |
| System.String System.Object.ToString() | System.String System.Object.ToString() |
| System.Type System.Object.GetType() | System.Type System.Object.GetType() |
| System.Void System.Object..ctor() | System.Void System.Object..ctor() |
| System.Void System.Object.Finalize() | System.Void System.Object.Finalize() |

View File

@@ -59,7 +59,7 @@ query predicate csharpLocationViolation(Element e) {
}
query predicate matchingObjectMethods(string s1, string s2) {
exists(Callable m1, CIL::Method m2 |
exists(DotNet::Callable m1, CIL::Method m2 |
m1.getDeclaringType().hasFullyQualifiedName("System", "Object") and
m1.matchesHandle(m2) and
s1 = m1.toStringWithTypes() and

View File

@@ -1,7 +1,7 @@
import dotnet
import csharp
import semmle.code.csharp.commons.Disposal
from DotNet::Callable c, DotNet::Parameter param, int p
from Callable c, Parameter param, int p
where
mayBeDisposed(param) and
param = c.getParameter(p) and

View File

@@ -1,8 +1,7 @@
import dotnet
import csharp
import semmle.code.csharp.commons.Disposal
import cil
from DotNet::Callable c, DotNet::Parameter param, int p
from Callable c, Parameter param, int p
where
not mayBeDisposed(param) and
param = c.getParameter(p) and

View File

@@ -1,4 +1,4 @@
import dotnet::DotNet
import csharp
from NamedElement ne
where ne.fromSource()