Commit Graph

4 Commits

Author SHA1 Message Date
Hamish Knight
ff145a261b [test] Couple of coverage test tweaks 2023-11-17 01:16:20 +00:00
Hamish Knight
d9f3047871 [Profiler] Fix DoCatchStmt coverage handling
The logic here previously worked by computing the
exit count by taking the parent count and
subtracting any control flow that jumped out of the
clauses. With `try` handling fixed, this no longer
works correctly, since a `try` shouldn't be
subtracted if the error is caught be one of the
catches, as that's not actually leaving the
statement. We could write the logic to determine
where a `try` is jumping to, but the logic here is
already pretty brittle, relying on being sprinkled
in various different places.

For now, let's take the more straightforward
approach and handle do-catches the same way we
handle switches, we initialize the exit counter to
0, and add on each exit count of each branch. This
lets us re-use the existing CaseStmt handling
logic. This doesn't necessarily produce the most
optimal counter expressions, but I want to replace
this all with a SILOptimizer pass anyway, which
will be able to much more easily compute optimal
counter expressions.

rdar://100470244
2023-11-16 17:28:57 +00:00
Hamish Knight
49ad980b86 [Profiler] Map regions for error-throwing AST nodes
Map a counter for the error branch of a given
potentially-throwing expression, and subtract it
from the following region count.

rdar://34244637
2023-11-16 17:28:57 +00:00
Hamish Knight
509a78102b [test] Rename a test file
And rename the functions in it
2023-11-16 17:28:57 +00:00