Clipi d007099422
[FileCheck] Fix --enable-var-scope for numvars after reassignment (#157158)
* When `--enable-var-scope` is active,
`lib/FileCheck.cpp#clearLocalVars` gets called.
* That function loops through `GlobalNumericVariableTable` and then
calls `NumericVariable::clear` on most items. It also removes them from
`GlobalNumericVariableTable`.
* When reassigning an already cleared variable, `Pattern::match` calls
`NumericVariable::setValue`, but it doesn't reinsert it into
`GlobalNumericVariableTable`. Therefore, the next time `clearLocalVars`
is called, it won't be able to loop through the variables.

Fix it by reinserting them in `GlobalNumericVariableTable` inside
`Pattern::match`.

Co-authored-by: Thomas Preud'homme <thomas.preudhomme@arm.com>
2025-09-09 22:28:01 +01:00
..