mirror of
https://github.com/github/codeql.git
synced 2026-04-27 09:45:15 +02:00
cache hasLocationInfo and Node::toString in the dataflow stage
This commit is contained in:
@@ -149,6 +149,7 @@ module DataFlow {
|
||||
* For more information, see
|
||||
* [Locations](https://help.semmle.com/QL/learn-ql/ql/locations.html).
|
||||
*/
|
||||
cached
|
||||
predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
@@ -171,6 +172,7 @@ module DataFlow {
|
||||
int getEndColumn() { hasLocationInfo(_, _, _, _, result) }
|
||||
|
||||
/** Gets a textual representation of this element. */
|
||||
cached
|
||||
string toString() { none() }
|
||||
|
||||
/**
|
||||
@@ -294,12 +296,13 @@ module DataFlow {
|
||||
override predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
Stages::DataFlowStage::ref() and
|
||||
astNode.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
|
||||
override File getFile() { result = astNode.getFile() }
|
||||
|
||||
override string toString() { result = astNode.toString() }
|
||||
override string toString() { Stages::DataFlowStage::ref() and result = astNode.toString() }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -126,6 +126,10 @@ module Stages {
|
||||
exists(any(Expr e).getExceptionTarget())
|
||||
or
|
||||
exists(DataFlow::ssaDefinitionNode(_))
|
||||
or
|
||||
any(DataFlow::Node node).hasLocationInfo(_, _, _, _, _)
|
||||
or
|
||||
exists(any(DataFlow::Node node).toString())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user