Auto merge of #32667 - dotdash:def_dec, r=nagisa
Stop accepting declarations when looking for definitions eternally_available linkage isn't legal for declarations anyway, so the check for an externally_available declaration should never succeed, so let's remove it.
This commit is contained in:
commit
5ab11d72ca
@ -28,7 +28,6 @@ use context::CrateContext;
|
|||||||
use type_::Type;
|
use type_::Type;
|
||||||
|
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
use libc::c_uint;
|
|
||||||
|
|
||||||
|
|
||||||
/// Declare a global value.
|
/// Declare a global value.
|
||||||
@ -159,14 +158,12 @@ pub fn get_defined_value(ccx: &CrateContext, name: &str) -> Option<ValueRef> {
|
|||||||
debug!("get_defined_value: {:?} value is null", name);
|
debug!("get_defined_value: {:?} value is null", name);
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
let (declaration, aext_link) = unsafe {
|
let declaration = unsafe {
|
||||||
let linkage = llvm::LLVMGetLinkage(val);
|
llvm::LLVMIsDeclaration(val) != 0
|
||||||
(llvm::LLVMIsDeclaration(val) != 0,
|
|
||||||
linkage == llvm::AvailableExternallyLinkage as c_uint)
|
|
||||||
};
|
};
|
||||||
debug!("get_defined_value: found {:?} value (declaration: {}, \
|
debug!("get_defined_value: found {:?} value (declaration: {})",
|
||||||
aext_link: {})", name, declaration, aext_link);
|
name, declaration);
|
||||||
if !declaration || aext_link {
|
if !declaration {
|
||||||
Some(val)
|
Some(val)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
Loading…
Reference in New Issue
Block a user