Merge commit '40dd3e2b70
' into sync_cg_clif-2021-05-27
This commit is contained in:
commit
fa702d0d2b
25 changed files with 218 additions and 296 deletions
|
@ -347,19 +347,10 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
|
|||
self.module.isa().triple()
|
||||
}
|
||||
|
||||
pub(crate) fn anonymous_str(&mut self, prefix: &str, msg: &str) -> Value {
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
let mut hasher = DefaultHasher::new();
|
||||
msg.hash(&mut hasher);
|
||||
let msg_hash = hasher.finish();
|
||||
pub(crate) fn anonymous_str(&mut self, msg: &str) -> Value {
|
||||
let mut data_ctx = DataContext::new();
|
||||
data_ctx.define(msg.as_bytes().to_vec().into_boxed_slice());
|
||||
let msg_id = self
|
||||
.module
|
||||
.declare_data(&format!("__{}_{:08x}", prefix, msg_hash), Linkage::Local, false, false)
|
||||
.unwrap();
|
||||
let msg_id = self.module.declare_anonymous_data(false, false).unwrap();
|
||||
|
||||
// Ignore DuplicateDefinition error, as the data will be the same
|
||||
let _ = self.module.define_data(msg_id, &data_ctx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue