[DebugInfo] Keep validating after register and entry-value ops (#214057)
isValid returned as soon as it saw a compact DW_OP_regN or DW_OP_bregN
operation, or a valid DW_OP_LLVM_entry_value. Operations after that
point skipped the remaining checks.
Let's keep walking the expression. DW_OP_regx and DW_OP_bregx already
leave the switch and continue validating the expression, so this makes
the compact forms validate their suffixes too. Entry-value suffixes are
also intentional here.
This adds no register-specific suffix rule. DWARF 5 requires a register
location to stand alone as an entire object or piece, while accepted
DWARF issue 230524.1 permits a register location followed by a
dereference in DWARF 6. Since isValid() does not know the emitted DWARF
version, we keep it limited to applying its existing checks to the
suffix.
Test each early-return path with a different invalid suffix: a stack
value followed by a dereference, a DW_OP_LLVM_arg without its index, and
a second entry value later in the expression. Also keep DW_OP_reg0
followed by DW_OP_deref valid. isValid has no dwarf version checking and
DWARF 6 permits that form; this does not claim it is valid DWARF 5
output.
Tested with make check.
Assisted by AI.