Skip to content

Conversation

@Mx-Iris
Copy link
Member

@Mx-Iris Mx-Iris commented Jun 22, 2025

  • Optimized the search method for Protocol requirements, now most requirement symbols should be found.

  • Changed the parsing method of types in swift-section from remaining to upToNextOption.

  • Switched swift-tools-version to 6.1.

  • Fixed the issue of type parsing errors after enabling synthesizeSugarTypes demangleOptions.

@Mx-Iris Mx-Iris requested a review from Copilot June 22, 2025 09:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR, version 0.5.0, improves protocol requirement search performance, refactors type parsing in Swift sections, updates the swift-tools-version, and tweaks demangle options for better type presentation. Key changes include:

  • Changing the semantic type property in FunctionDeclaration to use the more granular .function(.declaration).
  • Refactoring MachO-related extensions and cache handling for clarity and type safety.
  • Updating Package.swift to support newer platforms and swift-tools-version 6.1.

Reviewed Changes

Copilot reviewed 20 out of 50 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Sources/Semantic/Components/FunctionDeclaration.swift Updated semantic type for function declarations.
Sources/MachOTestingSupport/MachOFileName.swift Renamed and augmented enum cases for clarity of file source identification.
Sources/MachOTestingSupport/Extensions.swift Added an extension on String defining a 'print' method using package visibility.
Sources/MachOTestingSupport/DumpableTest.swift Introduced several async dump methods for protocol and type descriptors.
Sources/MachOTestingSupport/DemangleOptions.swift Defined a new 'test' demangle options configuration.
Sources/MachOSwiftSection/... (multiple files) Refactored section lookup and descriptor reading for consistency.
Sources/MachOPointer/Symbol/MachOSymbolCache.swift Adjusted symbol caching API to pass context explicitly.
Sources/Demangle/Main/NodePrinter.swift Updated printing calls to use the new semantic types and added weak-prefix support.
Sources/Demangle/Main/DemangleOptions.swift Removed deprecated prefix option and introduced a new removeWeakPrefix option.
Package.swift Advanced swift-tools-version and added platform support along with dependency tweaks.
Comments suppressed due to low confidence (1)

Sources/MachOTestingSupport/Extensions.swift:28

  • The method 'print' defined in the String extension may shadow Swift's global print function; consider renaming it to avoid potential confusion.
    package func print() {

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @Mx-Iris, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant version bump for the project, aligning it with a newer Swift toolchain and broadening its compatibility across Apple platforms. A core focus of these changes is to enhance the accuracy and detail of Swift metadata parsing and demangling, particularly for protocols and types, by refining internal data handling and introducing more granular semantic representations. The changes also include various refactorings and new testing infrastructure to support these improvements.

Highlights

  • Swift Toolchain & Platform Support: The project's swift-tools-version has been upgraded from 5.10 to 6.1, and platform support has been significantly expanded to include iOS (v13), tvOS (v13), watchOS (v6), and visionOS (v1), in addition to macOS (v10.15). An explicit swiftLanguageModes: [.v5] has also been added to Package.swift.
  • Swift Metadata Parsing & Demangling Enhancements: The search method for Protocol requirements has been optimized, improving the discovery of requirement symbols. Type parsing in the swift-section command-line tool has been refined from .remaining to .upToNextOption, addressing issues with type parsing errors when synthesizeSugarTypes demangle options are enabled. A new removeWeakPrefix demangling option was introduced, and the showPrefixAndSuffix option was removed.
  • Mach-O Section & Symbol Handling Improvements: Centralized utility functions for finding Swift sections within Mach-O files and images have been introduced (MachORepresentable+.swift). The symbol caching mechanism in MachOSymbolCache.swift has been enhanced to store both original and cache-adjusted offsets, improving symbol lookup robustness. MachOImage now includes more robust cache and startOffset calculations.
  • Semantic Type System Refactoring: The internal SemanticType enum has been refactored to use more granular nested TypeKind and Context enums (e.g., .type(.class, .declaration)), allowing for more precise semantic classification of code elements during demangling and dumping. This impacts various Dumpable extensions and CLI coloring.
  • New Features & Utilities: Support for dumping AssociatedType descriptors has been added. The Class dumping now correctly identifies and displays actor types. New array extension overloads for optional arrays were added. New test suites (DyldCacheDumpTests, MachOFileDumpTests, MachOImageDumpTests) have been introduced to validate dumping capabilities across different Mach-O contexts.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request includes several changes, including updating the Swift tools version, optimizing the search method for protocol requirements, changing the parsing method of types in swift-section, fixing type parsing errors, and adding support for new platforms. The code review focuses on suggesting minor improvements such as adding comments to explain certain code sections and ensuring code clarity.

@Mx-Iris Mx-Iris merged commit bca86ee into main Jun 22, 2025
1 check passed
@Mx-Iris Mx-Iris deleted the develop branch June 22, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants