mirror of
https://github.com/github/codeql.git
synced 2026-01-29 14:23:03 +01:00
Speed up unresolvedReference.
This commit is contained in:
@@ -42,14 +42,22 @@ class SsaSourceVariable extends LocalVariable {
|
||||
*/
|
||||
private predicate unresolvedReference(string name, FuncDef fn) {
|
||||
exists(Ident unresolved |
|
||||
unresolved.getName() = name and
|
||||
unresolved instanceof ReferenceExpr and
|
||||
unresolvedIdentifier(unresolved, name) and
|
||||
not unresolved = any(SelectorExpr sel).getSelector() and
|
||||
not unresolved.refersTo(_) and
|
||||
fn = unresolved.getEnclosingFunction()
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `id` is an unresolved identifier with the given `name`.
|
||||
*/
|
||||
pragma[noinline]
|
||||
private predicate unresolvedIdentifier(Ident id, string name) {
|
||||
id.getName() = name and
|
||||
id instanceof ReferenceExpr and
|
||||
not id.refersTo(_)
|
||||
}
|
||||
|
||||
/**
|
||||
* An SSA variable.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user