Fill in more test sequences for Python API SBFrame.LookupVarInScope(name, scope).
Change SBFrame::LookupVarInScope() to also work with "global" scope in addition
to "local" and "parameter" scope.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@119811 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp
index 238464e..58faed6 100644
--- a/source/API/SBFrame.cpp
+++ b/source/API/SBFrame.cpp
@@ -350,26 +350,25 @@
if (var_scope != eValueTypeInvalid)
{
- lldb_private::VariableList variable_list;
- SBSymbolContext sc = GetSymbolContext (eSymbolContextEverything);
-
- SBBlock block = sc.GetBlock();
- if (block.IsValid())
- block.AppendVariables (true, true, &variable_list);
-
- const uint32_t num_variables = variable_list.GetSize();
-
- bool found = false;
- for (uint32_t i = 0; i < num_variables && !found; ++i)
+ lldb_private::VariableList *variable_list = m_opaque_sp->GetVariableList(true);
+ if (variable_list)
{
- var_sp = variable_list.GetVariableAtIndex(i);
- if (var_sp
- && (var_sp.get()->GetName() == lldb_private::ConstString(var_name))
- && var_sp.get()->GetScope() == var_scope)
- found = true;
+ const uint32_t num_variables = variable_list->GetSize();
+ bool found = false;
+ for (uint32_t i = 0; i < num_variables && !found; ++i)
+ {
+ var_sp = variable_list->GetVariableAtIndex(i);
+ if (var_sp
+ && (var_sp.get()->GetName() == lldb_private::ConstString(var_name))
+ && var_sp.get()->GetScope() == var_scope)
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ var_sp.reset();
}
- if (!found)
- var_sp.reset();
}
}