Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nygard/class-dump
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: mas-cli/class-dump
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 20 commits
  • 15 files changed
  • 5 contributors

Commits on Feb 24, 2015

  1. Comment out C++ destructors.

    These methods can't be compiled.
    Mehdi Mulani committed Feb 24, 2015
    Copy the full SHA
    8b99ad9 View commit details
  2. Comment out unknown block and pointer types.

    Even if we include these types in the compilation, they are too specific to be useful.
    Instead let's trust the consumer of these APIs to know what they're doing.
    Mehdi Mulani committed Feb 24, 2015
    Copy the full SHA
    846e246 View commit details
  3. Properly print setters for read-only properties.

    In the rare case of having a setting for a read-only property, we must ensure the setter has the correct type as its argument, otherwise the header will not compile.
    Mehdi Mulani committed Feb 24, 2015
    Copy the full SHA
    0ee6234 View commit details

Commits on Sep 27, 2015

  1. Copy the full SHA
    4a6925a View commit details

Commits on Nov 24, 2018

  1. Merge PR #59 from 'apjanke/add-gitignore'

    #59
    
    # Conflicts:
    #	class-dump.xcodeproj/xcuserdata/nygard.xcuserdatad/xcschemes/class-dump.xcscheme
    phatblat committed Nov 24, 2018
    Copy the full SHA
    63ba4c6 View commit details
  2. Merge PR #50 from 'mmmulani/master'

    phatblat committed Nov 24, 2018
    Copy the full SHA
    b25203d View commit details
  3. 🔖 Version 4.0

    phatblat committed Nov 24, 2018
    Copy the full SHA
    36a294f View commit details

Commits on Nov 25, 2018

  1. Copy the full SHA
    51d3f0d View commit details

Commits on Nov 28, 2018

  1. Copy the full SHA
    3e52084 View commit details
  2. Copy the full SHA
    1595147 View commit details
  3. Copy the full SHA
    762b453 View commit details
  4. Copy the full SHA
    ef2465e View commit details
  5. 🤝 Share class-dump scheme

    phatblat committed Nov 28, 2018
    Copy the full SHA
    c23394b View commit details
  6. Copy the full SHA
    8ecb18e View commit details

Commits on Apr 8, 2021

  1. Verified

    This commit was signed with the committer’s verified signature.
    chris-araman Chris Araman
    Copy the full SHA
    66a4251 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    chris-araman Chris Araman
    Copy the full SHA
    956fb3b View commit details
  3. Verified

    This commit was signed with the committer’s verified signature.
    chris-araman Chris Araman
    Copy the full SHA
    6225c51 View commit details
  4. Verified

    This commit was signed with the committer’s verified signature.
    chris-araman Chris Araman
    Copy the full SHA
    69e5ea9 View commit details
  5. Verified

    This commit was signed with the committer’s verified signature.
    chris-araman Chris Araman
    Copy the full SHA
    4523df7 View commit details

Commits on Apr 16, 2021

  1. Merge pull request #1 from chris-araman/master

    Build with Xcode 12.4
    phatblat authored Apr 16, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4354acc View commit details
155 changes: 155 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Based on http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
#########################

#####
# OS X temporary files that should never be committed
#
# c.f. http://www.westwind.com/reference/os-x/invisibles.html

.DS_Store

# c.f. http://www.westwind.com/reference/os-x/invisibles.html

.Trashes

# c.f. http://www.westwind.com/reference/os-x/invisibles.html

*.swp

#
# *.lock - this is used and abused by many editors for many different things.
# For the main ones I use (e.g. Eclipse), it should be excluded
# from source-control, but YMMV.
# (lock files are usually local-only file-synchronization on the local FS that should NOT go in git)
# c.f. the "OPTIONAL" section at bottom though, for tool-specific variations!
#
# In particular, if you're using CocoaPods, you'll want to comment-out this line:
*.lock



####
# Xcode temporary files that should never be committed
#
# NB: NIB/XIB files still exist even on Storyboard projects, so we want this...

