Skip to content

Commit e1048cf

Browse files
committed
Java/C#: Address review comments.
1 parent 7bf7df2 commit e1048cf

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -279,24 +279,24 @@ private module PropagateContentFlowConfig implements ContentDataFlow::ConfigSig
279279

280280
private module PropagateContentFlow = ContentDataFlow::Global<PropagateContentFlowConfig>;
281281

282-
private string printStoreAccessPath(PropagateContentFlow::AccessPath ap) {
283-
not exists(ap.getHead()) and result = ""
284-
or
282+
private string getContent(PropagateContentFlow::AccessPath ap, int i) {
285283
exists(ContentSet head, PropagateContentFlow::AccessPath tail |
286284
head = ap.getHead() and
287-
tail = ap.getTail() and
288-
result = "." + printContent(head) + printStoreAccessPath(tail)
285+
tail = ap.getTail()
286+
|
287+
i = 0 and
288+
result = "." + printContent(head)
289+
or
290+
i > 0 and result = getContent(tail, i - 1)
289291
)
290292
}
291293

294+
private string printStoreAccessPath(PropagateContentFlow::AccessPath ap) {
295+
result = concat(int i | | getContent(ap, i), "" order by i)
296+
}
297+
292298
private string printReadAccessPath(PropagateContentFlow::AccessPath ap) {
293-
not exists(ap.getHead()) and result = ""
294-
or
295-
exists(ContentSet head, PropagateContentFlow::AccessPath tail |
296-
head = ap.getHead() and
297-
tail = ap.getTail() and
298-
result = printReadAccessPath(tail) + "." + printContent(head)
299-
)
299+
result = concat(int i | | getContent(ap, i), "" order by i desc)
300300
}
301301

302302
string captureContentFlow(DataFlowSummaryTargetApi api) {

java/ql/src/utils/modelgenerator/internal/CaptureModels.qll

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -279,24 +279,24 @@ private module PropagateContentFlowConfig implements ContentDataFlow::ConfigSig
279279

280280
private module PropagateContentFlow = ContentDataFlow::Global<PropagateContentFlowConfig>;
281281

282-
private string printStoreAccessPath(PropagateContentFlow::AccessPath ap) {
283-
not exists(ap.getHead()) and result = ""
284-
or
282+
private string getContent(PropagateContentFlow::AccessPath ap, int i) {
285283
exists(ContentSet head, PropagateContentFlow::AccessPath tail |
286284
head = ap.getHead() and
287-
tail = ap.getTail() and
288-
result = "." + printContent(head) + printStoreAccessPath(tail)
285+
tail = ap.getTail()
286+
|
287+
i = 0 and
288+
result = "." + printContent(head)
289+
or
290+
i > 0 and result = getContent(tail, i - 1)
289291
)
290292
}
291293

294+
private string printStoreAccessPath(PropagateContentFlow::AccessPath ap) {
295+
result = concat(int i | | getContent(ap, i), "" order by i)
296+
}
297+
292298
private string printReadAccessPath(PropagateContentFlow::AccessPath ap) {
293-
not exists(ap.getHead()) and result = ""
294-
or
295-
exists(ContentSet head, PropagateContentFlow::AccessPath tail |
296-
head = ap.getHead() and
297-
tail = ap.getTail() and
298-
result = printReadAccessPath(tail) + "." + printContent(head)
299-
)
299+
result = concat(int i | | getContent(ap, i), "" order by i desc)
300300
}
301301

302302
string captureContentFlow(DataFlowSummaryTargetApi api) {

0 commit comments

Comments
 (0)