Previously, an entity would be discarded if it had any location in a changed
file. This caused issues for entities with multiple declaration entries, such
as extern variables declared in one file and defined in another.
For example, given:
// a.c (changed) // b.c (unchanged)
extern int x; int x;
The variable `x` should be preserved because it has a location in the
unchanged file b.c, even though it also has a location in the changed file a.c.
In hindsight, having a `.getMetrics()` method that just returns `this`
is somewhat weird. It's possible that it predates the existence of the
inline cast, however.
Gets rid of the `getMetrics` methods on the `Function`, `Class`, and
`Module` classes. To access the metrics, one must first import the
`LegacyPointsTo` module, and then either change the type to
`{Function,Class,Module}Metrics` or cast to the appropriate type.
This is needed because a PR to another repo is needed to update the
location of the consistency queries, and until that PR is merged we
don't want to runny dummy.ql as a consistency query. After that PR is
merged we should reinstate these files so that consistency tests are
run on this test folder.
Fixed 73 .ql query files where the @name metadata contained an ending period.
This ensures consistency with the CodeQL query metadata style guidelines.
`__has_feature` is not available in GCC versions before GCC 14.
Our frontend was exposing `__has_feature` when emulating earlier versions of
GCC. This will be fixed with the latest major frontend update though.
The `Builtins` module is deeply entwined with points-to, so it would be
nice to not have this dependence. Happily, the only thing we used
`Builtin` for was to get the names of known builtins, and for this we
already maintain such a set of names in
`dataflow.new.internal.Builtins`.
For whatever reason, the CFG node for exceptions and exception groups
was placed with the points-to code. (Probably because a lot of the
predicates depended on points-to.)
However, as it turned out, two of the SSA modules only depended on
non-points-to properties of these nodes, and so it was fairly
straightforward to remove the imports of `LegacyPointsTo` for those
modules.
In the process, I moved the aforementioned CFG node types into
`Flow.qll`, and changed the classes in the `Exceptions` module to the
`...WithPointsTo` form that we introduced elsewhere.
Turns out the `ImportTime` module (despite living in
`semmle.python.types` does not actually depend on points-to, so some of
the `LegacyPointsTo` imports could be replaced or removed.
Gets rid of a bunch of predicates relating to reachability (which
depended on the modelling of exceptions, which uses points-to), moving
them to `LegacyPointsTo`. In the process, we gained a new class
`BasicBlockWithPointsTo`.