*~.nib


####
# Xcode build files -
#
# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData"

DerivedData/

# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build"

build/


#####
# Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups)
#
# This is complicated:
#
# SOMETIMES you need to put this file in version control.
# Apple designed it poorly - if you use "custom executables", they are
# saved in this file.
# 99% of projects do NOT use those, so they do NOT want to version control this file.
# ..but if you're in the 1%, comment out the line "*.pbxuser"

# .pbxuser: http://lists.apple.com/archives/xcode-users/2004/Jan/msg00193.html

*.pbxuser

# .mode1v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html

*.mode1v3

# .mode2v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html

*.mode2v3

# .perspectivev3: http://stackoverflow.com/questions/5223297/xcode-projects-what-is-a-perspectivev3-file

*.perspectivev3

# NB: also, whitelist the default ones, some projects need to use these
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3


####
# Xcode 4 - semi-personal settings
#
# Apple Shared data that Apple put in the wrong folder
# c.f. http://stackoverflow.com/a/19260712/153422
# FROM ANSWER: Apple says "don't ignore it"
# FROM COMMENTS: Apple is wrong; Apple code is too buggy to trust; there are no known negative side-effects to ignoring Apple's unofficial advice and instead doing the thing that actively fixes bugs in Xcode
# Up to you, but ... current advice: ignore it.
*.xccheckout

#
#
# OPTION 1: ---------------------------------
# throw away ALL personal settings (including custom schemes!
# - unless they are "shared")
# As per build/ and DerivedData/, this ought to have a trailing slash
#
# NB: this is exclusive with OPTION 2 below
xcuserdata/

# OPTION 2: ---------------------------------
# get rid of ALL personal settings, but KEEP SOME OF THEM
# - NB: you must manually uncomment the bits you want to keep
#
# NB: this *requires* git v1.8.2 or above; you may need to upgrade to latest OS X,
# or manually install git over the top of the OS X version
# NB: this is exclusive with OPTION 1 above
#
#xcuserdata/**/*

# (requires option 2 above): Personal Schemes
#
#!xcuserdata/**/xcschemes/*

####
# XCode 4 workspaces - more detailed
#
# Workspaces are important! They are a core feature of Xcode - don't exclude them :)
#
# Workspace layout is quite spammy. For reference:
#
# /(root)/
# /(project-name).xcodeproj/
# project.pbxproj
# /project.xcworkspace/
# contents.xcworkspacedata
# /xcuserdata/
# /(your name)/xcuserdatad/
# UserInterfaceState.xcuserstate
# /xcshareddata/
# /xcschemes/
# (shared scheme name).xcscheme
# /xcuserdata/
# /(your name)/xcuserdatad/
# (private scheme).xcscheme
# xcschememanagement.plist
#
#

####
# Xcode 4 - Deprecated classes
#
# Allegedly, if you manually "deprecate" your classes, they get moved here.
#
# We're using source-control, so this is a "feature" that we do not want!

*.moved-aside
2 changes: 1 addition & 1 deletion Source/CDClassDump.h
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@

#import "CDFile.h" // For CDArch

#define CLASS_DUMP_BASE_VERSION "3.5 (64 bit)"
#define CLASS_DUMP_BASE_VERSION "4.0 (mas fork)"

#ifdef DEBUG
#define CLASS_DUMP_VERSION CLASS_DUMP_BASE_VERSION " (Debug version compiled " __DATE__ " " __TIME__ ")"
3 changes: 2 additions & 1 deletion Source/CDLCBuildVersion.m
Original file line number Diff line number Diff line change
@@ -15,10 +15,11 @@
case PLATFORM_TVOS: return @"tvOS";
case PLATFORM_WATCHOS: return @"watchOS";
case PLATFORM_BRIDGEOS: return @"bridgeOS";
case PLATFORM_IOSMAC: return @"iOS Mac";
case PLATFORM_MACCATALYST: return @"Mac Catalyst";
case PLATFORM_IOSSIMULATOR: return @"iOS Simulator";
case PLATFORM_TVOSSIMULATOR: return @"tvOS Simulator";
case PLATFORM_WATCHOSSIMULATOR: return @"watchOS Simulator";
case PLATFORM_DRIVERKIT: return @"DriverKit";
default: return [NSString stringWithFormat:@"Unknown platform %x", platform];
}
}
24 changes: 22 additions & 2 deletions Source/CDMultiFileVisitor.m
Original file line number Diff line number Diff line change
@@ -36,6 +36,8 @@ @interface CDMultiFileVisitor ()

