Skip to content

Some new features and improvements #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
.swiftpm

This file was deleted.

37 changes: 0 additions & 37 deletions ClassDump/ClassDump.h

This file was deleted.

13 changes: 0 additions & 13 deletions ClassDump/Models/CDGenerationOptions.m

This file was deleted.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1540"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
Expand All @@ -15,9 +16,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FA2A00DB23ADD19D00B52F1D"
BuildableName = "ClassDump.framework"
BlueprintName = "ClassDump"
ReferencedContainer = "container:ClassDump.xcodeproj">
BuildableName = "ClassDumpRuntime.framework"
BlueprintName = "ClassDumpRuntime"
ReferencedContainer = "container:ClassDumpRuntime.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
Expand All @@ -26,13 +27,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:ClassDump/ClassDump.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -55,14 +51,14 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FA2A00DB23ADD19D00B52F1D"
BuildableName = "ClassDump.framework"
BlueprintName = "ClassDump"
ReferencedContainer = "container:ClassDump.xcodeproj">
BuildableName = "ClassDumpRuntime.framework"
BlueprintName = "ClassDumpRuntime"
ReferencedContainer = "container:ClassDumpRuntime.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Release">
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
version = "1.3">
LastUpgradeVersion = "1540"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
enableAddressSanitizer = "YES"
enableASanStackUseAfterReturn = "YES"
enableUBSanitizer = "YES"
codeCoverageEnabled = "YES">
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES"
testExecutionOrdering = "random">
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FA2A011823AEB15700B52F1D"
BuildableName = "ClassDumpTests.xctest"
BlueprintName = "ClassDumpTests"
ReferencedContainer = "container:ClassDump.xcodeproj">
BuildableName = "ClassDumpRuntimeTests.xctest"
BlueprintName = "ClassDumpRuntimeTests"
ReferencedContainer = "container:ClassDumpRuntime.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
Expand Down
37 changes: 37 additions & 0 deletions ClassDumpRuntime/ClassDumpRuntime.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// ClassDumpRuntime.h
// ClassDumpRuntime
//
// Created by Leptos on 3/24/19.
// Copyright © 2019 Leptos. All rights reserved.
//

// to support building as both an Xcode framework and a Swift Package,
// all headers that are marked as "public" for the Xcode framework
// should have a symlink in `Sources/ClassDumpRuntime/include/ClassDumpRuntime`;
// all those files should then be imported below.
//
// you can generate these imports using a shell script such as
// `ls ClassDumpRuntime/*.h | while read HEADER; do printf "#import <${HEADER}>\n"; done`
// (run from `Sources/ClassDumpRuntime/include`)

