@@ -166,15 +166,11 @@ module DataFlow {
166166 predicate hasLocationInfo (
167167 string filepath , int startline , int startcolumn , int endline , int endcolumn
168168 ) {
169- filepath = "" and
170- startline = 0 and
171- startcolumn = 0 and
172- endline = 0 and
173- endcolumn = 0
169+ none ( )
174170 }
175171
176172 /** Gets the file this data flow node comes from. */
177- File getFile ( ) { hasLocationInfo ( result . getAbsolutePath ( ) , _ , _ , _ , _ ) }
173+ File getFile ( ) { none ( ) } // overridden in subclasses
178174
179175 /** Gets the start line of this data flow node. */
180176 int getStartLine ( ) { hasLocationInfo ( _, result , _, _, _) }
@@ -314,6 +310,8 @@ module DataFlow {
314310 astNode .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
315311 }
316312
313+ override File getFile ( ) { result = astNode .getFile ( ) }
314+
317315 override string toString ( ) { result = astNode .toString ( ) }
318316 }
319317
@@ -338,6 +336,8 @@ module DataFlow {
338336
339337 override string toString ( ) { result = ssa .getSourceVariable ( ) .getName ( ) }
340338
339+ override File getFile ( ) { result = ssa .getBasicBlock ( ) .getFile ( ) }
340+
341341 override ASTNode getAstNode ( ) { none ( ) }
342342 }
343343
@@ -362,6 +362,8 @@ module DataFlow {
362362
363363 override string toString ( ) { result = prop .( ASTNode ) .toString ( ) }
364364
365+ override File getFile ( ) { result = prop .( ASTNode ) .getFile ( ) }
366+
365367 override ASTNode getAstNode ( ) { result = prop }
366368 }
367369
@@ -385,6 +387,8 @@ module DataFlow {
385387
386388 override string toString ( ) { result = "..." + rest .toString ( ) }
387389
390+ override File getFile ( ) { result = pattern .getFile ( ) }
391+
388392 override ASTNode getAstNode ( ) { result = rest }
389393 }
390394
@@ -407,6 +411,8 @@ module DataFlow {
407411
408412 override string toString ( ) { result = pattern .toString ( ) }
409413
414+ override File getFile ( ) { result = pattern .getFile ( ) }
415+
410416 override ASTNode getAstNode ( ) { result = pattern }
411417 }
412418
@@ -430,6 +436,8 @@ module DataFlow {
430436
431437 override string toString ( ) { result = elt .toString ( ) }
432438
439+ override File getFile ( ) { result = pattern .getFile ( ) }
440+
433441 override ASTNode getAstNode ( ) { result = elt }
434442 }
435443
@@ -457,6 +465,8 @@ module DataFlow {
457465
458466 override string toString ( ) { result = elt .toString ( ) }
459467
468+ override File getFile ( ) { result = arr .getFile ( ) }
469+
460470 override ASTNode getAstNode ( ) { result = elt }
461471 }
462472
@@ -479,6 +489,8 @@ module DataFlow {
479489 }
480490
481491 override string toString ( ) { result = "reflective call" }
492+
493+ override File getFile ( ) { result = call .getFile ( ) }
482494 }
483495
484496 /**
@@ -498,6 +510,8 @@ module DataFlow {
498510 }
499511
500512 override string toString ( ) { result = imprt .toString ( ) }
513+
514+ override File getFile ( ) { result = imprt .getFile ( ) }
501515 }
502516
503517 /**
@@ -925,6 +939,8 @@ module DataFlow {
925939 ) {
926940 p .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
927941 }
942+
943+ override File getFile ( ) { result = p .getFile ( ) }
928944 }
929945
930946 /**
@@ -945,6 +961,8 @@ module DataFlow {
945961
946962 /** Gets the attribute corresponding to this data flow node. */
947963 HTML:: Attribute getAttribute ( ) { result = attr }
964+
965+ override File getFile ( ) { result = attr .getFile ( ) }
948966 }
949967
950968 /**
@@ -969,6 +987,8 @@ module DataFlow {
969987 * Gets the function corresponding to this exceptional return node.
970988 */
971989 Function getFunction ( ) { result = function }
990+
991+ override File getFile ( ) { result = function .getFile ( ) }
972992 }
973993
974994 /**
@@ -993,6 +1013,8 @@ module DataFlow {
9931013 * Gets the invocation corresponding to this exceptional return node.
9941014 */
9951015 DataFlow:: InvokeNode getInvocation ( ) { result = invoke .flow ( ) }
1016+
1017+ override File getFile ( ) { result = invoke .getFile ( ) }
9961018 }
9971019
9981020 /**
@@ -1220,6 +1242,10 @@ module DataFlow {
12201242 .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
12211243 )
12221244 }
1245+
1246+ override File getFile ( ) {
1247+ exists ( StmtContainer container | this = TThisNode ( container ) | result = container .getFile ( ) )
1248+ }
12231249 }
12241250
12251251 /**
0 commit comments