Skip to content

Commit 0abeb83

Browse files
committed
Java: Move summaryModel predicate, which constructs a CSV row to the testcode where it is used.
1 parent 663d091 commit 0abeb83

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

java/ql/lib/semmle/code/java/dataflow/ExternalFlow.qll

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -533,26 +533,6 @@ predicate summaryModel(
533533
extSummaryModel(package, type, subtypes, name, signature, ext, input, output, kind, provenance)
534534
}
535535

536-
/** Holds if a summary model `row` exists for the given parameters. */
537-
bindingset[row]
538-
predicate summaryModel(
539-
string package, string type, boolean subtypes, string name, string signature, string ext,
540-
string input, string output, string kind, string provenance, string row
541-
) {
542-
summaryModel(package, type, subtypes, name, signature, ext, input, output, kind, provenance) and
543-
row =
544-
package + ";" //
545-
+ type + ";" //
546-
+ subtypes.toString() + ";" //
547-
+ name + ";" //
548-
+ signature + ";" //
549-
+ ext + ";" //
550-
+ input + ";" //
551-
+ output + ";" //
552-
+ kind + ";" //
553-
+ provenance
554-
}
555-
556536
/** Holds if a summary model exists indicating there is no flow for the given parameters. */
557537
extensible predicate extNegativeSummaryModel(
558538
string package, string type, string name, string signature, string provenance

java/ql/src/utils/flowtestcasegenerator/FlowTestCase.qll

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,26 @@ class TargetSummaryModelCsv extends Unit {
2121
abstract predicate row(string r);
2222
}
2323

24+
/** Holds if a summary model `row` exists for the given parameters. */
25+
bindingset[row]
26+
predicate summaryModelRow(
27+
string package, string type, boolean subtypes, string name, string signature, string ext,
28+
string input, string output, string kind, string provenance, string row
29+
) {
30+
summaryModel(package, type, subtypes, name, signature, ext, input, output, kind, provenance) and
31+
row =
32+
package + ";" //
33+
+ type + ";" //
34+
+ subtypes.toString() + ";" //
35+
+ name + ";" //
36+
+ signature + ";" //
37+
+ ext + ";" //
38+
+ input + ";" //
39+
+ output + ";" //
40+
+ kind + ";" //
41+
+ provenance
42+
}
43+
2444
/**
2545
* Gets a CSV row for which a test has been requested, but `SummaryModelCsv.row` does not hold of it.
2646
*/
@@ -64,8 +84,8 @@ private newtype TTestCase =
6484
string inputSpec, string outputSpec
6585
|
6686
any(TargetSummaryModelCsv tsmc).row(row) and
67-
summaryModel(namespace, type, subtypes, name, signature, ext, inputSpec, outputSpec, kind, _,
68-
row) and
87+
summaryModelRow(namespace, type, subtypes, name, signature, ext, inputSpec, outputSpec, kind,
88+
_, row) and
6989
callable = interpretElement(namespace, type, subtypes, name, signature, ext) and
7090
Private::External::interpretSpec(inputSpec, input) and
7191
Private::External::interpretSpec(outputSpec, output)

java/ql/src/utils/flowtestcasegenerator/GenerateFlowTestCase.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,25 @@ query string getAParseFailure(string reason) {
2121
any(TargetSummaryModelCsv target).row(result) and
2222
any(SummaryModelCsv model).row(result) and
2323
(
24-
not summaryModel(_, _, _, _, _, _, _, _, _, _, result) and
24+
not summaryModelRow(_, _, _, _, _, _, _, _, _, _, result) and
2525
reason = "row could not be parsed"
2626
or
2727
exists(
2828
string namespace, string type, boolean subtypes, string name, string signature, string ext
2929
|
30-
summaryModel(namespace, type, subtypes, name, signature, ext, _, _, _, _, result) and
30+
summaryModelRow(namespace, type, subtypes, name, signature, ext, _, _, _, _, result) and
3131
not interpretElement(namespace, type, subtypes, name, signature, ext) instanceof Callable and
3232
reason = "callable could not be resolved"
3333
)
3434
or
3535
exists(string inputSpec |
36-
summaryModel(_, _, _, _, _, _, inputSpec, _, _, _, result) and
36+
summaryModelRow(_, _, _, _, _, _, inputSpec, _, _, _, result) and
3737
not Private::External::interpretSpec(inputSpec, _) and
3838
reason = "input spec could not be parsed"
3939
)
4040
or
4141
exists(string outputSpec |
42-
summaryModel(_, _, _, _, _, _, _, outputSpec, _, _, result) and
42+
summaryModelRow(_, _, _, _, _, _, _, outputSpec, _, _, result) and
4343
not Private::External::interpretSpec(outputSpec, _) and
4444
reason = "output spec could not be parsed"
4545
)

0 commit comments

Comments
 (0)