diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 713939a5d83..4099f642637 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -850,6 +850,12 @@ pub fn const_get_elt(cx: &CrateContext, v: ValueRef, us: &[c_uint]) } } +pub fn is_const(v: ValueRef) -> bool { + unsafe { + llvm::LLVMIsConstant(v) == True + } +} + pub fn const_to_int(v: ValueRef) -> c_longlong { unsafe { llvm::LLVMConstIntGetSExtValue(v)