Skip to content

Commit

Permalink
Auto merge of #32667 - dotdash:def_dec, r=nagisa
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Apr 2, 2016
2 parents 3ec71b0 + 4b9ddf4 commit 5ab11d7
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/librustc_trans/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use context::CrateContext;
use type_::Type;

use std::ffi::CString;
use libc::c_uint;


/// Declare a global value.
Expand Down Expand Up @@ -159,14 +158,12 @@ pub fn get_defined_value(ccx: &CrateContext, name: &str) -> Option<ValueRef> {
debug!("get_defined_value: {:?} value is null", name);
None
} else {
let (declaration, aext_link) = unsafe {
let linkage = llvm::LLVMGetLinkage(val);
(llvm::LLVMIsDeclaration(val) != 0,
linkage == llvm::AvailableExternallyLinkage as c_uint)
let declaration = unsafe {
llvm::LLVMIsDeclaration(val) != 0
};
debug!("get_defined_value: found {:?} value (declaration: {}, \
aext_link: {})", name, declaration, aext_link);
if !declaration || aext_link {
debug!("get_defined_value: found {:?} value (declaration: {})",
name, declaration);
if !declaration {
Some(val)
} else {
None
Expand Down

0 comments on commit 5ab11d7

Please sign in to comment.