Skip to content

Commit 307c9d3

Browse files
committed
Updates
1 parent 13e2f82 commit 307c9d3

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

ClassDumpRuntime/Models/CDGenerationOptions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ NS_REFINED_FOR_SWIFT
5353

5454
@property (nonatomic) BOOL addIvarOffsetComments;
5555

56+
@property (nonatomic) BOOL expandIvarRecordTypeMembers;
57+
5658
@end
5759

5860
NS_HEADER_AUDIT_END(nullability)

ClassDumpRuntime/Models/CDGenerationOptions.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ - (id)copyWithZone:(NSZone *)zone {
2020
options.stripDtorMethod = _stripDtorMethod;
2121
options.addSymbolImageComments = _addSymbolImageComments;
2222
options.addIvarOffsetComments = _addIvarOffsetComments;
23+
options.expandIvarRecordTypeMembers = _expandIvarRecordTypeMembers;
2324
return options;
2425
}
2526

ClassDumpRuntime/Models/Reflections/CDClassModel.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ - (CDSemanticString *)semanticLinesWithOptions:(CDGenerationOptions *)options {
256256
[build appendString:@"\n" semanticType:CDSemanticTypeStandard];
257257
}
258258
[build appendString:@" " semanticType:CDSemanticTypeStandard];
259-
[build appendSemanticString:[ivar semanticString]];
259+
[build appendSemanticString:[ivar semanticStringWithOptions:options]];
260260
[build appendString:@";" semanticType:CDSemanticTypeStandard];
261261
if (options.addIvarOffsetComments) {
262262
[build appendString:[NSString stringWithFormat:@" // offset: %"PRIdPTR"", ivar.offset] semanticType:CDSemanticTypeComment];

ClassDumpRuntime/Models/Reflections/CDIvarModel.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#import <objc/runtime.h>
1111

1212
#import <ClassDumpRuntime/CDParseType.h>
13-
13+
#import <ClassDumpRuntime/CDGenerationOptions.h>
1414
NS_HEADER_AUDIT_BEGIN(nullability)
1515

1616
@interface CDIvarModel : NSObject
@@ -26,7 +26,7 @@ NS_HEADER_AUDIT_BEGIN(nullability)
2626
- (instancetype)initWithIvar:(Ivar)ivar;
2727
+ (instancetype)modelWithIvar:(Ivar)ivar;
2828

29-
- (CDSemanticString *)semanticString;
29+
- (CDSemanticString *)semanticStringWithOptions:(CDGenerationOptions *)options;
3030

3131
@end
3232

ClassDumpRuntime/Models/Reflections/CDIvarModel.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ - (instancetype)initWithIvar:(Ivar)ivar {
2121
_name = @(ivar_getName(ivar));
2222
_type = [CDTypeParser typeForEncoding:(ivar_getTypeEncoding(ivar) ?: "")];
2323
_offset = ivar_getOffset(ivar);
24-
if ([_type isKindOfClass:[CDRecordType class]]) {
25-
CDRecordType *recordType = (CDRecordType *)_type;
26-
recordType.indentLevel = 1;
27-
recordType.expand = YES;
28-
}
2924
}
3025
return self;
3126
}
3227

33-
- (CDSemanticString *)semanticString {
28+
- (CDSemanticString *)semanticStringWithOptions:(CDGenerationOptions *)options {
29+
if ([self.type isKindOfClass:[CDRecordType class]] && options.expandIvarRecordTypeMembers) {
30+
CDRecordType *recordType = (CDRecordType *)self.type;
31+
recordType.indentLevel = 1;
32+
recordType.expand = YES;
33+
}
3434
return [self.type semanticStringForVariableName:self.name];
3535
}
3636

ClassDumpRuntime/Models/Reflections/CDPropertyModel.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ - (instancetype)initWithProperty:(objc_property_t)property isClass:(BOOL)isClass
101101
attributeName = @"copy";
102102
break;
103103
case '&':
104-
attributeName = @"retain";
104+
attributeName = @"strong";
105105
break;
106106
case 'D':
107107
isDynamic = YES;

0 commit comments

Comments
 (0)