@@ -145,20 +145,15 @@ module DataFlow {
145
145
* For more information, see
146
146
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
147
147
*/
148
- cached
149
- predicate hasLocationInfo (
148
+ final predicate hasLocationInfo (
150
149
string filepath , int startline , int startcolumn , int endline , int endcolumn
151
150
) {
152
- none ( )
151
+ this . getLocation ( ) . hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
153
152
}
154
153
155
154
/** Gets the location of this node. */
156
- Location getLocation ( ) {
157
- exists ( string filepath , int startline , int startcolumn , int endline , int endcolumn |
158
- this .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn ) and
159
- result .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
160
- )
161
- }
155
+ cached
156
+ Location getLocation ( ) { none ( ) }
162
157
163
158
/** Gets the file this data flow node comes from. */
164
159
File getFile ( ) { none ( ) } // overridden in subclasses
@@ -300,11 +295,9 @@ module DataFlow {
300
295
301
296
override BasicBlock getBasicBlock ( ) { astNode = result .getANode ( ) }
302
297
303
- override predicate hasLocationInfo (
304
- string filepath , int startline , int startcolumn , int endline , int endcolumn
305
- ) {
298
+ override Location getLocation ( ) {
306
299
Stages:: DataFlowStage:: ref ( ) and
307
- astNode .getLocation ( ) . hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
300
+ result = astNode .getLocation ( )
308
301
}
309
302
310
303
override File getFile ( ) { result = astNode .getFile ( ) }
@@ -325,11 +318,7 @@ module DataFlow {
325
318
326
319
override BasicBlock getBasicBlock ( ) { result = ssa .getBasicBlock ( ) }
327
320
328
- override predicate hasLocationInfo (
329
- string filepath , int startline , int startcolumn , int endline , int endcolumn
330
- ) {
331
- ssa .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
332
- }
321
+ override Location getLocation ( ) { result = ssa .getLocation ( ) }
333
322
334
323
override string toString ( ) { result = ssa .getSourceVariable ( ) .getName ( ) }
335
324
@@ -348,13 +337,7 @@ module DataFlow {
348
337
349
338
override BasicBlock getBasicBlock ( ) { result = prop .( ControlFlowNode ) .getBasicBlock ( ) }
350
339
351
- override predicate hasLocationInfo (
352
- string filepath , int startline , int startcolumn , int endline , int endcolumn
353
- ) {
354
- prop .( Locatable )
355
- .getLocation ( )
356
- .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
357
- }
340
+ override Location getLocation ( ) { result = prop .( Locatable ) .getLocation ( ) }
358
341
359
342
override string toString ( ) { result = prop .( AstNode ) .toString ( ) }
360
343
@@ -375,11 +358,7 @@ module DataFlow {
375
358
376
359
override BasicBlock getBasicBlock ( ) { result = rest .getBasicBlock ( ) }
377
360
378
- override predicate hasLocationInfo (
379
- string filepath , int startline , int startcolumn , int endline , int endcolumn
380
- ) {
381
- rest .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
382
- }
361
+ override Location getLocation ( ) { result = rest .getLocation ( ) }
383
362
384
363
override string toString ( ) { result = "..." + rest .toString ( ) }
385
364
@@ -400,11 +379,7 @@ module DataFlow {
400
379
401
380
override BasicBlock getBasicBlock ( ) { result = elt .getBasicBlock ( ) }
402
381
403
- override predicate hasLocationInfo (
404
- string filepath , int startline , int startcolumn , int endline , int endcolumn
405
- ) {
406
- elt .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
407
- }
382
+ override Location getLocation ( ) { result = elt .getLocation ( ) }
408
383
409
384
override string toString ( ) { result = elt .toString ( ) }
410
385
@@ -429,11 +404,7 @@ module DataFlow {
429
404
430
405
override BasicBlock getBasicBlock ( ) { result = elt .getBasicBlock ( ) }
431
406
432
- override predicate hasLocationInfo (
433
- string filepath , int startline , int startcolumn , int endline , int endcolumn
434
- ) {
435
- elt .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
436
- }
407
+ override Location getLocation ( ) { result = elt .getLocation ( ) }
437
408
438
409
override string toString ( ) { result = elt .toString ( ) }
439
410
@@ -453,11 +424,7 @@ module DataFlow {
453
424
454
425
override BasicBlock getBasicBlock ( ) { result = call .getBasicBlock ( ) }
455
426
456
- override predicate hasLocationInfo (
457
- string filepath , int startline , int startcolumn , int endline , int endcolumn
458
- ) {
459
- call .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
460
- }
427
+ override Location getLocation ( ) { result = call .getLocation ( ) }
461
428
462
429
override string toString ( ) { result = "reflective call" }
463
430
@@ -474,11 +441,7 @@ module DataFlow {
474
441
475
442
override BasicBlock getBasicBlock ( ) { result = imprt .getBasicBlock ( ) }
476
443
477
- override predicate hasLocationInfo (
478
- string filepath , int startline , int startcolumn , int endline , int endcolumn
479
- ) {
480
- imprt .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
481
- }
444
+ override Location getLocation ( ) { result = imprt .getLocation ( ) }
482
445
483
446
override string toString ( ) { result = imprt .toString ( ) }
484
447
@@ -968,11 +931,7 @@ module DataFlow {
968
931
969
932
override string toString ( ) { result = attr .toString ( ) }
970
933
971
- override predicate hasLocationInfo (
972
- string filepath , int startline , int startcolumn , int endline , int endcolumn
973
- ) {
974
- attr .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
975
- }
934
+ override Location getLocation ( ) { result = attr .getLocation ( ) }
976
935
977
936
/** Gets the attribute corresponding to this data flow node. */
978
937
HTML:: Attribute getAttribute ( ) { result = attr }
@@ -990,11 +949,7 @@ module DataFlow {
990
949
991
950
override string toString ( ) { result = attr .toString ( ) }
992
951
993
- override predicate hasLocationInfo (
994
- string filepath , int startline , int startcolumn , int endline , int endcolumn
995
- ) {
996
- attr .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
997
- }
952
+ override Location getLocation ( ) { result = attr .getLocation ( ) }
998
953
999
954
/** Gets the attribute corresponding to this data flow node. */
1000
955
XmlAttribute getAttribute ( ) { result = attr }
@@ -1012,11 +967,7 @@ module DataFlow {
1012
967
1013
968
override string toString ( ) { result = "exceptional return of " + function .describe ( ) }
1014
969
1015
- override predicate hasLocationInfo (
1016
- string filepath , int startline , int startcolumn , int endline , int endcolumn
1017
- ) {
1018
- function .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
1019
- }
970
+ override Location getLocation ( ) { result = function .getLocation ( ) }
1020
971
1021
972
override BasicBlock getBasicBlock ( ) { result = function .getExit ( ) .getBasicBlock ( ) }
1022
973
@@ -1038,11 +989,7 @@ module DataFlow {
1038
989
1039
990
override string toString ( ) { result = "return of " + function .describe ( ) }
1040
991
1041
- override predicate hasLocationInfo (
1042
- string filepath , int startline , int startcolumn , int endline , int endcolumn
1043
- ) {
1044
- function .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
1045
- }
992
+ override Location getLocation ( ) { result = function .getLocation ( ) }
1046
993
1047
994
override BasicBlock getBasicBlock ( ) { result = function .getExit ( ) .getBasicBlock ( ) }
1048
995
@@ -1064,11 +1011,7 @@ module DataFlow {
1064
1011
1065
1012
override string toString ( ) { result = "'arguments' object of " + function .describe ( ) }
1066
1013
1067
- override predicate hasLocationInfo (
1068
- string filepath , int startline , int startcolumn , int endline , int endcolumn
1069
- ) {
1070
- function .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
1071
- }
1014
+ override Location getLocation ( ) { result = function .getLocation ( ) }
1072
1015
1073
1016
override BasicBlock getBasicBlock ( ) { result = function .getEntry ( ) .getBasicBlock ( ) }
1074
1017
@@ -1090,11 +1033,7 @@ module DataFlow {
1090
1033
1091
1034
override string toString ( ) { result = "exceptional return of " + invoke .toString ( ) }
1092
1035
1093
- override predicate hasLocationInfo (
1094
- string filepath , int startline , int startcolumn , int endline , int endcolumn
1095
- ) {
1096
- invoke .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
1097
- }
1036
+ override Location getLocation ( ) { result = invoke .getLocation ( ) }
1098
1037
1099
1038
override BasicBlock getBasicBlock ( ) { result = invoke .getBasicBlock ( ) }
1100
1039
@@ -1366,15 +1305,10 @@ module DataFlow {
1366
1305
exists ( StmtContainer container | this = TThisNode ( container ) | result = container .getEntry ( ) )
1367
1306
}
1368
1307
1369
- override predicate hasLocationInfo (
1370
- string filepath , int startline , int startcolumn , int endline , int endcolumn
1371
- ) {
1308
+ override Location getLocation ( ) {
1372
1309
// Use the function entry as the location
1373
1310
exists ( StmtContainer container | this = TThisNode ( container ) |
1374
- container
1375
- .getEntry ( )
1376
- .getLocation ( )
1377
- .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
1311
+ result = container .getEntry ( ) .getLocation ( )
1378
1312
)
1379
1313
}
1380
1314
@@ -1393,11 +1327,7 @@ module DataFlow {
1393
1327
1394
1328
override BasicBlock getBasicBlock ( ) { result = variable .getDeclaringContainer ( ) .getStartBB ( ) }
1395
1329
1396
- override predicate hasLocationInfo (
1397
- string filepath , int startline , int startcolumn , int endline , int endcolumn
1398
- ) {
1399
- variable .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
1400
- }
1330
+ override Location getLocation ( ) { result = variable .getLocation ( ) }
1401
1331
1402
1332
override string toString ( ) { result = variable .getName ( ) }
1403
1333
}
@@ -1409,13 +1339,7 @@ module DataFlow {
1409
1339
1410
1340
override BasicBlock getBasicBlock ( ) { none ( ) }
1411
1341
1412
- override predicate hasLocationInfo (
1413
- string filepath , int startline , int startcolumn , int endline , int endcolumn
1414
- ) {
1415
- this .getTag ( )
1416
- .getLocation ( )
1417
- .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
1418
- }
1342
+ override Location getLocation ( ) { result = this .getTag ( ) .getLocation ( ) }
1419
1343
1420
1344
override string toString ( ) { result = this .getTag ( ) .toString ( ) }
1421
1345
}
0 commit comments