PR24953 Fix: check for existence of value symbol
In commit
724b7014a, the code assumed that the foreach loop
structure always had a valid value symbol. However, this is
not true. Consider the following examples:
foreach loop (k in arr) ...
foreach loop (v = k in arr) ...
In the former case, the loop is only iterating over the keys
whereas in the latter case, both the key and value are being
iterated over. Consequently, the former loop will have a
nullptr value symbol.
This patch provides a fix by checking for the existence of a
value symbol and generating the BPF instructions accordingly.