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

Move diagnostic handler to a separate struct #224

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

vadorovsky
Copy link
Member

@vadorovsky vadorovsky commented Sep 9, 2024

Add the DiagnosticHandler struct which implements LLVMDiagnosticHandler, so only that struct and not the whole Linker is passed to LLVMContextSetDiagnosticHandler.

This is going to make writing a safe wrapper for Context easier.


Depends on #223


This change is Reviewable

It isn't being used anywhere (aside from `push` and immediate `pop`) and
has no impact on the visitor algorithm.
Instead of keeping raw pointer fields (of types like `LLVMValueRef`,
`LLVMMetadataRef`) public and defining constructors with different names,
provide the `LLVMTypeWrapper` trait with `from_ptr()` `as_ptr()` method
for all of them.

This will allow to convert all safe wrappers from and to raw pointers
with one method, which is going to be helpful for building macros for
them.
Add the `DiagnosticHandler` struct which implements `LLVMDiagnosticHandler`,
so only that struct and not the whole `Linker` is passed to
`LLVMContextSetDiagnosticHandler`.

This is going to make writing a safe wrapper for `Context` easier.
Copy link
Member

@tamird tamird left a comment

Choose a reason for hiding this comment

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

Last commit LGTM.

Reviewed 1 of 1 files at r1, 4 of 4 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @vadorovsky)

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