Skip to content

[PlaygroundTransform] Replace "$builtin" with "__builtin". #14257

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
Jul 9, 2018

Conversation

cwakamo
Copy link
Contributor

@cwakamo cwakamo commented Jan 30, 2018

Currently, the playground transform requires the use of dollar-identifiers as the functions are prefixed with "$builtin".
This commit removes that requirement by replacing "$builtin" with "__builtin".
This aligns with the PC macro.

This addresses rdar://problem/36031860.

@cwakamo
Copy link
Contributor Author

cwakamo commented Jan 30, 2018

Please test with these PRs:

apple/swift-lldb#293

@swift-ci Please test

@jrose-apple
Copy link
Contributor

I think it's only the tests that required that rather than the actual behavior at run time, but sure, go for it.

@cwakamo
Copy link
Contributor Author

cwakamo commented Jan 30, 2018

@jrose-apple Not sure what you mean by "only the tests that required that rather than the actual behavior at run time"? At present, it's not possible to pass -playground to the frontend without also passing -debugger-support (or, if you're doing this all in code, manually enabling dollar-identifiers in the LangOptions) and have it work because you can't provide the $builtin functions.

This PR lifts that restriction by making the playground transform use __builtin instead. (The PC macro has had this behavior its whole life, and we intended to go back and change the playground transform to match but haven't had the chance until now.)

@jrose-apple
Copy link
Contributor

The dollar-identifier check happens during parsing, so the PlaygroundTransform can use dollar-prefixed identifiers all it wants. The only problem is the way we've been doing the tests, by defining dummy functions in another file.

Still, bringing the two transforms in line makes sense, and this one does seem slightly easier to work with.

@cwakamo
Copy link
Contributor Author

cwakamo commented Feb 1, 2018

The dollar-identifier check happens during parsing, so the PlaygroundTransform can use dollar-prefixed identifiers all it wants. The only problem is the way we've been doing the tests, by defining dummy functions in another file.

Ah, as far as I know everywhere that playgrounds run does it a similar way, because the transform is just performing an name lookup. So there has to be a visible declaration of the $builtin/__builtin functions somewhere. LLDB currently defines these at the top of the source file being executed. The tests define these in a separate source file. I'm currently exploring a model where these are provided by a framework which is automatically imported (via the -import-module frontend flag) into the playground. By unifying on __builtin as the prefix instead of $builtin, that separate source file or framework does not have to be built with -debugger-support.

@jrose-apple
Copy link
Contributor

Ahh, I thought we already used -import-module or similar. Thanks for the explanation.

Currently, the playground transform requires the use of dollar-identifiers as the functions are prefixed with "$builtin".
This commit removes that requirement by replacing "$builtin" with "__builtin".
This aligns with the PC macro.

This addresses <rdar://problem/36031860>.
@cwakamo cwakamo force-pushed the remove-dollar-from-playgrounds branch from d2ac7ce to 4517785 Compare July 6, 2018 22:31
@cwakamo
Copy link
Contributor Author

cwakamo commented Jul 6, 2018

Please test with this PR:

apple/swift-lldb#293

@swift-ci Please test

@cwakamo
Copy link
Contributor Author

cwakamo commented Jul 6, 2018

@jrose-apple I've rebased this PR on top of master from earlier today. I'd like to try to land this on Monday if possible in preparation for potentially nominating it for 4.2 shortly thereafter, so if you wouldn't mind re-reviewing this PR, I'd greatly appreciate it!

@cwakamo cwakamo merged commit b8ed087 into swiftlang:master Jul 9, 2018
@cwakamo cwakamo deleted the remove-dollar-from-playgrounds branch July 9, 2018 18:11
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