Dataflow: Add totalorder predicates to all languages.

This commit is contained in:
Anders Schack-Mulligen
2024-05-08 15:39:11 +02:00
parent 5a259843bb
commit 1432519cc2
8 changed files with 143 additions and 3 deletions

View File

@@ -310,6 +310,16 @@ class DataFlowCallable extends TDataFlowCallable {
this.asSummarizedCallable()
.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
}
/** Gets a best-effort total ordering. */
int totalorder() {
this =
rank[result](DataFlowCallable c, string file, int startline, int startcolumn |
c.hasLocationInfo(file, startline, startcolumn, _, _)
|
c order by file, startline, startcolumn
)
}
}
/** A function call relevant for data flow. */
@@ -333,6 +343,16 @@ class DataFlowCall extends Expr {
or
not exists(this.getEnclosingFunction()) and result.asFileScope() = this.getFile()
}
/** Gets a best-effort total ordering. */
int totalorder() {
this =
rank[result](DataFlowCall c, int startline, int startcolumn |
c.getLocation().hasLocationInfo(_, startline, startcolumn, _, _)
|
c order by startline, startcolumn
)
}
}
/** Holds if `e` is an expression that always has the same Boolean value `val`. */