@@ -12,19 +12,19 @@ private module Cached {
1212 LevelStep ( ) or
1313 CallStep ( ) or
1414 ReturnStep ( ) or
15- StoreStep ( TypeTrackerContentSet contents ) or
16- LoadStep ( TypeTrackerContentSet contents ) or
15+ StoreStep ( TypeTrackerContent content ) or
16+ LoadStep ( TypeTrackerContent content ) or
1717 JumpStep ( )
1818
1919 pragma [ nomagic]
2020 private TypeTracker noContentTypeTracker ( boolean hasCall ) {
21- result = MkTypeTracker ( hasCall , noContentSet ( ) )
21+ result = MkTypeTracker ( hasCall , noContent ( ) )
2222 }
2323
2424 /** Gets the summary resulting from appending `step` to type-tracking summary `tt`. */
2525 cached
2626 TypeTracker append ( TypeTracker tt , StepSummary step ) {
27- exists ( Boolean hasCall , OptionalTypeTrackerContentSet currentContents |
27+ exists ( Boolean hasCall , OptionalTypeTrackerContent currentContents |
2828 tt = MkTypeTracker ( hasCall , currentContents )
2929 |
3030 step = LevelStep ( ) and result = tt
@@ -37,8 +37,8 @@ private module Cached {
3737 result = MkTypeTracker ( false , currentContents )
3838 )
3939 or
40- exists ( TypeTrackerContentSet storeContents , boolean hasCall |
41- exists ( TypeTrackerContentSet loadContents |
40+ exists ( TypeTrackerContent storeContents , boolean hasCall |
41+ exists ( TypeTrackerContent loadContents |
4242 step = LoadStep ( pragma [ only_bind_into ] ( loadContents ) ) and
4343 tt = MkTypeTracker ( hasCall , storeContents ) and
4444 compatibleContents ( storeContents , loadContents ) and
@@ -53,27 +53,27 @@ private module Cached {
5353
5454 pragma [ nomagic]
5555 private TypeBackTracker noContentTypeBackTracker ( boolean hasReturn ) {
56- result = MkTypeBackTracker ( hasReturn , noContentSet ( ) )
56+ result = MkTypeBackTracker ( hasReturn , noContent ( ) )
5757 }
5858
5959 /** Gets the summary resulting from prepending `step` to this type-tracking summary. */
6060 cached
6161 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 )
6464 |
6565 step = LevelStep ( ) and result = tbt
6666 or
6767 step = CallStep ( ) and hasReturn = false and result = tbt
6868 or
69- step = ReturnStep ( ) and result = MkTypeBackTracker ( true , contents )
69+ step = ReturnStep ( ) and result = MkTypeBackTracker ( true , content )
7070 or
7171 step = JumpStep ( ) and
72- result = MkTypeBackTracker ( false , contents )
72+ result = MkTypeBackTracker ( false , content )
7373 )
7474 or
75- exists ( TypeTrackerContentSet loadContents , boolean hasReturn |
76- exists ( TypeTrackerContentSet storeContents |
75+ exists ( TypeTrackerContent loadContents , boolean hasReturn |
76+ exists ( TypeTrackerContent storeContents |
7777 step = StoreStep ( pragma [ only_bind_into ] ( storeContents ) ) and
7878 tbt = MkTypeBackTracker ( hasReturn , loadContents ) and
7979 compatibleContents ( storeContents , loadContents ) and
@@ -123,11 +123,9 @@ class StepSummary extends TStepSummary {
123123 or
124124 this instanceof ReturnStep and result = "return"
125125 or
126- exists ( TypeTrackerContentSet contents | this = StoreStep ( contents ) |
127- result = "store " + contents
128- )
126+ exists ( TypeTrackerContent content | this = StoreStep ( content ) | result = "store " + content )
129127 or
130- exists ( TypeTrackerContentSet contents | this = LoadStep ( contents ) | result = "load " + contents )
128+ exists ( TypeTrackerContent content | this = LoadStep ( content ) | result = "load " + content )
131129 or
132130 this instanceof JumpStep and result = "jump"
133131 }
@@ -141,11 +139,11 @@ private predicate smallstepNoCall(Node nodeFrom, TypeTrackingNode nodeTo, StepSu
141139 levelStep ( nodeFrom , nodeTo ) and
142140 summary = LevelStep ( )
143141 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 )
147145 or
148- basicLoadStep ( nodeFrom , nodeTo , contents ) and summary = LoadStep ( contents )
146+ basicLoadStep ( nodeFrom , nodeTo , content ) and summary = LoadStep ( content )
149147 )
150148}
151149
@@ -191,7 +189,7 @@ module StepSummary {
191189 }
192190
193191 /**
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`.
195193 *
196194 * Note that `nodeTo` will always be a local source node that flows to the place where the content
197195 * is written in `basicStoreStep`. This may lead to the flow of information going "back in time"
@@ -210,20 +208,17 @@ module StepSummary {
210208 * def bar(x):
211209 * z = x.attr
212210 * ```
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"`,
214212 * `nodeFrom` will be `y`, and `nodeTo` will be the object `Foo()` created on the first line of the
215213 * function. This means we will track the fact that `x.attr` can have the type of `y` into the
216214 * assignment to `z` inside `bar`, even though this attribute write happens _after_ `bar` is called.
217215 */
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 ) )
222218 }
223219}
224220
225- private newtype TTypeTracker =
226- MkTypeTracker ( Boolean hasCall , OptionalTypeTrackerContentSet contents )
221+ private newtype TTypeTracker = MkTypeTracker ( Boolean hasCall , OptionalTypeTrackerContent content )
227222
228223/**
229224 * A summary of the steps needed to track a value to a given dataflow node.
@@ -254,9 +249,9 @@ private newtype TTypeTracker =
254249 */
255250class TypeTracker extends TTypeTracker {
256251 Boolean hasCall ;
257- OptionalTypeTrackerContentSet contents ;
252+ OptionalTypeTrackerContent content ;
258253
259- TypeTracker ( ) { this = MkTypeTracker ( hasCall , contents ) }
254+ TypeTracker ( ) { this = MkTypeTracker ( hasCall , content ) }
260255
261256 /** Gets the summary resulting from appending `step` to this type-tracking summary. */
262257 TypeTracker append ( StepSummary step ) { result = append ( this , step ) }
@@ -266,8 +261,8 @@ class TypeTracker extends TTypeTracker {
266261 exists ( string withCall , string withContent |
267262 ( if hasCall = true then withCall = "with" else withCall = "without" ) and
268263 (
269- if contents != noContentSet ( )
270- then withContent = " with content " + contents
264+ if content != noContent ( )
265+ then withContent = " with content " + content
271266 else withContent = ""
272267 ) and
273268 result = "type tracker " + withCall + " call steps" + withContent
@@ -277,26 +272,26 @@ class TypeTracker extends TTypeTracker {
277272 /**
278273 * Holds if this is the starting point of type tracking.
279274 */
280- predicate start ( ) { hasCall = false and contents = noContentSet ( ) }
275+ predicate start ( ) { hasCall = false and content = noContent ( ) }
281276
282277 /**
283278 * Holds if this is the starting point of type tracking, and the value starts in the content named `contentName`.
284279 * The type tracking only ends after the content has been loaded.
285280 */
286- predicate startInContent ( TypeTrackerContentSet contentName ) {
287- hasCall = false and contents = contentName
281+ predicate startInContent ( TypeTrackerContent contentName ) {
282+ hasCall = false and content = contentName
288283 }
289284
290285 /**
291286 * Holds if this is the starting point of type tracking
292287 * when tracking a parameter into a call, but not out of it.
293288 */
294- predicate call ( ) { hasCall = true and contents = noContentSet ( ) }
289+ predicate call ( ) { hasCall = true and content = noContent ( ) }
295290
296291 /**
297292 * Holds if this is the end point of type tracking.
298293 */
299- predicate end ( ) { contents = noContentSet ( ) }
294+ predicate end ( ) { content = noContent ( ) }
300295
301296 /**
302297 * INTERNAL. DO NOT USE.
@@ -310,15 +305,15 @@ class TypeTracker extends TTypeTracker {
310305 *
311306 * Gets the content associated with this type tracker.
312307 */
313- OptionalTypeTrackerContentSet getContent ( ) { result = contents }
308+ OptionalTypeTrackerContent getContent ( ) { result = content }
314309
315310 /**
316311 * Gets a type tracker that starts where this one has left off to allow continued
317312 * tracking.
318313 *
319314 * This predicate is only defined if the type is not associated to a piece of content.
320315 */
321- TypeTracker continue ( ) { contents = noContentSet ( ) and result = this }
316+ TypeTracker continue ( ) { content = noContent ( ) and result = this }
322317
323318 /**
324319 * Gets the summary that corresponds to having taken a forwards
@@ -377,7 +372,7 @@ module TypeTracker {
377372}
378373
379374private newtype TTypeBackTracker =
380- MkTypeBackTracker ( Boolean hasReturn , OptionalTypeTrackerContentSet contents )
375+ MkTypeBackTracker ( Boolean hasReturn , OptionalTypeTrackerContent content )
381376
382377/**
383378 * 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 =
411406 */
412407class TypeBackTracker extends TTypeBackTracker {
413408 Boolean hasReturn ;
414- OptionalTypeTrackerContentSet contents ;
409+ OptionalTypeTrackerContent content ;
415410
416- TypeBackTracker ( ) { this = MkTypeBackTracker ( hasReturn , contents ) }
411+ TypeBackTracker ( ) { this = MkTypeBackTracker ( hasReturn , content ) }
417412
418413 /** Gets the summary resulting from prepending `step` to this type-tracking summary. */
419414 TypeBackTracker prepend ( StepSummary step ) { result = prepend ( this , step ) }
@@ -423,8 +418,8 @@ class TypeBackTracker extends TTypeBackTracker {
423418 exists ( string withReturn , string withContent |
424419 ( if hasReturn = true then withReturn = "with" else withReturn = "without" ) and
425420 (
426- if contents != noContentSet ( )
427- then withContent = " with content " + contents
421+ if content != noContent ( )
422+ then withContent = " with content " + content
428423 else withContent = ""
429424 ) and
430425 result = "type back-tracker " + withReturn + " return steps" + withContent
@@ -434,12 +429,12 @@ class TypeBackTracker extends TTypeBackTracker {
434429 /**
435430 * Holds if this is the starting point of type tracking.
436431 */
437- predicate start ( ) { hasReturn = false and contents = noContentSet ( ) }
432+ predicate start ( ) { hasReturn = false and content = noContent ( ) }
438433
439434 /**
440435 * Holds if this is the end point of type tracking.
441436 */
442- predicate end ( ) { contents = noContentSet ( ) }
437+ predicate end ( ) { content = noContent ( ) }
443438
444439 /**
445440 * INTERNAL. DO NOT USE.
@@ -454,7 +449,7 @@ class TypeBackTracker extends TTypeBackTracker {
454449 *
455450 * This predicate is only defined if the type has not been tracked into a piece of content.
456451 */
457- TypeBackTracker continue ( ) { contents = noContentSet ( ) and result = this }
452+ TypeBackTracker continue ( ) { content = noContent ( ) and result = this }
458453
459454 /**
460455 * Gets the summary that corresponds to having taken a backwards
@@ -511,7 +506,7 @@ class TypeBackTracker extends TTypeBackTracker {
511506 * also flow to `sink`.
512507 */
513508 TypeTracker getACompatibleTypeTracker ( ) {
514- exists ( boolean hasCall | result = MkTypeTracker ( hasCall , contents ) |
509+ exists ( boolean hasCall | result = MkTypeTracker ( hasCall , content ) |
515510 hasCall = false or this .hasReturn ( ) = false
516511 )
517512 }
0 commit comments