[Lldb-commits] [lldb] [lldb][nfc] Factor out code checking if Variable is in scope (PR #143572)
Felipe de Azevedo Piovezan via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 10 15:25:03 PDT 2025
================
@@ -321,6 +302,27 @@ bool Variable::IsInScope(StackFrame *frame) {
return false;
}
+bool Variable::IsInScope(Block &block, Address addr) {
----------------
felipepiovezan wrote:
That's an interesting, given the current usage it makes sense to switch this to const reference.
Future changes aside, it's still worth pointing out that "by value" by default is usually the correct choice. An API that prescribes passing something by reference is also saying "it's a bad idea to copy this object", a warning to users of the API. Here, there is no such warning, so it is an API that makes a developer pause for nothing -- the warnings are usually "it's expensive", "you can't copy because of ownership semantics".
https://github.com/llvm/llvm-project/pull/143572
More information about the lldb-commits
mailing list