Skip to content

Commit 0e4e6bb

Browse files
committed
reduce git diff
1 parent 27d9a1b commit 0e4e6bb

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

compiler/rustc_codegen_llvm/src/declare.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -219,21 +219,6 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
219219
}
220220

221221
impl<'ll, CX: Borrow<SCx<'ll>>> GenericCx<'ll, CX> {
222-
/// Gets declared value by name.
223-
pub(crate) fn get_declared_value(&self, name: &str) -> Option<&'ll Value> {
224-
debug!("get_declared_value(name={:?})", name);
225-
unsafe { llvm::LLVMRustGetNamedValue(self.llmod(), name.as_c_char_ptr(), name.len()) }
226-
}
227-
228-
/// Gets defined or externally defined (AvailableExternally linkage) value by
229-
/// name.
230-
pub(crate) fn get_defined_value(&self, name: &str) -> Option<&'ll Value> {
231-
self.get_declared_value(name).and_then(|val| {
232-
let declaration = llvm::is_declaration(val);
233-
if !declaration { Some(val) } else { None }
234-
})
235-
}
236-
237222
/// Declare a global with an intention to define it.
238223
///
239224
/// Use this function when you intend to define a global. This function will
@@ -254,4 +239,19 @@ impl<'ll, CX: Borrow<SCx<'ll>>> GenericCx<'ll, CX> {
254239
pub(crate) fn define_private_global(&self, ty: &'ll Type) -> &'ll Value {
255240
unsafe { llvm::LLVMRustInsertPrivateGlobal(self.llmod(), ty) }
256241
}
242+
243+
/// Gets declared value by name.
244+
pub(crate) fn get_declared_value(&self, name: &str) -> Option<&'ll Value> {
245+
debug!("get_declared_value(name={:?})", name);
246+
unsafe { llvm::LLVMRustGetNamedValue(self.llmod(), name.as_c_char_ptr(), name.len()) }
247+
}
248+
249+
/// Gets defined or externally defined (AvailableExternally linkage) value by
250+
/// name.
251+
pub(crate) fn get_defined_value(&self, name: &str) -> Option<&'ll Value> {
252+
self.get_declared_value(name).and_then(|val| {
253+
let declaration = llvm::is_declaration(val);
254+
if !declaration { Some(val) } else { None }
255+
})
256+
}
257257
}

0 commit comments

Comments
 (0)