librustc: fix #7467 for android

This commit is contained in:
Young-il Choi 2013-06-29 14:07:24 +09:00 committed by Daniel Micay
parent 51beba6cf9
commit 21cc0ccea1

View File

@ -28,7 +28,7 @@ use middle::trans::type_of::*;
use middle::ty;
use middle::typeck;
use util::common::indenter;
use util::ppaux::{Repr, ty_to_str};
use util::ppaux::Repr;
use middle::trans::type_::Type;
@ -36,7 +36,6 @@ use core::vec;
use syntax::ast_map::{path, path_mod, path_name};
use syntax::ast_util;
use syntax::{ast, ast_map};
use syntax::parse::token;
/**
The main "translation" pass for methods. Generates code
@ -755,10 +754,9 @@ pub fn make_vtable(ccx: &mut CrateContext,
components.push(ptr)
}
let name = fmt!("%s_vtable_%u", ty_to_str(ccx.tcx, tydesc.ty), token::gensym("vtable"));
let tbl = C_struct(components);
let vt_gvar = do name.as_c_str |buf| {
let vtable = ccx.sess.str_of(gensym_name("vtable"));
let vt_gvar = do vtable.as_c_str |buf| {
llvm::LLVMAddGlobal(ccx.llmod, val_ty(tbl).to_ref(), buf)
};
llvm::LLVMSetInitializer(vt_gvar, tbl);