Skip to content

Commit

Permalink
Renamed CDOCClass’s superClass property to superClassRef, for consist…
Browse files Browse the repository at this point in the history
…ency with CDOCCategory, and to avoid confusion with -superclass (all lowercase)
  • Loading branch information
aricha committed Jan 6, 2014
1 parent bc7d56f commit ddc7ec6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Source/CDClassFrameworkVisitor.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ - (void)willVisitClass:(CDOCClass *)aClass;
[self addClassName:aClass.name referencedInFramework:self.frameworkName];

// We only need to add superclasses for external classes - classes defined in this binary will be visited on their own
id superClass = [aClass superClass];
if ([superClass isKindOfClass:[CDSymbol class]]) {
[self addClassForExternalSymbol:superClass];
id superClassRef = [aClass superClassRef];
if ([superClassRef isKindOfClass:[CDSymbol class]]) {
[self addClassForExternalSymbol:superClassRef];
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/CDOCClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@interface CDOCClass : CDOCProtocol <CDTopologicalSort>

@property (strong) id superClass; // can be CDOCClass, CDSymbol (for external classes), or NSString (for ObjC1 class refs)
@property (strong) id superClassRef; // can be CDOCClass, CDSymbol (for external classes), or NSString (for ObjC1 class refs)
@property (strong, readonly) NSString *superClassName;
@property (strong) NSArray *instanceVariables;
@property (assign) BOOL isExported;
Expand Down
14 changes: 7 additions & 7 deletions Source/CDOCClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ - (NSString *)description;

- (NSString *)superClassName
{
if ([_superClass isKindOfClass:[CDOCClass class]]) {
return [(CDOCClass *)_superClass name];
} else if ([_superClass isKindOfClass:[CDSymbol class]]) {
NSString *name = [(CDSymbol *)_superClass name];
if ([_superClassRef isKindOfClass:[CDOCClass class]]) {
return [(CDOCClass *)_superClassRef name];
} else if ([_superClassRef isKindOfClass:[CDSymbol class]]) {
NSString *name = [(CDSymbol *)_superClassRef name];
return [CDSymbol classNameFromSymbolName:name];
} else if ([_superClass isKindOfClass:[NSString class]]) {
return _superClass;
} else if ([_superClassRef isKindOfClass:[NSString class]]) {
return _superClassRef;
} else {
if (_superClass) NSLog(@"unknown superclass instance %@", _superClass);
if (_superClassRef) NSLog(@"unknown superclass instance %@", _superClassRef);
return nil;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/CDObjectiveC1Processor.m
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ - (CDOCClass *)processClassDefinitionAtAddress:(uint32_t)address;
aClass.name = className;

// TODO: can we extract more than just the string from here?
aClass.superClass = [self.machOFile stringAtAddress:objcClass.super_class];
aClass.superClassRef = [self.machOFile stringAtAddress:objcClass.super_class];

// Process ivars
if (objcClass.ivars != 0) {
Expand Down
4 changes: 2 additions & 2 deletions Source/CDObjectiveC2Processor.m
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,13 @@ - (CDOCClass *)loadClassAtAddress:(uint64_t)address;
//NSLog(@"class: got external class name (1): %@", [aClass superClassName]);
} else if (objc2Class.superclass != 0) {
CDOCClass *sc = [self loadClassAtAddress:objc2Class.superclass];
aClass.superClass = sc;
aClass.superClassRef = sc;
}

if (superClassName) {
CDSymbol *superClassSymbol = [[self.machOFile symbolTable] symbolForExternalClassName:superClassName];
if (superClassSymbol)
aClass.superClass = superClassSymbol;
aClass.superClassRef = superClassSymbol;
}
}

Expand Down

0 comments on commit ddc7ec6

Please sign in to comment.