Changed paths:
M hilti/toolchain/src/compiler/cfg.cc
M tests/Baseline/hilti.cfg.switch/output
Log Message:
-----------
Properly model switch case condition reads.
For switch statements we synthesize a condition declaration and each
switch case we then perform equality checks. Previously we would only
store the case label in the CFG.
This patch fixes the implementation so we instead store the checks
against the condition variable. With that we properly model e.g., reads
of the condition variable which otherwise could appear unused.
Changed paths:
M hilti/toolchain/src/compiler/cfg.cc
M tests/Baseline/hilti.cfg.switch/output
Log Message:
-----------
Fix CFG modelling of switch cases with multiple labels.
Switch cases with multiple labels were previously stored as a chain of
expressions which roughly corresponds to an AND. This patch fixes the
implementation to instead model them as separate branches which
corresponds to an OR and is closer to their actual behavior.