Skip to content

Commit

Permalink
Renamed lifetimes for better understanding
Browse files Browse the repository at this point in the history
  • Loading branch information
denismerigoux authored and eddyb committed Nov 16, 2018
1 parent 8d530db commit 91a2a80
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/librustc_codegen_llvm/context.rs
Expand Up @@ -45,14 +45,14 @@ use abi::Abi;
/// There is one `CodegenCx` per compilation unit. Each one has its own LLVM
/// `llvm::Context` so that several compilation units may be optimized in parallel.
/// All other LLVM data structures in the `CodegenCx` are tied to that `llvm::Context`.
pub struct CodegenCx<'a, 'tcx: 'a, V = &'a Value> {
pub tcx: TyCtxt<'a, 'tcx, 'tcx>,
pub struct CodegenCx<'ll, 'tcx: 'll, V = &'ll Value> {
pub tcx: TyCtxt<'ll, 'tcx, 'tcx>,
pub check_overflow: bool,
pub use_dll_storage_attrs: bool,
pub tls_model: llvm::ThreadLocalMode,

pub llmod: &'a llvm::Module,
pub llcx: &'a llvm::Context,
pub llmod: &'ll llvm::Module,
pub llcx: &'ll llvm::Context,
pub stats: RefCell<Stats>,
pub codegen_unit: Arc<CodegenUnit<'tcx>>,

Expand Down Expand Up @@ -86,12 +86,12 @@ pub struct CodegenCx<'a, 'tcx: 'a, V = &'a Value> {
/// See http://llvm.org/docs/LangRef.html#the-llvm-used-global-variable for details
pub used_statics: RefCell<Vec<V>>,

pub lltypes: RefCell<FxHashMap<(Ty<'tcx>, Option<VariantIdx>), &'a Type>>,
pub scalar_lltypes: RefCell<FxHashMap<Ty<'tcx>, &'a Type>>,
pub lltypes: RefCell<FxHashMap<(Ty<'tcx>, Option<VariantIdx>), &'ll Type>>,
pub scalar_lltypes: RefCell<FxHashMap<Ty<'tcx>, &'ll Type>>,
pub pointee_infos: RefCell<FxHashMap<(Ty<'tcx>, Size), Option<PointeeInfo>>>,
pub isize_ty: &'a Type,
pub isize_ty: &'ll Type,

pub dbg_cx: Option<debuginfo::CrateDebugContext<'a, 'tcx>>,
pub dbg_cx: Option<debuginfo::CrateDebugContext<'ll, 'tcx>>,

eh_personality: Cell<Option<V>>,
eh_unwind_resume: Cell<Option<V>>,
Expand All @@ -103,8 +103,7 @@ pub struct CodegenCx<'a, 'tcx: 'a, V = &'a Value> {
local_gen_sym_counter: Cell<usize>,
}

impl<'a, 'tcx> DepGraphSafe for CodegenCx<'a, 'tcx> {
}
impl<'ll, 'tcx> DepGraphSafe for CodegenCx<'ll, 'tcx> {}

pub fn get_reloc_model(sess: &Session) -> llvm::RelocMode {
let reloc_model_arg = match sess.opts.cg.relocation_model {
Expand Down Expand Up @@ -217,11 +216,11 @@ pub unsafe fn create_module(
llmod
}

impl<'a, 'tcx> CodegenCx<'a, 'tcx> {
crate fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>,
impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
crate fn new(tcx: TyCtxt<'ll, 'tcx, 'tcx>,
codegen_unit: Arc<CodegenUnit<'tcx>>,
llvm_module: &'a ::ModuleLlvm)
-> CodegenCx<'a, 'tcx> {
llvm_module: &'ll ::ModuleLlvm)
-> Self {
// An interesting part of Windows which MSVC forces our hand on (and
// apparently MinGW didn't) is the usage of `dllimport` and `dllexport`
// attributes in LLVM IR as well as native dependencies (in C these
Expand Down

0 comments on commit 91a2a80

Please sign in to comment.