Fixed the implementation of "bool Block::Contains (const Block *block) const"
to return the correct result.
Fixed "bool Variable::IsInScope (StackFrame *frame)" to return the correct
result when there are no location lists.
Modified the "frame variable" command such that:
- if no arguments are given (dump all frame variables), then we only show
variables that are currently in scope
- if some arguments are given, we show an error if the variable is out of
scope
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113830 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Symbol/Block.cpp b/source/Symbol/Block.cpp
index a6e7f8f..8ad775f 100644
--- a/source/Symbol/Block.cpp
+++ b/source/Symbol/Block.cpp
@@ -239,17 +239,17 @@
bool
Block::Contains (const Block *block) const
{
- // Block objects can't contain themselves...
if (this == block)
- return false;
+ return false; // This block doesn't contain itself...
+ // Walk the parent chain for "block" and see if any if them match this block
const Block *block_parent;
for (block_parent = block->GetParent();
block_parent != NULL;
block_parent = block_parent->GetParent())
{
- if (block_parent == block)
- return true;
+ if (this == block_parent)
+ return true; // One of the parents of "block" is this object!
}
return false;
}