@@ -311,6 +311,13 @@ class DataFlowCallable extends TDataFlowCallable {
311311 .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
312312 }
313313
314+ /** Gets the location of this callable. */
315+ Location getLocation ( ) {
316+ result = getCallableLocation ( this .asCallable ( ) ) or
317+ result = this .asFileScope ( ) .getLocation ( ) or
318+ result = getCallableLocation ( this .asSummarizedCallable ( ) )
319+ }
320+
314321 /** Gets a best-effort total ordering. */
315322 int totalorder ( ) {
316323 this =
@@ -322,6 +329,13 @@ class DataFlowCallable extends TDataFlowCallable {
322329 }
323330}
324331
332+ private Location getCallableLocation ( Callable c ) {
333+ exists ( string filepath , int startline , int startcolumn , int endline , int endcolumn |
334+ c .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn ) and
335+ result .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
336+ )
337+ }
338+
325339/** A function call relevant for data flow. */
326340class DataFlowCall extends Expr {
327341 DataFlow:: CallNode call ;
@@ -344,6 +358,9 @@ class DataFlowCall extends Expr {
344358 not exists ( this .getEnclosingFunction ( ) ) and result .asFileScope ( ) = this .getFile ( )
345359 }
346360
361+ /** Gets the location of this call. */
362+ Location getLocation ( ) { result = super .getLocation ( ) }
363+
347364 /** Gets a best-effort total ordering. */
348365 int totalorder ( ) {
349366 this =
0 commit comments