зеркало из https://github.com/github/codeql.git
Use RAExpr
This commit is contained in:
Родитель
e368b8f72a
Коммит
77871e287d
|
@ -1,5 +1,6 @@
|
||||||
private import ql
|
private import ql
|
||||||
private import codeql_ql.ast.internal.TreeSitter
|
private import codeql_ql.ast.internal.TreeSitter
|
||||||
|
private import experimental.RA
|
||||||
|
|
||||||
/** Gets a timestamp corresponding to the number of seconds since the date Semmle was founded. */
|
/** Gets a timestamp corresponding to the number of seconds since the date Semmle was founded. */
|
||||||
bindingset[d, h, m, s, ms]
|
bindingset[d, h, m, s, ms]
|
||||||
|
@ -78,6 +79,10 @@ private float getRanked(Array a, int i) {
|
||||||
result = rank[i + 1](int j, float f | f = a.getFloat(j) and f >= 0 | f order by j)
|
result = rank[i + 1](int j, float f | f = a.getFloat(j) and f >= 0 | f order by j)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string getRankedLine(Array a, int i) {
|
||||||
|
result = rank[i + 1](int j, string s | s = a.getString(j) and s != "" | s order by j)
|
||||||
|
}
|
||||||
|
|
||||||
module EvaluatorLog {
|
module EvaluatorLog {
|
||||||
class Entry extends Object { }
|
class Entry extends Object { }
|
||||||
|
|
||||||
|
@ -283,7 +288,9 @@ module KindPredicatesLog {
|
||||||
|
|
||||||
PipeLine() { this = ra.getArray(raReference) }
|
PipeLine() { this = ra.getArray(raReference) }
|
||||||
|
|
||||||
string getLineOfRA(int n) { result = this.getString(n) }
|
string getLineOfRA(int n) { result = getRankedLine(this, n) }
|
||||||
|
|
||||||
|
RAExpr getExpr(int n) { result.getPredicate() = this and result.getLine() = n }
|
||||||
}
|
}
|
||||||
|
|
||||||
class RA extends Object {
|
class RA extends Object {
|
||||||
|
@ -320,6 +327,12 @@ module KindPredicatesLog {
|
||||||
raLine = this.getPipeLine().getLineOfRA(pragma[only_bind_into](i))
|
raLine = this.getPipeLine().getLineOfRA(pragma[only_bind_into](i))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float getCountAndExpr(int i, RAExpr raExpr) {
|
||||||
|
result = this.getCount(i) and
|
||||||
|
raExpr.getPredicate() = this.getPipeLine() and
|
||||||
|
raExpr.getLine() = i
|
||||||
|
}
|
||||||
|
|
||||||
float getCount(int i) { result = getRanked(this.getArray("counts"), i) }
|
float getCount(int i) { result = getRanked(this.getArray("counts"), i) }
|
||||||
|
|
||||||
float getDuplicationPercentage(int i) {
|
float getDuplicationPercentage(int i) {
|
||||||
|
@ -376,4 +389,6 @@ module KindPredicatesLog {
|
||||||
class Extensional extends SummaryEvent {
|
class Extensional extends SummaryEvent {
|
||||||
Extensional() { evaluationStrategy = "EXTENSIONAL" }
|
Extensional() { evaluationStrategy = "EXTENSIONAL" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RAExpr = RAParser<PipeLine>::RAExpr;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче