Skip to main content

Module pass_scope

Module pass_scope 

Source
Expand description

Thread-local identity of the currently-running analysis pass.

The pipeline driver brackets every pass invocation in a PassScope guard. While the guard is alive, current_pass names the pass, so the assumption API (Context::assume_true and friends), the pass_log! macro, and the stat! counters attribute their records to the right pass without any plumbing through call signatures — free helper functions get the attribution too.

Outside any scope, current_pass reports "?" so stray records remain visible (and greppable) rather than silently unattributed.

Structs§

PassScope
RAII guard naming the current pass; restores the previous name on drop, so scopes nest (a driver phase can wrap individual passes).

Constants§

UNATTRIBUTED
The name reported outside any PassScope.

Functions§

absorb_stats
Fold entries (as produced by drain_stats) back into this thread’s counters. The parallel function-pass driver drains each worker thread’s counters before the thread exits (thread-local state would otherwise be lost) and re-absorbs them on the master thread, so the per-round statistics table is identical to a sequential run.
current_pass
The name of the pass currently running on this thread (or UNATTRIBUTED).
drain_stats
Drain all counters accumulated on this thread since the last drain, as ((pass, key), total) in sorted order. The pipeline driver calls this once per round to log a statistics table.
enter
Enter a pass scope. Hold the returned guard for the duration of the pass.
record_stat
Add n to the counter key of the current pass. Prefer the stat! macro.