C#: Add CIL attribute tests

This commit is contained in:
Tamas Vajk
2020-12-02 09:10:46 +01:00
parent 6e6cd05787
commit 636ff2d76e
3 changed files with 2653 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
// semmle-extractor-options: --cil
using System;
class Test
{
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
import semmle.code.cil.Attribute
import semmle.code.cil.Declaration
query predicate attrNoArg(string dec, string attr) {
exists(Declaration d, Attribute a |
a.getDeclaration() = d and
not exists(a.getAnArgument())
|
dec = d.toStringWithTypes() and
attr = a.toStringWithTypes()
)
}
query predicate attrArgNamed(string dec, string attr, string name, string value) {
exists(Declaration d, Attribute a |
a.getDeclaration() = d and
a.getNamedArgument(name) = value
|
dec = d.toStringWithTypes() and
attr = a.toStringWithTypes()
)
}
query predicate attrArgPositional(string dec, string attr, int index, string value) {
exists(Declaration d, Attribute a |
a.getDeclaration() = d and
a.getArgument(index) = value
|
dec = d.toStringWithTypes() and
attr = a.toStringWithTypes()
)
}