Skip to content

[Reflection] Add lightweight error handling to ReflectionContext #82244

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
Jun 18, 2025

Conversation

adrian-prantl
Copy link
Contributor

Reflection metadata lookup failures are notoriously difficult to debug because there is no error handling in TypeLowering outside of compile-time #ifdef'd fprintf(stderr) calls. The nicest thing to do would be to adopt llvm::Expected<> but TypeLowering is also included in the standard library, which only has access to a tiny subset of the LLVM Support library. This patch adds a place to store a pointer to the first encountered error, which can then be converted to an llvm::Error at the API level.

Reflection metadata lookup failures are notoriously difficult to debug
because there is no error handling in TypeLowering outside of
compile-time #ifdef'd fprintf(stderr) calls. The nicest thing to do
would be to adopt llvm::Expected<> but TypeLowering is also included
in the standard library, which only has access to a tiny subset of the
LLVM Support library. This patch adds a place to store a pointer to
the first encountered error, which can then be converted to an
llvm::Error at the API level.
@adrian-prantl
Copy link
Contributor Author

@swift-ci test

@adrian-prantl adrian-prantl merged commit edc7109 into swiftlang:main Jun 18, 2025
5 checks passed
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