C#: Adjustments to test cases.

This commit is contained in:
Michael Nebel
2023-12-08 09:24:49 +01:00
parent 09239ba804
commit e42afa3d3d
4 changed files with 19 additions and 3 deletions

View File

@@ -5,10 +5,11 @@ private predicate isOsSpecific(Declaration d) {
d.getFullyQualifiedName()
.matches("%" +
[
"libobjc", "libproc", "libc", "Interop.Sys",
"libobjc", "libproc", "libc", "Interop.OSReleaseFile", "Interop.Sys",
"System.Runtime.InteropServices.ObjectiveC.ObjectiveCMarshal",
"System.Diagnostics.Tracing.XplatEventLogger", "System.Threading.AutoreleasePool",
"System.CLRConfig", "System.Diagnostics.Tracing.EventSource.<WriteEventString>",
"System.IO.FileSystem.<TryCloneFile>"
] + "%")
}

View File

@@ -1,8 +1,16 @@
import semmle.code.cil.Types
import semmle.code.csharp.commons.QualifiedName
predicate osSpecific(string qualifier, string name) {
qualifier = "Interop.Sys" and
(
name = "LockType" or // doesn't exist on osx
name = "NSSearchPathDirectory" // doesn't exist on linux.
)
}
from Enum e, string qualifier, string name
where
e.hasFullyQualifiedName(qualifier, name) and
not (qualifier = "Interop.Sys" and name = "LockType") // doesn't exist on osx
not osSpecific(qualifier, name)
select getQualifiedName(qualifier, name), e.getUnderlyingType().toStringWithTypes()

View File

@@ -58,14 +58,20 @@ private predicate exclude(string s) {
"Parameter 1 of System.CLRConfig.GetConfigBoolValue",
"Parameter 1 of System.Runtime.InteropServices.ObjectiveC.ObjectiveCMarshal.CreateReferenceTrackingHandleInternal",
"Parameter 2 of System.Runtime.InteropServices.ObjectiveC.ObjectiveCMarshal.CreateReferenceTrackingHandleInternal",
"Parameter 2 of Interop.OSReleaseFile.<GetPrettyName>g__TryGetFieldValue|1_0",
"Parameter 2 of System.Runtime.InteropServices.ObjectiveC.ObjectiveCMarshal.InvokeUnhandledExceptionPropagation",
"Parameter 3 of System.IO.FileSystem.<TryCloneFile>g__TryCloneFile|5_0",
"Parameter 3 of System.IO.FileSystem.TryCloneFile",
"Parameter 6 of Microsoft.Win32.SafeHandles.SafeFileHandle.OpenNoFollowSymlink",
"Local variable 1 of method Interop.libobjc.NSOperatingSystemVersion_objc_msgSend_stret",
"Local variable 1 of method System.Diagnostics.Tracing.XplatEventLogger.LogEventSource",
"Local variable 2 of method System.Runtime.InteropServices.ObjectiveC.ObjectiveCMarshal.CreateReferenceTrackingHandleInternal",
"Local variable 3 of method System.Diagnostics.Tracing.XplatEventLogger.LogEventSource",
"Local variable 4 of method System.CLRConfig.GetConfigBoolValue",
"Local variable 4 of method System.Runtime.InteropServices.ObjectiveC.ObjectiveCMarshal.CreateReferenceTrackingHandleInternal",
"Local variable 5 of method Interop.OSReleaseFile.<GetPrettyName>g__TryGetFieldValue|1_0",
"Local variable 5 of method System.Diagnostics.Tracing.XplatEventLogger.LogEventSource",
"Local variable 13 of method Interop.procfs.TryParseStatusFile",
"Parameter 0 of System.Diagnostics.Tracing.XplatEventLogger.AppendByteArrayAsHexString",
"Parameter 1 of System.Diagnostics.Tracing.XplatEventLogger.MinimalJsonserializer"
]

View File

@@ -13,5 +13,6 @@ where
s2 != "FormatParam" and
s2 != "StringOrCharArray" and
s2 != "EventSourceActivity"
s2 != "EventSourceActivity" and
s2 != "EventSourcePrimitive"
select s1, s2 order by s1, s2