Skip to content

[Swift next] Construct DataLayout from string #38135

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

Conversation

etcwilde
Copy link
Member

Clang stopped returning the datalayout object, instead constructing it
on the fly from the string representation.

rdar://79799819

@@ -70,7 +70,7 @@ class TBDGenDescriptor final {
const TBDGenOptions &getOptions() const { return Opts; }
TBDGenOptions &getOptions() { return Opts; }

const llvm::DataLayout &getDataLayout() const;
const llvm::DataLayout getDataLayout() const;
Copy link
Member Author

Choose a reason for hiding this comment

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

The TBDGenVisitor holds a reference to the data layout, which it gets from here.
This returns a temporary now, so that reference is invalid.

etcwilde added 2 commits July 1, 2021 16:33
This patch fixes the call to get the datalayout from the clang module.
Clang no longer holds onto the DataLayout object, so we have to do that
if we want to keep it around. Rather than instanciating it early, we can
just hold onto the string description, which clang does keep around, and
only construct the actual DataLayout once we need it.
Same issue as with TBDGen. Clang doesn't hold onto the Datalayout object
anymore, but instead keeps the description string that is constructed on
the fly. This patch updates IRGen to behave the same way.
@etcwilde etcwilde force-pushed the ewilde/swift-next/find-getDataLayout branch from a87e8b8 to b3422fe Compare July 1, 2021 23:39
@etcwilde etcwilde requested a review from DougGregor July 1, 2021 23:40
@etcwilde
Copy link
Member Author

etcwilde commented Jul 1, 2021

I think we still have to hold onto the DataLayout because we're generating the whole mangle using it. Rather that constructing it eagerly though, we can still construct it lazily if we actually need to.

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.

1 participant