#import <ClassDumpRuntime/CDArrayType.h>
#import <ClassDumpRuntime/CDBitFieldType.h>
#import <ClassDumpRuntime/CDBlockType.h>
#import <ClassDumpRuntime/CDClassModel.h>
#import <ClassDumpRuntime/CDGenerationOptions.h>
#import <ClassDumpRuntime/CDIvarModel.h>
#import <ClassDumpRuntime/CDMethodModel.h>
#import <ClassDumpRuntime/CDObjectType.h>
#import <ClassDumpRuntime/CDParseType.h>
#import <ClassDumpRuntime/CDPointerType.h>
#import <ClassDumpRuntime/CDPrimitiveType.h>
#import <ClassDumpRuntime/CDPropertyAttribute.h>
#import <ClassDumpRuntime/CDPropertyModel.h>
#import <ClassDumpRuntime/CDProtocolModel+Conformance.h>
#import <ClassDumpRuntime/CDProtocolModel.h>
#import <ClassDumpRuntime/CDRecordType.h>
#import <ClassDumpRuntime/CDSemanticString.h>
#import <ClassDumpRuntime/CDTypeParser.h>
#import <ClassDumpRuntime/CDUtilities.h>
#import <ClassDumpRuntime/CDVariableModel.h>
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"testTargets" : [
{
"target" : {
"containerPath" : "container:ClassDump.xcodeproj",
"containerPath" : "container:ClassDumpRuntime.xcodeproj",
"identifier" : "FA2A011823AEB15700B52F1D",
"name" : "ClassDumpTests"
"name" : "ClassDumpRuntimeTests"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
//
// CDGenerationOptions.h
// ClassDump
// ClassDumpRuntime
//
// Created by Leptos on 2/25/24.
// Copyright © 2024 Leptos. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_HEADER_AUDIT_BEGIN(nullability)
/// Options with which a header file may be generated with
@interface CDGenerationOptions : NSObject
NS_REFINED_FOR_SWIFT
@interface CDGenerationOptions : NSObject <NSCopying>
/// @c YES means hide properties and methods that are required by a protocol the type conforms to
///
/// This property applies to both classes and protocols.
Expand Down Expand Up @@ -49,4 +51,10 @@
/// This property applies to both classes and protocols.
@property (nonatomic) BOOL addSymbolImageComments;

@property (nonatomic) BOOL addIvarOffsetComments;

@property (nonatomic) BOOL expandIvarRecordTypeMembers;

@end

NS_HEADER_AUDIT_END(nullability)
27 changes: 27 additions & 0 deletions ClassDumpRuntime/Models/CDGenerationOptions.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// CDGenerationOptions.m
// ClassDumpRuntime
//
// Created by Leptos on 2/25/24.
// Copyright © 2024 Leptos. All rights reserved.
//

#import "CDGenerationOptions.h"

@implementation CDGenerationOptions

- (id)copyWithZone:(NSZone *)zone {
CDGenerationOptions *options = [CDGenerationOptions new];
options.stripProtocolConformance = _stripProtocolConformance;
options.stripOverrides = _stripOverrides;
options.stripDuplicates = _stripDuplicates;
options.stripSynthesized = _stripSynthesized;
options.stripCtorMethod = _stripCtorMethod;
options.stripDtorMethod = _stripDtorMethod;
options.addSymbolImageComments = _addSymbolImageComments;
options.addIvarOffsetComments = _addIvarOffsetComments;
options.expandIvarRecordTypeMembers = _expandIvarRecordTypeMembers;
return options;
}

@end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// CDSemanticString.h
// ClassDump
// ClassDumpRuntime
//
// Created by Leptos on 1/1/23.
// Copyright © 2023 Leptos. All rights reserved.
Expand All @@ -27,33 +27,40 @@ typedef NS_ENUM(NSUInteger, CDSemanticType) {
CDSemanticTypeProtocol,
// a number literal (e.g. 2, 18, 1e5, 7.1)
CDSemanticTypeNumeric,

// an Obj-C method (e.g. initWithFrame)
CDSemanticTypeMethod,
// an Obj-C method argument (e.g. a0, a1, a2)
CDSemanticTypeMethodArgument,
/// The number of valid cases there are in @c CDSemanticType
CDSemanticTypeCount
};

NS_HEADER_AUDIT_BEGIN(nullability)

/// A string composed of substrings that may have different semantic meanings
@interface CDSemanticString : NSObject
@interface CDSemanticString : NSObject <NSSecureCoding>
/// The length of the string
@property (readonly) NSUInteger length;
/// Append another semantic string to the end of this string,
/// keeping all of the semantics of both the parameter and receiver
- (void)appendSemanticString:(nonnull CDSemanticString *)semanticString;
- (void)appendSemanticString:(CDSemanticString *)semanticString;
/// Append a string with a semantic type to the end of this string
- (void)appendString:(nullable NSString *)string semanticType:(CDSemanticType)type;
/// Whether the first character in this string is equal to @c character
- (BOOL)startsWithChar:(char)character;
/// Whether the last character in this string is equal to @c character
- (BOOL)endWithChar:(char)character;
/// Enumerate the substrings and the associated semantic type that compose this string
- (void)enumerateTypesUsingBlock:(void (NS_NOESCAPE ^_Nonnull)(NSString *_Nonnull string, CDSemanticType type))block;
- (void)enumerateTypesUsingBlock:(void (NS_NOESCAPE ^)(NSString *string, CDSemanticType type))block;
/// Enumerate the longest effective substrings and the associated semantic type that compose this string
///
/// Each invocation of @c block will have the longest substring of @c type such that the next
/// invocation will have a different @c type
- (void)enumerateLongestEffectiveRangesUsingBlock:(void (NS_NOESCAPE ^_Nonnull)(NSString *_Nonnull string, CDSemanticType type))block;
- (void)enumerateLongestEffectiveRangesUsingBlock:(void (NS_NOESCAPE ^)(NSString *string, CDSemanticType type))block;

/// The string representation without semantics
- (nonnull NSString *)string;
- (NSString *)string;

@end

NS_HEADER_AUDIT_END(nullability)
Loading