[all-commits] [llvm/llvm-project] 6c599b: [lldb] Let 'v' command directly access ivars of _a...
Dave Lee via All-commits
all-commits at lists.llvm.org
Wed Mar 8 11:20:02 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6c599b1e9b7e1b57952565468aed2de16af21082
https://github.com/llvm/llvm-project/commit/6c599b1e9b7e1b57952565468aed2de16af21082
Author: Dave Lee <davelee.com at gmail.com>
Date: 2023-03-08 (Wed, 08 Mar 2023)
Changed paths:
M lldb/include/lldb/Symbol/CompilerDeclContext.h
M lldb/include/lldb/Symbol/SymbolContext.h
M lldb/include/lldb/Symbol/TypeSystem.h
M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
M lldb/source/Symbol/CompilerDeclContext.cpp
M lldb/source/Symbol/SymbolContext.cpp
M lldb/source/Target/StackFrame.cpp
M lldb/test/API/commands/frame/var/direct-ivar/objc/Makefile
M lldb/test/API/commands/frame/var/direct-ivar/objc/TestFrameVarDirectIvarObjC.py
M lldb/test/API/commands/frame/var/direct-ivar/objc/main.m
Log Message:
-----------
[lldb] Let 'v' command directly access ivars of _any_ self/this
The `v` (`frame variable`) command can directly access ivars/fields of `this` or `self`.
Such as `v field`, instead of `v this->field`. This change relaxes the criteria for
finding `this`/`self` variables.
There are cases where a `this`/`self` variable does exist, but up to now the `v` command
has not made use of it. The user would have to explicitly run `v this->field` or
`self->_ivar` to access ivars. This change allows such cases to also work (without
explicitly dereferencing `this`/`self`).
A very common example in Objective-C (and Swift) is weakly capturing `self`:
```
__weak Type *weakSelf = self;
void (^block)(void) = ^{
Type *self = weakSelf; // Re-establish strong reference.
// `v _ivar` should work just as well as `v self->_ivar`.
};
```
In this case, `self` exists but `v` would not have used it. With this change, the fact
that a variable named `self` exists is enough for it to be used.
Differential Revision: https://reviews.llvm.org/D145276
More information about the All-commits
mailing list