Skip to content

Commit 6854845

Browse files
Jami CogswellJami Cogswell
authored andcommitted
Java: refactor isManuallyGenerated and isBothAutoAndManuallyGenerated
1 parent 0b2f2a3 commit 6854845

File tree

6 files changed

+36
-96
lines changed

6 files changed

+36
-96
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,20 +1001,6 @@ module Private {
10011001
not summaryElement(this, _, _, _, false)
10021002
}
10031003

1004-
private predicate relevantSummaryElementManual(
1005-
AccessPath inSpec, AccessPath outSpec, string kind
1006-
) {
1007-
summaryElement(this, inSpec, outSpec, kind, false) and
1008-
not summaryElement(this, _, _, _, true)
1009-
}
1010-
1011-
private predicate relevantSummaryElementBothGeneratedAndManual(
1012-
AccessPath inSpec, AccessPath outSpec, string kind
1013-
) {
1014-
summaryElement(this, inSpec, outSpec, kind, true) and
1015-
summaryElement(this, inSpec, outSpec, kind, false)
1016-
}
1017-
10181004
private predicate relevantSummaryElement(AccessPath inSpec, AccessPath outSpec, string kind) {
10191005
summaryElement(this, inSpec, outSpec, kind, false)
10201006
or
@@ -1037,10 +1023,14 @@ module Private {
10371023

10381024
override predicate isAutoGenerated() { this.relevantSummaryElementGenerated(_, _, _) }
10391025

1040-
override predicate isManuallyGenerated() { this.relevantSummaryElementManual(_, _, _) }
1026+
override predicate isManuallyGenerated() {
1027+
summaryElement(this, _, _, _, false) and
1028+
not summaryElement(this, _, _, _, true)
1029+
}
10411030

10421031
override predicate isBothAutoAndManuallyGenerated() {
1043-
this.relevantSummaryElementBothGeneratedAndManual(_, _, _)
1032+
summaryElement(this, _, _, _, true) and
1033+
summaryElement(this, _, _, _, false)
10441034
}
10451035
}
10461036

go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,20 +1001,6 @@ module Private {
10011001
not summaryElement(this, _, _, _, false)
10021002
}
10031003

1004-
private predicate relevantSummaryElementManual(
1005-
AccessPath inSpec, AccessPath outSpec, string kind
1006-
) {
1007-
summaryElement(this, inSpec, outSpec, kind, false) and
1008-
not summaryElement(this, _, _, _, true)
1009-
}
1010-
1011-
private predicate relevantSummaryElementBothGeneratedAndManual(
1012-
AccessPath inSpec, AccessPath outSpec, string kind
1013-
) {
1014-
summaryElement(this, inSpec, outSpec, kind, true) and
1015-
summaryElement(this, inSpec, outSpec, kind, false)
1016-
}
1017-
10181004
private predicate relevantSummaryElement(AccessPath inSpec, AccessPath outSpec, string kind) {
10191005
summaryElement(this, inSpec, outSpec, kind, false)
10201006
or
@@ -1037,10 +1023,14 @@ module Private {
10371023

10381024
override predicate isAutoGenerated() { this.relevantSummaryElementGenerated(_, _, _) }
10391025

1040-
override predicate isManuallyGenerated() { this.relevantSummaryElementManual(_, _, _) }
1026+
override predicate isManuallyGenerated() {
1027+
summaryElement(this, _, _, _, false) and
1028+
not summaryElement(this, _, _, _, true)
1029+
}
10411030

10421031
override predicate isBothAutoAndManuallyGenerated() {
1043-
this.relevantSummaryElementBothGeneratedAndManual(_, _, _)
1032+
summaryElement(this, _, _, _, true) and
1033+
summaryElement(this, _, _, _, false)
10441034
}
10451035
}
10461036

java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,20 +1001,6 @@ module Private {
10011001
not summaryElement(this, _, _, _, false)
10021002
}
10031003

1004-
private predicate relevantSummaryElementManual(
1005-
AccessPath inSpec, AccessPath outSpec, string kind
1006-
) {
1007-
summaryElement(this, inSpec, outSpec, kind, false) and
1008-
not summaryElement(this, _, _, _, true)
1009-
}
1010-
1011-
private predicate relevantSummaryElementBothGeneratedAndManual(
1012-
AccessPath inSpec, AccessPath outSpec, string kind
1013-
) {
1014-
summaryElement(this, inSpec, outSpec, kind, true) and
1015-
summaryElement(this, inSpec, outSpec, kind, false)
1016-
}
1017-
10181004
private predicate relevantSummaryElement(AccessPath inSpec, AccessPath outSpec, string kind) {
10191005
summaryElement(this, inSpec, outSpec, kind, false)
10201006
or
@@ -1037,10 +1023,14 @@ module Private {
10371023

10381024
override predicate isAutoGenerated() { this.relevantSummaryElementGenerated(_, _, _) }
10391025

1040-
override predicate isManuallyGenerated() { this.relevantSummaryElementManual(_, _, _) }
1026+
override predicate isManuallyGenerated() {
1027+
summaryElement(this, _, _, _, false) and
1028+
not summaryElement(this, _, _, _, true)
1029+
}
10411030

10421031
override predicate isBothAutoAndManuallyGenerated() {
1043-
this.relevantSummaryElementBothGeneratedAndManual(_, _, _)
1032+
summaryElement(this, _, _, _, true) and
1033+
summaryElement(this, _, _, _, false)
10441034
}
10451035
}
10461036

python/ql/lib/semmle/python/dataflow/new/internal/FlowSummaryImpl.qll

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,20 +1001,6 @@ module Private {
10011001
not summaryElement(this, _, _, _, false)
10021002
}
10031003

1004-
private predicate relevantSummaryElementManual(
1005-
AccessPath inSpec, AccessPath outSpec, string kind
1006-
) {
1007-
summaryElement(this, inSpec, outSpec, kind, false) and
1008-
not summaryElement(this, _, _, _, true)
1009-
}
1010-
1011-
private predicate relevantSummaryElementBothGeneratedAndManual(
1012-
AccessPath inSpec, AccessPath outSpec, string kind
1013-
) {
1014-
summaryElement(this, inSpec, outSpec, kind, true) and
1015-
summaryElement(this, inSpec, outSpec, kind, false)
1016-
}
1017-
10181004
private predicate relevantSummaryElement(AccessPath inSpec, AccessPath outSpec, string kind) {
10191005
summaryElement(this, inSpec, outSpec, kind, false)
10201006
or
@@ -1037,10 +1023,14 @@ module Private {
10371023

10381024
override predicate isAutoGenerated() { this.relevantSummaryElementGenerated(_, _, _) }
10391025

1040-
override predicate isManuallyGenerated() { this.relevantSummaryElementManual(_, _, _) }
1026+
override predicate isManuallyGenerated() {
1027+
summaryElement(this, _, _, _, false) and
1028+
not summaryElement(this, _, _, _, true)
1029+
}
10411030

10421031
override predicate isBothAutoAndManuallyGenerated() {
1043-
this.relevantSummaryElementBothGeneratedAndManual(_, _, _)
1032+
summaryElement(this, _, _, _, true) and
1033+
summaryElement(this, _, _, _, false)
10441034
}
10451035
}
10461036

ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,20 +1001,6 @@ module Private {
10011001
not summaryElement(this, _, _, _, false)
10021002
}
10031003

1004-
private predicate relevantSummaryElementManual(
1005-
AccessPath inSpec, AccessPath outSpec, string kind
1006-
) {
1007-
summaryElement(this, inSpec, outSpec, kind, false) and
1008-
not summaryElement(this, _, _, _, true)
1009-
}
1010-
1011-
private predicate relevantSummaryElementBothGeneratedAndManual(
1012-
AccessPath inSpec, AccessPath outSpec, string kind
1013-
) {
1014-
summaryElement(this, inSpec, outSpec, kind, true) and
1015-
summaryElement(this, inSpec, outSpec, kind, false)
1016-
}
1017-
10181004
private predicate relevantSummaryElement(AccessPath inSpec, AccessPath outSpec, string kind) {
10191005
summaryElement(this, inSpec, outSpec, kind, false)
10201006
or
@@ -1037,10 +1023,14 @@ module Private {
10371023

10381024
override predicate isAutoGenerated() { this.relevantSummaryElementGenerated(_, _, _) }
10391025

1040-
override predicate isManuallyGenerated() { this.relevantSummaryElementManual(_, _, _) }
1026+
override predicate isManuallyGenerated() {
1027+
summaryElement(this, _, _, _, false) and
1028+
not summaryElement(this, _, _, _, true)
1029+
}
10411030

10421031
override predicate isBothAutoAndManuallyGenerated() {
1043-
this.relevantSummaryElementBothGeneratedAndManual(_, _, _)
1032+
summaryElement(this, _, _, _, true) and
1033+
summaryElement(this, _, _, _, false)
10441034
}
10451035
}
10461036

swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,20 +1001,6 @@ module Private {
10011001
not summaryElement(this, _, _, _, false)
10021002
}
10031003

1004-
private predicate relevantSummaryElementManual(
1005-
AccessPath inSpec, AccessPath outSpec, string kind
1006-
) {
1007-
summaryElement(this, inSpec, outSpec, kind, false) and
1008-
not summaryElement(this, _, _, _, true)
1009-
}
1010-
1011-
private predicate relevantSummaryElementBothGeneratedAndManual(
1012-
AccessPath inSpec, AccessPath outSpec, string kind
1013-
) {
1014-
summaryElement(this, inSpec, outSpec, kind, true) and
1015-
summaryElement(this, inSpec, outSpec, kind, false)
1016-
}
1017-
10181004
private predicate relevantSummaryElement(AccessPath inSpec, AccessPath outSpec, string kind) {
10191005
summaryElement(this, inSpec, outSpec, kind, false)
10201006
or
@@ -1037,10 +1023,14 @@ module Private {
10371023

10381024
override predicate isAutoGenerated() { this.relevantSummaryElementGenerated(_, _, _) }
10391025

1040-
override predicate isManuallyGenerated() { this.relevantSummaryElementManual(_, _, _) }
1026+
override predicate isManuallyGenerated() {
1027+
summaryElement(this, _, _, _, false) and
1028+
not summaryElement(this, _, _, _, true)
1029+
}
10411030

10421031
override predicate isBothAutoAndManuallyGenerated() {
1043-
this.relevantSummaryElementBothGeneratedAndManual(_, _, _)
1032+
summaryElement(this, _, _, _, true) and
1033+
summaryElement(this, _, _, _, false)
10441034
}
10451035
}
10461036

0 commit comments

Comments
 (0)