Skip to content

Typed throws minor fixes #69741

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 3 commits into from
Nov 9, 2023

Conversation

DougGregor
Copy link
Member

Two minor fixes for typed throws:

  • Teach SIL cloning to clone throw_addr instructions by branching to the error basic block
  • Make sure we establish a generic scope for thrown errors when emitting debug info

… block

This is the same way we handle `throw` instructions, but without the
operand.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor enabled auto-merge November 9, 2023 05:10
…nstruction

These were only properly handling SIL-level indirect results, not
including indirect error results.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please smoke test Linux

@@ -2476,6 +2476,7 @@ IRGenDebugInfoImpl::emitFunction(const SILDebugScope *DS, llvm::Function *Fn,
llvm::DITypeArray Error = nullptr;
if (FnTy && (Opts.DebugInfoLevel > IRGenDebugInfoLevel::LineTables))
if (auto ErrorInfo = FnTy->getOptionalErrorResult()) {
GenericContextScope scope(IGM, FnTy->getInvocationGenericSignature());
Copy link
Contributor

Choose a reason for hiding this comment

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

And this is only needed when creating the function signature and not in the body of the function?

Copy link
Member Author

Choose a reason for hiding this comment

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

We should verify that; it didn't show up as a crash when putting typed throws into the standard library, but it might be because we aren't providing correct debug info for SIL-level indirect error results.

@DougGregor DougGregor merged commit 446dfbf into swiftlang:main Nov 9, 2023
@DougGregor DougGregor deleted the typed-throws-minor-fixes branch November 9, 2023 18:24
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