@property (nonatomic, readonly) NSString *referenceString;

@property (nonatomic) NSString *currentFramework;

@end

#pragma mark -
@@ -85,6 +87,8 @@ - (void)willVisitClass:(CDOCClass *)aClass;
[self.resultString setString:@""];
[self.classDump appendHeaderToString:self.resultString];

self.currentFramework = [self frameworkForClassName:aClass.name];

[self removeAllClassNameProtocolNameReferences];
NSString *str = [self importStringForClassName:aClass.superClassName];
if (str != nil) {
@@ -94,6 +98,7 @@ - (void)willVisitClass:(CDOCClass *)aClass;

self.referenceLocation = [self.resultString length];

[self.resultString setString:@"#import <Foundation/NSObjCRuntime.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n"];
// And then generate the regular output
[super willVisitClass:aClass];

@@ -102,8 +107,11 @@ - (void)willVisitClass:(CDOCClass *)aClass;

- (void)didVisitClass:(CDOCClass *)aClass;
{
self.currentFramework = nil;

// Generate the regular output
[super didVisitClass:aClass];
[self.resultString appendString:@"NS_ASSUME_NONNULL_END\n\n"];

// Then insert the imports and write the file.
[self removeReferenceToClassName:aClass.name];
@@ -125,6 +133,8 @@ - (void)willVisitCategory:(CDOCCategory *)category;
[self.resultString setString:@""];
[self.classDump appendHeaderToString:self.resultString];

self.currentFramework = [self frameworkForClassName:category.name];

[self removeAllClassNameProtocolNameReferences];
NSString *str = [self importStringForClassName:category.className];
if (str != nil) {
@@ -133,6 +143,7 @@ - (void)willVisitCategory:(CDOCCategory *)category;
}
self.referenceLocation = [self.resultString length];

[self.resultString appendString:@"#import <Foundation/NSObjCRuntime.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n"];
// And then generate the regular output
[super willVisitCategory:category];

@@ -141,8 +152,11 @@ - (void)willVisitCategory:(CDOCCategory *)category;

- (void)didVisitCategory:(CDOCCategory *)category;
{
self.currentFramework = nil;

// Generate the regular output
[super didVisitCategory:category];
[self.resultString appendString:@"NS_ASSUME_NONNULL_END\n\n"];

// Then insert the imports and write the file.
[self removeReferenceToClassName:category.className];
@@ -162,9 +176,12 @@ - (void)willVisitProtocol:(CDOCProtocol *)protocol;
[self.resultString setString:@""];
[self.classDump appendHeaderToString:self.resultString];

self.currentFramework = [self frameworkForClassName:protocol.name];

[self removeAllClassNameProtocolNameReferences];
self.referenceLocation = [self.resultString length];

[self.resultString appendString:@"#import <Foundation/NSObjCRuntime.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n"];
// And then generate the regular output
[super willVisitProtocol:protocol];

@@ -173,8 +190,11 @@ - (void)willVisitProtocol:(CDOCProtocol *)protocol;

- (void)didVisitProtocol:(CDOCProtocol *)protocol;
{
self.currentFramework = nil;

// Generate the regular output
[super didVisitProtocol:protocol];
[self.resultString appendString:@"NS_ASSUME_NONNULL_END\n\n"];

// Then insert the imports and write the file.
NSString *referenceString = self.referenceString;
@@ -223,7 +243,7 @@ - (NSString *)importStringForClassName:(NSString *)name;
{
if (name != nil) {
NSString *framework = [self frameworkForClassName:name];
if (framework == nil)
if (framework == nil || [framework isEqualToString:self.currentFramework])
return [NSString stringWithFormat:@"#import \"%@.h\"\n", name];
else
return [NSString stringWithFormat:@"#import <%@/%@.h>\n", framework, name];
@@ -237,7 +257,7 @@ - (NSString *)importStringForProtocolName:(NSString *)name;
if (name != nil) {
NSString *framework = [self frameworkForProtocolName:name];
NSString *headerName = [name stringByAppendingString:@"-Protocol.h"];
if (framework == nil)
if (framework == nil || [framework isEqualToString:self.currentFramework])
return [NSString stringWithFormat:@"#import \"%@\"\n", headerName];
else
return [NSString stringWithFormat:@"#import <%@/%@>\n", framework, headerName];
11 changes: 10 additions & 1 deletion Source/CDTextClassDumpVisitor.m
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
#import "CDTextClassDumpVisitor.h"

#import "CDClassDump.h"
#import "CDType.h"
#import "CDOCClass.h"
#import "CDOCCategory.h"
#import "CDOCMethod.h"
@@ -122,8 +123,16 @@ - (void)visitClassMethod:(CDOCMethod *)method;
- (void)visitInstanceMethod:(CDOCMethod *)method propertyState:(CDVisitorPropertyState *)propertyState;
{
CDOCProperty *property = [propertyState propertyForAccessor:method.name];
if (property == nil) {
if (property.isReadOnly && [property.setter isEqualToString:method.name]) {
[self.resultString appendFormat:@"- (void)%@(%@)arg1;\n", method.name, [property.type formattedString:nil formatter:self.classDump.typeController.propertyTypeFormatter level:0]];
} else if (property == nil) {
//NSLog(@"No property for method: %@", method.name);
// C++ destructors can't be called and this header can't be compiled with one declared. So let's comment it out.
// Leave it there so the user knows that the class has a C++ implementation though.
if ([method.name isEqualToString:@".cxx_destruct"]) {
[self.resultString appendString:@"// "];
}

[self.resultString appendString:@"- "];
[method appendToString:self.resultString typeController:self.classDump.typeController];
[self.resultString appendString:@"\n"];
17 changes: 9 additions & 8 deletions Source/CDType.m
Original file line number Diff line number Diff line change
@@ -433,20 +433,21 @@ - (NSString *)formattedString:(NSString *)previousName formatter:(CDTypeFormatte
break;

case T_FUNCTION_POINTER_TYPE:
if (currentName == nil)
result = @"CDUnknownFunctionPointerType";
else
result = [NSString stringWithFormat:@"CDUnknownFunctionPointerType %@", currentName];
result = @"void * /* CDUnknownFunctionPointerType */";
if (currentName != nil) {
result = [result stringByAppendingFormat:@" %@", currentName];
}

break;

case T_BLOCK_TYPE:
if (self.types) {
result = [self blockSignatureString];
} else {
if (currentName == nil)
result = @"CDUnknownBlockType";
else
result = [NSString stringWithFormat:@"CDUnknownBlockType %@", currentName];
result = @"id /* CDUnknownBlockType */";
if (currentName != nil) {
result = [result stringByAppendingFormat:@" %@", currentName];
}
}
break;

2 changes: 1 addition & 1 deletion Source/CDVisitorPropertyState.m
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ - (id)initWithProperties:(NSArray *)properties;
//NSLog(@"property: %@, getter: %@, setter: %@", [property name], [property getter], [property setter]);
_propertiesByName[property.name] = property;
_propertiesByAccessor[property.getter] = property;
if (property.isReadOnly == NO)
if (property.isReadOnly == NO || property.setter)
_propertiesByAccessor[property.setter] = property;
}
}
Loading