[Lldb-commits] [lldb] [lldb] Treat synthetic variables as always in scope (PR #204177)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 16 10:58:06 PDT 2026
================
@@ -840,10 +840,12 @@ def test_get_values(self):
self.assertTrue(variables.IsValid())
self.assertTrue(variables.GetValueAtIndex(0).name == "_handler_one")
- # FIXME: Synthetic variables are never in scope.
+ # Synthetic variables are always in scope.
variables = frame0.GetVariables(False, False, False, True)
----------------
jimingham wrote:
Something is not quite right here. Without synthetic variables, this invocation returns an empty list as it should.
The only True you are passing here is to the last argument to GetVariables: "in scope only". But that doesn't actually specify any variables to get. It just says, for instance "If Locals is true and the current context has a variable called `foo` that is shadowed by a variable `foo` in an outer scope, then should you return ONLY the `foo` that's currently visible, or should you return both.
But if all the actual search scope indicators are False, you shouldn't return anything. So it is odd that you are returning the synthetic ones here. If we aren't considering synthetic variables to be Locals, then we need a version of GetVariables that also has a `bool synthetics` variable as well. Or we could treat them as Locals, and print them when locals are requested?
The actual work in this patch seems right, which class the synthetic variables should print under is orthogonal to whether they can ever go out of scope. But the test seems wrong.
https://github.com/llvm/llvm-project/pull/204177
More information about the lldb-commits
mailing list