mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
This frees `Class.qll`, `Exprs.qll`, and `Function.qll` from the clutches of points-to. For the somewhat complicated setup with `getLiteralObject` (an abstract method), I opted for a slightly ugly but workable solution of just defining a predicate on `ImmutableLiteral` that inlines each predicate body, special-cased to the specific instance to which it applies.
14 lines
348 B
Plaintext
14 lines
348 B
Plaintext
/* Test that there are no literals that do not have a corresponding object. */
|
|
import python
|
|
private import LegacyPointsTo
|
|
|
|
string repr(Expr e) {
|
|
result = e.(Num).getN() or
|
|
result = e.(Bytes).getS() or
|
|
result = e.(Unicode).getS()
|
|
}
|
|
|
|
from ImmutableLiteral l
|
|
where not exists(getLiteralObject(l))
|
|
select l.getLocation().getStartLine(), repr(l)
|