Skip to content
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

Capture macro expansions in an output group named macro_expansions during debug builds #1355

Conversation

brentleyjones
Copy link
Collaborator

LLDB wants these files to be present on the file system to step into macro expansions, because their file paths are recorded in debug info. The compiler uses TMPDIR (if set) as the location for those files, so we can have the worker set TMPDIR to a target-specific location before spawning swiftc. If this location is workspace-relative, then those file paths are also remapped via -debug-prefix-map—an added bonus.

The macro_expansions group will contain a tree (directory) artifact that contains a swift-generated-sources subdirectory (the compiler forces that name), which contains one or more .swift files representing the expanded macro buffers.

PiperOrigin-RevId: 549932429
(cherry picked from commit 69349ee)

Cherry-pick notes: We already included most of this in c9d1f5f. This just restricts _macro_expansion_configurator to debug builds.

…during debug builds

LLDB wants these files to be present on the file system to step into macro expansions, because their file paths are recorded in debug info. The compiler uses `TMPDIR` (if set) as the location for those files, so we can have the worker set `TMPDIR` to a target-specific location before spawning `swiftc`. If this location is workspace-relative, then those file paths are also remapped via `-debug-prefix-map`—an added bonus.

The `macro_expansions` group will contain a tree (directory) artifact that contains a `swift-generated-sources` subdirectory (the compiler forces that name), which contains one or more `.swift` files representing the expanded macro buffers.

PiperOrigin-RevId: 549932429
(cherry picked from commit 69349ee)

Cherry-pick notes: We already included most of this in c9d1f5f. This just restricts `_macro_expansion_configurator` to debug builds.

Signed-off-by: Brentley Jones <github@brentleyjones.com>
@brentleyjones brentleyjones enabled auto-merge (rebase) October 7, 2024 17:47
brentleyjones referenced this pull request Oct 7, 2024
…during debug builds.

LLDB wants these files to be present on the file system to step into macro expansions, because their file paths are recorded in debug info. The compiler uses `TMPDIR` (if set) as the location for those files, so we can have the worker set `TMPDIR` to a target-specific location before spawning `swiftc`. If this location is workspace-relative, then those file paths are also remapped via `-debug-prefix-map`—an added bonus.

The `macro_expansions` group will contain a tree (directory) artifact that contains a `swift-generated-sources` subdirectory (the compiler forces that name), which contains one or more `.swift` files representing the expanded macro buffers.

PiperOrigin-RevId: 549932429
@brentleyjones brentleyjones merged commit 8a21c7c into master Oct 7, 2024
14 checks passed
@brentleyjones brentleyjones deleted the bj/capture-macro-expansions-in-an-output-group-named-macro_expansions-during-debug-builds branch October 7, 2024 19:49
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.

3 participants