1#include <objc/NSObject.h>
2
3@interface Classic : NSObject {
4@public
5 int _ivar;
6}
7@end
8
9@implementation Classic
10- (void)fun {
11 // check self
12}
13
14- (void)run {
15 __weak Classic *weakSelf = self;
16 ^{
17 Classic *self = weakSelf;
18 // check idiomatic self
19
20 // Use `self` to extend its lifetime (for lldb to inspect the variable).
21 [self copy];
22 }();
23}
24@end
25
26int main() {
27 Classic *c = [Classic new];
28 c->_ivar = 30;
29 [c fun];
30 [c run];
31}
32

source code of lldb/test/API/commands/frame/var/direct-ivar/objc/main.m