about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2024-10-25 22:26:15 +1100
committerZalathar <Zalathar@users.noreply.github.com>2024-10-27 11:05:33 +1100
commitd976ca870191e8677925ff4b76c48cae829ec5ae (patch)
treeaddd2b6439b625eb64b27a17cadf79c54cef8165 /compiler/rustc_codegen_llvm/src/llvm/ffi.rs
parent96993a9b5e971b3e5ecd5cd75bb79bfd62e18d5e (diff)
downloadrust-d976ca870191e8677925ff4b76c48cae829ec5ae.tar.gz
rust-d976ca870191e8677925ff4b76c48cae829ec5ae.zip
Use LLVM-C APIs for getting/setting visibility
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm/ffi.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm/ffi.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
index 3258a6c43cc..acc66076833 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
@@ -161,9 +161,9 @@ pub enum Linkage {
     LinkerPrivateWeakLinkage = 16,
 }
 
-// LLVMRustVisibility
+/// Must match the layout of `LLVMVisibility`.
 #[repr(C)]
-#[derive(Copy, Clone, PartialEq)]
+#[derive(Copy, Clone, PartialEq, TryFromU32)]
 pub enum Visibility {
     Default = 0,
     Hidden = 1,
@@ -984,6 +984,8 @@ unsafe extern "C" {
     pub fn LLVMGetLinkage(Global: &Value) -> RawEnum<Linkage>;
     pub fn LLVMSetLinkage(Global: &Value, RustLinkage: Linkage);
     pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
+    pub fn LLVMGetVisibility(Global: &Value) -> RawEnum<Visibility>;
+    pub fn LLVMSetVisibility(Global: &Value, Viz: Visibility);
     pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
     pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
     pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
@@ -1559,8 +1561,6 @@ unsafe extern "C" {
     ) -> bool;
 
     // Operations on global variables, functions, and aliases (globals)
-    pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
-    pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
     pub fn LLVMRustSetDSOLocal(Global: &Value, is_dso_local: bool);
 
     // Operations on global variables