2018-07-10 13:28:39 +03:00
|
|
|
pub use llvm::Value;
|
|
|
|
|
2014-07-07 17:58:01 -07:00
|
|
|
use llvm;
|
2016-02-18 19:49:45 +02:00
|
|
|
|
|
|
|
use std::fmt;
|
2018-07-10 13:28:39 +03:00
|
|
|
use std::hash::{Hash, Hasher};
|
|
|
|
|
|
|
|
impl PartialEq for Value {
|
|
|
|
fn eq(&self, other: &Self) -> bool {
|
|
|
|
self as *const _ == other as *const _
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Eq for Value {}
|
|
|
|
|
|
|
|
impl Hash for Value {
|
|
|
|
fn hash<H: Hasher>(&self, hasher: &mut H) {
|
|
|
|
(self as *const Self).hash(hasher);
|
|
|
|
}
|
|
|
|
}
|
2016-02-18 19:49:45 +02:00
|
|
|
|
2013-07-28 16:40:35 +02:00
|
|
|
|
2016-02-18 19:49:45 +02:00
|
|
|
impl fmt::Debug for Value {
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
|
|
f.write_str(&llvm::build_string(|s| unsafe {
|
2018-07-10 13:28:39 +03:00
|
|
|
llvm::LLVMRustWriteValueToString(self, s);
|
2018-10-08 16:59:24 +02:00
|
|
|
}).expect("non-UTF8 value description from LLVM"))
|
2016-02-18 19:49:45 +02:00
|
|
|
}
|
|
|
|
}
|