Skip to content

Commit

Permalink
syntax: Change ExpnId::{from,to}_llvm_cookie to {from,to}_u32
Browse files Browse the repository at this point in the history
  • Loading branch information
erickt committed Apr 21, 2015
1 parent 83b1d7f commit 7f9180f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/librustc_trans/back/write.rs
Expand Up @@ -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),
});
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/trans/asm.rs
Expand Up @@ -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));
Expand Down
10 changes: 4 additions & 6 deletions src/libsyntax/codemap.rs
Expand Up @@ -26,7 +26,6 @@ use std::rc::Rc;

use std::fmt;

use libc::c_uint;
use serialize::{Encodable, Decodable, Encoder, Decoder};


Expand Down Expand Up @@ -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
}
}

Expand Down

0 comments on commit 7f9180f

Please sign in to comment.