Skip to content

Commit b17a716

Browse files
committed
C#: Refactor the model generator configurations to use the new API.
1 parent d0732a7 commit b17a716

File tree

4 files changed

+5
-24
lines changed

4 files changed

+5
-24
lines changed

csharp/ql/src/utils/modelgenerator/CaptureSinkModels.ql

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88

99
import internal.CaptureModels
1010

11-
class Activate extends ActiveConfiguration {
12-
override predicate activateToSinkConfig() { any() }
13-
}
14-
1511
from DataFlowTargetApi api, string sink
1612
where sink = captureSink(api)
1713
select sink order by sink

csharp/ql/src/utils/modelgenerator/CaptureSourceModels.ql

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88

99
import internal.CaptureModels
1010

11-
class Activate extends ActiveConfiguration {
12-
override predicate activateFromSourceConfig() { any() }
13-
}
14-
1511
from DataFlowTargetApi api, string source
1612
where source = captureSource(api)
1713
select source order by source

csharp/ql/src/utils/modelgenerator/internal/CaptureModelsSpecific.qll

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ predicate isRelevantType(CS::Type t) {
110110
}
111111

112112
/**
113-
* Gets the CSV string representation of the qualifier.
113+
* Gets the MaD string representation of the qualifier.
114114
*/
115115
string qualifierString() { result = "Argument[this]" }
116116

@@ -120,22 +120,15 @@ string parameterAccess(CS::Parameter p) {
120120
else result = "Argument[" + p.getPosition() + "]"
121121
}
122122

123-
/**
124-
* Gets the CSV string representation of the parameter node `p`.
125-
*/
126-
string parameterNodeAsInput(DataFlow::ParameterNode p) {
127-
result = parameterAccess(p.asParameter())
128-
or
129-
result = qualifierString() and p instanceof DataFlowPrivate::InstanceParameterNode
130-
}
123+
class InstanceParameterNode = DataFlowPrivate::InstanceParameterNode;
131124

132125
pragma[nomagic]
133126
private CS::Parameter getParameter(DataFlowImplCommon::ReturnNodeExt node, ParameterPosition pos) {
134127
result = node.getEnclosingCallable().getParameter(pos.getPosition())
135128
}
136129

137130
/**
138-
* Gets the CSV string representation of the the return node `node`.
131+
* Gets the MaD string representation of the the return node `node`.
139132
*/
140133
string returnNodeAsOutput(DataFlowImplCommon::ReturnNodeExt node) {
141134
if node.getKind() instanceof DataFlowImplCommon::ValueReturnKind
@@ -188,9 +181,9 @@ predicate apiSource(DataFlow::Node source) {
188181
}
189182

190183
/**
191-
* Gets the CSV input string representation of `source`.
184+
* Gets the MaD input string representation of `source`.
192185
*/
193-
string asInputArgument(DataFlow::Node source) {
186+
string asInputArgumentSpecific(DataFlow::Node source) {
194187
exists(int pos |
195188
pos = source.(DataFlow::ParameterNode).getParameter().getPosition() and
196189
result = "Argument[" + pos + "]"

csharp/ql/src/utils/modelgenerator/internal/CaptureSummaryFlow.qll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
private import CaptureModels
22

3-
private class Activate extends ActiveConfiguration {
4-
override predicate activateThroughFlowConfig() { any() }
5-
}
6-
73
/**
84
* Capture fluent APIs that return `this`.
95
* Example of a fluent API:

0 commit comments

Comments
 (0)