labath wrote:

> Well, my logic was that it's better to return something than nothing, 

For a simple variable query, it might be okay since you kind of see the full 
name in the command output. However, for expressions like `a+b`, it's kind of 
important to know which `a`s and `b`s are you adding together. I think we 
should change that...


> similar to what current `frame var` does, it just outputs the first thing 
> that matches the base name, regardless of namespace. Should I make 
> `DILFindVariable` return a specific error message like "ambiguous name" or 
> something?

... but if the current implementation does the same thing, then I think it's 
good enough for now.

> I tried doing symbol_context.module_sp->GetSymbolFile()->FindGlobalVariables, 
> which in turn calls SymbolFileDWARF::FindGlobalVariables, but it searches 
> through the entire module, not just current CU. CompileUnit class has only 
> GetVariableList, no search. It looks like getting variable list there does 
> something different, but I really can't tell if it's any faster.

That might depend on the exact use case (number of CUs, number of variables per 
CU, how many times you're calling this, etc.). If you think it's necessary, we 
can talk about optimizing this, but I don't think we need to do that now.

https://github.com/llvm/llvm-project/pull/146094
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to