зеркало из https://github.com/github/codeql.git
Shared: Some model generator re-factoring.
This commit is contained in:
Родитель
0cd4ccb790
Коммит
53c20ccaeb
|
@ -571,15 +571,7 @@ module MakeModelGenerator<
|
||||||
}
|
}
|
||||||
|
|
||||||
private string getContent(PropagateContentFlow::AccessPath ap, int i) {
|
private string getContent(PropagateContentFlow::AccessPath ap, int i) {
|
||||||
exists(DataFlow::ContentSet head, PropagateContentFlow::AccessPath tail |
|
result = "." + printContent(ap.getAtIndex(i))
|
||||||
head = ap.getHead() and
|
|
||||||
tail = ap.getTail()
|
|
||||||
|
|
|
||||||
i = 0 and
|
|
||||||
result = "." + printContent(head)
|
|
||||||
or
|
|
||||||
i > 0 and result = getContent(tail, i - 1)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -600,12 +592,7 @@ module MakeModelGenerator<
|
||||||
* Holds if the access path `ap` contains a field or synthetic field access.
|
* Holds if the access path `ap` contains a field or synthetic field access.
|
||||||
*/
|
*/
|
||||||
private predicate mentionsField(PropagateContentFlow::AccessPath ap) {
|
private predicate mentionsField(PropagateContentFlow::AccessPath ap) {
|
||||||
exists(DataFlow::ContentSet head, PropagateContentFlow::AccessPath tail |
|
isField(ap.getAtIndex(_))
|
||||||
head = ap.getHead() and
|
|
||||||
tail = ap.getTail()
|
|
||||||
|
|
|
||||||
mentionsField(tail) or isField(head)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private predicate apiFlow(
|
private predicate apiFlow(
|
||||||
|
@ -668,21 +655,19 @@ module MakeModelGenerator<
|
||||||
* Holds if any of the content sets in `path` translates into a synthetic field.
|
* Holds if any of the content sets in `path` translates into a synthetic field.
|
||||||
*/
|
*/
|
||||||
private predicate hasSyntheticContent(PropagateContentFlow::AccessPath path) {
|
private predicate hasSyntheticContent(PropagateContentFlow::AccessPath path) {
|
||||||
exists(PropagateContentFlow::AccessPath tail, DataFlow::ContentSet head |
|
exists(getSyntheticName(path.getAtIndex(_)))
|
||||||
head = path.getHead() and
|
}
|
||||||
tail = path.getTail()
|
|
||||||
|
|
private string getHashAtIndex(PropagateContentFlow::AccessPath ap, int i) {
|
||||||
exists(getSyntheticName(head)) or
|
result = getSyntheticName(ap.getAtIndex(i))
|
||||||
hasSyntheticContent(tail)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string getReversedHash(PropagateContentFlow::AccessPath ap) {
|
private string getReversedHash(PropagateContentFlow::AccessPath ap) {
|
||||||
result = concat(int i | | getSyntheticName(ap.getAtIndex(i)), "" order by i desc)
|
result = concat(int i | | getHashAtIndex(ap, i), "" order by i desc)
|
||||||
}
|
}
|
||||||
|
|
||||||
private string getHash(PropagateContentFlow::AccessPath ap) {
|
private string getHash(PropagateContentFlow::AccessPath ap) {
|
||||||
result = concat(int i | | getSyntheticName(ap.getAtIndex(i)), "" order by i)
|
result = concat(int i | | getHashAtIndex(ap, i), "" order by i)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Загрузка…
Ссылка в новой задаче