Fix OS specific tests

This commit is contained in:
Tamas Vajk
2021-02-11 22:02:48 +01:00
parent f2e667173c
commit 7ae640ce16
4 changed files with 12 additions and 7 deletions

View File

@@ -9,9 +9,6 @@ attrNoArg
| Interop.Sys.<>c__DisplayClass37_0 | [CompilerGeneratedAttribute(...)] |
| Interop.Sys.FileStatusFlags | [FlagsAttribute(...)] |
| Interop.Sys.OpenFlags | [FlagsAttribute(...)] |
| Interop.libobjc.NSOperatingSystemVersion.majorVersion | [NativeIntegerAttribute(...)] |
| Interop.libobjc.NSOperatingSystemVersion.minorVersion | [NativeIntegerAttribute(...)] |
| Interop.libobjc.NSOperatingSystemVersion.patchVersion | [NativeIntegerAttribute(...)] |
| InteropErrorExtensions | [ExtensionAttribute(...)] |
| Microsoft.CodeAnalysis.EmbeddedAttribute | [CompilerGeneratedAttribute(...)] |
| Microsoft.CodeAnalysis.EmbeddedAttribute | [EmbeddedAttribute(...)] |

View File

@@ -1,8 +1,11 @@
import semmle.code.cil.Attribute
import semmle.code.cil.Declaration
private predicate isOsSpecific(Declaration d) { d.getQualifiedName().matches("%libobjc%") }
query predicate attrNoArg(string dec, string attr) {
exists(Declaration d, Attribute a |
not isOsSpecific(d) and
a.getDeclaration() = d and
not exists(a.getAnArgument())
|
@@ -14,6 +17,7 @@ query predicate attrNoArg(string dec, string attr) {
query predicate attrArgNamed(string dec, string attr, string name, string value) {
exists(Declaration d, Attribute a |
a.getDeclaration() = d and
not isOsSpecific(d) and
a.getNamedArgument(name) = value
|
dec = d.toStringWithTypes() and
@@ -24,6 +28,7 @@ query predicate attrArgNamed(string dec, string attr, string name, string value)
query predicate attrArgPositional(string dec, string attr, int index, string value) {
exists(Declaration d, Attribute a |
a.getDeclaration() = d and
not isOsSpecific(d) and
a.getArgument(index) = value
|
dec = d.toStringWithTypes() and

View File

@@ -923,7 +923,6 @@
| Parameter 1 of SetException | parameter | 32 |
| Parameter 1 of SetNotificationForWaitCompletion | parameter | 32 |
| Parameter 1 of SetValue | parameter | 32 |
| Parameter 1 of SkipWhitespace | parameter | 32 |
| Parameter 1 of SnapForObservation | parameter | 32 |
| Parameter 1 of SplitName | parameter | 32 |
| Parameter 1 of Start | parameter | 32 |
@@ -1038,7 +1037,6 @@
| Parameter 1 of UInt32ToNumber | parameter | 32 |
| Parameter 1 of UInt64ToNumber | parameter | 32 |
| Parameter 1 of Unscale | parameter | 32 |
| Parameter 1 of ValidateVariableAndValue | parameter | 32 |
| Parameter 1 of VarDecCmp | parameter | 32 |
| Parameter 1 of VarDecCmpSub | parameter | 32 |
| Parameter 1 of VarDecDiv | parameter | 32 |
@@ -1318,7 +1316,6 @@
| Parameter 2 of TryGetStringValue | parameter | 32 |
| Parameter 2 of TryGetTimeZone | parameter | 32 |
| Parameter 2 of TryGetTimeZoneFromLocalMachine | parameter | 32 |
| Parameter 2 of TryGetUserNameFromPasswd | parameter | 32 |
| Parameter 2 of TryGetValue | parameter | 32 |
| Parameter 2 of TryGetValueWorker | parameter | 32 |
| Parameter 2 of TryLoadTzFile | parameter | 32 |

View File

@@ -21,5 +21,11 @@ private string elementType(Element e) {
}
from Element e, int i
where cil_type_annotation(e, i)
where
cil_type_annotation(e, i) and
(
not e instanceof Parameter or
e.(Parameter).getDeclaringElement().(Method).getDeclaringType().getQualifiedName() !=
"System.Environment" // There are OS specific methods in this class
)
select e.toString(), elementType(e), i