Skip to content

mark the BumpPtrAllocator class as @_spi(BumpPtrAllocator). #2249

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

Merged
merged 1 commit into from
Oct 9, 2023

Conversation

ChiduAnush
Copy link
Contributor

mark the BumpPtrAllocator class as @_spi(BumpPtrAllocator) instead of @_spi(RawSyntax).
resolves the issue #68351 (swiftlang/swift#68351)

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Could you make sure that swift-syntax builds with this change? There are a couple of references to BumpPtrAllocator within the swift-syntax package that now no longer work. You will need to add @_spi(BumpPtrAllocator) to the imports in those files as well.

@ChiduAnush
Copy link
Contributor Author

just to confirm, in the swift-syntax repo, inside the sources folder, inside the swiftSyntax folder, I need to include the @_spi(BumpPtrAllocator) in the required files?

which files exactly should I add this import statement?

when I do a search in vscode for BumpPtrAllocator, it returns about 16 results. most of then pass BumpPtrAllocator as StateAllocator

@bnbarham
Copy link
Contributor

bnbarham commented Oct 3, 2023

just to confirm, in the swift-syntax repo, inside the sources folder, inside the swiftSyntax folder, I need to include the @_spi(BumpPtrAllocator) in the required files?

If you run a build (either in your editor or just swift build) you'll see there will be many error: cannot find 'BumpPtrAllocator' in scope errors. They're caused because those files import SwiftSyntax with @_spi(RawSyntax) instead of BumpPtrAllocator as you've just changed it to.

You'll need to update those to use @_spi(BumpPtrAllocator), though It might be that they need both @_spi(RawSyntax) and @_spi(BumpPtrAllocator) depending on what's used - you'll need to check.

@ChiduAnush
Copy link
Contributor Author

whenever I try running swift build in the cloned repo, I get the following error,
xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'

I have checked that xcode-select -p returns a valid path. so it is installed properly.

@ahoppen
Copy link
Member

ahoppen commented Oct 7, 2023

Oh, that's odd. I have never seen this issue before. A couple of questions:

  • Which version of Xcode do you have installed.
  • What's the output of xcode-select -p
  • What's the output of swift --version?

@ChiduAnush
Copy link
Contributor Author

okay, I got it. had to reinstall my Xcode.
worked fine. I saw the errors and put in the import statements wherever required.

@ChiduAnush ChiduAnush force-pushed the markBumpPtrAllocatorClass branch from 41e9acf to bc6afe7 Compare October 7, 2023 17:02
@ChiduAnush
Copy link
Contributor Author

I squashed the commits.

Comment on lines 13 to 14
@_spi(RawSyntax) import SwiftSyntax
@_spi(BumpPtrAllocator) import SwiftSyntax
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we prefer to pile up the attributes on a single import.

@ChiduAnush ChiduAnush force-pushed the markBumpPtrAllocatorClass branch from 4070982 to a2fe6b9 Compare October 7, 2023 18:49
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏽

@ahoppen
Copy link
Member

ahoppen commented Oct 9, 2023

@swift-ci Please test

@ahoppen ahoppen enabled auto-merge October 9, 2023 16:13
@ahoppen
Copy link
Member

ahoppen commented Oct 9, 2023

@swift-ci Please test Windows

@ahoppen
Copy link
Member

ahoppen commented Oct 9, 2023

swiftlang/swift#68860

@swift-ci Please test

@ahoppen ahoppen merged commit 693a130 into swiftlang:main Oct 9, 2023
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.

4 participants