@@ -12,19 +12,19 @@ private module Cached {
12
12
LevelStep ( ) or
13
13
CallStep ( ) or
14
14
ReturnStep ( ) or
15
- StoreStep ( TypeTrackerContentSet contents ) or
16
- LoadStep ( TypeTrackerContentSet contents ) or
15
+ StoreStep ( TypeTrackerContent content ) or
16
+ LoadStep ( TypeTrackerContent content ) or
17
17
JumpStep ( )
18
18
19
19
pragma [ nomagic]
20
20
private TypeTracker noContentTypeTracker ( boolean hasCall ) {
21
- result = MkTypeTracker ( hasCall , noContentSet ( ) )
21
+ result = MkTypeTracker ( hasCall , noContent ( ) )
22
22
}
23
23
24
24
/** Gets the summary resulting from appending `step` to type-tracking summary `tt`. */
25
25
cached
26
26
TypeTracker append ( TypeTracker tt , StepSummary step ) {
27
- exists ( Boolean hasCall , OptionalTypeTrackerContentSet currentContents |
27
+ exists ( Boolean hasCall , OptionalTypeTrackerContent currentContents |
28
28
tt = MkTypeTracker ( hasCall , currentContents )
29
29
|
30
30
step = LevelStep ( ) and result = tt
@@ -37,8 +37,8 @@ private module Cached {
37
37
result = MkTypeTracker ( false , currentContents )
38
38
)
39
39
or
40
- exists ( TypeTrackerContentSet storeContents , boolean hasCall |
41
- exists ( TypeTrackerContentSet loadContents |
40
+ exists ( TypeTrackerContent storeContents , boolean hasCall |
41
+ exists ( TypeTrackerContent loadContents |
42
42
step = LoadStep ( pragma [ only_bind_into ] ( loadContents ) ) and
43
43
tt = MkTypeTracker ( hasCall , storeContents ) and
44
44
compatibleContents ( storeContents , loadContents ) and
@@ -53,27 +53,27 @@ private module Cached {
53
53
54
54
pragma [ nomagic]
55
55
private TypeBackTracker noContentTypeBackTracker ( boolean hasReturn ) {
56
- result = MkTypeBackTracker ( hasReturn , noContentSet ( ) )
56
+ result = MkTypeBackTracker ( hasReturn , noContent ( ) )
57
57
}
58
58
59
59
/** Gets the summary resulting from prepending `step` to this type-tracking summary. */
60
60
cached
61
61
TypeBackTracker prepend ( TypeBackTracker tbt , StepSummary step ) {
62
- exists ( Boolean hasReturn , OptionalTypeTrackerContentSet contents |
63
- tbt = MkTypeBackTracker ( hasReturn , contents )
62
+ exists ( Boolean hasReturn , OptionalTypeTrackerContent content |
63
+ tbt = MkTypeBackTracker ( hasReturn , content )
64
64
|
65
65
step = LevelStep ( ) and result = tbt
66
66
or
67
67
step = CallStep ( ) and hasReturn = false and result = tbt
68
68
or
69
- step = ReturnStep ( ) and result = MkTypeBackTracker ( true , contents )
69
+ step = ReturnStep ( ) and result = MkTypeBackTracker ( true , content )
70
70
or
71
71
step = JumpStep ( ) and
72
- result = MkTypeBackTracker ( false , contents )
72
+ result = MkTypeBackTracker ( false , content )
73
73
)
74
74
or
75
- exists ( TypeTrackerContentSet loadContents , boolean hasReturn |
76
- exists ( TypeTrackerContentSet storeContents |
75
+ exists ( TypeTrackerContent loadContents , boolean hasReturn |
76
+ exists ( TypeTrackerContent storeContents |
77
77
step = StoreStep ( pragma [ only_bind_into ] ( storeContents ) ) and
78
78
tbt = MkTypeBackTracker ( hasReturn , loadContents ) and
79
79
compatibleContents ( storeContents , loadContents ) and
@@ -123,11 +123,9 @@ class StepSummary extends TStepSummary {
123
123
or
124
124
this instanceof ReturnStep and result = "return"
125
125
or
126
- exists ( TypeTrackerContentSet contents | this = StoreStep ( contents ) |
127
- result = "store " + contents
128
- )
126
+ exists ( TypeTrackerContent content | this = StoreStep ( content ) | result = "store " + content )
129
127
or
130
- exists ( TypeTrackerContentSet contents | this = LoadStep ( contents ) | result = "load " + contents )
128
+ exists ( TypeTrackerContent content | this = LoadStep ( content ) | result = "load " + content )
131
129
or
132
130
this instanceof JumpStep and result = "jump"
133
131
}
@@ -141,11 +139,11 @@ private predicate smallstepNoCall(Node nodeFrom, TypeTrackingNode nodeTo, StepSu
141
139
levelStep ( nodeFrom , nodeTo ) and
142
140
summary = LevelStep ( )
143
141
or
144
- exists ( TypeTrackerContentSet contents |
145
- StepSummary:: localSourceStoreStep ( nodeFrom , nodeTo , contents ) and
146
- summary = StoreStep ( contents )
142
+ exists ( TypeTrackerContent content |
143
+ StepSummary:: localSourceStoreStep ( nodeFrom , nodeTo , content ) and
144
+ summary = StoreStep ( content )
147
145
or
148
- basicLoadStep ( nodeFrom , nodeTo , contents ) and summary = LoadStep ( contents )
146
+ basicLoadStep ( nodeFrom , nodeTo , content ) and summary = LoadStep ( content )
149
147
)
150
148
}
151
149
@@ -191,7 +189,7 @@ module StepSummary {
191
189
}
192
190
193
191
/**
194
- * Holds if `nodeFrom` is being written to the `contents ` of the object in `nodeTo`.
192
+ * Holds if `nodeFrom` is being written to the `content ` of the object in `nodeTo`.
195
193
*
196
194
* Note that `nodeTo` will always be a local source node that flows to the place where the content
197
195
* is written in `basicStoreStep`. This may lead to the flow of information going "back in time"
@@ -210,20 +208,17 @@ module StepSummary {
210
208
* def bar(x):
211
209
* z = x.attr
212
210
* ```
213
- * for the attribute write `x.attr = y`, we will have `contents ` being the literal string `"attr"`,
211
+ * for the attribute write `x.attr = y`, we will have `content ` being the literal string `"attr"`,
214
212
* `nodeFrom` will be `y`, and `nodeTo` will be the object `Foo()` created on the first line of the
215
213
* function. This means we will track the fact that `x.attr` can have the type of `y` into the
216
214
* assignment to `z` inside `bar`, even though this attribute write happens _after_ `bar` is called.
217
215
*/
218
- predicate localSourceStoreStep (
219
- Node nodeFrom , TypeTrackingNode nodeTo , TypeTrackerContentSet contents
220
- ) {
221
- exists ( Node obj | nodeTo .flowsTo ( obj ) and basicStoreStep ( nodeFrom , obj , contents ) )
216
+ predicate localSourceStoreStep ( Node nodeFrom , TypeTrackingNode nodeTo , TypeTrackerContent content ) {
217
+ exists ( Node obj | nodeTo .flowsTo ( obj ) and basicStoreStep ( nodeFrom , obj , content ) )
222
218
}
223
219
}
224
220
225
- private newtype TTypeTracker =
226
- MkTypeTracker ( Boolean hasCall , OptionalTypeTrackerContentSet contents )
221
+ private newtype TTypeTracker = MkTypeTracker ( Boolean hasCall , OptionalTypeTrackerContent content )
227
222
228
223
/**
229
224
* A summary of the steps needed to track a value to a given dataflow node.
@@ -254,9 +249,9 @@ private newtype TTypeTracker =
254
249
*/
255
250
class TypeTracker extends TTypeTracker {
256
251
Boolean hasCall ;
257
- OptionalTypeTrackerContentSet contents ;
252
+ OptionalTypeTrackerContent content ;
258
253
259
- TypeTracker ( ) { this = MkTypeTracker ( hasCall , contents ) }
254
+ TypeTracker ( ) { this = MkTypeTracker ( hasCall , content ) }
260
255
261
256
/** Gets the summary resulting from appending `step` to this type-tracking summary. */
262
257
TypeTracker append ( StepSummary step ) { result = append ( this , step ) }
@@ -266,8 +261,8 @@ class TypeTracker extends TTypeTracker {
266
261
exists ( string withCall , string withContent |
267
262
( if hasCall = true then withCall = "with" else withCall = "without" ) and
268
263
(
269
- if contents != noContentSet ( )
270
- then withContent = " with content " + contents
264
+ if content != noContent ( )
265
+ then withContent = " with content " + content
271
266
else withContent = ""
272
267
) and
273
268
result = "type tracker " + withCall + " call steps" + withContent
@@ -277,26 +272,26 @@ class TypeTracker extends TTypeTracker {
277
272
/**
278
273
* Holds if this is the starting point of type tracking.
279
274
*/
280
- predicate start ( ) { hasCall = false and contents = noContentSet ( ) }
275
+ predicate start ( ) { hasCall = false and content = noContent ( ) }
281
276
282
277
/**
283
278
* Holds if this is the starting point of type tracking, and the value starts in the content named `contentName`.
284
279
* The type tracking only ends after the content has been loaded.
285
280
*/
286
- predicate startInContent ( TypeTrackerContentSet contentName ) {
287
- hasCall = false and contents = contentName
281
+ predicate startInContent ( TypeTrackerContent contentName ) {
282
+ hasCall = false and content = contentName
288
283
}
289
284
290
285
/**
291
286
* Holds if this is the starting point of type tracking
292
287
* when tracking a parameter into a call, but not out of it.
293
288
*/
294
- predicate call ( ) { hasCall = true and contents = noContentSet ( ) }
289
+ predicate call ( ) { hasCall = true and content = noContent ( ) }
295
290
296
291
/**
297
292
* Holds if this is the end point of type tracking.
298
293
*/
299
- predicate end ( ) { contents = noContentSet ( ) }
294
+ predicate end ( ) { content = noContent ( ) }
300
295
301
296
/**
302
297
* INTERNAL. DO NOT USE.
@@ -310,15 +305,15 @@ class TypeTracker extends TTypeTracker {
310
305
*
311
306
* Gets the content associated with this type tracker.
312
307
*/
313
- OptionalTypeTrackerContentSet getContent ( ) { result = contents }
308
+ OptionalTypeTrackerContent getContent ( ) { result = content }
314
309
315
310
/**
316
311
* Gets a type tracker that starts where this one has left off to allow continued
317
312
* tracking.
318
313
*
319
314
* This predicate is only defined if the type is not associated to a piece of content.
320
315
*/
321
- TypeTracker continue ( ) { contents = noContentSet ( ) and result = this }
316
+ TypeTracker continue ( ) { content = noContent ( ) and result = this }
322
317
323
318
/**
324
319
* Gets the summary that corresponds to having taken a forwards
@@ -377,7 +372,7 @@ module TypeTracker {
377
372
}
378
373
379
374
private newtype TTypeBackTracker =
380
- MkTypeBackTracker ( Boolean hasReturn , OptionalTypeTrackerContentSet contents )
375
+ MkTypeBackTracker ( Boolean hasReturn , OptionalTypeTrackerContent content )
381
376
382
377
/**
383
378
* A summary of the steps needed to back-track a use of a value to a given dataflow node.
@@ -411,9 +406,9 @@ private newtype TTypeBackTracker =
411
406
*/
412
407
class TypeBackTracker extends TTypeBackTracker {
413
408
Boolean hasReturn ;
414
- OptionalTypeTrackerContentSet contents ;
409
+ OptionalTypeTrackerContent content ;
415
410
416
- TypeBackTracker ( ) { this = MkTypeBackTracker ( hasReturn , contents ) }
411
+ TypeBackTracker ( ) { this = MkTypeBackTracker ( hasReturn , content ) }
417
412
418
413
/** Gets the summary resulting from prepending `step` to this type-tracking summary. */
419
414
TypeBackTracker prepend ( StepSummary step ) { result = prepend ( this , step ) }
@@ -423,8 +418,8 @@ class TypeBackTracker extends TTypeBackTracker {
423
418
exists ( string withReturn , string withContent |
424
419
( if hasReturn = true then withReturn = "with" else withReturn = "without" ) and
425
420
(
426
- if contents != noContentSet ( )
427
- then withContent = " with content " + contents
421
+ if content != noContent ( )
422
+ then withContent = " with content " + content
428
423
else withContent = ""
429
424
) and
430
425
result = "type back-tracker " + withReturn + " return steps" + withContent
@@ -434,12 +429,12 @@ class TypeBackTracker extends TTypeBackTracker {
434
429
/**
435
430
* Holds if this is the starting point of type tracking.
436
431
*/
437
- predicate start ( ) { hasReturn = false and contents = noContentSet ( ) }
432
+ predicate start ( ) { hasReturn = false and content = noContent ( ) }
438
433
439
434
/**
440
435
* Holds if this is the end point of type tracking.
441
436
*/
442
- predicate end ( ) { contents = noContentSet ( ) }
437
+ predicate end ( ) { content = noContent ( ) }
443
438
444
439
/**
445
440
* INTERNAL. DO NOT USE.
@@ -454,7 +449,7 @@ class TypeBackTracker extends TTypeBackTracker {
454
449
*
455
450
* This predicate is only defined if the type has not been tracked into a piece of content.
456
451
*/
457
- TypeBackTracker continue ( ) { contents = noContentSet ( ) and result = this }
452
+ TypeBackTracker continue ( ) { content = noContent ( ) and result = this }
458
453
459
454
/**
460
455
* Gets the summary that corresponds to having taken a backwards
@@ -511,7 +506,7 @@ class TypeBackTracker extends TTypeBackTracker {
511
506
* also flow to `sink`.
512
507
*/
513
508
TypeTracker getACompatibleTypeTracker ( ) {
514
- exists ( boolean hasCall | result = MkTypeTracker ( hasCall , contents ) |
509
+ exists ( boolean hasCall | result = MkTypeTracker ( hasCall , content ) |
515
510
hasCall = false or this .hasReturn ( ) = false
516
511
)
517
512
}
0 commit comments