[Lldb-commits] [lldb] [lldb][nfc] Factor out code checking if Variable is in scope (PR #143572)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 10 15:10:27 PDT 2025


================
@@ -321,6 +302,27 @@ bool Variable::IsInScope(StackFrame *frame) {
   return false;
 }
 
+bool Variable::IsInScope(Block &block, Address addr) {
----------------
JDevlieghere wrote:

A quick grep shows 223 instances of it being passed by const ref and the class itself seems to be taking other Addresses by const-ref too. There are definitely a bunch of instances of it being passed by value, but I would say "it's only slightly more expensive" isn't a strong argument unless there's a benefit to weigh that against such as needing a copy to modify or something. My final argument would be that if we ever do [address spaces](https://lists.llvm.org/pipermail/lldb-dev/2020-October/016517.html), the class will grow, which makes the case for the reference more compelling. 

https://github.com/llvm/llvm-project/pull/143572


More information about the lldb-commits mailing list