Remove a couple of uses of interior mutability around statics

This commit is contained in:
bjorn3
2024-12-13 09:52:38 +00:00
parent a4cb1c72c5
commit 0fd257d66c
8 changed files with 33 additions and 28 deletions

View File

@@ -411,7 +411,7 @@ impl<'ll> CodegenCx<'ll, '_> {
g
}
fn codegen_static_item(&self, def_id: DefId) {
fn codegen_static_item(&mut self, def_id: DefId) {
unsafe {
assert!(
llvm::LLVMGetInitializer(
@@ -571,18 +571,18 @@ impl<'ll> StaticCodegenMethods for CodegenCx<'ll, '_> {
self.const_pointercast(gv, self.type_ptr())
}
fn codegen_static(&self, def_id: DefId) {
fn codegen_static(&mut self, def_id: DefId) {
self.codegen_static_item(def_id)
}
/// Add a global value to a list to be stored in the `llvm.used` variable, an array of ptr.
fn add_used_global(&self, global: &'ll Value) {
self.used_statics.borrow_mut().push(global);
fn add_used_global(&mut self, global: &'ll Value) {
self.used_statics.push(global);
}
/// Add a global value to a list to be stored in the `llvm.compiler.used` variable,
/// an array of ptr.
fn add_compiler_used_global(&self, global: &'ll Value) {
self.compiler_used_statics.borrow_mut().push(global);
fn add_compiler_used_global(&mut self, global: &'ll Value) {
self.compiler_used_statics.push(global);
}
}