C#: Refactor the model generator configurations to use the new API.

This commit is contained in:
Michael Nebel
2023-03-16 12:24:48 +01:00
parent d0732a765b
commit b17a71674a
4 changed files with 5 additions and 24 deletions

View File

@@ -8,10 +8,6 @@
import internal.CaptureModels
class Activate extends ActiveConfiguration {
override predicate activateToSinkConfig() { any() }
}
from DataFlowTargetApi api, string sink
where sink = captureSink(api)
select sink order by sink

View File

@@ -8,10 +8,6 @@
import internal.CaptureModels
class Activate extends ActiveConfiguration {
override predicate activateFromSourceConfig() { any() }
}
from DataFlowTargetApi api, string source
where source = captureSource(api)
select source order by source

View File

@@ -110,7 +110,7 @@ predicate isRelevantType(CS::Type t) {
}
/**
* Gets the CSV string representation of the qualifier.
* Gets the MaD string representation of the qualifier.
*/
string qualifierString() { result = "Argument[this]" }
@@ -120,14 +120,7 @@ string parameterAccess(CS::Parameter p) {
else result = "Argument[" + p.getPosition() + "]"
}
/**
* Gets the CSV string representation of the parameter node `p`.
*/
string parameterNodeAsInput(DataFlow::ParameterNode p) {
result = parameterAccess(p.asParameter())
or
result = qualifierString() and p instanceof DataFlowPrivate::InstanceParameterNode
}
class InstanceParameterNode = DataFlowPrivate::InstanceParameterNode;
pragma[nomagic]
private CS::Parameter getParameter(DataFlowImplCommon::ReturnNodeExt node, ParameterPosition pos) {
@@ -135,7 +128,7 @@ private CS::Parameter getParameter(DataFlowImplCommon::ReturnNodeExt node, Param
}
/**
* Gets the CSV string representation of the the return node `node`.
* Gets the MaD string representation of the the return node `node`.
*/
string returnNodeAsOutput(DataFlowImplCommon::ReturnNodeExt node) {
if node.getKind() instanceof DataFlowImplCommon::ValueReturnKind
@@ -188,9 +181,9 @@ predicate apiSource(DataFlow::Node source) {
}
/**
* Gets the CSV input string representation of `source`.
* Gets the MaD input string representation of `source`.
*/
string asInputArgument(DataFlow::Node source) {
string asInputArgumentSpecific(DataFlow::Node source) {
exists(int pos |
pos = source.(DataFlow::ParameterNode).getParameter().getPosition() and
result = "Argument[" + pos + "]"

View File

@@ -1,9 +1,5 @@
private import CaptureModels
private class Activate extends ActiveConfiguration {
override predicate activateThroughFlowConfig() { any() }
}
/**
* Capture fluent APIs that return `this`.
* Example of a fluent API: