@@ -145,20 +145,15 @@ module DataFlow {
145145 * For more information, see
146146 * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
147147 */
148- cached
149- predicate hasLocationInfo (
148+ final predicate hasLocationInfo (
150149 string filepath , int startline , int startcolumn , int endline , int endcolumn
151150 ) {
152- none ( )
151+ this . getLocation ( ) . hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
153152 }
154153
155154 /** 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 ( ) }
162157
163158 /** Gets the file this data flow node comes from. */
164159 File getFile ( ) { none ( ) } // overridden in subclasses
@@ -300,11 +295,9 @@ module DataFlow {
300295
301296 override BasicBlock getBasicBlock ( ) { astNode = result .getANode ( ) }
302297
303- override predicate hasLocationInfo (
304- string filepath , int startline , int startcolumn , int endline , int endcolumn
305- ) {
298+ override Location getLocation ( ) {
306299 Stages:: DataFlowStage:: ref ( ) and
307- astNode .getLocation ( ) . hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
300+ result = astNode .getLocation ( )
308301 }
309302
310303 override File getFile ( ) { result = astNode .getFile ( ) }
@@ -325,11 +318,7 @@ module DataFlow {
325318
326319 override BasicBlock getBasicBlock ( ) { result = ssa .getBasicBlock ( ) }
327320
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 ( ) }
333322
334323 override string toString ( ) { result = ssa .getSourceVariable ( ) .getName ( ) }
335324
@@ -348,13 +337,7 @@ module DataFlow {
348337
349338 override BasicBlock getBasicBlock ( ) { result = prop .( ControlFlowNode ) .getBasicBlock ( ) }
350339
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 ( ) }
358341
359342 override string toString ( ) { result = prop .( AstNode ) .toString ( ) }
360343
@@ -375,11 +358,7 @@ module DataFlow {
375358
376359 override BasicBlock getBasicBlock ( ) { result = rest .getBasicBlock ( ) }
377360
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 ( ) }
383362
384363 override string toString ( ) { result = "..." + rest .toString ( ) }
385364
@@ -400,11 +379,7 @@ module DataFlow {
400379
401380 override BasicBlock getBasicBlock ( ) { result = elt .getBasicBlock ( ) }
402381
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 ( ) }
408383
409384 override string toString ( ) { result = elt .toString ( ) }
410385
@@ -429,11 +404,7 @@ module DataFlow {
429404
430405 override BasicBlock getBasicBlock ( ) { result = elt .getBasicBlock ( ) }
431406
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 ( ) }
437408
438409 override string toString ( ) { result = elt .toString ( ) }
439410
@@ -453,11 +424,7 @@ module DataFlow {
453424
454425 override BasicBlock getBasicBlock ( ) { result = call .getBasicBlock ( ) }
455426
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 ( ) }
461428
462429 override string toString ( ) { result = "reflective call" }
463430
@@ -474,11 +441,7 @@ module DataFlow {
474441
475442 override BasicBlock getBasicBlock ( ) { result = imprt .getBasicBlock ( ) }
476443
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 ( ) }
482445
483446 override string toString ( ) { result = imprt .toString ( ) }
484447
@@ -968,11 +931,7 @@ module DataFlow {
968931
969932 override string toString ( ) { result = attr .toString ( ) }
970933
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 ( ) }
976935
977936 /** Gets the attribute corresponding to this data flow node. */
978937 HTML:: Attribute getAttribute ( ) { result = attr }
@@ -990,11 +949,7 @@ module DataFlow {
990949
991950 override string toString ( ) { result = attr .toString ( ) }
992951
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 ( ) }
998953
999954 /** Gets the attribute corresponding to this data flow node. */
1000955 XmlAttribute getAttribute ( ) { result = attr }
@@ -1012,11 +967,7 @@ module DataFlow {
1012967
1013968 override string toString ( ) { result = "exceptional return of " + function .describe ( ) }
1014969
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 ( ) }
1020971
1021972 override BasicBlock getBasicBlock ( ) { result = function .getExit ( ) .getBasicBlock ( ) }
1022973
@@ -1038,11 +989,7 @@ module DataFlow {
1038989
1039990 override string toString ( ) { result = "return of " + function .describe ( ) }
1040991
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 ( ) }
1046993
1047994 override BasicBlock getBasicBlock ( ) { result = function .getExit ( ) .getBasicBlock ( ) }
1048995
@@ -1064,11 +1011,7 @@ module DataFlow {
10641011
10651012 override string toString ( ) { result = "'arguments' object of " + function .describe ( ) }
10661013
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 ( ) }
10721015
10731016 override BasicBlock getBasicBlock ( ) { result = function .getEntry ( ) .getBasicBlock ( ) }
10741017
@@ -1090,11 +1033,7 @@ module DataFlow {
10901033
10911034 override string toString ( ) { result = "exceptional return of " + invoke .toString ( ) }
10921035
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 ( ) }
10981037
10991038 override BasicBlock getBasicBlock ( ) { result = invoke .getBasicBlock ( ) }
11001039
@@ -1366,15 +1305,10 @@ module DataFlow {
13661305 exists ( StmtContainer container | this = TThisNode ( container ) | result = container .getEntry ( ) )
13671306 }
13681307
1369- override predicate hasLocationInfo (
1370- string filepath , int startline , int startcolumn , int endline , int endcolumn
1371- ) {
1308+ override Location getLocation ( ) {
13721309 // Use the function entry as the location
13731310 exists ( StmtContainer container | this = TThisNode ( container ) |
1374- container
1375- .getEntry ( )
1376- .getLocation ( )
1377- .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
1311+ result = container .getEntry ( ) .getLocation ( )
13781312 )
13791313 }
13801314
@@ -1393,11 +1327,7 @@ module DataFlow {
13931327
13941328 override BasicBlock getBasicBlock ( ) { result = variable .getDeclaringContainer ( ) .getStartBB ( ) }
13951329
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 ( ) }
14011331
14021332 override string toString ( ) { result = variable .getName ( ) }
14031333 }
@@ -1409,13 +1339,7 @@ module DataFlow {
14091339
14101340 override BasicBlock getBasicBlock ( ) { none ( ) }
14111341
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 ( ) }
14191343
14201344 override string toString ( ) { result = this .getTag ( ) .toString ( ) }
14211345 }
0 commit comments