Skip to content

Replace some LLVMRust wrappers with calls to the LLVM C API#132167

Merged
bors merged 6 commits intorust-lang:masterfrom
Zalathar:llvm-wrappers
Oct 27, 2024
Merged

Replace some LLVMRust wrappers with calls to the LLVM C API#132167
bors merged 6 commits intorust-lang:masterfrom
Zalathar:llvm-wrappers

Conversation

@Zalathar
Copy link
Member

This PR removes the LLVMRust wrapper functions for getting/setting linkage and visibility, and replaces them with direct calls to the corresponding functions in LLVM's C API.

To make this convenient and sound, two pieces of supporting code have also been added:

  • A simple proc-macro that derives TryFrom<u32> for fieldless enums
  • A wrapper type for C enum values returned by LLVM functions, to ensure soundness if LLVM returns an enum value we don't know about

In a few places, the use of safe wrapper functions means that an unsafe block is no longer needed, so the affected code has changed its indentation level.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants