Skip to content

[Reflection] Add lightweight error handling to ReflectionContext #82345

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

Open
wants to merge 2 commits into
base: release/6.2
Choose a base branch
from

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.

(cherry picked from commit 868c991)

Explanation: Better error handling for reflection in LLDB.

Scope: LLDB

Original PR: #82244

Risk: Low. NFC

Reviewers: @tbkka

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.

(cherry picked from commit 868c991)
@adrian-prantl
Copy link
Contributor Author

test with swiftlang/llvm-project#10868
@swift-ci test

@adrian-prantl
Copy link
Contributor Author

@swift-ci test macOS

(cherry picked from commit 45198dc)
@adrian-prantl
Copy link
Contributor Author

@swift-ci test

@adrian-prantl
Copy link
Contributor Author

test with swiftlang/llvm-project#10868
@swift-ci test

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