From d5985bc9ecbdc792d514cf531107d33f85644fdc Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 4 Apr 2019 13:05:41 -0700 Subject: rustc: Start implementing compat with LLVM 9 This commit doesn't actually migrate to LLVM 9, but it brings our own C++ bindings in line with LLVM 9 and able to compile against tip of tree. The changes made were: * The `MainSubprogram` flag for debuginfo moved between flag types. * Iteration of archive members was tweaked slightly and we have to construct the two iterators before constructing the returned `RustArchiveIterator` value. * The `getOrInsertFunction` binding now returns a wrapper which we use `getCallee()` on to get the value we're interested in. --- src/librustc_codegen_llvm/debuginfo/mod.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/librustc_codegen_llvm/debuginfo') diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs index 6abbcd9feba..57e4ac07d5e 100644 --- a/src/librustc_codegen_llvm/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -296,12 +296,6 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { let mut flags = DIFlags::FlagPrototyped; - if let Some((id, _)) = self.tcx.entry_fn(LOCAL_CRATE) { - if id == def_id { - flags |= DIFlags::FlagMainSubprogram; - } - } - if self.layout_of(sig.output()).abi.is_uninhabited() { flags |= DIFlags::FlagNoReturn; } @@ -313,6 +307,11 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { if self.sess().opts.optimize != config::OptLevel::No { spflags |= DISPFlags::SPFlagOptimized; } + if let Some((id, _)) = self.tcx.entry_fn(LOCAL_CRATE) { + if id == def_id { + spflags |= DISPFlags::SPFlagMainSubprogram; + } + } let fn_metadata = unsafe { llvm::LLVMRustDIBuilderCreateFunction( -- cgit 1.4.1-3-g733a5