Skip to content

Commit c18f4b1

Browse files
committed
Sync files and make language specific rename.
1 parent 4ee2d62 commit c18f4b1

File tree

10 files changed

+125
-285
lines changed

10 files changed

+125
-285
lines changed

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

Lines changed: 24 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,30 @@ module Public {
2323
* content type, or a return kind.
2424
*/
2525
class SummaryComponent extends TSummaryComponent {
26-
/** Gets a textual representation of this summary component. */
27-
string toString() {
28-
exists(ContentSet c | this = TContentSummaryComponent(c) and result = c.toString())
29-
or
30-
exists(ContentSet c | this = TWithoutContentSummaryComponent(c) and result = "without " + c)
31-
or
32-
exists(ContentSet c | this = TWithContentSummaryComponent(c) and result = "with " + c)
26+
/** Gets a textual representation of this component used for flow summaries. */
27+
string getAccessStep() {
28+
result = getAccessStepSpecific(this)
3329
or
3430
exists(ArgumentPosition pos |
35-
this = TParameterSummaryComponent(pos) and result = "parameter " + pos
31+
this = TParameterSummaryComponent(pos) and
32+
result = "Parameter[" + getArgumentPosition(pos) + "]"
3633
)
3734
or
3835
exists(ParameterPosition pos |
39-
this = TArgumentSummaryComponent(pos) and result = "argument " + pos
36+
this = TArgumentSummaryComponent(pos) and
37+
result = "Argument[" + getParameterPosition(pos) + "]"
4038
)
4139
or
42-
exists(ReturnKind rk | this = TReturnSummaryComponent(rk) and result = "return (" + rk + ")")
43-
or
44-
exists(SummaryComponent::SyntheticGlobal sg |
45-
this = TSyntheticGlobalSummaryComponent(sg) and
46-
result = "synthetic global (" + sg + ")"
40+
exists(string synthetic |
41+
this = TSyntheticGlobalSummaryComponent(synthetic) and
42+
result = "SyntheticGlobal[" + synthetic + "]"
4743
)
44+
or
45+
this = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
4846
}
47+
48+
/** Gets a textual representation of this summary component. */
49+
string toString() { result = this.getAccessStep() }
4950
}
5051

5152
/** Provides predicates for constructing summary components. */
@@ -125,19 +126,22 @@ module Public {
125126
this = TSingletonSummaryComponentStack(result) or result = this.tail().bottom()
126127
}
127128

128-
/** Gets a textual representation of this stack. */
129-
string toString() {
129+
/** Gets a textual representation of this stack used for MaD models. */
130+
string getAccessPath() {
130131
exists(SummaryComponent head, SummaryComponentStack tail |
131132
head = this.head() and
132133
tail = this.tail() and
133-
result = tail + "." + head
134+
result = tail.getAccessPath() + "." + head.getAccessStep()
134135
)
135136
or
136137
exists(SummaryComponent c |
137138
this = TSingletonSummaryComponentStack(c) and
138-
result = c.toString()
139+
result = c.getAccessStep()
139140
)
140141
}
142+
143+
/** Gets a textual representation of this stack. */
144+
string toString() { result = this.getAccessPath() }
141145
}
142146

143147
/** Provides predicates for constructing stacks of summary components. */
@@ -166,42 +170,6 @@ module Public {
166170
SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) }
167171
}
168172

169-
/** Gets a textual representation of this component used for flow summaries. */
170-
private string getComponent(SummaryComponent sc) {
171-
result = getComponentSpecific(sc)
172-
or
173-
exists(ArgumentPosition pos |
174-
sc = TParameterSummaryComponent(pos) and
175-
result = "Parameter[" + getArgumentPosition(pos) + "]"
176-
)
177-
or
178-
exists(ParameterPosition pos |
179-
sc = TArgumentSummaryComponent(pos) and
180-
result = "Argument[" + getParameterPosition(pos) + "]"
181-
)
182-
or
183-
exists(string synthetic |
184-
sc = TSyntheticGlobalSummaryComponent(synthetic) and
185-
result = "SyntheticGlobal[" + synthetic + "]"
186-
)
187-
or
188-
sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
189-
}
190-
191-
/** Gets a textual representation of this stack used for flow summaries. */
192-
string getComponentStack(SummaryComponentStack stack) {
193-
exists(SummaryComponent head, SummaryComponentStack tail |
194-
head = stack.head() and
195-
tail = stack.tail() and
196-
result = getComponentStack(tail) + "." + getComponent(head)
197-
)
198-
or
199-
exists(SummaryComponent c |
200-
stack = TSingletonSummaryComponentStack(c) and
201-
result = getComponent(c)
202-
)
203-
}
204-
205173
/**
206174
* A class that exists for QL technical reasons only (the IPA type used
207175
* to represent component stacks needs to be bounded).
@@ -1382,8 +1350,8 @@ module Private {
13821350
c.relevantSummary(input, output, preservesValue) and
13831351
csv =
13841352
c.getCallableCsv() // Callable information
1385-
+ getComponentStack(input) + ";" // input
1386-
+ getComponentStack(output) + ";" // output
1353+
+ input.getAccessPath() + ";" // input
1354+
+ output.getAccessPath() + ";" // output
13871355
+ renderKind(preservesValue) + ";" // kind
13881356
+ renderProvenance(c) // provenance
13891357
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private string getContentSpecific(Content c) {
111111
}
112112

113113
/** Gets the textual representation of the content in the format used for flow summaries. */
114-
string getComponentSpecific(SummaryComponent sc) {
114+
string getAccessStepSpecific(SummaryComponent sc) {
115115
exists(Content c | sc = TContentSummaryComponent(c) and result = getContentSpecific(c))
116116
or
117117
exists(ReturnKind rk |

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

Lines changed: 24 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,30 @@ module Public {
2323
* content type, or a return kind.
2424
*/
2525
class SummaryComponent extends TSummaryComponent {
26-
/** Gets a textual representation of this summary component. */
27-
string toString() {
28-
exists(ContentSet c | this = TContentSummaryComponent(c) and result = c.toString())
29-
or
30-
exists(ContentSet c | this = TWithoutContentSummaryComponent(c) and result = "without " + c)
31-
or
32-
exists(ContentSet c | this = TWithContentSummaryComponent(c) and result = "with " + c)
26+
/** Gets a textual representation of this component used for flow summaries. */
27+
string getAccessStep() {
28+
result = getAccessStepSpecific(this)
3329
or
3430
exists(ArgumentPosition pos |
35-
this = TParameterSummaryComponent(pos) and result = "parameter " + pos
31+
this = TParameterSummaryComponent(pos) and
32+
result = "Parameter[" + getArgumentPosition(pos) + "]"
3633
)
3734
or
3835
exists(ParameterPosition pos |
39-
this = TArgumentSummaryComponent(pos) and result = "argument " + pos
36+
this = TArgumentSummaryComponent(pos) and
37+
result = "Argument[" + getParameterPosition(pos) + "]"
4038
)
4139
or
42-
exists(ReturnKind rk | this = TReturnSummaryComponent(rk) and result = "return (" + rk + ")")
43-
or
44-
exists(SummaryComponent::SyntheticGlobal sg |
45-
this = TSyntheticGlobalSummaryComponent(sg) and
46-
result = "synthetic global (" + sg + ")"
40+
exists(string synthetic |
41+
this = TSyntheticGlobalSummaryComponent(synthetic) and
42+
result = "SyntheticGlobal[" + synthetic + "]"
4743
)
44+
or
45+
this = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
4846
}
47+
48+
/** Gets a textual representation of this summary component. */
49+
string toString() { result = this.getAccessStep() }
4950
}
5051

5152
/** Provides predicates for constructing summary components. */
@@ -125,19 +126,22 @@ module Public {
125126
this = TSingletonSummaryComponentStack(result) or result = this.tail().bottom()
126127
}
127128

128-
/** Gets a textual representation of this stack. */
129-
string toString() {
129+
/** Gets a textual representation of this stack used for MaD models. */
130+
string getAccessPath() {
130131
exists(SummaryComponent head, SummaryComponentStack tail |
131132
head = this.head() and
132133
tail = this.tail() and
133-
result = tail + "." + head
134+
result = tail.getAccessPath() + "." + head.getAccessStep()
134135
)
135136
or
136137
exists(SummaryComponent c |
137138
this = TSingletonSummaryComponentStack(c) and
138-
result = c.toString()
139+
result = c.getAccessStep()
139140
)
140141
}
142+
143+
/** Gets a textual representation of this stack. */
144+
string toString() { result = this.getAccessPath() }
141145
}
142146

143147
/** Provides predicates for constructing stacks of summary components. */
@@ -166,42 +170,6 @@ module Public {
166170
SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) }
167171
}
168172

169-
/** Gets a textual representation of this component used for flow summaries. */
170-
private string getComponent(SummaryComponent sc) {
171-
result = getComponentSpecific(sc)
172-
or
173-
exists(ArgumentPosition pos |
174-
sc = TParameterSummaryComponent(pos) and
175-
result = "Parameter[" + getArgumentPosition(pos) + "]"
176-
)
177-
or
178-
exists(ParameterPosition pos |
179-
sc = TArgumentSummaryComponent(pos) and
180-
result = "Argument[" + getParameterPosition(pos) + "]"
181-
)
182-
or
183-
exists(string synthetic |
184-
sc = TSyntheticGlobalSummaryComponent(synthetic) and
185-
result = "SyntheticGlobal[" + synthetic + "]"
186-
)
187-
or
188-
sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
189-
}
190-
191-
/** Gets a textual representation of this stack used for flow summaries. */
192-
string getComponentStack(SummaryComponentStack stack) {
193-
exists(SummaryComponent head, SummaryComponentStack tail |
194-
head = stack.head() and
195-
tail = stack.tail() and
196-
result = getComponentStack(tail) + "." + getComponent(head)
197-
)
198-
or
199-
exists(SummaryComponent c |
200-
stack = TSingletonSummaryComponentStack(c) and
201-
result = getComponent(c)
202-
)
203-
}
204-
205173
/**
206174
* A class that exists for QL technical reasons only (the IPA type used
207175
* to represent component stacks needs to be bounded).
@@ -1382,8 +1350,8 @@ module Private {
13821350
c.relevantSummary(input, output, preservesValue) and
13831351
csv =
13841352
c.getCallableCsv() // Callable information
1385-
+ getComponentStack(input) + ";" // input
1386-
+ getComponentStack(output) + ";" // output
1353+
+ input.getAccessPath() + ";" // input
1354+
+ output.getAccessPath() + ";" // output
13871355
+ renderKind(preservesValue) + ";" // kind
13881356
+ renderProvenance(c) // provenance
13891357
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ private string getContentSpecific(Content c) {
194194
}
195195

196196
/** Gets the textual representation of the content in the format used for flow summaries. */
197-
string getComponentSpecific(SummaryComponent sc) {
197+
string getAccessStepSpecific(SummaryComponent sc) {
198198
exists(Content c | sc = TContentSummaryComponent(c) and result = getContentSpecific(c))
199199
}
200200

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

Lines changed: 24 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,30 @@ module Public {
2323
* content type, or a return kind.
2424
*/
2525
class SummaryComponent extends TSummaryComponent {
26-
/** Gets a textual representation of this summary component. */
27-
string toString() {
28-
exists(ContentSet c | this = TContentSummaryComponent(c) and result = c.toString())
29-
or
30-
exists(ContentSet c | this = TWithoutContentSummaryComponent(c) and result = "without " + c)
31-
or
32-
exists(ContentSet c | this = TWithContentSummaryComponent(c) and result = "with " + c)
26+
/** Gets a textual representation of this component used for flow summaries. */
27+
string getAccessStep() {
28+
result = getAccessStepSpecific(this)
3329
or
3430
exists(ArgumentPosition pos |
35-
this = TParameterSummaryComponent(pos) and result = "parameter " + pos
31+
this = TParameterSummaryComponent(pos) and
32+
result = "Parameter[" + getArgumentPosition(pos) + "]"
3633
)
3734
or
3835
exists(ParameterPosition pos |
39-
this = TArgumentSummaryComponent(pos) and result = "argument " + pos
36+
this = TArgumentSummaryComponent(pos) and
37+
result = "Argument[" + getParameterPosition(pos) + "]"
4038
)
4139
or
42-
exists(ReturnKind rk | this = TReturnSummaryComponent(rk) and result = "return (" + rk + ")")
43-
or
44-
exists(SummaryComponent::SyntheticGlobal sg |
45-
this = TSyntheticGlobalSummaryComponent(sg) and
46-
result = "synthetic global (" + sg + ")"
40+
exists(string synthetic |
41+
this = TSyntheticGlobalSummaryComponent(synthetic) and
42+
result = "SyntheticGlobal[" + synthetic + "]"
4743
)
44+
or
45+
this = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
4846
}
47+
48+
/** Gets a textual representation of this summary component. */
49+
string toString() { result = this.getAccessStep() }
4950
}
5051

5152
/** Provides predicates for constructing summary components. */
@@ -125,19 +126,22 @@ module Public {
125126
this = TSingletonSummaryComponentStack(result) or result = this.tail().bottom()
126127
}
127128

128-
/** Gets a textual representation of this stack. */
129-
string toString() {
129+
/** Gets a textual representation of this stack used for MaD models. */
130+
string getAccessPath() {
130131
exists(SummaryComponent head, SummaryComponentStack tail |
131132
head = this.head() and
132133
tail = this.tail() and
133-
result = tail + "." + head
134+
result = tail.getAccessPath() + "." + head.getAccessStep()
134135
)
135136
or
136137
exists(SummaryComponent c |
137138
this = TSingletonSummaryComponentStack(c) and
138-
result = c.toString()
139+
result = c.getAccessStep()
139140
)
140141
}
142+
143+
/** Gets a textual representation of this stack. */
144+
string toString() { result = this.getAccessPath() }
141145
}
142146

143147
/** Provides predicates for constructing stacks of summary components. */
@@ -166,42 +170,6 @@ module Public {
166170
SummaryComponentStack return(ReturnKind rk) { result = singleton(SummaryComponent::return(rk)) }
167171
}
168172

169-
/** Gets a textual representation of this component used for flow summaries. */
170-
private string getComponent(SummaryComponent sc) {
171-
result = getComponentSpecific(sc)
172-
or
173-
exists(ArgumentPosition pos |
174-
sc = TParameterSummaryComponent(pos) and
175-
result = "Parameter[" + getArgumentPosition(pos) + "]"
176-
)
177-
or
178-
exists(ParameterPosition pos |
179-
sc = TArgumentSummaryComponent(pos) and
180-
result = "Argument[" + getParameterPosition(pos) + "]"
181-
)
182-
or
183-
exists(string synthetic |
184-
sc = TSyntheticGlobalSummaryComponent(synthetic) and
185-
result = "SyntheticGlobal[" + synthetic + "]"
186-
)
187-
or
188-
sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
189-
}
190-
191-
/** Gets a textual representation of this stack used for flow summaries. */
192-
string getComponentStack(SummaryComponentStack stack) {
193-
exists(SummaryComponent head, SummaryComponentStack tail |
194-
head = stack.head() and
195-
tail = stack.tail() and
196-
result = getComponentStack(tail) + "." + getComponent(head)
197-
)
198-
or
199-
exists(SummaryComponent c |
200-
stack = TSingletonSummaryComponentStack(c) and
201-
result = getComponent(c)
202-
)
203-
}
204-
205173
/**
206174
* A class that exists for QL technical reasons only (the IPA type used
207175
* to represent component stacks needs to be bounded).
@@ -1382,8 +1350,8 @@ module Private {
13821350
c.relevantSummary(input, output, preservesValue) and
13831351
csv =
13841352
c.getCallableCsv() // Callable information
1385-
+ getComponentStack(input) + ";" // input
1386-
+ getComponentStack(output) + ";" // output
1353+
+ input.getAccessPath() + ";" // input
1354+
+ output.getAccessPath() + ";" // output
13871355
+ renderKind(preservesValue) + ";" // kind
13881356
+ renderProvenance(c) // provenance
13891357
)

0 commit comments

Comments
 (0)