Add a function to check whether a ValueRef is a constant
This commit is contained in:
parent
ba9c3ebc02
commit
75a08622e8
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user