You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[src][sourcepath] remove .pp extension from sourcepath
Rather than removing the `.pp` extension in `Utils.unit`, it is directly
removed from the sourcepaths read in `.cmt` files. This way,
compilation units remain consistent; and file paths read in locations
are now also consistent with the sourcepaths. More details on why this
fixes the observed FN and FP below.
With this change, I measured a gain of ~10s (from ~22s to ~12s) when
running the analyzer with `-v --all` on
[Frama-C 31.0](https://git.frama-c.com/pub/frama-c/-/tree/31.0?ref_type=tags)
on my machine. This is coherent with the few computations of the cmts'
sourcepaths (once per `.cmt` read) vs the amount of time the compilation
unit is computed (on every potentially meaningful location).
As mentionned in f090928, there was a difference between the compilation
unit of a preprocessed file and the one of an unpreprocessed file.
Forcing them to have the same compilation unit by removing the `.pp`
extension is sufficient in most cases.
However, in the case of optional arguments, some computations relied on
finding whether a location belongs to the current or a previously
analyzed sourcefile, or if it belongs to an unknown (potentially
analyzed later) sourcefile. In particular, `VdNode.eof` relies on this
to discard "internal" locations and, thus, dissociate them from their
corresponding "external" locations.
This property is checked in `DeadCommon.VdNode.seen` by verifying if the
location has a corresponding sourcepath in the `DeadCommon.abspath`
table. This table associates compilation units (as obtained by
`Utils.unit`) with sourcepaths (read in the `.cmi` and `.cmt` files) and
is filled when starting the analysis of either a `.cmi` or a `.cmt`.
Verifying that a location belongs to a known file is done by checking if
its filename is a suffix of one of the sourcepaths associated with its
compilation unit.
The sourcepath of a `.cmt` file may end with `.pp.ml`, while locaitons
found in the typedtree will not contain the `.pp` part. Therefore, the
inconsistency observed in f090928 still remains for sourcepaths. Because
of this inconsistency, the internal and external locations are not
dissociated at the end of the analysis of a `.cmt`, leading to the
observed FN and FP.
0 commit comments