diff options
| author | Irina Popa <irinagpopa@gmail.com> | 2018-06-27 17:57:25 +0300 |
|---|---|---|
| committer | Irina Popa <irinagpopa@gmail.com> | 2018-07-30 18:27:52 +0300 |
| commit | 249d5acaec0b10ee15b21b888977b5445baba42e (patch) | |
| tree | 966ea8d75c9e97d2b6e70d0bcd30ceef689d4b8a /src/librustc_codegen_llvm/debuginfo/mod.rs | |
| parent | af04e9426c71ac1050b9007c93b03864e45a81df (diff) | |
| download | rust-249d5acaec0b10ee15b21b888977b5445baba42e.tar.gz rust-249d5acaec0b10ee15b21b888977b5445baba42e.zip | |
rustc_codegen_llvm: use safe references for Context and Module.
Diffstat (limited to 'src/librustc_codegen_llvm/debuginfo/mod.rs')
| -rw-r--r-- | src/librustc_codegen_llvm/debuginfo/mod.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs index fcabd273326..d4b51106033 100644 --- a/src/librustc_codegen_llvm/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -21,7 +21,7 @@ use self::metadata::{type_metadata, file_metadata, TypeMap}; use self::source_loc::InternalDebugLocation::{self, UnknownLocation}; use llvm; -use llvm::{ModuleRef, ContextRef, ValueRef}; +use llvm::ValueRef; use llvm::debuginfo::{DIFile, DIType, DIScope, DIBuilderRef, DISubprogram, DIArray, DIFlags}; use rustc::hir::CodegenFnAttrFlags; use rustc::hir::def_id::{DefId, CrateNum}; @@ -67,9 +67,9 @@ const DW_TAG_auto_variable: c_uint = 0x100; const DW_TAG_arg_variable: c_uint = 0x101; /// A context object for maintaining all state needed by the debuginfo module. -pub struct CrateDebugContext<'tcx> { - llcontext: ContextRef, - llmod: ModuleRef, +pub struct CrateDebugContext<'a, 'tcx> { + llcontext: &'a llvm::Context, + llmod: &'a llvm::Module, builder: DIBuilderRef, created_files: RefCell<FxHashMap<(Symbol, Symbol), DIFile>>, created_enum_disr_types: RefCell<FxHashMap<(DefId, layout::Primitive), DIType>>, @@ -82,8 +82,8 @@ pub struct CrateDebugContext<'tcx> { composite_types_completed: RefCell<FxHashSet<DIType>>, } -impl<'tcx> CrateDebugContext<'tcx> { - pub fn new(llmod: ModuleRef) -> CrateDebugContext<'tcx> { +impl<'a, 'tcx> CrateDebugContext<'a, 'tcx> { + pub fn new(llmod: &'a llvm::Module) -> Self { debug!("CrateDebugContext::new"); let builder = unsafe { llvm::LLVMRustDIBuilderCreate(llmod) }; // DIBuilder inherits context from the module, so we'd better use the same one |
