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

Add more safe wrappers #225

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

vadorovsky
Copy link
Member

@vadorovsky vadorovsky commented Sep 9, 2024

Add more safe wrappers

  • Add safe wrappers for:
    • Context
    • Module
    • DIBuilder
  • Modify the iter module and its macros to operate on wrappers.

Depends on #224


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.
- Add safe wrappers for:
  - `Context`
  - `Module`
  - `DIBuilder`
- Modify the `iter` module and its macros to operate on wrappers.
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