Skip to content

Commit 3debe14

Browse files
committed
make more builder functions generic
1 parent c683403 commit 3debe14

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/rustc_codegen_llvm/src/declare.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
215215

216216
llfn
217217
}
218+
}
218219

220+
impl<'ll, CX: Borrow<SCx<'ll>>> GenericCx<'ll, CX> {
219221
/// Declare a global with an intention to define it.
220222
///
221223
/// Use this function when you intend to define a global. This function will
@@ -234,13 +236,13 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
234236
///
235237
/// Use this function when you intend to define a global without a name.
236238
pub(crate) fn define_private_global(&self, ty: &'ll Type) -> &'ll Value {
237-
unsafe { llvm::LLVMRustInsertPrivateGlobal(self.llmod, ty) }
239+
unsafe { llvm::LLVMRustInsertPrivateGlobal(self.llmod(), ty) }
238240
}
239241

240242
/// Gets declared value by name.
241243
pub(crate) fn get_declared_value(&self, name: &str) -> Option<&'ll Value> {
242244
debug!("get_declared_value(name={:?})", name);
243-
unsafe { llvm::LLVMRustGetNamedValue(self.llmod, name.as_c_char_ptr(), name.len()) }
245+
unsafe { llvm::LLVMRustGetNamedValue(self.llmod(), name.as_c_char_ptr(), name.len()) }
244246
}
245247

246248
/// Gets defined or externally defined (AvailableExternally linkage) value by

0 commit comments

Comments
 (0)