syntax: Change ExpnId::{from,to}_llvm_cookie to {from,to}_u32

This commit is contained in:
Erick Tryzelaar 2015-04-20 17:51:10 -07:00
parent 83b1d7fd6f
commit 7f9180fcb9
3 changed files with 6 additions and 8 deletions

View File

@ -348,7 +348,7 @@ unsafe extern "C" fn report_inline_asm<'a, 'b>(cgcx: &'a CodegenContext<'a>,
match cgcx.lto_ctxt {
Some((sess, _)) => {
sess.codemap().with_expn_info(ExpnId::from_llvm_cookie(cookie), |info| match info {
sess.codemap().with_expn_info(ExpnId::from_u32(cookie), |info| match info {
Some(ei) => sess.span_err(ei.call_site, msg),
None => sess.err(msg),
});

View File

@ -138,7 +138,7 @@ pub fn trans_inline_asm<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ia: &ast::InlineAsm)
let kind = llvm::LLVMGetMDKindIDInContext(bcx.ccx().llcx(),
key.as_ptr() as *const c_char, key.len() as c_uint);
let val: llvm::ValueRef = C_i32(bcx.ccx(), ia.expn_id.to_llvm_cookie());
let val: llvm::ValueRef = C_i32(bcx.ccx(), ia.expn_id.into_u32() as i32);
llvm::LLVMSetMetadata(r, kind,
llvm::LLVMMDNodeInContext(bcx.ccx().llcx(), &val, 1));

View File

@ -26,7 +26,6 @@ use std::rc::Rc;
use std::fmt;
use libc::c_uint;
use serialize::{Encodable, Decodable, Encoder, Decoder};
@ -287,13 +286,12 @@ pub const NO_EXPANSION: ExpnId = ExpnId(!0);
pub const COMMAND_LINE_EXPN: ExpnId = ExpnId(!1);
impl ExpnId {
pub fn from_llvm_cookie(cookie: c_uint) -> ExpnId {
ExpnId(cookie)
pub fn from_u32(id: u32) -> ExpnId {
ExpnId(id)
}
pub fn to_llvm_cookie(self) -> i32 {
let ExpnId(cookie) = self;
cookie as i32
pub fn into_u32(self) -> u32 {
self.0
}
}